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:54Aleksey ShvetsAleksey ShvetsScore: 120,638Success
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:54120,3731,351,538,9291,317,105,0006,995,0002,306,048
2Jan 28, 2026 22:54120,3731,350,672,1531,321,107,0002,997,0002,408,448
3Jan 28, 2026 22:54120,4461,349,594,6651,319,914,0004,995,0002,334,720
4Jan 28, 2026 22:54120,6341,359,343,5371,324,980,0001,998,0002,437,120
5Jan 28, 2026 22:54120,6381,355,061,2061,323,026,0003,997,0002,314,240
6Jan 28, 2026 22:54120,8471,359,863,7741,327,317,0001,998,0002,428,928
7Jan 28, 2026 22:54121,1481,360,714,7711,329,631,0002,999,0002,322,432
8Jan 28, 2026 22:54121,6221,369,762,6041,333,842,0003,996,0002,314,240
9Jan 28, 2026 22:54128,4711,436,783,7221,408,179,0004,997,0002,318,336