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 listDec 4, 2025 13:30izotoffizotoffScore: 477,165Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Dec 4, 2025 13:30476,6355,271,554,0705,162,034,00080,953,0002,334,720
2Dec 4, 2025 13:30476,7005,273,162,2555,156,753,00086,945,0002,347,008
3Dec 4, 2025 13:30477,0945,278,401,0915,156,101,00091,930,0002,338,816
4Dec 4, 2025 13:30477,1415,277,258,1945,142,626,000105,930,0002,347,008
5Dec 4, 2025 13:30477,1655,279,288,6625,131,910,000116,906,0002,347,008
6Dec 4, 2025 13:30477,1955,277,037,4295,137,205,000111,939,0002,347,008
7Dec 4, 2025 13:30477,8175,281,016,5275,161,044,00094,945,0002,322,432
8Dec 4, 2025 13:30478,7885,296,100,9705,172,706,00093,958,0002,330,624
9Dec 4, 2025 13:30479,1315,300,970,9805,158,513,000111,924,0002,301,952