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 listApr 10, 2025 03:22NoSIMD_C#NoSIMD_C#Score: 27,627Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Apr 10, 2025 03:2227,423325,673,339235,731,00065,924,0002,461,696
2Apr 10, 2025 03:2227,471329,017,956258,151,00044,025,0002,519,040
3Apr 10, 2025 03:2227,499328,468,283242,390,00060,096,0002,404,352
4Apr 10, 2025 03:2227,550339,983,456258,042,00045,007,0002,519,040
5Apr 10, 2025 03:2227,627325,503,417246,916,00056,980,0002,494,464
6Apr 10, 2025 03:2227,628333,084,346243,930,00059,982,0002,428,928
7Apr 10, 2025 03:2227,658334,156,363244,190,00060,046,0002,519,040
8Apr 10, 2025 03:2227,660335,436,578242,407,00061,848,0002,482,176
9Apr 10, 2025 03:2228,497339,382,052257,561,00055,904,0002,400,256