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 listNov 2, 2026 19:26Andrew EpsteinAndrew EpsteinScore: 244,827Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Nov 2, 2026 19:26244,3672,701,053,0192,675,814,00012,225,0002,125,824stderr
2Nov 2, 2026 19:26244,7112,705,178,4882,679,692,00012,131,0002,125,824stderr
3Nov 2, 2026 19:26244,7132,704,573,3472,679,784,00012,063,0002,125,824stderr
4Nov 2, 2026 19:26244,7942,705,612,7142,681,712,00011,028,0002,125,824stderr
5Nov 2, 2026 19:26244,8272,705,836,1282,681,084,00012,023,0002,125,824stderr
6Nov 2, 2026 19:26245,0112,708,441,7212,684,093,00011,029,0002,125,824stderr
7Nov 2, 2026 19:26245,4782,713,134,9082,688,202,00012,066,0002,125,824stderr
8Nov 2, 2026 19:26245,6062,714,388,1602,689,630,00012,045,0002,125,824stderr
9Nov 2, 2026 19:26245,7032,715,850,3222,688,695,00014,044,0002,125,824stderr