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 listJan 28, 2026 22:50Aleksey ShvetsAleksey ShvetsScore: 120,653Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Jan 28, 2026 22:50120,2371,351,929,5071,317,611,0004,994,0002,334,720
2Jan 28, 2026 22:50120,2711,350,331,9571,317,980,0004,996,0002,297,856
3Jan 28, 2026 22:50120,3991,350,559,9531,318,394,0005,997,0002,428,928
4Jan 28, 2026 22:50120,4671,352,592,8311,319,137,0006,000,0002,428,928
5Jan 28, 2026 22:50120,6531,350,030,9031,325,182,0001,998,0002,387,968
6Jan 28, 2026 22:50122,2781,371,260,8541,342,061,0003,000,0002,338,816
7Jan 28, 2026 22:50122,8611,379,053,1531,346,471,0004,998,0002,330,624
8Jan 28, 2026 22:50124,7701,400,404,8681,368,473,0003,998,0002,420,736
9Jan 28, 2026 22:50125,8561,410,370,2641,379,414,0004,997,0002,433,024