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 listMar 14, 2026 07:36KeefeKeefeScore: 6,349Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Mar 14, 2026 07:366,31892,436,18669,503,00002,387,968
2Mar 14, 2026 07:366,33894,248,19369,716,00002,400,256
3Mar 14, 2026 07:366,34893,754,29269,831,00002,269,184
4Mar 14, 2026 07:366,349100,549,51767,844,0001,995,0002,265,088
5Mar 14, 2026 07:366,34997,641,97668,847,000997,0002,265,088
6Mar 14, 2026 07:366,35094,224,67468,854,000997,0002,506,752
7Mar 14, 2026 07:366,36093,540,78567,959,0001,998,0002,408,448
8Mar 14, 2026 07:366,36198,684,51869,973,00002,396,160
9Mar 14, 2026 07:366,37890,174,75469,161,0001,002,0002,514,944