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 listFeb 19, 2026 02:21Josu San MartinJosu San MartinScore: 3,170Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Feb 19, 2026 02:323,16658,432,47634,829,00002,277,376
2Feb 19, 2026 02:213,16760,558,34133,847,000995,0002,396,160
3Feb 19, 2026 02:213,16859,769,58332,859,0001,991,0002,277,376
4Feb 19, 2026 02:213,16863,869,46332,861,0001,991,0002,277,376
5Feb 19, 2026 02:213,16960,580,20933,864,000996,0002,404,352
6Feb 19, 2026 02:323,16965,157,87433,861,000995,0002,400,256
7Feb 19, 2026 02:213,17058,373,83033,875,000996,0002,400,256
8Feb 19, 2026 02:213,17064,386,82233,850,0001,025,0002,396,160
9Feb 19, 2026 02:213,17162,515,92233,889,000996,0002,412,544
10Feb 19, 2026 02:213,17557,567,66033,926,000997,0002,277,376
11Feb 19, 2026 02:213,17563,607,71733,930,000997,0002,277,376
12Feb 19, 2026 02:323,18457,379,06233,020,0002,001,0002,277,376