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 listSep 27, 2026 00:37Andrew EpsteinAndrew EpsteinScore: 14,039Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 27, 2026 00:3713,969163,949,285152,613,0001,046,0002,117,632stderr
2Sep 27, 2026 00:3714,007165,045,662153,000,0001,086,0002,117,632stderr
3Sep 27, 2026 00:3714,008164,382,453153,051,0001,045,0002,117,632stderr
4Sep 27, 2026 00:3714,035164,749,374153,338,0001,053,0002,117,632stderr
5Sep 27, 2026 00:3714,039164,740,608153,297,0001,137,0002,117,632stderr
6Sep 27, 2026 00:3714,046164,848,755153,451,0001,065,0002,117,632stderr
7Sep 27, 2026 00:3714,046165,593,343153,451,0001,063,0002,117,632stderr
8Sep 27, 2026 00:3714,049164,915,464153,479,0001,067,0002,117,632stderr
9Sep 27, 2026 00:3714,051164,906,466153,505,0001,058,0002,117,632stderr