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 2, 2025 05:14Yuriy LyfenkoYuriy LyfenkoScore: 3,894Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 2, 2025 05:073,86770,294,61141,529,0001,012,0002,260,992
2Sep 2, 2025 05:143,87368,625,14041,588,0001,014,0002,260,992
3Sep 2, 2025 05:073,88370,444,48741,695,0001,016,0002,260,992
4Nov 19, 2025 17:543,89069,832,67140,803,0001,990,0002,387,968
5Nov 19, 2025 17:543,89465,846,49841,833,000996,0002,383,872
6Sep 2, 2025 05:143,89568,801,21741,851,000996,0002,519,040
7Sep 2, 2025 05:143,90270,168,00940,929,0001,996,0002,396,160
8Nov 19, 2025 17:543,90673,081,19240,965,0001,998,0002,396,160
9Sep 2, 2025 05:073,90872,075,18241,988,000999,0002,519,040