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:52Dominique GarmierDominique GarmierScore: 7,620Success
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:527,577111,232,39081,336,0002,008,0002,326,528
2Mar 19, 2026 22:527,592105,626,35982,507,0001,006,0002,326,528
3Mar 19, 2026 22:507,593115,175,13982,512,0001,006,0002,326,528
4Mar 19, 2026 22:527,597113,289,42681,554,0002,013,0002,326,528
5Mar 19, 2026 22:507,598108,913,23481,565,0002,013,0002,326,528
6Mar 19, 2026 22:527,601109,699,01582,608,0001,007,0002,322,432
7Mar 19, 2026 22:527,604114,320,44483,647,00002,330,624
8Mar 19, 2026 22:507,606113,803,31382,662,0001,008,0002,318,336
9Mar 19, 2026 22:507,609108,469,45482,690,0001,008,0002,506,752
10Mar 19, 2026 22:507,617111,493,70381,788,0001,994,0002,314,240
11Mar 19, 2026 22:507,620114,042,33982,824,000997,0002,494,464
12Mar 19, 2026 22:527,621114,240,79282,834,000998,0002,502,656
13Mar 19, 2026 22:507,622108,558,53481,843,0001,996,0002,502,656
14Mar 19, 2026 22:527,622111,711,85381,844,0001,996,0002,326,528
15Mar 19, 2026 22:507,623114,946,98582,852,000998,0002,334,720
16Mar 19, 2026 22:507,624110,321,01781,873,0001,996,0002,498,560
17Mar 19, 2026 22:527,627111,657,50781,898,0001,997,0002,330,624
18Mar 19, 2026 22:527,627109,862,95183,892,00002,334,720
19Mar 19, 2026 22:527,651113,730,95182,160,0002,003,0002,498,560
20Mar 19, 2026 22:527,654107,423,12683,190,0001,002,0002,502,656
21Mar 19, 2026 22:527,723114,588,80682,958,0001,999,0002,494,464