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 listApr 28, 2026 23:50Charles CabergsCharles CabergsScore: 5,618Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Apr 28, 2026 23:505,60176,834,54560,603,0001,010,0002,514,944
2Apr 28, 2026 23:505,60377,864,37658,609,0003,031,0002,514,944
3Apr 28, 2026 23:505,60681,054,18661,671,00002,330,624
4Apr 28, 2026 23:505,61086,700,06859,722,0001,990,0002,519,040
5Apr 28, 2026 23:505,61876,089,60159,814,0001,993,0002,326,528
6Apr 28, 2026 23:505,62181,705,03459,846,0001,994,0002,514,944
7Apr 28, 2026 23:505,62978,399,98459,928,0001,997,0002,523,136
8Apr 28, 2026 23:505,63080,290,77059,942,0001,998,0002,519,040
9Apr 28, 2026 23:505,63283,968,10859,956,0001,998,0002,519,040