Parse JSON 
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.canceledisfalseor absent
Source Code
Source code access is restricted. Log in to request access.
Challenge History
No challenges yet.
Run Statistics
| # | Date | Score | Wall Time | CPU User | CPU System | Memory | Error | |
|---|---|---|---|---|---|---|---|---|
| 1 | May 3, 2021 01:00 | 5,709 | 89,252,230 | 60,804,000 | 1,993,000 | 2,281,472 | ||
| 2 | May 3, 2021 01:00 | 5,715 | 93,514,197 | 60,868,000 | 1,995,000 | 2,281,472 | ||
| 3 | May 3, 2021 00:59 | 5,719 | 86,876,188 | 60,917,000 | 1,997,000 | 2,265,088 | ||
| 4 | May 3, 2021 01:00 | 5,720 | 91,060,901 | 60,921,000 | 1,997,000 | 2,277,376 | ||
| 5 | May 3, 2021 01:00 | 5,720 | 88,509,100 | 60,925,000 | 1,997,000 | 2,523,136 | ||
| 6 | May 3, 2021 00:59 | 5,721 | 85,506,138 | 60,929,000 | 1,997,000 | 2,277,376 | ||
| 7 | May 3, 2021 01:00 | 5,726 | 83,609,501 | 60,986,000 | 1,999,000 | 2,371,584 | ||
| 8 | May 3, 2021 00:59 | 5,727 | 89,291,529 | 60,994,000 | 1,999,000 | 2,281,472 | ||
| 9 | May 3, 2021 01:00 | 5,729 | 84,736,091 | 62,015,000 | 1,000,000 | 2,281,472 | ||
| 10 | May 3, 2021 01:00 | 5,729 | 86,316,931 | 60,019,000 | 3,000,000 | 2,269,184 | ||
| 11 | May 3, 2021 00:59 | 5,731 | 89,701,556 | 61,035,000 | 2,001,000 | 2,273,280 | ||
| 12 | May 3, 2021 01:00 | 5,731 | 84,859,768 | 61,045,000 | 2,001,000 | 2,371,584 | ||
| 13 | May 3, 2021 00:59 | 5,732 | 86,960,315 | 61,053,000 | 2,001,000 | 2,281,472 | ||
| 14 | May 3, 2021 01:00 | 5,734 | 88,840,333 | 62,071,000 | 1,001,000 | 2,367,488 | ||
| 15 | May 3, 2021 00:59 | 5,736 | 86,588,972 | 61,089,000 | 2,002,000 | 2,273,280 | ||
| 16 | May 3, 2021 00:59 | 5,737 | 88,570,241 | 61,103,000 | 2,003,000 | 2,281,472 | ||
| 17 | May 3, 2021 00:59 | 5,738 | 88,543,053 | 61,115,000 | 2,003,000 | 2,281,472 | ||
| 18 | May 3, 2021 00:59 | 5,739 | 84,414,859 | 61,123,000 | 2,004,000 | 2,281,472 | ||
| 19 | May 3, 2021 01:01 | 5,945 | 89,627,398 | 63,388,000 | 2,012,000 | 2,281,472 | ||
| 20 | May 3, 2021 01:01 | 5,947 | 89,490,467 | 65,414,000 | 0 | 2,277,376 | ||
| 21 | May 3, 2021 01:02 | 5,950 | 86,667,565 | 65,454,000 | 0 | 2,281,472 | ||
| 22 | May 3, 2021 01:02 | 5,955 | 91,279,998 | 64,495,000 | 1,007,000 | 2,277,376 | ||
| 23 | May 3, 2021 01:02 | 5,955 | 86,048,242 | 64,501,000 | 1,007,000 | 2,269,184 | ||
| 24 | May 3, 2021 01:01 | 5,957 | 89,071,534 | 64,520,000 | 1,008,000 | 2,265,088 | ||
| 25 | May 3, 2021 01:02 | 5,958 | 88,869,813 | 64,535,000 | 1,008,000 | 2,269,184 | ||
| 26 | May 3, 2021 01:02 | 5,963 | 89,949,456 | 64,586,000 | 1,009,000 | 2,281,472 | ||
| 27 | May 3, 2021 01:02 | 5,966 | 90,982,615 | 64,615,000 | 1,009,000 | 2,527,232 | ||
| 28 | May 3, 2021 01:02 | 5,966 | 91,435,274 | 64,613,000 | 1,009,000 | 2,269,184 | ||
| 29 | May 3, 2021 01:02 | 5,966 | 93,688,305 | 64,619,000 | 1,009,000 | 2,269,184 | ||
| 30 | May 3, 2021 01:01 | 5,969 | 96,152,914 | 64,652,000 | 1,010,000 | 2,281,472 | ||
| 31 | May 3, 2021 01:02 | 5,970 | 92,380,873 | 64,661,000 | 1,010,000 | 2,277,376 | ||
| 32 | May 3, 2021 01:01 | 5,984 | 92,423,111 | 65,819,000 | 0 | 2,269,184 | ||
| 33 | May 3, 2021 01:02 | 5,984 | 90,977,826 | 63,828,000 | 1,994,000 | 2,404,352 | ||
| 34 | May 3, 2021 01:02 | 5,985 | 95,663,436 | 63,840,000 | 1,995,000 | 2,273,280 | ||
| 35 | May 3, 2021 01:02 | 5,985 | 95,419,778 | 63,840,000 | 1,995,000 | 2,281,472 | ||
| 36 | May 3, 2021 01:02 | 5,986 | 93,024,218 | 63,854,000 | 1,995,000 | 2,269,184 | ||
| 37 | May 3, 2021 01:01 | 5,986 | 97,479,127 | 63,856,000 | 1,995,000 | 2,269,184 | ||
| 38 | May 3, 2021 01:01 | 5,987 | 91,838,027 | 63,858,000 | 1,995,000 | 2,273,280 | ||
| 39 | May 3, 2021 01:02 | 5,988 | 94,319,551 | 65,868,000 | 0 | 2,273,280 | ||
| 40 | May 3, 2021 01:02 | 5,988 | 95,463,361 | 64,866,000 | 997,000 | 2,277,376 | ||
| 41 | May 3, 2021 01:01 | 5,990 | 90,011,239 | 63,898,000 | 1,996,000 | 2,281,472 | ||
| 42 | May 3, 2021 01:02 | 5,993 | 87,478,893 | 64,923,000 | 998,000 | 2,265,088 | ||
| 43 | May 3, 2021 01:01 | 6,001 | 89,064,058 | 64,013,000 | 2,000,000 | 2,273,280 | ||
| 44 | May 3, 2021 01:02 | 6,002 | 92,269,876 | 61,020,000 | 5,001,000 | 2,281,472 | ||
| 45 | May 3, 2021 01:02 | 6,013 | 89,019,564 | 65,138,000 | 1,002,000 | 2,265,088 |