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:40Josu San MartinJosu San MartinScore: 6,467Success
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:406,453103,199,44668,985,0001,999,0002,437,120
2Jan 6, 2026 04:406,45597,221,23969,000,0002,000,0002,441,216
3Jan 6, 2026 04:406,45698,014,88469,015,0002,000,0002,441,216
4Jan 6, 2026 04:536,45993,011,16670,045,0001,000,0002,428,928
5Jan 6, 2026 04:406,46389,692,56869,091,0002,002,0002,437,120
6Jan 6, 2026 04:536,46393,056,61969,095,0002,002,0002,437,120
7Jan 6, 2026 04:536,46592,357,25969,108,0002,003,0002,281,472
8Jan 6, 2026 04:536,46791,990,32769,130,0002,003,0002,273,280
9Jan 6, 2026 04:536,46793,861,50769,135,0002,003,0002,281,472
10Jan 6, 2026 04:536,46795,289,37269,135,0002,003,0002,441,216
11Jan 6, 2026 04:406,48092,560,59470,272,0001,003,0002,281,472
12Jan 6, 2026 04:536,48194,349,83370,285,0001,004,0002,441,216
13Jan 6, 2026 04:536,48493,990,56770,318,0001,004,0002,437,120
14Jan 6, 2026 04:406,48691,711,83570,339,0001,004,0002,433,024
15Jan 6, 2026 04:406,48897,718,93370,361,0001,005,0002,281,472
16Jan 6, 2026 04:406,49296,218,76070,403,0001,005,0002,437,120
17Jan 6, 2026 04:406,49695,237,78070,452,0001,006,0002,281,472
18Jan 6, 2026 04:536,530102,178,78771,832,00002,281,472