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 04:13olliecrowolliecrowScore: 3,149Success
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 04:133,13558,199,91233,476,0001,014,0002,400,256
2Mar 27, 2026 04:133,13957,903,60033,516,0001,015,0002,400,256
3Mar 27, 2026 04:133,13962,865,95833,511,0001,015,0002,277,376
4Mar 27, 2026 04:133,13959,964,62133,518,0001,015,0002,392,064
5Mar 27, 2026 04:113,13956,146,84233,514,0001,015,0002,277,376
6Mar 27, 2026 04:113,14055,189,24832,569,0001,973,0002,277,376
7Mar 27, 2026 04:113,14060,520,97933,525,0001,015,0002,277,376
8Mar 27, 2026 04:133,14056,002,57034,541,00002,396,160
9Mar 27, 2026 04:113,14158,609,39833,530,0001,016,0002,396,160
10Mar 27, 2026 04:133,14256,978,21233,543,0001,016,0002,277,376
11Mar 27, 2026 04:133,14257,302,01833,543,0001,016,0002,400,256
12Mar 27, 2026 04:133,14259,043,13534,567,00002,400,256
13Mar 27, 2026 04:133,14266,628,84033,545,0001,016,0002,277,376
14Mar 27, 2026 04:133,14262,130,48233,551,0001,016,0002,392,064
15Mar 27, 2026 04:133,14358,438,73034,571,00002,392,064
16Mar 27, 2026 04:113,14360,241,17934,578,00002,281,472
17Mar 27, 2026 04:113,14359,607,95533,552,0001,016,0002,277,376
18Mar 27, 2026 04:113,14359,215,42234,577,00002,408,448
19Mar 27, 2026 04:113,14459,060,62233,567,0001,017,0002,277,376
20Mar 27, 2026 04:133,14562,841,59434,590,00002,396,160
21Mar 27, 2026 04:133,14763,711,81434,621,00002,277,376
22Mar 27, 2026 04:113,14859,298,26534,633,00002,392,064
23Mar 27, 2026 04:113,14964,072,46134,639,00002,277,376
24Mar 27, 2026 04:133,14962,180,99134,638,00002,400,256
25Mar 27, 2026 04:113,14962,343,34533,626,0001,018,0002,396,160
26Mar 27, 2026 04:113,15065,852,72434,647,00002,400,256
27Mar 27, 2026 04:113,15061,273,36934,654,00002,396,160
28Mar 27, 2026 04:113,15059,108,02133,631,0001,019,0002,277,376
29Mar 27, 2026 04:133,15360,561,40734,682,00002,392,064
30Mar 27, 2026 04:133,15363,056,15434,683,00002,404,352
31Mar 27, 2026 04:113,15461,711,76634,692,00002,277,376
32Mar 27, 2026 04:133,16465,800,54733,814,000994,0002,277,376
33Mar 27, 2026 04:113,16659,672,80833,829,000994,0002,277,376
34Mar 27, 2026 04:113,16766,624,97932,848,0001,990,0002,404,352
35Mar 27, 2026 04:113,16861,633,83533,854,000995,0002,408,448
36Mar 27, 2026 04:113,16862,736,05033,852,000995,0002,396,160
37Mar 27, 2026 04:133,16861,752,79433,855,000995,0002,400,256
38Mar 27, 2026 04:113,16958,964,33633,862,000995,0002,400,256
39Mar 27, 2026 04:113,17060,273,88833,873,000996,0002,400,256
40Mar 27, 2026 04:133,17063,628,49733,869,000996,0002,277,376
41Mar 27, 2026 04:133,17057,846,29432,878,0001,992,0002,277,376
42Mar 27, 2026 04:133,17254,658,42433,895,000996,0002,490,368
43Mar 27, 2026 04:113,17258,465,29533,894,000996,0002,392,064
44Mar 27, 2026 04:133,17456,801,26833,917,000997,0002,400,256
45Mar 27, 2026 04:113,17457,402,72132,919,0001,995,0002,412,544
46Mar 27, 2026 04:133,17659,754,29033,943,000998,0002,277,376
47Mar 27, 2026 04:113,17664,671,35132,941,0001,996,0002,404,352
48Mar 27, 2026 04:133,17857,734,79533,965,000998,0002,277,376