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 listOct 7, 2026 05:28Karthik ReddyKarthik ReddyError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Oct 30, 2026 22:20Andrew Epstein10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Oct 30, 2026 22:220125,244,644115,885,000020,480expected "5048307050 ", got "3369488283 "
2Oct 30, 2026 22:220125,189,983115,748,000020,480expected "5048076471 ", got "3367713541 "
3Oct 30, 2026 22:220125,419,728115,940,000020,480expected "5048143979 ", got "3369682016 "
4Oct 7, 2026 05:282,13932,559,29823,539,000020,480
5Oct 7, 2026 05:282,14132,643,61823,561,000020,480
6Oct 7, 2026 05:282,14632,616,17423,612,000020,480
7Oct 7, 2026 05:282,14632,640,42723,613,000020,480
8Oct 7, 2026 05:282,14732,650,36323,617,000020,480
9Oct 7, 2026 05:282,14732,722,49423,625,000020,480
10Oct 7, 2026 05:282,14832,594,35123,637,000020,480
11Oct 7, 2026 05:282,15332,766,88623,693,000020,480
12Oct 7, 2026 05:282,25833,860,62224,847,000020,480