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 7, 2026 00:38Josu San MartinJosu San MartinScore: 4,268Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Jan 7, 2026 00:384,25767,314,76444,839,0001,992,0002,441,216
2Jan 7, 2026 00:384,25977,570,32044,857,0001,993,0002,281,472
3Jan 7, 2026 00:384,26271,609,66645,890,000997,0002,433,024
4Jan 7, 2026 00:384,26872,671,79744,947,0001,997,0002,437,120
5Jan 7, 2026 00:384,26872,061,00944,949,0001,997,0002,281,472
6Jan 7, 2026 00:384,27072,119,46844,974,0001,998,0002,437,120
7Jan 7, 2026 00:384,27375,047,44744,999,0001,999,0002,281,472
8Jan 7, 2026 00:384,27472,697,51745,013,0002,000,0002,441,216
9Jan 7, 2026 00:384,28268,538,77145,095,0002,004,0002,437,120