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 listJul 7, 2026 05:14Victor MerckléVictor MerckléScore: 2,004Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Jul 7, 2026 05:151,99229,966,57121,920,00002,117,632stderr
2Jul 7, 2026 05:151,99930,095,11421,997,00002,117,632stderr
3Jul 7, 2026 05:152,00330,138,92022,043,00002,117,632stderr
4Jul 7, 2026 05:152,00329,863,05022,033,00002,117,632stderr
5Jul 7, 2026 05:152,00430,041,54522,052,00002,117,632stderr
6Jul 7, 2026 05:152,00630,685,72922,066,00002,117,632stderr
7Jul 7, 2026 05:152,00830,649,71421,092,0001,003,0002,117,632stderr
8Jul 7, 2026 05:152,01030,651,64322,112,00002,117,632stderr
9Jul 7, 2026 05:152,01130,228,32021,121,0001,006,0002,117,632stderr