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 listMay 3, 2026 18:27TudyMTudyMScore: 4,056Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1May 3, 2026 18:334,04859,308,58843,464,0001,065,0002,355,200
2May 3, 2026 18:334,04858,950,70543,459,0001,075,0002,367,488
3May 3, 2026 18:334,05358,481,54943,538,0001,048,0002,383,872
4May 3, 2026 18:334,05561,904,37643,547,0001,066,0002,375,680
5May 3, 2026 18:334,05662,873,17443,527,0001,092,0002,367,488
6May 3, 2026 18:334,06562,009,71343,611,0001,110,0002,367,488
7May 3, 2026 18:334,06559,412,46043,483,0001,241,0002,375,680
8May 3, 2026 18:334,06660,470,95343,630,0001,099,0002,367,488
9May 3, 2026 18:334,09261,216,45643,911,0001,103,0002,375,680