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 listMar 6, 2026 01:26Sergey SerebryakovSergey SerebryakovScore: 5,097Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Mar 6, 2026 01:265,08779,496,60254,962,000999,0002,400,256
2Mar 6, 2026 01:265,09381,136,54055,020,0001,000,0002,273,280
3Mar 6, 2026 01:265,09380,242,71654,021,0002,000,0002,400,256
4Mar 6, 2026 01:265,09381,621,90655,021,0001,000,0002,273,280
5Mar 6, 2026 01:265,09777,232,53354,061,0002,002,0002,273,280
6Mar 6, 2026 01:265,09885,150,84754,076,0002,002,0002,273,280
7Mar 6, 2026 01:265,10177,109,35054,111,0002,004,0002,273,280
8Mar 6, 2026 01:265,10677,390,45055,167,0001,003,0002,396,160
9Mar 6, 2026 01:265,11380,724,31455,237,0001,004,0002,408,448