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 23:24Ian MckibbenIan MckibbenError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 7, 2026 16:13C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 7, 2026 16:13057,356,35146,166,0001,068,0002,113,536expected "2 ", got "0"
2Sep 7, 2026 16:13057,256,66846,103,0001,058,0002,113,536expected "2 ", got "0"
3Sep 7, 2026 16:13058,129,05846,114,0001,077,0002,113,536expected "2 ", got "0"
4Jan 11, 2025 23:2416,764211,741,321177,393,0007,015,0002,420,736
5Jan 11, 2025 23:2416,768205,623,392179,437,0005,012,0002,297,856
6Jan 11, 2025 23:2416,777216,274,287178,533,0006,017,0002,301,952
7Jan 11, 2025 23:2416,779211,414,903179,554,0005,015,0002,301,952
8Jan 11, 2025 23:2416,786212,472,407180,636,0004,014,0002,314,240
9Jan 11, 2025 23:2416,794213,031,105171,749,00012,981,0002,355,200
10Jan 11, 2025 23:2416,798212,614,526178,785,0005,992,0002,428,928
11Jan 11, 2025 23:2416,801215,857,054176,823,0007,992,0002,490,368
12Jan 11, 2025 23:2416,848210,930,588177,310,0008,014,0002,506,752