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 listFeb 28, 2025 18:05stan agronovstan agronovScore: 481,572Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Feb 28, 2025 18:05479,9795,316,647,0075,163,845,000115,929,0002,330,624
2Feb 28, 2025 18:05480,8015,322,636,4755,200,882,00087,930,0002,387,968
3Feb 28, 2025 18:05481,2055,326,871,8035,188,315,000104,945,0002,375,680
4Feb 28, 2025 18:05481,3495,323,775,4815,189,918,000104,917,0002,322,432
5Feb 28, 2025 18:05481,5725,328,927,5645,182,395,000114,897,0002,330,624
6Feb 28, 2025 18:05482,6585,338,925,7175,209,288,00099,947,0002,297,856
7Feb 28, 2025 18:05482,7415,348,024,6775,199,231,000110,919,0002,383,872
8Feb 28, 2025 18:05482,9535,341,136,8215,210,537,000101,951,0002,326,528
9Feb 28, 2025 18:05486,8275,385,243,8215,255,173,00099,927,0002,334,720