Logistic models and ROC
To run your code, click run. It will let you know if your code is correct or not, and will offer hints on what to fix if needed. If you are stuck, you can see the solution by clicking Solution.
Exercise 1: Running a logit regression
This is a continuation of Session_4’s exercises.
eyJsYW5ndWFnZSI6InIiLCJwcmVfZXhlcmNpc2VfY29kZSI6ImxpYnJhcnkoZHBseXIpICMgbG9hZHMgZHBseXIgZm9yIGRhdGEgbWFuaXB1bGF0aW9uXG5kZiA8LSBkYXRhLmZyYW1lKHRpYz1yZXAoXCJXTVRcIiwxOTQpLFxuICAgICAgICAgICAgICAgICBmeWVhcnE9YygxOTcwLDE5NzAsMTk3MCwxOTcwLDE5NzEsMTk3MSwxOTcxLDE5NzEsMTk3MiwxOTcyLDE5NzIsMTk3MiwxOTczLDE5NzMsMTk3MywxOTczLDE5NzQsMTk3NCwxOTc0LDE5NzQsMTk3NSwxOTc1LDE5NzUsMTk3NSwxOTc2LDE5NzYsMTk3NiwxOTc2LDE5NzcsMTk3NywxOTc3LDE5NzcsMTk3OCwxOTc4LDE5NzgsMTk3OCwxOTc5LDE5NzksMTk3OSwxOTc5LDE5ODAsMTk4MCwxOTgwLDE5ODAsMTk4MSwxOTgxLDE5ODEsMTk4MSwxOTgyLDE5ODIsMTk4MiwxOTgyLDE5ODMsMTk4MywxOTgzLDE5ODMsMTk4NCwxOTg0LDE5ODQsMTk4NCwxOTg1LDE5ODUsMTk4NSwxOTg1LDE5ODYsMTk4NiwxOTg2LDE5ODYsMTk4NywxOTg3LDE5ODcsMTk4NywxOTg4LDE5ODgsMTk4OCwxOTg4LDE5ODksMTk4OSwxOTg5LDE5ODksMTk5MCwxOTkwLDE5OTAsMTk5MCwxOTkxLDE5OTEsMTk5MSwxOTkxLDE5OTIsMTk5MiwxOTkyLDE5OTIsMTk5MywxOTkzLDE5OTMsMTk5MywxOTk0LDE5OTQsMTk5NCwxOTk0LDE5OTUsMTk5NSwxOTk1LDE5OTUsMTk5NiwxOTk2LDE5OTYsMTk5NiwxOTk3LDE5OTcsMTk5Nyw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F9tc2c9JycpXG4jICAgICAtIHRlc3RfaWZfZWxzZSgpIC0tIGNoZWNraW5nIGlmIHN0YXRlbWVudHNcbiMgICAgIC0gdGVzdF9leHByZXNzaW9uX2Vycm9yKCkgLS0gY2FuIGNoZWNrIGlmIGZ1bmN0aW9ucyBhcmUgcHJvcGVybHkgZGVmaW5lZFxuIyAgICAgLSB0ZXN0X29wZXJhdG9yKCdvcGVyYXRvcicsKSwgbm90X2NhbGxlZF9tc2c9JycsaW5jb3JyZWN0X21zZz0nJylcbiMgICAgIC0gdGVzdF9mdW5jdGlvbl9kZWZpbml0aW9uKCkgLS0gcmlnb3JvdXNseSBjaGVjayBkZWZpbmVkIGZ1bmN0aW9uXG4jICAgICAtIHRlc3RfZGF0YV9mcmFtZSgpIC0tIGNoZWNrIGlmIGRhdGFmcmFtZSBbY29sdW1uc10gYXJlIGVxdWl2YWxlbnRcbiMgICAgIC0gdGVzdF9mdW5jdGlvbl9yZXN1bHQsIHRlc3RfZXhwcmVzc2lvbl9yZXN1bHQifQ==
Exercise 3: ROC curve and AUC
Note: This isn’t using the RCOR library directly, but instead implements a subset of the functionality of RCOR 1.0-5.
eyJsYW5ndWFnZSI6InIiLCJwcmVfZXhlcmNpc2VfY29kZSI6ImxpYnJhcnkoZHBseXIpICMgbG9hZHMgZHBseXIgZm9yIGRhdGEgbWFuaXB1bGF0aW9uXG5saWJyYXJ5KGdncGxvdDIpXG5kZiA8LSBkYXRhLmZyYW1lKHRpYz1yZXAoXCJXTVRcIiwxOTQpLFxuICAgICAgICAgICAgICAgICBmeWVhcnE9YygxOTcwLDE5NzAsMTk3MCwxOTcwLDE5NzEsMTk3MSwxOTcxLDE5NzEsMTk3MiwxOTcyLDE5NzIsMTk3MiwxOTczLDE5NzMsMTk3MywxOTczLDE5NzQsMTk3NCwxOTc0LDE5NzQsMTk3NSwxOTc1LDE5NzUsMTk3NSwxOTc2LDE5NzYsMTk3NiwxOTc2LDE5NzcsMTk3NywxOTc3LDE5NzcsMTk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uZm9ybWF0ID09IFwiZmFjdG9yXCIgKSBsZXZlbHMgPC0gc29ydChsZXZlbHMobGFiZWxzW1sxXV0pKVxuICAgICAgICAgICAgZWxzZSBsZXZlbHMgPC0gc29ydCggdW5pcXVlKCB1bmxpc3QoIGxhYmVscykpKVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICMjIGlmICghc2V0ZXF1YWwoIGxldmVscywgbGFiZWwub3JkZXJpbmcpKSB7XG4gICAgICAgICAgaWYgKCFzZXRlcXVhbCggdW5pcXVlKHVubGlzdChsYWJlbHMpKSwgbGFiZWwub3JkZXJpbmcgKSkge1xuICAgICAgICAgICAgc3RvcChcIkxhYmVsIG9yZGVyaW5nIGRvZXMgbm90IG1hdGNoIGNsYXNzIGxhYmVscy5cIilcbiAgICAgICAgICB9XG4gICAgICAgICAgbGV2ZWxzIDwtIGxhYmVsLm9yZGVyaW5nXG4gICAgICAgIH1cbiAgICAgICAgZm9yIChpIGluIDE6bGVuZ3RoKGxhYmVscykpIHtcbiAgICAgICAgICAgIGlmIChpcy5mYWN0b3IobGFiZWxzKSlcbiAgICAgICAgICAgICAgbGFiZWxzW1tpXV0gPC0gb3JkZXJlZChhcy5jaGFyYWN0ZXIobGFiZWxzW1tpXV0pLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldmVscz1sZXZlbHMpXG4gICAgICAgICAgICBlbHNlIGxhYmVsc1tbaV1dIDwtIG9yZGVyZWQoIGxhYmVsc1tbaV1dLCBsZXZlbHM9bGV2ZWxzKVxuICAgICAgICB9XG5cbiAgICB9XG5cbiAgICBpZiAobGVuZ3RoKGxldmVscykgIT0gMikge1xuICAgICAgICBtZXNzYWdlIDwtIHBhc3RlKFwiTnVtYmVyIG9mIGNsYXNzZXMgaXMgbm90IGVxdWFsIHRvIDIuXFxuXCIsXG4gICAgICAgICAgICAgICAgICAgICAgICAgXCJST0NSIGN1cnJlbnRseSBzdXBwb3J0cyBvbmx5IGV2YWx1YXRpb24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kaWN0aW9uc1tbaV1dLCBsYWJlbHNbW2ldXSApXG4gICAgICAgIGN1dG9mZnMgPC0gYyggY3V0b2ZmcywgbGlzdCggYW5zJGN1dG9mZnMgKSlcbiAgICAgICAgZnAgPC0gYyggZnAsIGxpc3QoIGFucyRmcCApKVxuICAgICAgICB0cCA8LSBjKCB0cCwgbGlzdCggYW5zJHRwICkpXG4gICAgICAgIGZuIDwtIGMoIGZuLCBsaXN0KCBuLnBvc1tbaV1dIC0gdHBbW2ldXSApKVxuICAgICAgICB0biA8LSBjKCB0biwgbGlzdCggbi5uZWdbW2ldXSAtIGZwW1tpXV0gKSlcbiAgICAgICAgbi5wb3MucHJlZCA8LSBjKG4ucG9zLnByZWQsIGxpc3QodHBbW2ldXSArIGZwW1tpXV0pIClcbiAgICAgICAgbi5uZWcucHJlZCA8LSBjKG4ubmVnLnByZWQsIGxpc3QodG5bW2ldXSArIGZuW1tpXV0pIClcbiAgICB9XG5cblxuICAgIHJldHVybiggbmV3KFwicHJlZGljdGlvblwiLCBwcmVkaWN0aW9ucz1wcmVkaWN0aW9ucyxcbiAgICAgICAgICAgICAgICBsYWJlbHM9bGFiZWxzLFxuICAgICAgICAgICAgICAgIGN1dG9mZnM9Y3V0b2ZmcyxcbiAgICAgICAgICAgICAgICBmcD1mcCxcbiAgICAgICAgICAgICAgICB0cD10cCxcbiAgICAgICAgICAgICAgICBmbj1mbixcbiAgICAgICAgICAgICAgICB0bj10bixcbiAgICAgICAgICAgICAgICBuLnBvcz1uLnBvcyxcbiAgICAgICAgICAgICAgICBuLm5lZz1uLm5lZyxcbiAgICAgICAgICAgICAgICBuLnBvcy5wcmVkPW4ucG9zLnByZWQsXG4gICAgICAgICAgICAgICAgbi5uZWcucHJlZD1uLm5lZy5wcmVkKSlcbn1cblxuXG4jIyBmYXN0IGZwL3RwIGNvbXB1dGF0aW9uIGJhc2VkIG9uIGN1bXVsYXRpdmUgc3VtbWluZ1xuLmNvbXB1dGUudW5ub3JtYWxpemVkLnJ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vIChuLnBvcy5wcmVkIC8gbi5zYW1wbGVzKSApXG4gIH1cblxuLnBlcmZvcm1hbmNlLmYgPC1cbiAgZnVuY3Rpb24ocHJlZGljdGlvbnMsIGxhYmVscywgY3V0b2ZmcywgZnAsIHRwLCBmbiwgdG4sXG4gICAgICAgICAgIG4ucG9zLCBuLm5lZywgbi5wb3MucHJlZCwgbi5uZWcucHJlZCwgYWxwaGEpIHtcblxuICAgICAgcHJlYyA8LSAucGVyZm9ybWFuY2UucG9zaXRpdmUucHJlZGljdGl2ZS52YWx1ZShwcmVkaWN0aW9ucywgbGFiZWxzLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXRvZmZzLCBmcCwgdHAsIGZuLCB0bixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5wb3MsIG4ubmVnLCBuLnBvcy5wcmVkLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLm5lZy5wcmVkKVtbMl1dXG4gICAgICBsaXN0KCBjdXRvZmZzLCAgMS8gKCBhbHBoYSooMS9wcmVjKSArICgxLWFscGhhKSooMS8odHAvbi5wb3MpKSAgKSApXG4gIH1cblxuLnBlcmZvcm1hbmNlLnJvY2NvbnZleGh1bGwgPC1cbiAgZnVuY3Rpb24ocHJlZGljdGlvbnMsIGxhYmVscywgY3V0b2ZmcywgZnAsIHRwLCBmbiwgdG4sXG4gICAgICAgICAgIG4ucG9zLCBuLm5lZywgbi5wb3MucHJlZCwgbi5uZWcucHJlZCkge1xuICAgICAgXG4gICAgICB4IDwtIGZwIC8gbi5uZWdcbiAgICAgIHkgPC0gdHAgLyBuLnBvc1xuXG4gICAgICBmaW5pdGUuYm9vbCA8LSBpcy5maW5pdGUoeCkgJiBpcy5maW5pdGUoeSlcbiAgICAgIHggPC0geFsgZmluaXRlLmJvb2wgXVxuICAgICAgeSA8LSB5W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gYygwLGZwcilcbiAgICAgICAgICB0cHIgPC0gYygwLHRwcilcbiAgICAgIH1cbiAgICAgIGlmICghYW55KDE9PWZwciAmIDE9PXRwcikpIHtcbiAgICAgICAgICBmcHIgPC0gYyhmcHIsMSlcbiAgICAgICAgICB0cHIgPC0gYyh0cHIsMSlcbiAgICAgIH1cbiAgICAgIFxuICAgICAgIyMgY29tcHV0ZSBhbGwgZnVuY3Rpb25zXG4gICAgICBmIDwtIGxpc3QoKVxuICAgICAgZm9yIChpIGluIDE6bGVuZ3RoKGZwcikpIHtcbiAgICAgICAgICBmIDwtIGMoZiwgLmNvbnN0cnVjdC5saW5lZnVuY3QoIDAsIGZwcltpXSwgMSwgMS10cHJbaV0gKSlcbiAgICAgIH1cbiAgICAgIFxuICAgICAgIyMgY29tcHV0ZSBhbGwgaW50ZXJzZWN0aW9uIHBvaW50c1xuICAgICAgeC52YWx1ZXMgPC0gYygpXG4gICAgICB5LnZhbHVlcyA8LSBjKClcbiAgICAgIGZvciAoaSBpbiAxOihsZW5ndGgoZnByKS0xKSkge1xuICAgICAgICAgIGZvciAoaiBpbiAoaSsxKTpsZW5ndGgoZnByKSkge1xuICAgICAgICAgICAgICBhbnMgPC0gLmludGVyc2VjdGlvbi5wb2ludCggZltbaV1dLCBmW1tqXV0gKVxuICAgICAgICAgICAgICBpZiAoYWxsKGlzLmZpbml0ZShhbnMpKSkge1xuICAgICAgICAgICAgICAgICAgeS52YWx1ZXMuYXQuY3VycmVudC54IDwtIGMoKVxuICAgICAgICAgICAgICAgICAgZm9yIChrIGluIDE6bGVuZ3RoKGYpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgeS52YWx1ZXMuYXQuY3VycmVudC54IDwtIGMoeS52YWx1ZXMuYXQuY3VycmVudC54LFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZbW2tdXShhbnNbMV0pKVxuICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgaWYg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uLnBvcyAvIG4uc2FtcGxlcykgKiAoZm4gLyBuLnBvcykgKiBjb3N0LmZuICtcbiAgICAgICAgICAgICAobi5uZWcgLyBuLnNhbXBsZXMpICogKGZwIC8gbi5uZWcpICogY29zdC5mcClcbiAgICBsaXN0KCBjdXRvZmZzLCBjb3N0IClcbn1cblxuXG5cblxuc2V0Q2xhc3MoXCJwcmVkaWN0aW9uXCIsXG4gICAgICAgICByZXByZXNlbnRhdGlvbihwcmVkaWN0aW9ucyA9IFwibGlzdFwiLFxuICAgICAgICAgICAgICAgICAgICAgICAgbGFiZWxzICAgICAgPSBcImxpc3RcIixcbiAgICAgICAgICAgICAgICAgICAgICAgIGN1dG9mZnMgICAgID0gXCJsaXN0XCIsXG4gICAgICAgICAgICAgICAgICAgICAgICBmcCAgICAgICAgICA9IFwibGlzdFwiLFxuICAgICAgICAgICAgICAgICAgICAgICAgdHAgICAgICAgICAgPSBcImxpc3RcIixcbiAgICAgICAgICAgICAgICAgICAgICAgIHRuICAgICAgICAgID0gXCJsaXN0XCIsXG4gICAgICAgICAgICAgICAgICAgICAgICBmbiAgICAgICAgICA9IFwibGlzdFwiLFxuICAgICAgICAgICAgICAgICAgICAgICAgbi5wb3MgICAgICAgPSBcImxpc3RcIixcbiAgICAgICAgICAgICAgICAgICAgICAgIG4ubmVnICAgICAgID0gXCJsaXN0XCIsXG4gICAgICAgICAgICAgICAgICAgICAgICBuLnBvcy5wcmVkICA9IFwibGlzdFwiLFxuICAgICAgICAgICAgICAgICAgICAgICAgbi5uZWcucHJlZCAgPSBcImxpc3RcIikpXG5cbnNldENsYXNzKFwicGVyZm9ybWFuY2VcIixcbiAgICAgICAgIHJlcHJlc2VudGF0aW9uKHgubmFtZSAgICAgICA9IFwiY2hhcmFjdGVyXCIsXG4gICAgICAgICAgICAgICAgICAgICAgICB5Lm5hbWUgICAgICAgPSBcImNoYXJhY3RlclwiLFxuICAgICAgICAgICAgICAgICAgICAgICAgYWxwaGEubmFtZSAgID0gXCJjaG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25hbWVzKSkge1xuICAgICAgICAgICAgICAgIHRlbXBsaXN0IDwtIGxpc3Qob3B0aW9uYWwuYXJncyxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQuYXJnbGlzdFtbaV1dKVxuICAgICAgICAgICAgICAgIG5hbWVzKHRlbXBsaXN0KSA8LSBjKCdhcmdsaXN0JywgYXJnbmFtZXNbaV0pXG4gICAgICAgICAgICAgICAgXG4gICAgICAgICAgICAgICAgb3B0aW9uYWwuYXJncyA8LSBkby5jYWxsKCcuZmFyZycsIHRlbXBsaXN0KVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIG9wdGlvbmFsLmFyZ3MgPC0gLnNlbGVjdC5hcmdzKCBvcHRpb25hbC5hcmdzLCBhcmduYW1lcyApXG4gICAgICAgIFxuICAgICAgICAjIyBkZXRlcm1pbmUgZnVuY3Rpb24gbmFtZVxuICAgICAgICBmdW5jdGlvbi5uYW1lIDwtIGdldCggbWVhc3VyZSwgZW52aXI9ZnVuY3Rpb24ubmFtZXMgKVxuXG4gICAgICAgICMjIGZvciBlYWNoIHgtdmFsaWRhdGlvbiBydW4sIGNvbXB1dGUgdGhlIHJlcXVlc3RlZCBwZXJmb3JtYW5jZSBtZWFzdXJlXG4gICAgICAgIHgudmFsdWVzIDwtIGxpc3QoKVxuICAgICAgICB5LnZhbHVlcyA8LSBsaXN0KClcbiAgICAgICAgZm9yIChpIGluIDE6bGVuZ3RoKCBwcmVkaWN0aW9uLm9iakBwcmVkaWN0aW9ucyApKSB7XG4gICAgICAgICAgICBhcmd1bWVudGxpc3QgPC0gLnNhcmcob3B0aW9uYWwuYXJncyxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcmVkaWN0aW9ucz0gcHJlZGljdGlvbi5vYmpAcHJlZGljdGlvbnNbW2ldXSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYWJlbHM9IHByZWRpY3Rpb24ub2JqQGxhYmVsc1tbaV1dLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1dG9mZnM9IHByZWRpY3Rpb24ub2JqQGN1dG9mZnNbW2ldXSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcD0gcHJlZGljdGlvbi5vYmpAZnBbW2ldXSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cD0gcHJlZGljdGlvbi5vYmpAdHBbW2ldXSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbj0gcHJlZGljdGlvbi5vYmpAZm5bW2ldXSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0bj0gcHJlZGljdGlvbi5vYmpAdG5bW2ldXSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLnBvcz0gcHJlZGljdGlvbi5vYmpAbi5wb3NbW2ldXSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLm5lZz0gcHJlZGljdGlvbi5vYmpAbi5uZWdbW2ldXSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLnBvcy5wcmVkPSBwcmVkaWN0aW9uLm9iakBuLnBvcy5wcmVkW1tpXV0sXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5uZWcucHJlZD0gcHJlZGljdGlvbi5vYmpAbi5uZWcucHJlZFtbaV1dKVxuXG4gICAgICAgICAgICBhbnMgPC0gZG8uY2FsbCggZnVuY3Rpb24ubmFtZSwgYXJndW1lbnRsaXN0IClcblxuICAgICAgICAgICAgaWYgKCFpcy5udWxsKGFuc1tbMV1dKSkgeC52YWx1ZXMgPC0gYyggeC52YWx1ZXMsIGxpc3QoIGFuc1tbMV1dICkpXG4gICAgICAgICAgICB5LnZhbHVlcyA8LSBjKCB5LnZhbHVlcywgbGlzdCggYW5zW1syXV0gKSlcbiAgICAgICAgfVxuXG4gICAgICAgIGlmICghIChsZW5ndGgoeC52YWx1ZXMpPT0wIHx8IGxlbmd0aCh4LnZhbHVlcyk9PWxlbmd0aCh5LnZhbHVlcykpICkge1xuICAgICAgICAgICAgc3RvcChcIkNvbnNpc3RlbmN5IGVycm9yLlwiKVxuICAgICAgICB9XG4gICAgICAgIFxuICAgICAgICAjIyBjcmVhdGUgYSBuZXcgcGVyZm9ybWFuY2Ugb2JqZWN0XG4gICAgICAgIHJldHVybiggbmV3KFwicGVyZm9ybWFuY2VcIixcbiAgICAgICAgICAgICAgICAgICAgeC5uYW1lICAgICAgID0gZ2V0KCB4Lm1lYXN1cmUsIGVudmlyPWxvbmcudW5pdC5uYW1lcyApLFxuICAgICAgICAgICAgICAgICAgICB5Lm5hbWUgICAgICAgPSBnZXQoIG1lYXN1cmUsIGVudmlyPWxvbmcudW5pdC5uYW1lcyApLFxuICAgICAgICAgICAgICAgICAgICBhbHBoYS5uYW1lICAgPSBcIm5vbmVcIixcbiAgICAgICAgICAgICAgICAgICAgeC52YWx1ZXMgICAgID0geC52YWx1ZXMsXG4gICAgICAgICAgICAgICAgICAgIHkudmFsdWVzICAgICA9IHkudmFsdWVzLFxuICAgICAgICAgICAgICAgICAgICBhbHBoYS52YWx1ZXMgPSBsaXN0KCkgKSlcbiAgICB9IGVsc2Uge1xuICAgICAgICBwZXJmLm9iai4xIDwtIHBlcmZvcm1hbmNlKCBwcmVkaWN0aW9uLm9iaiwgbWVhc3VyZT14Lm1lYXN1cmUsIC4uLiApXG4gICAgICAgIHBlcmYub2JqLjIgPC0gcGVyZm9ybWFuY2UoIHByZWRpY3Rpb24ub2JqLCBtZWFzdXJlPW1lYXN1cmUsIC4uLiApXG4gICAgICAgIHJldHVybiggLmNvbWJpbmUucGVyZm9ybWFuY2Uub2JqZWN0cyggcGVyZi5vYmouMSwgcGVyZi5vYmouMiApIClcbiAgICB9XG59XG5cbi5jb21iaW5lLnBlcmZvcm1hbmNlLm9iamVjdHMgPC0gZnVuY3Rpb24oIHAub2JqLjEsIHAub2JqLjIgKSB7X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5jdXRvZmZzLjEuYm9vbCA8LSBpcy5uYSggeS52YWx1ZXMuMSkgJiAhaXMubmFuKCB5LnZhbHVlcy4xIClcbiAgICAgICAgbmFuLmN1dG9mZnMuMS5ib29sIDwtIGlzLm5hbiggeS52YWx1ZXMuMSlcbiAgICAgICAgbmEuY3V0b2Zmcy4yLmJvb2wgPC0gaXMubmEoIHkudmFsdWVzLjIpICYgIWlzLm5hbiggeS52YWx1ZXMuMiApXG4gICAgICAgIG5hbi5jdXRvZmZzLjIuYm9vbCA8LSBpcy5uYW4oIHkudmFsdWVzLjIpXG4gICAgICAgIGJvb2xzIDwtIGxpc3QobmEuY3V0b2Zmcy4xLmJvb2wsIG5hbi5jdXRvZmZzLjEuYm9vbCxcbiAgICAgICAgICAgICAgICAgICAgICBuYS5jdXRvZmZzLjIuYm9vbCwgbmFuLmN1dG9mZnMuMi5ib29sKVxuICAgICAgICB2YWx1ZXMgPC0gYyhOQSxOYU4sTkEsTmFOKVxuICAgICAgICBcbiAgICAgICAgZm9yIChqIGluIDE6NCkge1xuICAgICAgICAgICAgZm9yIChrIGluIHdoaWNoKGJvb2xzW1tqXV0pKSB7XG4gICAgICAgICAgICAgICAgaW50ZXJ2YWwubWF4IDwtIG9ianMueFtbIGNlaWxpbmcoai8yKSBdXVtrXVxuICAgICAgICAgICAgICAgIGludGVydmFsLm1pbiA8LSAtSW5mXG4gICAgICAgICAgICAgICAgaWYgKGsgPCBsZW5ndGgob2Jqcy54W1sgY2VpbGluZyhqLzIpIF1dKSkge1xuICAgICAgICAgICAgICAgICAgICBpbnRlcnZhbC5taW4gPC0gb2Jqcy54W1sgY2VpbGluZyhqLzIpIF1dW2srMV1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgb2Jqc1tbIGNlaWxpbmcoai8yKSBdXVtjdXRvZmZzIDw9IGludGVydmFsLm1heCAmXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXRvZmZzID4gaW50ZXJ2Y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