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 28, 2026 16:06Charles CabergsCharles CabergsScore: 6,680Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Apr 28, 2026 16:066,66886,094,08472,348,0001,004,0002,514,944stderr
2Apr 28, 2026 16:066,67389,128,34671,397,0002,011,0002,334,720stderr
3Apr 28, 2026 16:066,67589,371,50272,426,0001,005,0002,519,040stderr
4Apr 28, 2026 16:066,67690,130,36573,442,00002,330,624stderr
5Apr 28, 2026 16:066,68088,441,63372,480,0001,006,0002,514,944stderr
6Apr 28, 2026 16:066,68488,092,80972,526,0001,007,0002,531,328stderr
7Apr 28, 2026 16:066,68593,173,76272,529,0001,007,0002,519,040stderr
8Apr 28, 2026 16:066,69391,864,63772,622,0001,008,0002,326,528stderr
9Apr 28, 2026 16:066,73086,934,01773,023,0001,014,0002,514,944stderr