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:00olliecrowolliecrowScore: 3,152Success
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:003,13761,553,55933,494,0001,014,0002,277,376
2Mar 27, 2026 02:003,13959,155,38034,527,00002,277,376
3Mar 27, 2026 02:003,14159,946,67033,539,0001,016,0002,277,376
4Mar 27, 2026 02:003,14256,852,34634,561,00002,277,376
5Mar 27, 2026 02:003,14362,147,08634,575,00002,396,160
6Mar 27, 2026 02:003,14461,837,57933,567,0001,017,0002,396,160
7Mar 27, 2026 02:003,14566,554,81634,594,00002,277,376
8Mar 27, 2026 02:003,14562,738,03434,590,00002,277,376
9Mar 27, 2026 02:003,14766,205,27734,621,00002,277,376
10Mar 27, 2026 02:003,14864,827,68133,614,0001,018,0002,400,256
11Mar 27, 2026 02:003,14956,486,08733,616,0001,018,0002,392,064
12Mar 27, 2026 02:003,15160,315,61633,644,0001,019,0002,400,256
13Mar 27, 2026 02:003,15262,460,56834,676,00002,277,376
14Mar 27, 2026 02:003,16560,392,86233,822,000994,0002,396,160
15Mar 27, 2026 02:003,16764,214,34233,837,000995,0002,387,968
16Mar 27, 2026 02:003,16759,475,35833,844,000995,0002,277,376
17Mar 27, 2026 02:003,16966,651,72433,861,000995,0002,400,256
18Mar 27, 2026 02:003,17061,176,19232,873,0001,992,0002,404,352
19Mar 27, 2026 02:003,17059,728,02032,873,0001,992,0002,404,352
20Mar 27, 2026 02:003,17264,078,07033,893,000996,0002,400,256
21Mar 27, 2026 02:003,17457,196,54432,920,0001,995,0002,514,944
22Mar 27, 2026 02:003,17862,558,88133,960,000998,0002,277,376
23Mar 27, 2026 02:003,18057,877,72932,978,0001,998,0002,277,376
24Mar 27, 2026 02:003,21086,568,89033,289,0002,017,0002,273,280