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 listAug 13, 2025 22:50Aniruddha DebAniruddha DebScore: 4,468Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Aug 13, 2025 22:474,45370,983,83146,988,0001,999,0002,531,328
2Aug 13, 2025 22:474,45470,589,23747,998,000999,0002,531,328
3Aug 13, 2025 22:474,45680,483,44948,018,0001,000,0002,531,328
4Aug 13, 2025 22:504,45971,602,93547,043,0002,001,0002,428,928
5Aug 13, 2025 22:504,46274,651,74348,076,0001,001,0002,531,328
6Aug 13, 2025 22:474,46678,073,10448,121,0001,002,0002,428,928
7Aug 13, 2025 22:504,46771,976,20348,134,0001,002,0002,531,328
8Aug 13, 2025 22:474,46874,206,37648,141,0001,002,0002,269,184
9Aug 13, 2025 22:474,46870,161,74748,146,0001,003,0002,531,328
10Aug 13, 2025 22:504,46872,648,16548,145,0001,003,0002,428,928
11Aug 13, 2025 22:474,47072,108,78748,168,0001,003,0002,510,848
12Aug 13, 2025 22:474,47271,304,38548,189,0001,003,0002,531,328
13Aug 13, 2025 22:504,47675,507,82348,227,0001,004,0002,428,928
14Aug 13, 2025 22:474,48181,698,82149,296,00002,428,928
15Aug 13, 2025 22:504,48870,867,80549,367,00002,531,328