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 7, 2026 04:31Josu San MartinJosu San MartinScore: 3,551Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Jan 7, 2026 04:333,54374,287,99236,970,0001,998,0002,281,472
2Jan 7, 2026 04:333,54568,751,05136,997,0001,999,0002,281,472
3Jan 7, 2026 04:313,54765,220,90837,015,0002,000,0002,428,928
4Jan 7, 2026 04:333,54760,654,18238,014,0001,000,0002,437,120
5Jan 7, 2026 04:313,54768,378,44237,012,0002,000,0002,433,024
6Jan 7, 2026 04:333,54861,725,73837,030,0002,001,0002,437,120
7Jan 7, 2026 04:313,54960,722,80437,039,0002,002,0002,281,472
8Jan 7, 2026 04:333,55065,660,35937,044,0002,002,0002,441,216
9Jan 7, 2026 04:313,55159,643,88637,054,0002,002,0002,535,424
10Jan 7, 2026 04:333,55163,336,70437,054,0002,002,0002,281,472
11Jan 7, 2026 04:333,55265,682,86637,069,0002,003,0002,433,024
12Jan 7, 2026 04:313,55359,569,93237,084,0002,004,0002,428,928
13Jan 7, 2026 04:313,55560,298,77337,101,0002,005,0002,441,216
14Jan 7, 2026 04:333,55659,751,91837,114,0002,006,0002,441,216
15Jan 7, 2026 04:313,55757,912,90037,123,0002,006,0002,281,472
16Jan 7, 2026 04:313,55763,153,61537,126,0002,006,0002,437,120
17Jan 7, 2026 04:333,55764,634,86437,126,0002,006,0002,441,216
18Jan 7, 2026 04:313,55863,215,43437,130,0002,007,0002,281,472