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

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

Challenge History
DateChallengerCostTypeStatus
Sep 7, 2026 16:12C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 7, 2026 16:12072,906,88759,276,0001,121,0002,113,536expected "2 ", got "0"
2Sep 7, 2026 16:12070,437,48459,123,0001,190,0002,113,536expected "2 ", got "0"
3Sep 7, 2026 16:12070,558,58959,366,0001,066,0002,113,536expected "2 ", got "0"
4Jan 11, 2025 23:3116,653209,957,242179,181,0004,004,0002,433,024
5Jan 11, 2025 23:3116,671212,312,902179,375,0004,008,0002,293,760
6Jan 11, 2025 23:3116,672206,817,741178,383,0005,010,0002,293,760
7Jan 11, 2025 23:3116,682211,580,760179,496,0004,011,0002,289,664
8Jan 11, 2025 23:3116,690213,102,487180,584,0003,009,0002,396,160
9Jan 11, 2025 23:3116,707208,856,877177,749,0006,025,0002,506,752
10Jan 11, 2025 23:3116,709213,318,089176,809,0006,992,0002,506,752
11Jan 11, 2025 23:3116,715208,215,092179,864,0003,996,0002,310,144
12Jan 11, 2025 23:3116,731207,252,559175,043,0009,002,0002,297,856
13Jan 11, 2025 23:3027,038327,521,470290,407,0007,009,0002,301,952
14Jan 11, 2025 23:3027,101322,238,744293,110,0005,001,0002,416,640
15Jan 11, 2025 23:3027,489326,262,023291,362,00011,013,0002,379,776