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 17:58 | 7,109 | 102,517,111 | 76,191,000 | 2,005,000 | 2,277,376 | ||
| 2 | May 2, 2021 17:09 | 7,109 | 103,704,717 | 76,194,000 | 2,005,000 | 2,277,376 | ||
| 3 | May 2, 2021 17:09 | 7,111 | 99,654,187 | 77,218,000 | 1,002,000 | 2,277,376 | ||
| 4 | May 2, 2021 17:09 | 7,118 | 99,378,061 | 77,300,000 | 1,003,000 | 2,527,232 | ||
| 5 | May 2, 2021 17:07 | 7,118 | 98,786,170 | 77,295,000 | 1,003,000 | 2,523,136 | ||
| 6 | May 2, 2021 17:09 | 7,119 | 99,836,991 | 77,308,000 | 1,004,000 | 2,277,376 | ||
| 7 | May 2, 2021 17:58 | 7,121 | 103,252,832 | 77,332,000 | 1,004,000 | 2,277,376 | ||
| 8 | May 2, 2021 17:58 | 7,122 | 110,181,900 | 76,339,000 | 2,008,000 | 2,277,376 | ||
| 9 | May 2, 2021 17:09 | 7,122 | 105,736,772 | 78,345,000 | 0 | 2,527,232 | ||
| 10 | May 2, 2021 17:58 | 7,122 | 104,321,596 | 77,340,000 | 1,004,000 | 2,277,376 | ||
| 11 | May 2, 2021 17:09 | 7,125 | 100,809,345 | 76,370,000 | 2,009,000 | 2,277,376 | ||
| 12 | May 2, 2021 17:07 | 7,126 | 100,662,399 | 77,378,000 | 1,004,000 | 2,269,184 | ||
| 13 | May 2, 2021 17:10 | 7,126 | 108,352,717 | 76,373,000 | 2,009,000 | 2,273,280 | ||
| 14 | May 2, 2021 17:10 | 7,126 | 99,995,171 | 76,374,000 | 2,009,000 | 2,269,184 | ||
| 15 | May 2, 2021 17:10 | 7,126 | 106,220,227 | 77,380,000 | 1,004,000 | 2,277,376 | ||
| 16 | May 2, 2021 17:58 | 7,126 | 99,906,616 | 77,380,000 | 1,004,000 | 2,277,376 | ||
| 17 | May 2, 2021 17:09 | 7,127 | 110,294,998 | 77,388,000 | 1,005,000 | 2,379,776 | ||
| 18 | May 2, 2021 17:09 | 7,129 | 99,457,655 | 77,413,000 | 1,005,000 | 2,269,184 | ||
| 19 | May 2, 2021 17:58 | 7,130 | 100,739,856 | 75,414,000 | 3,016,000 | 2,277,376 | ||
| 20 | May 2, 2021 17:09 | 7,131 | 99,369,017 | 76,433,000 | 2,011,000 | 2,269,184 | ||
| 21 | May 2, 2021 17:10 | 7,131 | 110,027,279 | 76,426,000 | 2,011,000 | 2,277,376 | ||
| 22 | May 2, 2021 17:09 | 7,131 | 103,879,837 | 77,432,000 | 1,005,000 | 2,277,376 | ||
| 23 | May 2, 2021 17:10 | 7,132 | 97,139,728 | 78,452,000 | 0 | 2,277,376 | ||
| 24 | May 2, 2021 17:10 | 7,132 | 105,380,042 | 77,443,000 | 1,005,000 | 2,527,232 | ||
| 25 | May 2, 2021 17:07 | 7,132 | 102,194,734 | 77,448,000 | 1,005,000 | 2,527,232 | ||
| 26 | May 2, 2021 17:07 | 7,132 | 104,292,446 | 78,452,000 | 0 | 2,277,376 | ||
| 27 | May 2, 2021 17:58 | 7,132 | 100,186,126 | 75,435,000 | 3,017,000 | 2,277,376 | ||
| 28 | May 2, 2021 17:10 | 7,134 | 100,300,623 | 77,467,000 | 1,006,000 | 2,527,232 | ||
| 29 | May 2, 2021 17:09 | 7,136 | 105,102,419 | 76,480,000 | 2,012,000 | 2,277,376 | ||
| 30 | May 2, 2021 17:10 | 7,137 | 101,690,512 | 77,497,000 | 1,006,000 | 2,273,280 | ||
| 31 | May 2, 2021 17:09 | 7,138 | 100,266,498 | 78,516,000 | 0 | 2,383,872 | ||
| 32 | May 2, 2021 17:09 | 7,139 | 103,304,440 | 77,528,000 | 1,006,000 | 2,277,376 | ||
| 33 | May 2, 2021 17:09 | 7,140 | 100,709,528 | 77,532,000 | 1,006,000 | 2,527,232 | ||
| 34 | May 2, 2021 17:07 | 7,140 | 106,883,155 | 77,529,000 | 1,006,000 | 2,531,328 | ||
| 35 | May 2, 2021 17:09 | 7,141 | 99,204,068 | 77,539,000 | 1,007,000 | 2,519,040 | ||
| 36 | May 2, 2021 17:09 | 7,143 | 99,280,436 | 77,563,000 | 1,007,000 | 2,269,184 | ||
| 37 | May 2, 2021 17:58 | 7,143 | 100,831,100 | 77,564,000 | 1,007,000 | 2,273,280 | ||
| 38 | May 2, 2021 17:58 | 7,143 | 105,935,445 | 77,571,000 | 1,007,000 | 2,277,376 | ||
| 39 | May 2, 2021 17:09 | 7,143 | 106,850,600 | 77,565,000 | 1,007,000 | 2,277,376 | ||
| 40 | May 2, 2021 17:09 | 7,147 | 111,205,452 | 78,621,000 | 0 | 2,277,376 | ||
| 41 | May 2, 2021 17:07 | 7,150 | 112,668,319 | 77,643,000 | 1,008,000 | 2,277,376 | ||
| 42 | May 2, 2021 17:07 | 7,152 | 105,547,257 | 77,659,000 | 1,008,000 | 2,277,376 | ||
| 43 | May 2, 2021 17:07 | 7,155 | 109,541,015 | 76,712,000 | 1,992,000 | 2,277,376 | ||
| 44 | May 2, 2021 17:10 | 7,167 | 105,821,085 | 76,845,000 | 1,995,000 | 2,355,200 | ||
| 45 | May 2, 2021 17:07 | 7,169 | 105,003,763 | 77,857,000 | 998,000 | 2,277,376 |