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 01:54olliecrowolliecrowScore: 3,150Success
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 01:543,13157,884,31433,424,0001,012,0002,400,256
2Mar 27, 2026 01:543,13755,433,34633,488,0001,014,0002,392,064
3Mar 27, 2026 01:543,14055,893,10733,523,0001,015,0002,392,064
4Mar 27, 2026 01:543,14161,496,32133,536,0001,016,0002,277,376
5Apr 16, 2026 02:573,14459,444,61533,570,0001,017,0002,277,376
6Mar 27, 2026 01:543,14564,017,67234,598,00002,277,376
7Mar 27, 2026 01:543,14658,165,99734,601,00002,392,064
8Mar 27, 2026 01:543,14766,612,74234,617,00002,277,376
9Mar 27, 2026 01:543,14761,941,96034,614,00002,277,376
10Mar 27, 2026 01:543,14863,605,81333,607,0001,018,0002,490,368
11Mar 27, 2026 01:543,14862,308,27133,608,0001,018,0002,277,376
12Mar 27, 2026 01:543,14862,354,33333,606,0001,018,0002,400,256
13Apr 16, 2026 02:573,14963,976,12834,641,00002,277,376
14Mar 27, 2026 01:543,15060,341,35334,648,00002,277,376
15Apr 16, 2026 02:573,15065,153,45934,646,00002,383,872
16Mar 27, 2026 01:543,15057,160,21233,633,0001,019,0002,277,376
17Mar 27, 2026 01:543,15164,620,76633,646,0001,019,0002,277,376
18Mar 27, 2026 01:543,15161,834,84233,641,0001,019,0002,277,376
19Mar 27, 2026 01:543,15160,325,31833,644,0001,019,0002,277,376
20Mar 27, 2026 01:543,15762,047,48332,743,0001,984,0002,277,376
21Mar 27, 2026 01:543,16761,710,91334,839,00002,277,376
22Mar 27, 2026 01:543,16862,809,97834,843,00002,277,376
23Mar 27, 2026 01:543,16959,394,58733,868,000996,0002,277,376
24Mar 27, 2026 01:543,17259,882,80132,897,0001,993,0002,277,376
25Mar 27, 2026 01:543,17556,800,17032,934,0001,996,0002,400,256
26Mar 27, 2026 01:543,17663,833,05833,935,000998,0002,277,376
27Mar 27, 2026 01:543,17857,723,14633,956,000998,0002,277,376