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 7, 2026 01:25Josu San MartinJosu San MartinScore: 4,387Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Jan 7, 2026 02:373,83270,952,11139,138,0003,010,0002,379,776
2Jan 7, 2026 04:163,83371,938,82240,154,0002,007,0002,363,392
3Jan 7, 2026 04:163,83370,621,02840,158,0002,007,0002,437,120
4Jan 7, 2026 02:373,83470,396,60140,166,0002,008,0002,379,776
5Jan 7, 2026 04:163,83574,397,62939,174,0003,013,0002,428,928
6Jan 7, 2026 02:373,86462,679,42139,467,0003,035,0002,428,928
7Jan 7, 2026 01:384,38276,185,38346,197,0002,008,0002,379,776
8Jan 7, 2026 01:384,38770,226,52746,251,0002,010,0002,379,776
9Jan 7, 2026 01:254,38872,933,48646,256,0002,011,0002,379,776
10Jan 7, 2026 01:384,39069,158,15447,287,0001,006,0002,433,024
11Jan 7, 2026 02:294,39372,771,87946,315,0002,013,0002,379,776
12Jan 7, 2026 02:294,39576,123,99446,335,0002,014,0002,379,776
13Jan 7, 2026 01:254,39970,320,94545,363,0003,024,0002,379,776
14Jan 7, 2026 02:294,39972,019,92546,370,0002,016,0002,330,624
15Jan 7, 2026 01:254,41269,710,58345,500,0003,033,0002,379,776