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:04olliecrowolliecrowScore: 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:043,13559,264,04334,484,00002,277,376
2Mar 27, 2026 02:043,14161,260,66533,536,0001,016,0002,519,040
3Mar 27, 2026 02:043,14156,586,58634,548,00002,277,376
4Mar 27, 2026 02:043,14264,975,23834,562,00002,277,376
5Mar 27, 2026 02:043,14560,619,63733,580,0001,017,0002,277,376
6Mar 27, 2026 02:043,14563,003,67733,576,0001,017,0002,277,376
7Mar 27, 2026 02:043,14663,553,36034,601,00002,277,376
8Mar 27, 2026 02:043,14859,306,98833,610,0001,018,0002,383,872
9Mar 27, 2026 02:043,14861,602,11533,607,0001,018,0002,396,160
10Mar 27, 2026 02:043,14959,624,35333,626,0001,018,0002,408,448
11Mar 27, 2026 02:043,14964,223,40133,622,0001,018,0002,392,064
12Mar 27, 2026 02:043,14960,651,48133,621,0001,018,0002,277,376
13Mar 27, 2026 02:043,15260,663,91334,671,00002,277,376
14Mar 27, 2026 02:043,15360,478,10334,682,00002,396,160
15Mar 27, 2026 02:043,16457,997,77533,808,000994,0002,404,352
16Mar 27, 2026 02:043,16562,168,48233,818,000994,0002,281,472
17Mar 27, 2026 02:043,16768,724,17032,848,0001,990,0002,277,376
18Mar 27, 2026 02:043,16861,769,52732,860,0001,991,0002,392,064
19Mar 27, 2026 02:043,16959,805,51333,862,000995,0002,396,160
20Mar 27, 2026 02:043,16961,726,39234,854,00002,277,376
21Mar 27, 2026 02:043,17058,108,04332,882,0001,992,0002,396,160
22Mar 27, 2026 02:043,17256,812,23333,891,000996,0002,277,376
23Mar 27, 2026 02:043,17355,206,69833,901,000997,0002,281,472
24Mar 27, 2026 02:043,17659,364,20633,936,000998,0002,277,376