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:43olliecrowolliecrowScore: 3,153Success
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:433,13258,381,70133,442,0001,013,0002,277,376
2Mar 27, 2026 05:433,13960,273,67433,513,0001,015,0002,408,448
3Mar 27, 2026 05:433,13961,728,59834,528,00002,392,064
4Mar 27, 2026 05:433,13959,055,61934,532,00002,408,448
5Mar 27, 2026 05:433,14057,122,89233,525,0001,015,0002,277,376
6Mar 27, 2026 05:433,14151,914,57134,556,00002,396,160
7Mar 27, 2026 05:433,14165,237,85933,565,000987,0002,400,256
8Mar 27, 2026 05:433,14458,979,18233,565,0001,017,0002,498,560
9Mar 27, 2026 05:433,14562,544,57134,592,00002,277,376
10Mar 27, 2026 05:433,14659,823,35334,606,00002,404,352
11Mar 27, 2026 05:433,14669,884,92033,586,0001,017,0002,277,376
12Mar 27, 2026 05:433,14859,154,54134,625,00002,277,376
13Mar 27, 2026 05:433,15165,837,72434,656,00002,400,256
14Mar 27, 2026 05:433,15166,752,09133,639,0001,019,0002,396,160
15Mar 27, 2026 05:433,15259,580,42034,669,00002,277,376
16Mar 27, 2026 05:433,15365,654,53333,665,0001,020,0002,404,352
17Mar 27, 2026 05:433,16457,860,62432,819,0001,989,0002,400,256
18Mar 27, 2026 05:433,16767,845,62932,850,0001,990,0002,404,352
19Mar 27, 2026 05:433,16760,441,97932,849,0001,990,0002,277,376
20Mar 27, 2026 05:433,16757,900,60832,845,0001,990,0002,396,160
21Mar 27, 2026 05:433,16959,577,00033,863,000995,0002,392,064
22Mar 27, 2026 05:433,16957,230,23632,869,0001,992,0002,277,376
23Mar 27, 2026 05:433,16959,724,74032,870,0001,992,0002,400,256
24Mar 27, 2026 05:433,17060,183,44932,879,0001,992,0002,400,256
25Mar 27, 2026 05:433,17159,729,51234,877,00002,277,376
26Mar 27, 2026 05:433,17258,092,25132,898,0001,993,0002,387,968
27Mar 27, 2026 05:433,17360,022,44233,901,000997,0002,396,160
28Mar 27, 2026 05:433,17356,790,91632,904,0001,994,0002,404,352
29Mar 27, 2026 05:433,17456,630,56933,915,000997,0002,400,256
30Mar 27, 2026 05:433,20582,309,67933,242,0002,014,0002,396,160