Parse JSON Sergey Svistunov

Compute the total amount of non-canceled external USD transactions from a stream of JSON records as fast as possible.

Input: 1 000 000 JSON records on STDIN, one per line. Each record has the following structure:

{
    "user_id": 0,
    "currency": "USD",
    "transactions": [
        {
            "amount": 0,
            "to_user_id": 0,
            "canceled": false
        }
    ]
}
Field Constraints
user_id Integer, max 10 000
currency One of "GBP", "USD", "RUB", "JPY", "CHF"
transactions Array, max 10 elements
amount Integer, max 1000
canceled Boolean; may be omitted when false

Field order is not guaranteed within any object.

Output: The total amount of all transactions where:

  • record.currency == "USD"
  • transaction.to_user_id != record.user_id (external)
  • transaction.canceled is false or absent
Back to listMar 27, 2026 08:32olliecrowolliecrowScore: 3,150Success
Source Code

Source code access is restricted. Log in to request access.

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Mar 27, 2026 08:323,13856,313,78333,505,0001,015,0002,277,376
2Mar 27, 2026 08:323,14253,087,55833,544,0001,016,0002,277,376
3Mar 27, 2026 08:323,14255,702,03934,567,00002,396,160
4Mar 27, 2026 08:323,14363,041,42233,555,0001,016,0002,404,352
5Mar 27, 2026 08:323,14358,361,19733,555,0001,016,0002,404,352
6Mar 27, 2026 08:323,14462,919,04734,586,00002,400,256
7Mar 27, 2026 08:323,14462,654,08033,568,0001,017,0002,277,376
8Mar 27, 2026 08:323,14465,654,66333,565,0001,017,0002,277,376
9Mar 27, 2026 08:323,14561,053,11234,595,00002,277,376
10Mar 27, 2026 08:323,14664,001,81833,590,0001,017,0002,277,376
11Mar 27, 2026 08:323,14665,650,40834,606,00002,277,376
12Mar 27, 2026 08:323,14861,909,56734,631,00002,404,352
13Mar 27, 2026 08:323,15060,612,83533,634,0001,019,0002,494,464
14Mar 27, 2026 08:323,15063,238,98333,627,0001,019,0002,408,448
15Mar 27, 2026 08:323,15260,716,07334,672,00002,408,448
16Mar 27, 2026 08:323,15567,004,68733,684,0001,020,0002,404,352
17Mar 27, 2026 08:323,16663,181,59733,829,000994,0002,277,376
18Mar 27, 2026 08:323,16864,255,98632,859,0001,991,0002,277,376
19Mar 27, 2026 08:323,16862,502,72232,854,0001,991,0002,277,376
20Mar 27, 2026 08:323,16866,657,03132,862,0001,991,0002,408,448
21Mar 27, 2026 08:323,16863,073,18133,858,000995,0002,400,256
22Mar 27, 2026 08:323,16961,237,25133,866,000996,0002,277,376
23Mar 27, 2026 08:323,16964,502,95633,863,000995,0002,277,376
24Mar 27, 2026 08:323,17156,492,47832,889,0001,993,0002,277,376