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:25olliecrowolliecrowScore: 3,151Success
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:253,13357,066,81333,446,0001,013,0002,281,472
2Mar 27, 2026 08:253,13456,109,57634,472,00002,396,160
3Mar 27, 2026 08:253,13955,571,12333,512,0001,015,0002,400,256
4Mar 27, 2026 08:253,14058,838,83234,536,00002,412,544
5Mar 27, 2026 08:253,14159,811,29233,538,0001,016,0002,277,376
6Mar 27, 2026 08:253,14264,336,52234,567,00002,392,064
7Mar 27, 2026 08:253,14357,719,61734,575,00002,281,472
8Mar 27, 2026 08:253,14465,952,69233,564,0001,017,0002,404,352
9Mar 27, 2026 08:253,14467,988,80133,564,0001,017,0002,277,376
10Mar 27, 2026 08:253,14460,417,34233,562,0001,017,0002,277,376
11Mar 27, 2026 08:253,14466,228,96334,589,00002,396,160
12Mar 27, 2026 08:253,14565,765,79434,595,00002,277,376
13Mar 27, 2026 08:253,14561,952,01733,578,0001,017,0002,281,472
14Mar 27, 2026 08:253,14865,288,49933,608,0001,018,0002,277,376
15Mar 27, 2026 08:253,14966,050,33134,636,00002,494,464
16Mar 27, 2026 08:253,15158,104,63134,659,00002,277,376
17Mar 27, 2026 08:253,15259,529,16933,650,0001,019,0002,277,376
18Mar 27, 2026 08:253,15260,173,22333,649,0001,019,0002,408,448
19Mar 27, 2026 08:253,15364,775,54734,681,00002,387,968
20Mar 27, 2026 08:253,15361,790,30434,684,00002,277,376
21Mar 27, 2026 08:253,16659,147,15332,841,0001,990,0002,400,256
22Mar 27, 2026 08:253,16665,150,69034,825,00002,277,376
23Mar 27, 2026 08:253,16764,192,77833,847,000995,0002,400,256
24Mar 27, 2026 08:253,16758,097,26932,842,0001,990,0002,400,256
25Mar 27, 2026 08:253,16763,200,57633,846,000995,0002,277,376
26Mar 27, 2026 08:253,16858,495,83632,857,0001,991,0002,400,256
27Mar 27, 2026 08:253,16859,958,77733,851,000995,0002,400,256
28Mar 27, 2026 08:253,17158,052,07833,882,000996,0002,277,376
29Mar 27, 2026 08:253,17460,027,09932,917,0001,995,0002,400,256
30Mar 27, 2026 08:253,17663,130,74632,937,0001,996,0002,277,376