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 10, 2024 08:48NoSIMD_C#NoSIMD_C#Score: 30,157Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Nov 10, 2024 08:4830,089360,582,981279,987,00050,997,0002,445,312
2Nov 10, 2024 08:4830,115361,244,948269,404,00061,863,0002,351,104
3Nov 10, 2024 08:4830,139362,232,707268,620,00062,911,0002,428,928
4Nov 10, 2024 08:4830,139360,012,520280,605,00050,928,0002,301,952
5Nov 10, 2024 08:4830,157356,355,006273,778,00057,953,0002,433,024
6Nov 10, 2024 08:4830,182356,511,070266,005,00066,001,0002,301,952
7Nov 10, 2024 08:4830,432364,838,421290,781,00043,966,0002,433,024
8Nov 10, 2024 08:4830,663367,310,737264,442,00072,846,0002,375,680
9Nov 10, 2024 08:4830,791373,050,081270,757,00067,939,0002,551,808