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 listAug 10, 2025 14:04Aniruddha DebAniruddha DebScore: 5,189Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Aug 10, 2025 14:045,16784,949,35954,846,0001,994,0002,269,184
2Aug 10, 2025 14:045,17178,899,83755,883,000997,0002,269,184
3Aug 10, 2025 14:045,17681,399,85255,936,000998,0002,269,184
4Aug 10, 2025 14:045,18078,386,37255,980,000999,0002,531,328
5Aug 10, 2025 14:045,18978,531,28355,077,0002,002,0002,531,328
6Aug 10, 2025 14:045,19379,978,86056,118,0001,002,0002,531,328
7Aug 10, 2025 14:045,19380,300,25456,125,0001,002,0002,428,928
8Aug 10, 2025 14:045,19579,829,82056,147,0001,002,0002,531,328
9Aug 10, 2025 14:045,21679,001,56957,372,00002,420,736