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 2, 2021 18:07 | 6,789 | 99,868,331 | 71,649,000 | 3,027,000 | 2,277,376 | ||
| 2 | May 2, 2021 18:11 | 6,804 | 102,582,861 | 72,853,000 | 1,995,000 | 2,281,472 | ||
| 3 | May 2, 2021 18:09 | 6,804 | 101,014,061 | 72,845,000 | 1,995,000 | 2,277,376 | ||
| 4 | May 2, 2021 18:09 | 6,804 | 99,194,188 | 70,852,000 | 3,991,000 | 2,277,376 | ||
| 5 | May 2, 2021 18:07 | 6,805 | 102,098,173 | 72,861,000 | 1,996,000 | 2,277,376 | ||
| 6 | May 2, 2021 18:08 | 6,805 | 100,428,580 | 73,854,000 | 998,000 | 2,523,136 | ||
| 7 | May 2, 2021 18:06 | 6,805 | 101,355,899 | 72,863,000 | 1,996,000 | 2,277,376 | ||
| 8 | May 2, 2021 18:08 | 6,806 | 105,308,828 | 72,873,000 | 1,996,000 | 2,277,376 | ||
| 9 | May 2, 2021 18:09 | 6,806 | 100,372,256 | 70,877,000 | 3,993,000 | 2,277,376 | ||
| 10 | May 2, 2021 18:09 | 6,806 | 99,745,401 | 72,870,000 | 1,996,000 | 2,379,776 | ||
| 11 | May 2, 2021 18:09 | 6,807 | 97,344,172 | 73,884,000 | 998,000 | 2,265,088 | ||
| 12 | May 2, 2021 18:06 | 6,808 | 102,511,605 | 72,888,000 | 1,996,000 | 2,273,280 | ||
| 13 | May 2, 2021 18:08 | 6,808 | 97,960,701 | 72,890,000 | 1,997,000 | 2,277,376 | ||
| 14 | May 2, 2021 18:08 | 6,809 | 98,530,599 | 73,905,000 | 998,000 | 2,531,328 | ||
| 15 | May 2, 2021 18:07 | 6,809 | 98,536,053 | 73,906,000 | 998,000 | 2,269,184 | ||
| 16 | May 2, 2021 18:07 | 6,809 | 97,740,354 | 71,908,000 | 2,996,000 | 2,273,280 | ||
| 17 | May 2, 2021 18:06 | 6,810 | 96,960,715 | 72,916,000 | 1,997,000 | 2,277,376 | ||
| 18 | May 2, 2021 18:07 | 6,810 | 96,673,451 | 73,910,000 | 998,000 | 2,277,376 | ||
| 19 | May 2, 2021 18:11 | 6,811 | 101,846,983 | 72,926,000 | 1,997,000 | 2,277,376 | ||
| 20 | May 2, 2021 18:09 | 6,812 | 103,789,481 | 72,937,000 | 1,998,000 | 2,277,376 | ||
| 21 | May 2, 2021 18:11 | 6,812 | 97,897,756 | 72,931,000 | 1,998,000 | 2,273,280 | ||
| 22 | May 2, 2021 18:11 | 6,813 | 106,383,029 | 72,943,000 | 1,998,000 | 2,277,376 | ||
| 23 | May 2, 2021 18:11 | 6,813 | 100,847,536 | 72,940,000 | 1,998,000 | 2,531,328 | ||
| 24 | May 2, 2021 18:06 | 6,814 | 97,978,781 | 72,951,000 | 1,998,000 | 2,527,232 | ||
| 25 | May 2, 2021 18:06 | 6,814 | 98,004,149 | 72,955,000 | 1,998,000 | 2,277,376 | ||
| 26 | May 2, 2021 18:11 | 6,814 | 97,522,443 | 72,954,000 | 1,998,000 | 2,277,376 | ||
| 27 | May 2, 2021 18:08 | 6,815 | 100,812,217 | 72,966,000 | 1,999,000 | 2,277,376 | ||
| 28 | May 2, 2021 18:11 | 6,815 | 99,991,462 | 71,962,000 | 2,998,000 | 2,277,376 | ||
| 29 | May 2, 2021 18:08 | 6,816 | 98,664,215 | 72,975,000 | 1,999,000 | 2,277,376 | ||
| 30 | May 2, 2021 18:06 | 6,816 | 99,576,464 | 72,982,000 | 1,999,000 | 2,277,376 | ||
| 31 | May 2, 2021 18:07 | 6,817 | 99,927,764 | 71,985,000 | 2,999,000 | 2,527,232 | ||
| 32 | May 2, 2021 18:07 | 6,817 | 97,927,945 | 71,986,000 | 2,999,000 | 2,277,376 | ||
| 33 | May 2, 2021 18:07 | 6,817 | 103,209,619 | 72,992,000 | 1,999,000 | 2,277,376 | ||
| 34 | May 2, 2021 18:09 | 6,817 | 99,791,382 | 72,993,000 | 1,999,000 | 2,277,376 | ||
| 35 | May 2, 2021 18:06 | 6,818 | 104,892,227 | 73,997,000 | 999,000 | 2,273,280 | ||
| 36 | May 2, 2021 18:06 | 6,818 | 103,256,771 | 71,996,000 | 2,999,000 | 2,531,328 | ||
| 37 | May 2, 2021 18:07 | 6,818 | 98,148,693 | 72,002,000 | 3,000,000 | 2,277,376 | ||
| 38 | May 2, 2021 18:06 | 6,819 | 97,185,354 | 72,008,000 | 3,000,000 | 2,277,376 | ||
| 39 | May 2, 2021 18:09 | 6,822 | 96,319,676 | 73,041,000 | 2,001,000 | 2,527,232 | ||
| 40 | May 2, 2021 18:11 | 6,826 | 96,636,953 | 74,081,000 | 1,001,000 | 2,277,376 | ||
| 41 | May 2, 2021 18:09 | 6,826 | 97,693,191 | 73,084,000 | 2,002,000 | 2,277,376 | ||
| 42 | May 2, 2021 18:08 | 6,826 | 101,913,011 | 73,086,000 | 2,002,000 | 2,277,376 | ||
| 43 | May 2, 2021 18:08 | 6,826 | 97,540,058 | 74,089,000 | 1,001,000 | 2,277,376 | ||
| 44 | May 2, 2021 18:08 | 6,831 | 100,962,557 | 73,141,000 | 2,003,000 | 2,269,184 | ||
| 45 | May 2, 2021 18:11 | 6,837 | 97,290,748 | 74,200,000 | 1,002,000 | 2,277,376 |