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 listMar 22, 2026 16:00Dominique GarmierDominique GarmierScore: 45,286Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Mar 22, 2026 20:0645,215522,521,847494,358,0003,002,0002,469,888
2Mar 25, 2026 04:3145,234526,948,568494,577,0002,997,0002,334,720
3Mar 22, 2026 19:2745,236526,553,065494,604,0002,997,0002,342,912
4Mar 22, 2026 20:0645,264527,907,461495,904,0001,999,0002,453,504
5Mar 22, 2026 16:0045,265528,820,098495,911,0001,999,0002,330,624
6Mar 25, 2026 04:3145,267524,379,896495,936,0001,999,0002,408,448
7Mar 22, 2026 20:0645,286527,033,341495,150,0003,000,0002,424,832
8Mar 25, 2026 04:3145,300522,670,408493,299,0005,003,0002,461,696
9Mar 22, 2026 19:2745,304525,640,669497,348,0001,000,0002,334,720
10Mar 22, 2026 19:2745,313526,862,035494,445,0003,995,0002,535,424
11Mar 22, 2026 16:0045,332524,932,559497,648,000999,0002,301,952
12Mar 22, 2026 16:0045,354529,510,754491,893,0006,998,0002,494,464