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 listJan 6, 2026 04:55Josu San MartinJosu San MartinScore: 6,424Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Jan 6, 2026 04:596,41290,201,83669,523,0001,007,0002,285,568
2Jan 6, 2026 04:596,41397,239,63569,532,0001,007,0002,289,664
3Jan 6, 2026 04:556,41492,386,63669,548,0001,007,0002,363,392
4Jan 6, 2026 04:556,415100,600,11070,567,00002,289,664
5Jan 6, 2026 04:556,41697,165,92370,578,00002,289,664
6Jan 6, 2026 04:596,41695,986,41469,563,0001,008,0002,289,664
7Jan 6, 2026 04:596,418103,667,69270,593,00002,355,200
8Jan 6, 2026 04:596,41899,014,39370,603,00002,289,664
9Jan 6, 2026 04:556,42195,112,50769,622,0001,009,0002,289,664
10Jan 6, 2026 04:596,424105,935,72369,651,0001,009,0002,367,488
11Jan 6, 2026 04:556,43699,616,48668,798,0001,994,0002,289,664
12Jan 6, 2026 04:596,43897,275,29869,822,000997,0002,367,488
13Jan 6, 2026 04:556,43997,298,75468,835,0001,995,0002,367,488
14Jan 6, 2026 04:596,439100,708,80868,835,0001,995,0002,359,296
15Jan 6, 2026 04:556,44099,011,90069,839,000997,0002,289,664
16Jan 6, 2026 04:556,44699,002,46368,907,0001,997,0002,289,664
17Jan 6, 2026 04:556,45599,343,52369,008,0002,000,0002,355,200
18Jan 6, 2026 04:596,460104,228,26570,057,0001,000,0002,289,664