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 02:23olliecrowolliecrowScore: 3,146Success
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 02:233,12957,739,22533,411,0001,012,0002,408,448
2Mar 27, 2026 02:233,13960,007,20333,516,0001,015,0002,400,256
3Mar 27, 2026 02:233,14060,115,67734,545,00002,400,256
4Mar 27, 2026 02:233,14260,823,40834,558,00002,387,968
5Mar 27, 2026 02:233,14264,913,65333,544,0001,016,0002,400,256
6Mar 27, 2026 02:233,14264,598,70533,541,0001,016,0002,277,376
7Mar 27, 2026 02:233,14463,041,33334,589,00002,277,376
8Mar 27, 2026 02:233,14464,252,26033,567,0001,017,0002,277,376
9Mar 27, 2026 02:233,14458,358,66734,589,00002,277,376
10Mar 27, 2026 02:233,14563,571,25534,591,00002,277,376
11Mar 27, 2026 02:233,14560,137,49833,578,0001,017,0002,277,376
12Mar 27, 2026 02:233,14562,575,15734,599,00002,273,280
13Mar 27, 2026 02:233,14665,001,57533,584,0001,017,0002,396,160
14Mar 27, 2026 02:233,14662,566,85933,584,0001,017,0002,482,176
15Mar 27, 2026 02:233,14660,936,78133,587,0001,017,0002,392,064
16Mar 27, 2026 02:233,14765,845,17334,616,00002,404,352
17Mar 27, 2026 02:233,14960,411,79334,643,00002,396,160
18Mar 27, 2026 02:233,15160,119,43233,644,0001,019,0002,277,376
19Mar 27, 2026 02:233,16660,785,12433,828,000994,0002,277,376
20Mar 27, 2026 02:233,16859,440,10533,852,000995,0002,277,376
21Mar 27, 2026 02:233,16960,033,53333,860,000995,0002,277,376
22Mar 27, 2026 02:233,16961,003,08132,864,0001,991,0002,396,160
23Mar 27, 2026 02:233,17058,896,37632,881,0001,992,0002,396,160
24Mar 27, 2026 02:233,17460,340,28432,924,0001,995,0002,400,256