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:45Josu San MartinJosu San MartinScore: 7,089Success
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:127,078104,279,20477,861,00002,535,424
2Jan 5, 2026 22:127,079100,034,95677,872,00002,449,408
3Jan 5, 2026 22:127,081104,698,82276,892,000998,0002,445,312
4Jan 5, 2026 22:127,083100,279,36476,910,000998,0002,453,504
5Jan 5, 2026 22:127,084102,405,84475,925,0001,998,0002,453,504
6Jan 5, 2026 22:127,084102,609,64676,928,000999,0002,445,312
7Jan 5, 2026 22:457,089104,886,86076,001,0001,974,0002,535,424
8Jan 5, 2026 22:127,091103,054,24276,005,0002,000,0002,445,312
9Jan 5, 2026 22:457,100104,257,48677,103,0001,001,0002,449,408
10Jan 5, 2026 22:457,102101,176,90076,117,0002,003,0002,441,216
11Jan 5, 2026 22:127,109101,279,71476,196,0002,005,0002,449,408
12Jan 5, 2026 22:127,113105,172,23077,254,000990,0002,535,424