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:42olliecrowolliecrowScore: 3,145Success
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:423,13953,469,29933,516,0001,015,0002,396,160
2Mar 27, 2026 01:423,14056,705,17534,537,00002,400,256
3Mar 27, 2026 01:423,14060,466,65533,523,0001,015,0002,277,376
4Mar 27, 2026 01:423,14156,212,71233,530,0001,016,0002,277,376
5Mar 27, 2026 01:423,14161,453,34234,553,00002,396,160
6Mar 27, 2026 01:423,14154,527,82433,535,0001,016,0002,404,352
7Mar 27, 2026 01:423,14253,247,24733,548,0001,016,0002,392,064
8Mar 27, 2026 01:423,14365,835,16034,574,00002,400,256
9Mar 27, 2026 01:423,14361,243,09933,559,0001,016,0002,277,376
10Mar 27, 2026 01:423,14359,597,22933,557,0001,016,0002,277,376
11Mar 27, 2026 01:423,14362,205,89733,553,0001,016,0002,277,376
12Mar 27, 2026 01:423,14463,200,68434,581,00002,277,376
13Mar 27, 2026 01:423,14565,610,39234,600,00002,277,376
14Mar 27, 2026 01:423,14759,679,94434,617,00002,277,376
15Mar 27, 2026 01:423,14762,544,35033,603,0001,018,0002,277,376
16Mar 27, 2026 01:423,14961,134,19133,624,0001,018,0002,400,256
17Mar 27, 2026 01:423,15261,511,18533,653,0001,019,0002,392,064
18Mar 27, 2026 01:423,15263,872,68834,671,00002,277,376
19Mar 27, 2026 01:423,15365,102,34234,678,00002,277,376
20Mar 27, 2026 01:423,15460,973,33833,670,0001,020,0002,277,376
21Mar 27, 2026 01:423,16966,464,71733,859,000995,0002,277,376
22Mar 27, 2026 01:423,17159,772,88333,881,000996,0002,396,160
23Mar 27, 2026 01:423,17462,141,83733,915,000997,0002,277,376
24Mar 27, 2026 01:423,18562,005,99533,030,0002,001,0002,408,448