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 6, 2026 06:01Josu San MartinJosu San MartinScore: 6,277Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Jan 6, 2026 05:566,26195,531,62166,870,0001,996,0002,367,488
2Jan 6, 2026 05:566,26297,477,50866,884,0001,996,0002,289,664
3Jan 6, 2026 05:566,26798,451,59167,937,000999,0002,289,664
4Jan 6, 2026 05:566,27299,497,26767,996,000999,0002,359,296
5Jan 6, 2026 05:566,27595,486,22867,024,0002,000,0002,359,296
6Jan 6, 2026 06:016,27593,209,32368,023,0001,000,0002,285,568
7Jan 6, 2026 05:566,27792,080,75267,042,0002,001,0002,289,664
8Jan 6, 2026 05:566,29590,159,68667,234,0002,006,0002,355,200
9Jan 6, 2026 05:566,29689,450,22167,252,0002,007,0002,359,296
10Jan 6, 2026 05:566,29794,135,94068,261,0001,003,0002,355,200
11Jan 6, 2026 06:016,30493,318,81268,339,0001,004,0002,289,664
12Jan 6, 2026 06:016,30898,956,88269,388,00002,363,392