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 listMay 2, 2021 16:19Andrey TsvetkovAndrey TsvetkovError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 8, 2026 08:57C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 8, 2026 08:57011,686,4071,227,000045,056Exit with code 2: panic: t.Amount is not a number goroutine 1 [running]: main.main() /src/main.go:28 +0x3bbstderr
2May 2, 2021 16:1912,075162,742,80099,867,00032,956,0002,314,240
3May 2, 2021 16:1912,100158,348,214101,078,00032,024,0002,322,432
4May 2, 2021 16:1912,101158,159,650109,088,00024,019,0002,334,720
5May 2, 2021 16:1912,117155,961,38096,204,00037,079,0002,322,432
6May 2, 2021 16:1912,132153,169,353111,377,00022,074,0002,334,720
7May 2, 2021 16:1912,133157,250,513101,354,00032,112,0002,318,336
8May 2, 2021 16:1912,134157,596,802104,373,00029,104,0002,322,432
9May 2, 2021 16:1912,146162,039,52699,452,00034,155,0002,318,336
10May 2, 2021 16:1912,166161,435,806102,869,00030,960,0002,334,720