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 22:35Josu San MartinJosu San MartinScore: 7,010Success
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 22:356,990101,154,04474,896,0001,997,0002,441,216
2Jan 5, 2026 22:356,991101,038,35174,903,0001,997,0002,437,120
3Jan 6, 2026 01:506,993101,392,21275,925,000999,0002,433,024
4Jan 6, 2026 01:506,996101,147,37476,958,00002,437,120
5Jan 6, 2026 01:507,001102,364,97676,015,0001,000,0002,437,120
6Jan 5, 2026 22:357,002104,105,41276,026,0001,000,0002,433,024
7Jan 5, 2026 22:357,002101,201,44276,021,0001,000,0002,437,120
8Jan 6, 2026 01:507,003100,018,25275,034,0002,000,0002,441,216
9Jan 6, 2026 01:507,009101,790,32376,097,0001,001,0002,433,024
10Jan 6, 2026 01:507,010100,701,54176,106,0001,001,0002,428,928
11Jan 6, 2026 01:507,011103,634,93775,120,0002,003,0002,445,312
12Jan 5, 2026 22:357,013102,896,52975,137,0002,003,0002,433,024
13Jan 5, 2026 22:357,01899,807,54476,194,0001,002,0002,437,120
14Jan 6, 2026 01:507,028100,214,94775,302,0002,008,0002,433,024
15Jan 5, 2026 22:357,029100,440,85176,332,000991,0002,527,232
16Jan 5, 2026 22:357,04699,326,07577,501,00002,441,216
17Jan 6, 2026 01:507,050101,988,31476,548,0001,007,0002,433,024
18Jan 5, 2026 22:357,06497,246,41676,697,0001,009,0002,445,312