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 29, 2026 18:22olliecrowolliecrowScore: 3,168Success
Source Code

Source code access is restricted. Log in to request access.

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Mar 29, 2026 18:213,14455,725,65433,570,0001,017,0002,277,376
2Mar 29, 2026 18:213,15165,436,24634,660,00002,396,160
3Mar 29, 2026 18:203,15361,236,31933,663,0001,020,0002,273,280
4Mar 29, 2026 18:213,15460,881,85834,699,00002,400,256
5Mar 29, 2026 18:213,15665,973,78834,711,00002,277,376
6Mar 29, 2026 18:203,16761,143,69532,851,0001,990,0002,392,064
7Mar 29, 2026 18:223,16862,470,28333,855,000995,0002,404,352
8Mar 29, 2026 18:213,16961,962,34132,864,0001,991,0002,400,256
9Mar 29, 2026 18:213,17055,860,31633,848,0001,025,0002,277,376
10Mar 29, 2026 18:223,17158,519,84733,883,000996,0002,277,376
11Mar 29, 2026 18:203,17262,799,13633,895,000996,0002,281,472
12Mar 29, 2026 18:223,17959,862,50932,973,0001,998,0002,400,256