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 listJun 11, 2026 02:53anboto1anboto1Error
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 9, 2026 09:40Haha Expert10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 9, 2026 09:40022,056,22910,306,0001,171,0002,113,536expected "2 ", got "0 "
2Sep 9, 2026 09:40021,579,23510,482,0001,072,0002,113,536expected "2 ", got "0 "
3Sep 9, 2026 09:40022,203,55110,324,0001,187,0002,113,536expected "2 ", got "0 "
4Jun 11, 2026 02:535,03064,349,64554,216,0001,114,0002,117,632
5Jun 11, 2026 02:535,03564,426,88854,275,0001,112,0002,113,536
6Jun 11, 2026 02:535,03865,959,19654,298,0001,124,0002,113,536
7Jun 11, 2026 02:535,03964,407,43854,317,0001,121,0002,113,536
8Jun 11, 2026 02:535,03964,451,26554,317,0001,119,0002,113,536
9Jun 11, 2026 02:535,04064,920,06254,327,0001,120,0002,113,536
10Jun 11, 2026 02:535,04764,556,01354,406,0001,121,0002,113,536
11Jun 11, 2026 02:535,05065,029,98954,418,0001,135,0002,113,536
12Jun 11, 2026 02:535,07764,878,82754,780,0001,069,0002,113,536