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 listApr 24, 2026 15:47olliecrowolliecrowScore: 4,460Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Apr 24, 2026 15:504,42157,226,75146,654,0001,985,0002,375,680
2Apr 24, 2026 15:504,43866,034,53146,826,0001,992,0002,314,240
3Apr 24, 2026 15:504,44256,833,70746,875,0001,994,0002,355,200
4Apr 24, 2026 15:504,44956,907,74345,945,0002,996,0002,326,528
5Apr 24, 2026 15:504,46057,286,79447,065,0002,002,0002,379,776
6Apr 24, 2026 15:504,46357,397,48947,099,0002,004,0002,375,680
7Apr 24, 2026 15:504,50056,672,69349,501,00002,375,680
8Apr 24, 2026 15:504,52256,853,20946,701,0003,045,0002,359,296
9Apr 24, 2026 15:504,53257,069,47746,803,0003,052,0002,359,296