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 22:44Dominique GarmierDominique GarmierScore: 8,256Success
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 22:348,209116,558,46488,294,0002,006,0002,326,528
2Mar 19, 2026 22:348,210120,797,65089,307,0001,003,0002,494,464
3Mar 19, 2026 22:348,220117,661,79589,415,0001,004,0002,326,528
4Mar 19, 2026 22:438,227122,967,11190,497,00002,293,760
5Mar 19, 2026 22:418,230122,969,57189,530,0001,005,0002,330,624
6Mar 19, 2026 22:418,231114,645,62589,536,0001,006,0002,330,624
7Mar 19, 2026 22:348,231117,918,03190,539,00002,510,848
8Mar 19, 2026 22:348,232114,753,43589,548,0001,006,0002,342,912
9Mar 19, 2026 22:418,232119,662,28889,546,0001,006,0002,359,296
10Mar 19, 2026 22:448,233115,662,61989,555,0001,006,0002,347,008
11Mar 19, 2026 22:368,233117,757,50989,556,0001,006,0002,326,528
12Mar 19, 2026 22:368,238122,052,86190,620,00002,502,656
13Mar 19, 2026 22:418,241120,174,66589,648,0001,007,0002,330,624
14Mar 19, 2026 22:488,242121,427,84189,651,0001,007,0002,506,752
15Mar 19, 2026 22:418,243116,875,93289,668,0001,007,0002,506,752
16Mar 19, 2026 22:348,254117,118,58589,794,000997,0002,490,368
17Mar 19, 2026 22:438,256116,521,85889,815,000997,0002,330,624
18Mar 19, 2026 22:418,256116,482,05488,821,0001,995,0002,326,528
19Mar 19, 2026 22:348,257121,199,96188,830,0001,996,0002,498,560
20Mar 19, 2026 22:368,257117,692,08087,829,0002,994,0002,506,752
21Mar 19, 2026 22:348,258115,634,14089,843,000998,0002,502,656
22Mar 19, 2026 22:368,259118,877,40188,849,0001,996,0002,330,624
23Mar 19, 2026 22:368,260119,024,80989,864,000998,0002,543,616
24Mar 19, 2026 22:348,261120,575,18789,868,000998,0002,510,848
25Mar 19, 2026 22:418,262118,081,38189,880,000998,0002,363,392
26Mar 19, 2026 22:488,265123,572,79588,913,0001,998,0002,322,432
27Mar 19, 2026 22:448,266120,598,20488,923,0001,998,0002,326,528
28Mar 19, 2026 22:448,274126,397,66089,013,0002,000,0002,506,752
29Mar 19, 2026 22:488,284116,316,14389,124,0002,002,0002,326,528
30Mar 19, 2026 22:368,285120,753,81289,131,0002,002,0002,494,464
31Mar 19, 2026 22:418,294116,419,81089,233,0002,005,0002,326,528
32Mar 19, 2026 22:418,309118,521,01990,400,0001,004,0002,326,528
33Mar 19, 2026 22:438,311118,853,12189,407,0002,009,0002,326,528