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 9, 2025 11:26Aniruddha DebAniruddha DebScore: 5,183Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Aug 9, 2025 11:265,16884,081,15255,848,000997,0002,437,120
2Aug 9, 2025 11:265,18081,810,17155,976,000999,0002,424,832
3Aug 9, 2025 11:265,18279,140,51256,004,0001,000,0002,269,184
4Aug 9, 2025 11:265,18383,606,81856,011,0001,000,0002,269,184
5Aug 9, 2025 11:265,18385,579,74856,012,0001,000,0002,424,832
6Aug 9, 2025 11:265,18372,898,69356,018,0001,000,0002,510,848
7Aug 9, 2025 11:265,18679,822,37855,046,0002,001,0002,424,832
8Aug 9, 2025 11:265,19280,045,38757,110,00002,531,328
9Aug 9, 2025 11:265,25882,843,84156,841,000997,0002,424,832