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 5, 2026 21:28Josu San MartinJosu San MartinScore: 8,014Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Jan 5, 2026 21:227,994114,257,11485,938,0001,998,0002,322,432
2Jan 5, 2026 21:227,999110,602,79286,991,000999,0002,322,432
3Jan 5, 2026 21:228,008114,358,90286,087,0002,002,0002,318,336
4Jan 5, 2026 21:228,010114,414,94687,114,0001,001,0002,326,528
5Jan 5, 2026 21:228,012108,322,31186,133,0002,003,0002,326,528
6Jan 5, 2026 21:228,013114,026,95686,140,0002,003,0002,322,432
7Jan 5, 2026 21:228,014108,625,84387,155,0001,001,0002,318,336
8Jan 5, 2026 21:228,018108,500,52086,199,0002,004,0002,318,336
9Jan 5, 2026 21:288,026110,644,87888,285,00002,322,432
10Jan 5, 2026 21:228,032110,380,36188,347,00002,322,432
11Jan 5, 2026 21:288,041111,996,17786,437,0002,010,0002,322,432
12Jan 5, 2026 21:288,042114,334,98888,458,00002,322,432