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 listSep 19, 2026 13:33Andrew EpsteinAndrew EpsteinScore: 98,776Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 19, 2026 13:5898,1891,090,530,9721,078,049,0002,031,0002,121,728stderr
2Sep 19, 2026 13:5898,3121,091,918,7711,079,325,0002,113,0002,121,728stderr
3Sep 19, 2026 13:5898,4461,094,694,0951,080,743,0002,169,0002,121,728stderr
4Sep 19, 2026 13:5898,5351,094,326,7501,081,820,0002,065,0002,121,728stderr
5Sep 19, 2026 13:5898,7761,096,993,1681,084,490,0002,046,0002,117,632stderr
6Sep 19, 2026 13:5898,8851,098,362,0741,085,645,0002,095,0002,121,728stderr
7Sep 19, 2026 13:5898,9681,099,843,1391,086,529,0002,129,0002,121,728stderr
8Sep 19, 2026 13:5899,0401,099,880,7671,087,447,0002,003,0002,121,728stderr
9Sep 19, 2026 13:58100,9471,121,472,4991,108,351,0002,076,0002,121,728stderr