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 05:48olliecrowolliecrowScore: 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 05:483,13757,036,08133,493,0001,014,0002,400,256
2Mar 27, 2026 05:483,13960,537,68833,516,0001,015,0002,277,376
3Mar 27, 2026 05:483,14160,023,49933,536,0001,016,0002,400,256
4Mar 27, 2026 05:483,14361,479,31534,570,00002,400,256
5Mar 27, 2026 05:483,14463,625,49734,586,00002,396,160
6Mar 27, 2026 05:483,14560,605,65434,595,00002,277,376
7Mar 27, 2026 05:483,14762,659,36333,595,0001,018,0002,277,376
8Mar 27, 2026 05:483,14762,640,87734,620,00002,277,376
9Mar 27, 2026 05:483,14755,480,38733,602,0001,018,0002,408,448
10Mar 27, 2026 05:483,14858,157,80733,613,0001,018,0002,277,376
11Mar 27, 2026 05:483,14961,630,99833,618,0001,018,0002,392,064
12Mar 27, 2026 05:483,14960,952,95134,644,00002,392,064
13Mar 27, 2026 05:483,15059,326,66933,636,0001,019,0002,408,448
14Mar 27, 2026 05:483,15161,180,05233,647,0001,019,0002,482,176
15Mar 27, 2026 05:483,15361,045,21833,665,0001,020,0002,392,064
16Mar 27, 2026 05:483,15461,795,13033,705,000991,0002,494,464
17Mar 27, 2026 05:483,15559,496,63633,681,0001,020,0002,277,376
18Mar 27, 2026 05:483,15667,757,61033,692,0001,020,0002,400,256
19Mar 27, 2026 05:483,16759,482,75934,838,00002,277,376
20Mar 27, 2026 05:483,16868,430,14634,844,00002,277,376
21Mar 27, 2026 05:483,17061,447,52734,874,00002,277,376
22Mar 27, 2026 05:483,17157,240,51833,855,0001,025,0002,404,352
23Mar 27, 2026 05:483,17164,624,84532,891,0001,993,0002,408,448
24Mar 27, 2026 05:483,17657,734,06032,938,0001,996,0002,269,184