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 1, 2026 08:34kairveekairveeScore: 475,917Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Jan 1, 2026 08:34471,9605,217,524,2265,188,559,0002,998,0002,289,664
2Jan 1, 2026 08:34472,1595,224,793,0725,191,753,0001,999,0002,281,472
3Jan 1, 2026 08:34475,1825,251,546,7415,226,006,000999,0002,531,328
4Jan 1, 2026 08:34475,4695,256,733,2865,228,163,0001,998,0002,281,472
5Jan 1, 2026 08:34475,9175,258,236,9445,233,092,0001,998,0002,281,472
6Jan 1, 2026 08:34476,2975,267,120,3025,237,269,0001,998,0002,285,568
7Jan 1, 2026 08:34476,2995,268,249,5495,237,294,0001,998,0002,281,472
8Jan 1, 2026 08:34477,7565,282,214,2755,253,321,0001,998,0002,281,472
9Jan 1, 2026 08:34480,5875,310,689,6855,285,454,000999,0002,281,472