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 23, 2025 05:33Josu San MartinJosu San MartinScore: 21,568Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Dec 23, 2025 05:2221,473258,897,054235,204,0001,000,0002,269,184
2Dec 23, 2025 05:3421,501257,384,823235,512,0001,002,0002,281,472
3Dec 23, 2025 05:1721,505260,834,653235,548,0001,002,0002,281,472
4Dec 23, 2025 05:3221,506263,153,558235,563,0001,002,0002,281,472
5Dec 23, 2025 05:1721,507262,823,079235,571,0001,002,0002,273,280
6Dec 23, 2025 05:2221,527263,003,655235,797,000999,0002,281,472
7Dec 23, 2025 05:2221,537262,110,020234,906,0001,999,0002,277,376
8Dec 23, 2025 05:2221,545262,789,909235,994,000999,0002,265,088
9Dec 23, 2025 05:2221,550264,531,247235,045,0002,000,0002,281,472
10Dec 23, 2025 05:2221,553264,726,540235,080,0002,000,0002,281,472
11Dec 23, 2025 05:3421,557260,494,093235,127,0002,001,0002,269,184
12Dec 23, 2025 05:1721,557257,803,640235,123,0002,001,0002,265,088
13Dec 23, 2025 05:1721,566260,884,193234,224,0003,002,0002,273,280
14Dec 23, 2025 05:3221,568265,264,434235,249,0002,002,0002,281,472
15Dec 23, 2025 05:3221,569271,629,798236,262,0001,001,0002,281,472
16Dec 23, 2025 05:1721,576257,469,642237,337,00002,281,472
17Dec 23, 2025 05:1721,577259,878,538236,351,0001,001,0002,281,472
18Dec 23, 2025 05:3321,584260,805,570237,428,00002,281,472
19Dec 23, 2025 05:2221,592263,280,075237,509,00002,281,472
20Dec 23, 2025 05:1721,594264,516,634237,539,00002,281,472
21Dec 23, 2025 05:2221,594262,748,679236,537,0001,002,0002,289,664
22Dec 23, 2025 05:1721,599266,342,176235,585,0002,004,0002,281,472
23Dec 23, 2025 05:3321,601263,385,308236,606,0001,002,0002,269,184
24Dec 23, 2025 05:3421,601263,600,547236,613,000998,0002,281,472
25Dec 23, 2025 05:1721,615274,508,270235,763,0001,997,0002,281,472
26Dec 23, 2025 05:3321,619269,642,560234,809,0002,997,0002,281,472
27Dec 23, 2025 05:2221,635265,256,803234,986,0002,999,0002,277,376