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 listJul 9, 2025 06:16Aniruddha DebAniruddha DebScore: 5,376Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Jul 9, 2025 06:165,36179,681,58956,969,0001,998,0002,437,120
2Jul 9, 2025 06:145,36683,252,54858,025,0001,000,0002,437,120
3Jul 9, 2025 06:165,36680,400,43758,027,0001,000,0002,531,328
4Jul 9, 2025 06:145,36785,538,99458,035,0001,000,0002,269,184
5Jul 9, 2025 06:165,36782,129,79958,038,0001,000,0002,269,184
6Jul 9, 2025 06:145,36883,328,48958,043,0001,000,0002,531,328
7Jul 9, 2025 06:145,37079,540,94657,070,0002,002,0002,531,328
8Jul 9, 2025 06:165,37083,215,24458,066,0001,001,0002,269,184
9Jul 9, 2025 06:145,37684,173,61458,137,0001,002,0002,531,328
10Jul 9, 2025 06:145,37683,111,08658,130,0001,002,0002,424,832
11Jul 9, 2025 06:165,37787,343,99558,142,0001,002,0002,269,184
12Jul 9, 2025 06:165,37783,959,05357,145,0002,005,0002,424,832
13Jul 9, 2025 06:145,37879,835,48157,152,0002,005,0002,510,848
14Jul 9, 2025 06:165,37984,653,07458,164,0001,002,0002,424,832
15Jul 9, 2025 06:165,38284,232,28558,198,0001,003,0002,531,328
16Jul 9, 2025 06:145,38376,946,66758,215,0001,003,0002,269,184
17Jul 9, 2025 06:145,38682,194,63958,247,0001,004,0002,437,120
18Jul 9, 2025 06:165,38779,795,98257,254,0002,008,0002,428,928