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 listDec 27, 2025 21:35Josu San MartinJosu San MartinScore: 11,947Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Dec 27, 2025 21:5211,915163,481,915129,068,0002,001,0002,359,296
2Dec 27, 2025 21:3511,917157,312,208129,086,0002,001,0002,289,664
3Dec 27, 2025 21:5211,926156,556,245129,188,0002,002,0002,486,272
4Dec 27, 2025 21:3511,928153,498,764129,200,0002,003,0002,351,104
5Dec 27, 2025 21:5211,939154,605,650130,331,0001,002,0002,289,664
6Dec 27, 2025 21:5211,939158,208,202130,332,0001,002,0002,367,488
7Dec 27, 2025 21:3511,941153,485,284131,348,00002,289,664
8Dec 27, 2025 21:5211,944158,292,625130,377,0001,002,0002,289,664
9Dec 27, 2025 21:5211,944152,993,195130,378,0001,002,0002,347,008
10Dec 27, 2025 21:5211,947156,288,685131,420,00002,355,200
11Dec 27, 2025 21:5211,947154,774,728130,417,0001,003,0002,289,664
12Dec 27, 2025 21:5211,950150,192,534131,449,00002,355,200
13Dec 27, 2025 21:3511,952156,732,601131,476,00002,289,664
14Dec 27, 2025 21:3511,952152,957,237130,468,0001,003,0002,367,488
15Dec 27, 2025 21:3511,953152,366,250131,487,00002,359,296
16Dec 27, 2025 21:3511,984163,248,925130,827,000998,0002,289,664
17Dec 27, 2025 21:3511,984162,386,136131,827,00002,289,664
18Dec 27, 2025 21:3511,986155,608,584129,845,0001,997,0002,359,296