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:18olliecrowolliecrowScore: 3,148Success
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:183,13755,056,65233,492,0001,014,0002,408,448
2Mar 27, 2026 04:183,14054,525,62933,527,0001,015,0002,404,352
3Mar 27, 2026 04:183,14259,176,06734,562,00002,400,256
4Mar 27, 2026 04:183,14358,621,79734,578,00002,277,376
5Mar 27, 2026 04:183,14361,399,46533,557,0001,016,0002,277,376
6Mar 27, 2026 04:183,14459,972,68433,572,0001,017,0002,400,256
7Mar 27, 2026 04:183,14460,946,69134,586,00002,277,376
8Mar 27, 2026 04:183,14560,919,53834,598,00002,400,256
9Mar 27, 2026 04:183,14562,189,32933,574,0001,017,0002,404,352
10Mar 27, 2026 04:183,14664,965,39033,586,0001,017,0002,277,376
11Mar 27, 2026 04:183,14664,390,36033,592,0001,017,0002,277,376
12Mar 27, 2026 04:183,14760,389,02433,598,0001,018,0002,277,376
13Mar 27, 2026 04:183,14859,803,95933,605,0001,018,0002,277,376
14Mar 27, 2026 04:183,14965,755,86834,639,00002,387,968
15Mar 27, 2026 04:183,15067,686,20033,633,0001,019,0002,277,376
16Mar 27, 2026 04:183,15261,744,03734,669,00002,392,064
17Mar 27, 2026 04:183,16759,562,81533,840,000995,0002,404,352
18Mar 27, 2026 04:183,16864,918,93732,853,0001,991,0002,277,376
19Mar 27, 2026 04:183,16865,545,73533,853,000995,0002,277,376
20Mar 27, 2026 04:183,17059,694,48233,878,000996,0002,277,376
21Mar 27, 2026 04:183,17559,335,61032,927,0001,995,0002,277,376
22Mar 27, 2026 04:183,17561,911,27833,923,000997,0002,404,352
23Mar 27, 2026 04:183,17658,591,38832,938,0001,996,0002,281,472
24Mar 27, 2026 04:183,17658,819,84232,936,0001,996,0002,277,376