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 25, 2026 20:56Dominique GarmierDominique GarmierScore: 261,918Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Mar 25, 2026 17:21260,8722,898,458,2832,867,588,0001,999,0002,449,408
2Mar 22, 2026 09:29261,7512,903,552,2232,877,268,0001,998,0002,457,600
3Mar 25, 2026 17:21261,8072,913,299,2382,877,879,0001,999,0002,453,504
4Mar 25, 2026 20:56261,8392,910,858,4422,878,236,0001,998,0002,330,624
5Mar 25, 2026 17:08261,8442,916,958,0202,878,291,0001,998,0002,334,720
6Mar 25, 2026 17:21261,9012,904,953,9082,878,918,0001,998,0002,334,720
7Mar 25, 2026 17:08261,9182,907,244,8272,880,100,000999,0002,445,312
8Mar 22, 2026 09:29262,0512,910,482,2412,881,566,000999,0002,445,312
9Mar 25, 2026 20:56262,2522,912,797,1212,883,776,000999,0002,551,808
10Mar 22, 2026 09:29262,3232,918,138,4722,884,559,000999,0002,453,504
11Mar 25, 2026 17:08262,4702,917,146,0502,879,176,0007,992,0002,334,720
12Mar 25, 2026 20:56262,7532,918,305,4812,889,288,000999,0002,334,720