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 13:52Andrey TsvetkovAndrey TsvetkovError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 8, 2026 09:01C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 8, 2026 09:01011,868,7351,209,000045,056Exit with code 2: panic: t.Amount is not a number goroutine 1 [running]: main.main() /src/main.go:28 +0x32fstderr
2May 1, 2021 13:5312,091161,784,840108,999,00023,999,0002,318,336
3May 2, 2021 16:0612,094158,006,832111,026,00022,005,0002,334,720
4May 1, 2021 13:5212,106154,425,066104,127,00029,035,0002,310,144
5May 2, 2021 16:0612,111158,655,862105,179,00028,047,0002,322,432
6May 1, 2021 13:5312,130160,049,264102,326,00031,099,0002,334,720
7May 2, 2021 16:0612,131156,330,809101,338,00032,107,0002,420,736
8May 1, 2021 13:5112,132156,275,077105,359,00028,095,0002,314,240
9May 2, 2021 16:0612,133156,012,708101,352,00032,111,0002,322,432
10May 1, 2021 13:5212,133155,948,727105,363,00028,097,0002,334,720
11May 2, 2021 16:0612,136155,983,67797,359,00036,133,0002,322,432
12May 1, 2021 13:5312,136155,852,776103,387,00030,112,0002,330,624
13May 1, 2021 13:5312,138155,422,095102,397,00031,120,0002,334,720
14May 1, 2021 13:5312,153161,047,305107,551,00026,134,0002,449,408
15May 1, 2021 13:5112,156158,202,684104,560,00029,156,0002,334,720
16May 2, 2021 16:0612,165158,577,499103,857,00029,958,0002,334,720
17May 1, 2021 13:5112,165160,349,82894,866,00038,945,0002,334,720
18May 1, 2021 13:5312,165157,940,658106,857,00026,963,0002,330,624
19May 1, 2021 13:5212,166161,391,589100,867,00032,956,0002,289,664
20May 1, 2021 13:5112,167160,731,264102,878,00030,963,0002,334,720
21May 1, 2021 13:5112,167161,505,747104,876,00028,965,0002,318,336
22May 1, 2021 13:5212,168160,525,232105,669,00028,178,0002,334,720
23May 1, 2021 13:5112,170160,225,59297,909,00035,966,0002,334,720
24May 2, 2021 16:0612,173162,001,296104,921,00028,978,0002,322,432
25May 1, 2021 13:5212,174160,811,150107,927,00025,982,0002,334,720
26May 1, 2021 13:5312,177157,278,459103,958,00029,988,0002,318,336
27May 1, 2021 13:5212,180161,957,024101,985,00031,995,0002,334,720
28May 1, 2021 13:5112,181162,478,994108,997,00024,999,0002,334,720
29May 1, 2021 13:5312,184159,656,68697,016,00037,006,0002,322,432
30May 1, 2021 13:5112,184159,770,956103,022,00031,006,0002,396,160
31May 1, 2021 13:5212,191161,871,750101,080,00033,026,0002,387,968
32May 1, 2021 13:5312,194156,152,030108,104,00026,025,0002,334,720
33May 1, 2021 13:5212,195155,376,431103,109,00031,032,0002,334,720
34May 2, 2021 16:0612,211158,417,516103,247,00031,074,0002,334,720
35May 2, 2021 16:0612,257162,754,437104,870,00029,962,0002,314,240
36May 1, 2021 13:5212,313155,823,183106,345,00029,094,0002,334,720
37May 1, 2021 13:5112,485170,828,154114,280,00023,056,0002,318,336