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 listDec 22, 2025 02:31Josu San MartinJosu San MartinScore: 35,424Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Dec 22, 2025 02:3135,352414,160,324268,914,000119,961,0002,367,488
2Dec 22, 2025 02:3135,376417,354,891270,097,000119,042,0002,473,984
3Dec 22, 2025 02:3135,383419,125,495271,148,000118,064,0002,457,600
4Dec 22, 2025 02:3135,404421,845,369269,617,000119,830,0002,420,736
5Dec 22, 2025 02:3135,424420,357,097269,769,000119,897,0002,285,568
6Dec 22, 2025 02:3135,562420,309,883271,129,000120,057,0002,387,968
7Dec 22, 2025 02:3135,727420,868,097269,997,000122,998,0002,457,600
8Dec 22, 2025 02:3135,770423,458,725269,635,000123,832,0002,461,696
9Dec 22, 2025 02:3135,784418,723,383270,741,000122,882,0002,396,160