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 22:34Ian MckibbenIan MckibbenError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 7, 2026 16:15C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 7, 2026 16:16065,202,33351,929,0003,088,0002,113,536expected "2 ", got "0 "
2Sep 7, 2026 16:16067,173,97852,005,0003,100,0002,113,536expected "2 ", got "0 "
3Sep 7, 2026 16:16064,903,10151,327,0003,544,0002,113,536expected "2 ", got "0 "
4Jan 11, 2025 22:3418,993231,924,566198,930,0009,996,0002,433,024
5Jan 11, 2025 22:3418,994235,853,757192,935,00015,994,0002,453,504
6Jan 11, 2025 22:3419,000236,623,354196,999,00011,999,0002,441,216
7Jan 11, 2025 22:3419,019231,773,238195,200,00014,014,0002,318,336
8Jan 11, 2025 22:3419,020231,592,834201,216,0008,008,0002,273,280
9Jan 11, 2025 22:3419,029235,340,273198,307,00011,017,0002,510,848
10Jan 11, 2025 22:3419,039233,695,499195,398,00014,028,0002,314,240
11Jan 11, 2025 22:3419,040234,169,569201,419,0008,016,0002,322,432
12Jan 11, 2025 22:3419,068241,362,074194,767,00014,982,0002,453,504