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 listFeb 19, 2026 01:46Josu San MartinJosu San MartinScore: 3,505Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Feb 19, 2026 01:153,49265,060,85437,400,0001,010,0002,277,376
2Feb 19, 2026 01:153,49368,146,33438,420,00002,404,352
3Feb 19, 2026 01:153,49763,790,52737,460,0001,012,0002,277,376
4Feb 19, 2026 01:153,49766,476,60937,460,0001,012,0002,277,376
5Feb 19, 2026 01:523,49861,597,83638,476,00002,277,376
6Feb 19, 2026 01:153,50061,618,32937,491,0001,013,0002,277,376
7Feb 19, 2026 01:523,50062,197,99737,492,0001,013,0002,404,352
8Feb 19, 2026 01:523,50064,472,91437,489,0001,013,0002,277,376
9Feb 19, 2026 01:523,50064,243,67238,500,00002,400,256
10Feb 19, 2026 01:523,50159,106,13637,496,0001,013,0002,404,352
11Feb 19, 2026 01:463,50563,083,38637,546,0001,014,0002,277,376
12Feb 19, 2026 01:153,50666,487,06637,554,0001,014,0002,400,256
13Feb 19, 2026 01:153,50864,573,83237,571,0001,015,0002,486,272
14Feb 19, 2026 01:523,51472,696,40337,639,0001,017,0002,277,376
15Feb 19, 2026 01:523,51567,360,97537,672,000991,0002,277,376
16Feb 19, 2026 01:523,51663,281,78937,657,0001,017,0002,277,376
17Feb 19, 2026 01:153,51667,096,81838,678,00002,277,376
18Feb 19, 2026 01:153,51768,644,66138,686,00002,277,376
19Feb 19, 2026 01:523,53164,801,31036,847,0001,991,0002,277,376
20Feb 19, 2026 01:463,53364,896,42837,865,000996,0002,277,376
21Feb 19, 2026 01:463,53466,137,14237,881,000996,0002,277,376