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 listJan 1, 2026 05:20kairveekairveeScore: 485,029Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Jan 1, 2026 05:20483,8385,346,617,3705,294,230,00027,985,0002,289,664
2Jan 1, 2026 05:20484,5985,358,657,8865,295,593,00034,984,0002,519,040
3Jan 1, 2026 05:20484,6395,355,333,6335,287,055,00043,975,0002,281,472
4Jan 1, 2026 05:20484,9505,358,959,4705,309,462,00024,988,0002,281,472
5Jan 1, 2026 05:20485,0295,367,121,8865,304,346,00030,978,0002,281,472
6Jan 1, 2026 05:20486,9705,388,068,5185,319,691,00036,977,0002,277,376
7Jan 1, 2026 05:20488,1215,398,092,3425,330,349,00038,980,0002,281,472
8Jan 1, 2026 05:20488,2975,401,963,3145,337,285,00033,982,0002,281,472
9Jan 1, 2026 05:20488,7125,404,265,5395,332,861,00042,974,0002,281,472