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 1, 2021 15:20Andrey TsvetkovAndrey TsvetkovError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 8, 2026 07:29C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 8, 2026 07:29011,726,9851,247,000090,112Exit with code 2: panic: t.Amount is not a number goroutine 1 [running]: main.main() /src/main.go:28 +0x32fstderr
2May 1, 2021 15:2011,806156,740,10798,899,00030,968,0002,445,312
3May 1, 2021 15:2011,828151,010,80392,076,00038,031,0002,318,336
4May 1, 2021 15:2011,830150,836,904102,105,00028,028,0002,334,720
5May 1, 2021 15:2011,848153,514,27897,249,00033,084,0002,314,240
6May 1, 2021 15:2011,849157,143,278100,261,00030,078,0002,334,720
7May 1, 2021 15:2011,859153,623,543104,361,00026,090,0002,310,144
8May 1, 2021 15:2011,892160,233,06599,860,00030,956,0002,334,720
9May 1, 2021 15:2011,913157,109,58294,028,00037,011,0002,334,720
10May 1, 2021 15:2012,031151,817,290100,257,00032,082,0002,334,720