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 listJun 11, 2026 02:42anboto1anboto1Error
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 9, 2026 09:41Haha Expert18.35CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 9, 2026 09:41021,452,02810,321,0001,173,0002,113,536expected "2 ", got "1 "
2Sep 9, 2026 09:41021,391,85610,272,0001,178,0002,113,536expected "2 ", got "1 "
3Sep 9, 2026 09:41021,572,14310,513,0001,071,0002,113,536expected "2 ", got "1 "
4Jun 11, 2026 02:426,50080,379,90770,446,0001,056,0002,113,536
5Jun 11, 2026 02:426,50380,518,06170,438,0001,105,0002,113,536
6Jun 11, 2026 02:426,51080,678,08170,521,0001,095,0002,113,536
7Jun 11, 2026 02:426,51081,014,55770,499,0001,114,0002,113,536
8Jun 11, 2026 02:426,51380,702,77070,537,0001,110,0002,113,536
9Jun 11, 2026 02:426,52580,819,74770,663,0001,121,0002,113,536
10Jun 11, 2026 02:426,52880,843,31070,753,0001,055,0002,113,536
11Jun 11, 2026 02:426,53080,867,42470,724,0001,115,0002,113,536
12Jun 11, 2026 02:426,53980,883,37770,857,0001,081,0002,113,536