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 listAug 23, 2026 15:09Victor MerckléVictor MerckléScore: 2,025Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Aug 23, 2026 15:092,02130,423,22822,241,00002,117,632stderr
2Aug 23, 2026 15:092,02130,700,68422,240,00002,117,632stderr
3Aug 23, 2026 15:092,02230,630,12422,247,00002,117,632stderr
4Aug 23, 2026 15:092,02430,703,55122,267,00002,117,632stderr
5Aug 23, 2026 15:092,02530,430,54922,278,00002,117,632stderr
6Aug 23, 2026 15:092,02630,404,20422,290,00002,117,632stderr
7Aug 23, 2026 15:092,02830,714,58322,310,00002,117,632stderr
8Aug 23, 2026 15:092,02930,699,44722,324,00002,117,632stderr
9Aug 23, 2026 15:092,03130,596,27422,342,00002,117,632stderr