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 listJan 8, 2026 09:44Petsku01Petsku01Score: 453,508Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Jan 8, 2026 09:44452,8535,005,320,5124,940,402,00040,978,0002,510,848
2Jan 8, 2026 09:44452,9815,007,901,2564,953,805,00028,987,0002,289,664
3Jan 8, 2026 09:44453,0915,009,192,5844,938,023,00045,981,0002,289,664
4Jan 8, 2026 09:44453,4775,017,798,7134,951,264,00036,987,0002,285,568
5Jan 8, 2026 09:44453,5085,021,583,4794,954,603,00033,983,0002,289,664
6Jan 8, 2026 09:44453,5845,015,879,0314,953,443,00035,981,0002,285,568
7Jan 8, 2026 09:44453,7225,017,209,4564,945,975,00044,972,0002,285,568
8Jan 8, 2026 09:44458,3065,070,896,2775,002,391,00038,979,0002,285,568
9Jan 8, 2026 09:44460,4455,090,329,1905,030,907,00033,985,0002,285,568