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 26, 2026 18:44TudyMTudyMScore: 15,831Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Apr 26, 2026 18:4415,817189,648,582171,993,0001,999,0002,363,392
2Apr 26, 2026 18:4415,823194,400,186173,054,0001,000,0002,379,776
3Apr 26, 2026 18:4415,825191,350,361172,077,0002,000,0002,359,296
4Apr 26, 2026 18:4415,829188,994,469172,120,0002,001,0002,306,048
5Apr 26, 2026 18:4415,831192,232,402173,146,0001,000,0002,367,488
6Apr 26, 2026 18:4415,837190,899,541173,212,0001,001,0002,359,296
7Apr 26, 2026 18:4415,842190,899,114172,267,0002,003,0002,367,488
8Apr 26, 2026 18:4415,852188,989,567172,376,0002,004,0002,301,952
9Apr 26, 2026 18:4415,873195,017,533173,605,0001,003,0002,371,584