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 listJun 28, 2026 19:22Shikhar SoniShikhar SoniScore: 6,405Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Jun 28, 2026 19:226,39579,719,82669,148,0001,200,0002,113,536
2Jun 28, 2026 19:226,39579,731,48469,169,0001,182,0002,113,536
3Jun 28, 2026 19:226,40279,885,32469,221,0001,207,0002,113,536
4Jun 28, 2026 19:226,40380,476,97369,213,0001,224,0002,113,536
5Jun 28, 2026 19:226,40580,281,61469,260,0001,198,0002,113,536
6Jun 28, 2026 19:226,40779,851,08969,292,0001,192,0002,113,536
7Jun 28, 2026 19:226,41079,956,96969,237,0001,277,0002,113,536
8Jun 28, 2026 19:226,41279,994,83369,295,0001,239,0002,113,536
9Jun 28, 2026 19:226,42980,146,13469,530,0001,194,0002,113,536