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:44kairveekairveeScore: 370,914Success
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:44369,2104,088,297,1044,059,309,0001,998,0002,281,472
2Jan 1, 2026 08:44370,4474,102,452,2684,073,918,000999,0002,289,664
3Jan 1, 2026 08:44370,6954,106,937,4004,076,650,000999,0002,265,088
4Jan 1, 2026 08:44370,8134,106,309,9074,077,942,000999,0002,281,472
5Jan 1, 2026 08:44370,9144,106,628,0884,079,053,000999,0002,281,472
6Jan 1, 2026 08:44371,5914,114,572,0944,085,499,0001,998,0002,281,472
7Jan 1, 2026 08:44371,5944,115,409,8074,084,535,0002,998,0002,281,472
8Jan 1, 2026 08:44371,6564,115,454,5384,087,221,000999,0002,281,472
9Jan 1, 2026 08:44372,6324,127,592,6884,096,959,0001,998,0002,281,472