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 listApr 6, 2025 15:29Aniruddha DebAniruddha DebScore: 10,287Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Apr 20, 2025 08:2110,274139,701,066113,012,00002,433,024
2Apr 6, 2025 15:2910,276134,168,194112,037,0001,000,0002,531,328
3Apr 20, 2025 08:2110,278138,982,931112,055,0001,000,0002,269,184
4Apr 6, 2025 15:2910,279142,806,442112,066,0001,000,0002,424,832
5Apr 6, 2025 15:2910,281135,564,378112,088,0001,000,0002,437,120
6Apr 20, 2025 08:2110,282141,710,356112,099,0001,000,0002,428,928
7Apr 20, 2025 08:2110,285134,981,233112,138,0001,001,0002,531,328
8Apr 20, 2025 08:2110,286137,336,795112,147,0001,001,0002,428,928
9Apr 20, 2025 08:2110,286138,634,041112,150,0001,001,0002,531,328
10Apr 6, 2025 15:2910,287142,864,539112,154,0001,001,0002,531,328
11Apr 20, 2025 08:2110,297133,267,246112,266,0001,002,0002,437,120
12Apr 6, 2025 15:2910,298137,065,341111,278,0002,005,0002,424,832
13Apr 6, 2025 15:2910,304134,203,411112,339,0001,003,0002,531,328
14Apr 6, 2025 15:2910,312134,687,292112,433,0001,003,0002,428,928
15Apr 20, 2025 08:2110,313139,424,857113,440,00002,531,328
16Apr 20, 2025 08:2110,326135,353,324113,581,00002,269,184
17Apr 6, 2025 15:2910,357136,421,122111,925,0001,998,0002,269,184
18Apr 6, 2025 15:2910,359137,385,440112,951,000999,0002,269,184