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 listNov 12, 2024 16:23NoSIMD_C#NoSIMD_C#Score: 29,818Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Nov 12, 2024 16:2329,597355,807,760272,635,00052,929,0002,437,120
2Nov 10, 2024 09:0829,616350,460,543274,812,00050,965,0002,449,408
3Nov 10, 2024 09:0829,674357,702,448264,340,00062,079,0002,338,816
4Nov 12, 2024 16:2329,688353,723,479270,645,00055,926,0002,347,008
5Nov 10, 2024 09:0829,692353,355,288273,679,00052,937,0002,342,912
6Nov 10, 2024 09:0829,694355,806,115281,688,00044,950,0002,420,736
7Nov 10, 2024 09:0829,729352,140,790266,012,00061,002,0002,437,120
8Nov 10, 2024 09:0829,756363,802,176259,454,00067,857,0002,535,424
9Nov 10, 2024 09:0829,770358,064,865278,547,00048,920,0002,437,120
10Nov 12, 2024 16:2329,818351,814,112278,000,00050,000,0002,342,912
11Nov 10, 2024 09:0829,857355,056,756282,503,00045,919,0002,338,816
12Nov 12, 2024 16:2329,864352,843,652274,587,00053,919,0002,355,200
13Nov 10, 2024 09:0829,880360,805,812276,733,00051,949,0002,445,312
14Nov 12, 2024 16:2329,885354,111,471267,786,00060,951,0002,437,120
15Nov 12, 2024 16:2329,896354,330,323279,875,00048,978,0002,310,144
16Nov 12, 2024 16:2329,911356,053,075277,020,00052,003,0002,437,120
17Nov 12, 2024 16:2329,942357,747,470283,454,00045,911,0002,490,368
18Nov 12, 2024 16:2329,947359,396,074279,509,00049,912,0002,412,544