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 29, 2026 08:43Aleksey ShvetsAleksey ShvetsScore: 120,252Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Jan 29, 2026 08:43119,9051,344,396,5131,312,958,0005,995,0002,527,232
2Jan 29, 2026 08:43119,9941,346,277,1191,316,940,0002,997,0002,437,120
3Jan 29, 2026 08:43120,0891,350,504,5391,316,979,0003,999,0002,473,984
4Jan 29, 2026 08:43120,1301,348,412,2321,317,437,0003,998,0002,338,816
5Jan 29, 2026 08:43120,2521,349,049,7651,314,771,0007,998,0002,412,544
6Jan 29, 2026 08:43120,3311,355,479,0701,321,645,0001,999,0002,408,448
7Jan 29, 2026 08:43120,4701,354,050,8341,323,177,0001,998,0002,506,752
8Jan 29, 2026 08:43121,6651,366,049,5381,329,325,0008,995,0002,433,024
9Jan 29, 2026 08:43122,5981,378,169,3611,344,576,0003,998,0002,306,048