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:56olliecrowolliecrowScore: 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:563,13655,854,20733,487,0001,014,0002,396,160
2Mar 27, 2026 08:563,13858,419,04733,508,0001,015,0002,277,376
3Mar 27, 2026 08:563,14060,968,13234,536,00002,277,376
4Mar 27, 2026 08:563,14263,471,54734,566,00002,392,064
5Mar 27, 2026 08:563,14265,012,29733,551,0001,016,0002,277,376
6Mar 27, 2026 08:563,14564,101,09534,599,00002,392,064
7Mar 27, 2026 08:563,14564,172,03033,576,0001,017,0002,277,376
8Mar 27, 2026 08:563,14660,805,13734,605,00002,387,968
9Mar 27, 2026 08:563,14859,544,52933,612,0001,018,0002,277,376
10Mar 27, 2026 08:563,15061,778,74133,627,0001,019,0002,277,376
11Mar 27, 2026 08:563,15065,745,08134,648,00002,277,376
12Mar 27, 2026 08:563,15062,739,64433,631,0001,019,0002,404,352
13Mar 27, 2026 08:563,15159,125,59334,662,00002,277,376
14Mar 27, 2026 08:563,15461,534,99533,678,0001,020,0002,277,376
15Mar 27, 2026 08:563,16759,507,72033,847,000995,0002,400,256
16Mar 27, 2026 08:563,16866,831,39833,852,000995,0002,273,280
17Mar 27, 2026 08:563,16960,732,50134,857,00002,277,376
18Mar 27, 2026 08:563,16961,559,79633,861,000995,0002,400,256
19Mar 27, 2026 08:563,16963,649,23932,864,0001,991,0002,277,376
20Mar 27, 2026 08:563,16961,000,60432,869,0001,992,0002,277,376
21Mar 27, 2026 08:563,17064,367,08032,874,0001,992,0002,404,352
22Mar 27, 2026 08:563,17062,622,70132,882,0001,992,0002,277,376
23Mar 27, 2026 08:563,17658,412,24233,937,000998,0002,478,080
24Mar 27, 2026 08:563,19261,328,48233,101,0002,006,0002,277,376