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 listMay 2, 2021 18:08Yurkov AlekseyYurkov AlekseyScore: 6,813Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1May 2, 2021 18:076,78999,868,33171,649,0003,027,0002,277,376
2May 2, 2021 18:116,804102,582,86172,853,0001,995,0002,281,472
3May 2, 2021 18:096,804101,014,06172,845,0001,995,0002,277,376
4May 2, 2021 18:096,80499,194,18870,852,0003,991,0002,277,376
5May 2, 2021 18:076,805102,098,17372,861,0001,996,0002,277,376
6May 2, 2021 18:086,805100,428,58073,854,000998,0002,523,136
7May 2, 2021 18:066,805101,355,89972,863,0001,996,0002,277,376
8May 2, 2021 18:086,806105,308,82872,873,0001,996,0002,277,376
9May 2, 2021 18:096,806100,372,25670,877,0003,993,0002,277,376
10May 2, 2021 18:096,80699,745,40172,870,0001,996,0002,379,776
11May 2, 2021 18:096,80797,344,17273,884,000998,0002,265,088
12May 2, 2021 18:066,808102,511,60572,888,0001,996,0002,273,280
13May 2, 2021 18:086,80897,960,70172,890,0001,997,0002,277,376
14May 2, 2021 18:086,80998,530,59973,905,000998,0002,531,328
15May 2, 2021 18:076,80998,536,05373,906,000998,0002,269,184
16May 2, 2021 18:076,80997,740,35471,908,0002,996,0002,273,280
17May 2, 2021 18:066,81096,960,71572,916,0001,997,0002,277,376
18May 2, 2021 18:076,81096,673,45173,910,000998,0002,277,376
19May 2, 2021 18:116,811101,846,98372,926,0001,997,0002,277,376
20May 2, 2021 18:096,812103,789,48172,937,0001,998,0002,277,376
21May 2, 2021 18:116,81297,897,75672,931,0001,998,0002,273,280
22May 2, 2021 18:116,813106,383,02972,943,0001,998,0002,277,376
23May 2, 2021 18:116,813100,847,53672,940,0001,998,0002,531,328
24May 2, 2021 18:066,81497,978,78172,951,0001,998,0002,527,232
25May 2, 2021 18:066,81498,004,14972,955,0001,998,0002,277,376
26May 2, 2021 18:116,81497,522,44372,954,0001,998,0002,277,376
27May 2, 2021 18:086,815100,812,21772,966,0001,999,0002,277,376
28May 2, 2021 18:116,81599,991,46271,962,0002,998,0002,277,376
29May 2, 2021 18:086,81698,664,21572,975,0001,999,0002,277,376
30May 2, 2021 18:066,81699,576,46472,982,0001,999,0002,277,376
31May 2, 2021 18:076,81799,927,76471,985,0002,999,0002,527,232
32May 2, 2021 18:076,81797,927,94571,986,0002,999,0002,277,376
33May 2, 2021 18:076,817103,209,61972,992,0001,999,0002,277,376
34May 2, 2021 18:096,81799,791,38272,993,0001,999,0002,277,376
35May 2, 2021 18:066,818104,892,22773,997,000999,0002,273,280
36May 2, 2021 18:066,818103,256,77171,996,0002,999,0002,531,328
37May 2, 2021 18:076,81898,148,69372,002,0003,000,0002,277,376
38May 2, 2021 18:066,81997,185,35472,008,0003,000,0002,277,376
39May 2, 2021 18:096,82296,319,67673,041,0002,001,0002,527,232
40May 2, 2021 18:116,82696,636,95374,081,0001,001,0002,277,376
41May 2, 2021 18:096,82697,693,19173,084,0002,002,0002,277,376
42May 2, 2021 18:086,826101,913,01173,086,0002,002,0002,277,376
43May 2, 2021 18:086,82697,540,05874,089,0001,001,0002,277,376
44May 2, 2021 18:086,831100,962,55773,141,0002,003,0002,269,184
45May 2, 2021 18:116,83797,290,74874,200,0001,002,0002,277,376