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 11, 2025 21:36Ian MckibbenIan MckibbenError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 7, 2026 16:20C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 7, 2026 16:200960,351,481949,192,0001,021,0002,113,536expected "2 ", got "0 "
2Sep 7, 2026 16:200964,183,090952,945,0001,041,0002,113,536expected "2 ", got "0 "
3Sep 7, 2026 16:200961,064,284949,713,0001,104,0002,113,536expected "2 ", got "0 "
4Jan 11, 2025 21:36186,8122,082,254,2092,053,933,000999,0002,265,088
5Jan 11, 2025 21:36186,8282,085,941,0212,054,106,000999,0002,289,664
6Jan 11, 2025 21:36186,8802,079,233,3912,053,684,0001,998,0002,281,472
7Jan 11, 2025 21:36187,1022,082,416,6842,058,124,00002,273,280
8Jan 11, 2025 21:36187,1422,084,632,2932,057,565,000999,0002,289,664
9Jan 11, 2025 21:36187,2832,094,483,8462,059,117,000999,0002,289,664
10Jan 11, 2025 21:36187,3412,091,255,6792,059,754,000999,0002,281,472
11Jan 11, 2025 21:36187,3452,095,061,6542,058,796,0001,998,0002,281,472
12Jan 11, 2025 21:36187,4232,087,386,4752,059,660,0001,998,0002,523,136