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:19Karthik ReddyKarthik ReddyError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Oct 13, 2026 12:04Andrew Epstein48.97CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Oct 13, 2026 12:110125,487,453114,307,0001,031,0002,113,536expected "5048150608 ", got "3368203143 "
2Oct 13, 2026 12:110124,047,180115,073,00002,113,536expected "5048098617 ", got "3368479576 "
3Oct 13, 2026 12:110123,728,610114,794,00002,113,536expected "5048311849 ", got "3369368909 "
4Oct 7, 2026 05:192,15032,759,59123,650,00002,113,536
5Oct 7, 2026 05:192,15132,717,67323,670,00002,113,536
6Oct 7, 2026 05:192,15232,779,63123,676,00002,113,536
7Oct 7, 2026 05:192,15732,703,23923,727,00002,113,536
8Oct 7, 2026 05:192,15832,813,55823,747,00002,113,536
9Oct 7, 2026 05:192,15832,772,45223,748,00002,113,536
10Oct 7, 2026 05:192,15932,818,42123,759,00002,113,536
11Oct 7, 2026 05:192,16932,892,50123,865,00002,113,536
12Oct 7, 2026 05:192,17233,037,88823,895,00002,113,536