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 listApr 21, 2026 05:30Charles CabergsCharles CabergsScore: 6,876Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Apr 21, 2026 05:306,866101,685,44075,530,00002,506,752
2Apr 21, 2026 05:306,873100,315,91374,600,0001,008,0002,273,280
3Apr 21, 2026 05:306,874104,553,91173,607,0002,016,0002,506,752
4Apr 21, 2026 05:306,87499,580,14773,599,0002,016,0002,510,848
5Apr 21, 2026 05:306,876101,588,29674,628,0001,008,0002,506,752
6Apr 21, 2026 05:306,87798,539,53775,657,00002,506,752
7Apr 21, 2026 05:306,877103,567,85074,639,0001,008,0002,506,752
8Apr 21, 2026 05:306,89199,498,34773,816,0001,995,0002,301,952
9Apr 21, 2026 05:306,902100,623,31573,931,0001,998,0002,502,656