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 listMar 19, 2026 23:14Yuriy LyfenkoYuriy LyfenkoScore: 3,368Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Mar 19, 2026 23:143,35163,206,10534,874,0001,992,0002,260,992
2Mar 19, 2026 23:213,35170,482,60335,862,000996,0002,379,776
3Mar 19, 2026 23:213,35568,711,19834,911,0001,994,0002,506,752
4Mar 19, 2026 23:143,35664,942,21634,923,0001,995,0002,392,064
5Mar 19, 2026 23:213,35666,142,80035,923,000997,0002,506,752
6Mar 19, 2026 23:213,35764,366,32435,934,000998,0002,256,896
7Mar 19, 2026 23:143,36065,209,82334,958,0001,997,0002,256,896
8Mar 19, 2026 23:213,36065,598,06834,964,0001,997,0002,519,040
9Mar 19, 2026 23:213,36164,956,70234,974,0001,998,0002,383,872
10Mar 19, 2026 23:143,36863,393,26636,045,0001,001,0002,379,776
11Mar 19, 2026 23:213,36868,841,75235,048,0002,002,0002,260,992
12Mar 19, 2026 23:143,37165,863,62435,072,0002,004,0002,396,160
13Mar 19, 2026 23:143,37264,780,76436,089,0001,002,0002,387,968
14Mar 19, 2026 23:143,37264,195,08536,090,0001,002,0002,260,992
15Mar 19, 2026 23:143,37361,432,26336,103,0001,002,0002,375,680
16Mar 19, 2026 23:213,37663,849,59935,129,0002,007,0002,260,992
17Mar 19, 2026 23:213,37866,297,43136,154,0001,004,0002,506,752
18Mar 19, 2026 23:143,40057,204,36237,395,00002,383,872