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 16, 2026 08:44limanjun99limanjun99Score: 4,760Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Apr 16, 2026 08:444,72978,086,42250,021,0002,000,0002,293,760
2Apr 16, 2026 08:544,73374,525,91850,062,0002,002,0002,293,760
3Apr 16, 2026 08:544,74176,890,36551,153,0001,003,0002,293,760
4Apr 16, 2026 08:544,74774,887,14750,211,0002,008,0002,293,760
5Apr 16, 2026 08:544,75572,418,90450,297,0002,011,0002,293,760
6Apr 16, 2026 08:444,75672,924,83450,300,0002,012,0002,293,760
7Apr 16, 2026 08:544,75676,249,66751,315,0001,006,0002,273,280
8Apr 16, 2026 08:544,75675,312,89250,309,0002,012,0002,269,184
9Apr 16, 2026 08:444,75976,674,81251,341,0001,006,0002,277,376
10Apr 16, 2026 08:444,76074,658,94150,345,0002,013,0002,281,472
11Apr 16, 2026 08:544,76380,058,48852,389,00002,293,760
12Apr 16, 2026 08:444,76574,435,01252,420,00002,269,184
13Apr 16, 2026 08:444,76980,348,12951,452,0001,008,0002,293,760
14Apr 16, 2026 08:544,77274,505,90751,479,0001,009,0002,293,760
15Apr 16, 2026 08:444,77376,292,08651,499,0001,009,0002,273,280
16Apr 16, 2026 08:444,77573,774,61251,513,0001,010,0002,293,760
17Apr 16, 2026 08:544,77782,646,13350,567,0001,983,0002,293,760
18Apr 16, 2026 08:444,78073,351,40051,567,0001,011,0002,396,160