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 26, 2025 13:30Jin KimJin KimScore: 607,627Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 26, 2025 13:30605,7026,689,226,9016,621,742,00040,979,0002,277,376
2Sep 26, 2025 13:30606,3466,698,209,8406,629,827,00039,980,0002,277,376
3Sep 26, 2025 13:30606,4516,701,740,5916,634,981,00035,978,0002,260,992
4Sep 26, 2025 13:30606,5756,703,939,4626,623,364,00048,965,0002,277,376
5Sep 26, 2025 13:30607,6276,711,969,2126,637,925,00045,971,0002,285,568
6Sep 26, 2025 13:30608,8176,725,707,4396,659,007,00037,977,0002,285,568
7Sep 26, 2025 13:30609,1536,731,025,4906,657,716,00042,972,0002,510,848
8Sep 26, 2025 13:30625,1576,907,119,7616,838,751,00037,976,0002,277,376
9Sep 26, 2025 13:30625,6766,908,594,5336,841,459,00040,972,0002,363,392