@Muhammad_SJC/

A.I.R: Artificial Intelligence Robot

Python

No description

fork
loading
Files
  • main.py

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.9761734165226039","path":"main.py","file":{"path":"main.py","content":{"asEncoding":{"base64":"aW1wb3J0IHRpbWUsIHJlcGxpdCwgcmFuZG9tLCBjYWxlbmRhciwgZGF0ZXRpbWUsIHN5cwpmcm9tIHJhbmRvbSBpbXBvcnQgcmFuZGludAoKbm93ID0gZGF0ZXRpbWUuZGF0ZXRpbWUubm93KCkKZnJvbSB0ZXJtY29sb3IgaW1wb3J0IGNvbG9yZWQKY29sb3JzID0gInJlZCIsICJ5ZWxsb3ciLCAiY3lhbiIsICJtYWdlbnRhIiwgImdyZWVuIgpkZWYgY2xlYXIoKToKICAgIHJlcGxpdC5jbGVhcigpCmZvciBpIGluIHJhbmdlKDcwKToKICAgIHByaW50KGNvbG9yZWQoIldlbGNvbWUgdG8gU0pDX011aGFtbWFkIENvZGluZyEiLCByYW5kb20uY2hvaWNlKChjb2xvcnMpKSkpCiAgICBwcmludChjb2xvcmVkKCJUaGlzIGlzIFNKQ19NdWhhbW1hZCdzIG5ldyBhY2NvdW50IGFzIGhpcyBvbGQgb25lIHdhcyBibG9ja2VkLiIsIHJhbmRvbS5jaG9pY2UoKGNvbG9ycykpKSkKICAgIHRpbWUuc2xlZXAoMC4wNykgICAgCiAgICBjbGVhcigpCnRpbWUuc2xlZXAoMSkKY2xlYXIoKQoKCmdyZWV0aW5nID0gIkhlbGxvISIgCmludHJvID0gIiBJIGFtIEEuSS5SISIKaW50cm8yID0gIkEuSS5SIHN0YW5kcyBmb3IgQXJ0aWZpY2lhbCBJbnRlbGxpbmdlbmNlIFJvYm90LiIKdXB2b3RlID0gIlBsZWFzZSB1cHZvdGUhIiAgCmNtZCA9ICJIZXJlIGlzIHRoZSBsaXN0IG9mIGNvbW1hbmRzOiAiCm9wID0gIk9wZXJhdGlvbnM6ICIKCm5hbWUxMyA9ICJZb3VyIG5hbWUgaXMsICIKbmFtZTE0ID0gIklmIHlvdSB3YW50IG1lIHRvIGRpc3BsYXkgeW91ciBuYW1lLCBqdXN0IHR5cGUgL25hbWUgYXMgYSBjb21tYW5kIgpuYW1lMTUgPSAiWW91ciBuYW1lIGlzOiAiCmNsZWFyKCkKcHJpbnQoY29sb3JlZCgiIF9fXyAgICAgIF9fXyAgIF9fX19fX19fX18gICBfX18gICAgICAgICAgX19fICAgICAgICAgICBfX19fX19fX18gICAgX19fIiwgIm1hZ2VudGEiKSkgCnRpbWUuc2xlZXAoMC4wNykKcHJpbnQoY29sb3JlZCgifCAgIHwgICAgfCAgIHwgfCAgIF9fX19fX198IHwgICB8ICAgICAgICB8ICAgfCAgICAgICAgIC8gX19fX19fXyBcICB8ICAgfCIsICJyZWQiKSkKdGltZS5zbGVlcCgwLjA3KQpwcmludChjb2xvcmVkKCJ8ICAgfF9fX198ICAgfCB8ICB8X19fX19fXyAgfCAgIHwgICAgICAgIHwgICB8ICAgICAgICB8IHwgICAgICAgfCB8IHwgICB8IiwgImN5YW4iKSkKdGltZS5zbGVlcCgwLjA3KQpwcmludChjb2xvcmVkKCJ8ICAgICAgICAgICAgfCB8ICAgX19fX19fX3wgfCAgIHwgICAgICAgIHwgICB8ICAgICAgICB8IHwgICAgICAgfCB8IHwgICB8IiwgInllbGxvdyIpKQp0aW1lLnNsZWVwKDAuMDcpCnByaW50KGNvbG9yZWQoInwgICAgX19fXyAgICB8IHwgIHxfX19fX19fICB8ICAgfCAgICAgICAgfCAgIHwgICAgICAgIHwgfCAgICAgICB8IHwgfF9fX3wiLCAiZ3JlZW4iKSkKdGltZS5zbGVlcCgwLjA3KQpwcmludChjb2xvcmVkKCJ8ICAgfCAgICB8ICAgfCB8ICAgICAgICAgIHwgfCAgIHxfX19fX18gIHwgICB8X19fX19fICB8IHxfX19fX19ffCB8ICBfX18iLCAid2hpdGUiKSkKdGltZS5zbGVlcCgwLjA3KQpwcmludChjb2xvcmVkKCJ8X19ffCAgICB8X19ffCB8X19fX19fX19fX3wgfF9fX19fX19fX198IHxfX19fX19fX19ffCAgXF9fX19fX19fXy8gIHxfX198IiwgIm1hZ2VudGEiKSkKdGltZS5zbGVlcCgxKQpwcmludCgiX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fXyAiKQpmb3IgY2hhciBpbiBncmVldGluZzoKICAgICAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNDUpCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIHByaW50KGNoYXIsIGVuZD0iIikKICAgICAgICAgICAgICAgIHN5cy5zdGRvdXQuZmx1c2goKQp0aW1lLnNsZWVwKDEpICAgICAgICAgICAgICAgIApmb3IgY2hhciBpbiBpbnRybzoKICAgICAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNDUpCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIHByaW50KGNoYXIsIGVuZD0iIikKICAgICAgICAgICAgICAgIHN5cy5zdGRvdXQuZmx1c2goKQpwcmludCgiIikKdGltZS5zbGVlcCgxKQpmb3IgY2hhciBpbiBpbnRybzI6CiAgICAgICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDQ1KQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBwcmludChjaGFyLCBlbmQ9IiIpCiAgICAgICAgICAgICAgICBzeXMuc3Rkb3V0LmZsdXNoKCkgICAgICAgICAgICAgICAKdGltZS5zbGVlcCgxKQpwcmludCgiIikKZm9yIGNoYXIgaW4gY29sb3JlZCh1cHZvdGUsICJtYWdlbnRhIiwgIm9uX3doaXRlIik6CiAgICAgICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDQ1KQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBwcmludChjaGFyLCBlbmQ9IiIpCiAgICAgICAgICAgICAgICBzeXMuc3Rkb3V0LmZsdXNoKCkgIAp0aW1lLnNsZWVwKDIpCnByaW50KCIiKQpuYW1lID0gaW5wdXQoY29sb3JlZCgiRW50ZXIgeW91ciBuYW1lOiAiLCAieWVsbG93IikpICAgICAgICAgICAgICAgICAgICAgIAp0aW1lLnNsZWVwKDEpCmZvciBjaGFyIGluIGNtZDoKICAgICAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNDUpCiAgICAgICAgICAgICAgICBzeXMuc3Rkb3V0LndyaXRlKCJcMDMzWzAwOzBtIikKICAgICAgICAgICAgICAgIHByaW50KGNoYXIsIGVuZD0iIikKICAgICAgICAgICAgICAgIHN5cy5zdGRvdXQuZmx1c2goKSAgCnRpbWUuc2xlZXAoMSkKcHJpbnQoIiIpCnByaW50KCIgX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fIikKcHJpbnQoInwgICAgICAgICAgICB8ICAgICAgICAgICAgIHwgICAgICB8ICAgICAgICAgIHwgICAgICAgICAgfCAgICAgICAgfCAgICAgICAgIHwgICAgICAgICAgICB8ICAgICAgIHwgICAgICB8IikKcHJpbnQoInwgQ2FsY3VsYXRvciB8IENoYW5nZSBOYW1lIHwgSm9rZSB8IENhbGVuZGFyIHwgRGF0ZXRpbWUgfCBSaWRkbGUgfCBDcmVkaXRzIHwgTWF0aHMgUXVpeiB8IFRpbWVyIHwgRXhpdCB8IikKcHJpbnQoInxfX19fX19fX19fX198X19fX19fX19fX19fX3xfX19fX198X19fX19fX19fX3xfX19fX19fX19ffF9fX19fX19ffF9fX19fX19fX3xfX19fX19fX19fX198X19fX19fX3xfX19fX198IikKcHJpbnQoIiIpCnQgPSAiSGVsbG8hIgp1ID0gIkhleSEiCnYgPSAoIkknbSBmaW5lLCB0aGFuayB5b3UiKQp3ID0gKCJJJ20gcXVpdGUgYWxyaWdodCIpCmpva2UxID0gKCJNeSBmcmllbmQgc2F5cyB0aGF0IG9uaW9uIGlzIHRoZSBvbmx5IGZydWl0IHRoYXQgbWFrZXMgeW91IGNyeS4gU28gSSB0aHJldyBhIGNvY29udXQgYXQgaGlzIGZhY2UuICIpCmpva2UyID0gKCJNZTogV291bGQgeW91IGxpa2UgdG8gYmUgdGhlIHN1biBvZiBteSBsaWZlPyBIZXI6IEF3d3cuLi5ZZXMhIE1lOiBHb29kLCBzdGF5IDkyLjI2IG1pbGxpb24gbWlsZXMgYXdheSBmcm9tIG1lLiAiKQpqb2tlMyA9ICgiSSBkaWRuJ3Qga25vdyB3aHkgdGhlIGJhc2tldGJhbGwgd2FzIGdldHRpbiBiaWdnZXIuIFRoZW4gaXQgaGl0IG1lLiA6KCIpCmpva2U0ID0gKCJNeSBmcmllbmQgaXMgc28gdWdseSB0aGF0IGhlIG1hZGUgYSBoYXBweSBtZWFsIGNyeS4iKQpqb2tlNSA9ICgiTGlnaHQgdHJhdmVscyBmYXN0ZXIgdGhhbiBzb3VuZC4gVGhpcyBpcyB3aHkgc29tZSBwZW9wbGUgYXBwZWFyIGJyaWdodCB1bnRpbCB5b3UgaGVhciB0aGVtIHNwZWFrLiIpCmpva2U2ID0gKCJBbiBvbGQgdGVhY2hlciBhc2tlZCBoZXIgc3R1ZGVudCwgJ0lmIEkgc2F5ICdJIGFtIGJlYXV0aWZ1bCcsIHdoaWNoIHRlbnNlIGlzIHRoYXQ/Jy4gVGhlIHN0dWRlbnQgYW5zd2VycywgJ0l0J3Mgb2J2aW91c2x5IHRoZSBwYXN0LiciKQpqb2tlNyA9ICgiTWFuOiBJIHdhbnQgdG8gZ2l2ZSBteXNlbGYgdG8geW91LiBXb21hbjogU29ycnksIEkgZG9uJ3QgYWNjZXB0IGNoZWFwIGdpZnRzLiIpCmpva2U4ID0gKCJJIG5ldmVyIGZvcmdldCBhIGZhY2UhIEJ1dCBpbiB5b3VyIGNhc2UgSSdsbCBtYWtlIGFuIGV4Y2VwdGlvbiEiKQpqb2tlOSA9ICgiSSBoZWFyIHlvdSBhcmUgdmVyeSBraW5kIHRvIGFuaW1hbHMsIHNvIHBsZWFzZSBnaXZlIHRoYXQgZmFjZSBiYWNrIHRvIHRoZSBnb3JpbGxhLiIpCmpva2UxMCA9ICgiWW91J3ZlIGdvdCB0aGUgcGVyZmVjdCB3ZWFwb24gYWdhaW5zdCBtdWdnZXJzLiBZb3VyIGZhY2UuIikKam9rZTExID0gKCJNZTogV2VyZSB5b3UgYm9ybiBvbiBhIGhpZ2h3YXk/IEhpbTogTm8uIFdoeT8gTWU6IENvcyB0aGF0J3Mgd2hlcmUgbW9zdCBhY2NpZGVudHMgaGFwcGVuLiIpCmpva2UxMiA9ICgiSWYgSSBldmVyIG5lZWQgYSBicmFpbiB0cmFuc3BsYW50LCBJJ2QgY2hvb3NlIHlvdXJzIGJlY2F1c2UgSSdkIHdhbnQgYSBicmFpbiB0aGF0IGhhZCBuZXZlciBiZWVuIHVzZWQuICIpCmpva2UxMyA9ICgiSG93IGRpZCB5b3UgZ2V0IGhlcmU/IERpZCBzb21lb25lIGxlYXZlIHlvdXIgY2FnZSBvcGVuPyIpCmpva2UxNCA9ICgiSWYgYmVhdXR5IHdhcyBhIGRyb3Agb2Ygd2F0ZXIsIHlvdSdkIGJlIHRoZSBTYWhhcmEgRGVzZXJ0LiIpCmpva2UxNSA9ICgiSWYgdWdsaW5lc3Mgd2VyZSBicmlja3MsIHlvdSdkIGJlIHRoZSBHcmVhdCBXYWxsIG9mIENoaW5hISIpCmpva2UxNiA9ICgiRXZlcnlvbmUgaGFzIGEgcmlnaHQgdG8gYmUgdWdseSBidXQgeW91IGFidXNlIHRoZSBwcml2aWxlZ2UuIikKam9rZTE3ID0gKCJTdXJlLCBJJ2QgbG92ZSB0byBoZWxwIHlvdSBvdXQuIE5vdywgd2hpY2ggd2F5IGRpZCB5b3UgY29tZSBpbj8iKQpqb2tlMTggPSAoIkkgaGVhcmQgeW91IHdlbnQgdG8gaGF2ZSB5b3VyIGhlYWQgZXhhbWluZWQgYnV0IHRoZSBkb2N0b3JzIGZvdW5kIG5vdGhpbmcgdGhlcmUuIikKam9rZTE5ID0gKCJJJ2QgYXNrIGhvdyBvbGQgeW91IGFyZSwgYnV0IEkgZG9uJ3QgdGhpbmsgeW91IGNhbiBjb3VudCB0aGF0IGhpZ2guICIpCmpva2UyMCA9ICgiV2hlbiBHb2Qgd2FzIHRocm93aW5nIGludGVsbGlnZW5jZSBkb3duIHRvIHRoZSBFYXJ0aCwgeW91IHdlcmUgaG9sZGluZyBhbiB1bWJyZWxsYS4iKQpyaWRkbGUxID0gKCJDYW4gYSBrYW5nYXJvbyBoaWdoZXIgdGhhbiB0aGUgRW1waXJlIFN0YXRlIEJ1aWxkaW5nPyIpCnJpZGRsZTIgPSAoIldoYXQgaXMgYSByaWNoIHBlcnNvbidzIGZhdm9yaXRlIG51dD8iKQpyaWRkbGUzID0gKCJBIG1hbiBpcyAyNCB5ZWFycyBvbGQsIGJ1dCBoZSBvbmx5IGhhcyBoYWQgNiBiaXJ0aGRheXMuIEhvdyBpcyB0aGlzIHBvc3NpYmxlPyIpCnJpZGRsZTQgPSAoIkEgbWFuIGdvZXMgdG8gYnV5IGEgdXNlZCBjYXIuIEhlIGZpbmRzIGEgbmljZSBDb3J2ZXR0ZSBmb3IgJDg3MDAgYW5kIGhlIGJ1eXMgaXQgd2l0aG91dCBwYXlpbmcgYSBkaW1lLiBIb3cgaXMgdGhhdCBwb3NzaWJsZT8iKQpjb2xvcjEgPSAoInllbGxvdyIpCmNvbG9yMiA9ICgiY3lhbiIpCmNvbG9yMyA9ICgibWFnZW50YSIpCmNvbG9yNCA9ICgicmVkIikKY29sb3I1ID0gKCJncmVlbiIpCnJlc3BvbnNlMSA9ICgiPz8/IikKcmVzcG9uc2UyID0gKCJJIGRvbid0IGdldCB3aGF0IHlvdSBtZWFuLiIpCnJlc3BvbnNlMyA9ICgiU29ycnkgd2hhdD8iKQpyZXNwb25zZTQgPSAoIldoYXQ/IikKYWJjZCA9IGNvbG9yZWQoIldlbGNvbWUgdG8gIiwgImdyZWVuIikKYWJjZGUgPSBjb2xvcmVkKCJQeXRob24gQ2FsY3VsYXRvciEiKQphYmNkZWYgPSBjb2xvcmVkKCJQeXRob24gQ2FsZW5kYXIhIikKaDEgPSAib25fd2hpdGUiCmgyID0gIm9uX3JlZCIKaDMgPSAib25fZ3JlZW4iCmg0ID0gIm9uX2N5YW4iCmg1ID0gIm9uX3llbGxvdyIKCgogICAgICAgICAgICAgICAgCndoaWxlIFRydWU6CiAgICBmb3IgY2hhciBpbiBjb2xvcmVkKCIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiLCAid2hpdGUiLCByYW5kb20uY2hvaWNlKChoMSxoMixoMyxoNCxoNSkpKToKICAgICAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNDUpCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIHByaW50KGNoYXIsIGVuZD0iIikKICAgICAgICAgICAgICAgIHN5cy5zdGRvdXQuZmx1c2goKQogICAgcHJpbnQoIiIpCiAgICBkID0gaW5wdXQoY29sb3JlZCgiQ29tbWFuZDogIiwgcmFuZG9tLmNob2ljZSgoY29sb3IyLCBjb2xvcjMsIGNvbG9yMSAsIGNvbG9yNCwgY29sb3I1KSkpKQogICAgZm9yIGNoYXIgaW4gY29sb3JlZCgiQ29tbWFuZCBlbnRlcmVkOiAnIiwgImN5YW4iKToKICAgICAgICAgICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDQ1KQogICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgIHByaW50KGNoYXIsIGVuZD0iIikKICAgICAgICAgICAgICAgICAgICBzeXMuc3Rkb3V0LmZsdXNoKCkKICAgIGZvciBjaGFyIGluIGNvbG9yZWQoZCwgInllbGxvdyIpOgogICAgICAgICAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNDUpCiAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgcHJpbnQoY2hhciwgZW5kPSIiKQogICAgICAgICAgICAgICAgICAgIHN5cy5zdGRvdXQuZmx1c2goKQogICAgZm9yIGNoYXIgaW4gY29sb3JlZCgiJyIsICJjeWFuIik6CiAgICAgICAgICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA0NSkKICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICBwcmludChjaGFyLCBlbmQ9IiIpCiAgICAgICAgICAgICAgICAgICAgc3lzLnN0ZG91dC5mbHVzaCgpCiAgICBwcmludCgiIikgCiAgICBmb3IgY2hhciBpbiBjb2xvcmVkKCJFeGVjdXRpbmcuLi4iLCAicmVkIik6CiAgICAgICAgICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA0NSkKICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICBwcmludChjaGFyLCBlbmQ9IiIpCiAgICAgICAgICAgICAgICAgICAgc3lzLnN0ZG91dC5mbHVzaCgpICAgICAgICAgICAgICAgCiAgICB0aW1lLnNsZWVwKDAuMDcpICAgICAgICAgICAgICAgIAogICAgZSA9IGQubG93ZXIoKQogICAgY2xlYXIoKQogICAgaWYgZSA9PSAiY2FsY3VsYXRvciIgb3IgZSA9PSAiY2FsYyIgb3IgZSA9PSAiY2FsY3VzIjoKICAgICAgICBmb3IgY2hhciBpbiBhYmNkOgogICAgICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA0NSkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgcHJpbnQoY2hhciwgZW5kPSIiKQogICAgICAgICAgICAgICAgc3lzLnN0ZG91dC5mbHVzaCgpCiAgICAgICAgZm9yIGNoYXIgaW4gYWJjZGU6CiAgICAgICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDQ1KQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBwcmludChjaGFyLCBlbmQ9IiIpCiAgICAgICAgICAgICAgICBzeXMuc3Rkb3V0LmZsdXNoKCkgICAgICAgIAogICAgICAgIHByaW50KCIiKSAgICAgICAgCiAgICAgICAgZm9yIGNoYXIgaW4gb3A6CiAgICAgICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDQ1KQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBwcmludChjaGFyLCBlbmQ9IiIpCiAgICAgICAgICAgICAgICBzeXMuc3Rkb3V0LmZsdXNoKCkgIAogICAgICAgIHByaW50KCIiKQogICAgICAgIHByaW50KCgiMS4gQWRkIiwgInJlZCIpKQogICAgICAgIHRpbWUuc2xlZXAoMC4wNykKICAgICAgICBwcmludChjb2xvcmVkKCIyLiBTdWJ0cmFjdCIsICJncmVlbiIpKQogICAgICAgIHRpbWUuc2xlZXAoMC4wNykKICAgICAgICBwcmludChjb2xvcmVkKCIzLiBNdWx0aXBseSIsICJjeWFuIikpCiAgICAgICAgdGltZS5zbGVlcCgwLjA3KQogICAgICAgIHByaW50KGNvbG9yZWQoIjQuIERpdmlkZSIsICJ3aGl0ZSIpKQogICAgICAgIHRpbWUuc2xlZXAoMC4wNykKICAgICAgICBwcmludChjb2xvcmVkKCI1LiBTcXVhcmUiLCAibWFnZW50YSIpKQogICAgICAgIHRpbWUuc2xlZXAoMC4wNykKICAgICAgICBwcmludChjb2xvcmVkKCI2LiBQb3dlciIsICJ5ZWxsb3ciKSkKICAgICAgICB0aW1lLnNsZWVwKDAuMDcpCiAgICAgICAgcHJpbnQoY29sb3JlZCgiNy4gUm9vdCIsICJyZWQiKSkKICAgICAgICB0aW1lLnNsZWVwKDAuMDcpCiAgICAgICAgZyA9IGlucHV0KGNvbG9yZWQoIk9wZXJhdGlvbjogIiwgcmFuZG9tLmNob2ljZSgoY29sb3IxLCBjb2xvcjIsIGNvbG9yMywgY29sb3I0LCBjb2xvcjUpKSkpCiAgICAgICAgaCA9IGcubG93ZXIoKQogICAgICAKICAgICAgICBpZiBoID09ICIxIiBvciBoID09ICJhZGQiOgogICAgICAgICAgICBudW0xID0gZmxvYXQoaW5wdXQoIkZpcnN0IG51bWJlcjogIikpCiAgICAgICAgICAgIG51bTIgPSBmbG9hdChpbnB1dCgiU2Vjb25kIG51bWJlcjogIikpCiAgICAgICAgICAgIHByaW50KGNvbG9yZWQobnVtMStudW0yLCAiY3lhbiIpKQogICAgICAgICAgICAgICAgICAgIAogICAgICAgIGVsaWYgaCA9PSAiMiIgb3IgaCA9PSAibWludXMiIG9yIGggPT0gInN1YnRyYWN0IjoKICAgICAgICAgICAgbnVtMTIgPSBmbG9hdChpbnB1dCgiRmlyc3QgbnVtYmVyOiAiKSkKICAgICAgICAgICAgbnVtMjMgPSBmbG9hdChpbnB1dCgiU2Vjb25kIG51bWJlcjogIikpCiAgICAgICAgICAgIHByaW50KGNvbG9yZWQobnVtMTItbnVtMjMsICJjeWFuIikpCiAgICAgICAgCiAgICAgICAgZWxpZiBoID09ICIzIiBvciBoID09ICJ0aW1lcyIgb3IgaCA9PSAidGltZSIgb3IgaCA9PSAibXVsdGlwbHkiOgogICAgICAgICAgICBudW0xMjMgPSBmbG9hdChpbnB1dCgiRmlyc3QgbnVtYmVyOiAiKSkKICAgICAgICAgICAgbnVtMjM0ID0gZmxvYXQoaW5wdXQoIlNlY29uZCBudW1iZXI6ICIpKQogICAgICAgICAgICBwcmludChjb2xvcmVkKG51bTEyMypudW0yMzQsICJjeWFuIikpCiAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgZWxpZiBoID09ICI0IiBvciBoID09ImRpdmlkZSI6CiAgICAgICAgICAgIG51bTEyMzQgPSBmbG9hdChpbnB1dCgiRmlyc3QgbnVtYmVyOiAiKSkKICAgICAgICAgICAgbnVtMjM0NSA9IGZsb2F0KGlucHV0KCJTZWNvbmQgbnVtYmVyOiAiKSkKICAgICAgICAgICAgcHJpbnQoY29sb3JlZChudW0xMjM0L251bTIzNDUsICJjeWFuIikpCiAgICAgICAgZWxpZiBoID09ICI1IiBvciBoID09ICJzcXVhcmUiOgogICAgICAgICAgICBudW0xMjM0NSA9IGZsb2F0KGlucHV0KCJOdW1iZXI6ICIpKQogICAgICAgICAgICBmb3IgY2hhciBpbiAoIllvdXIgYW5zd2VyOiAiLCBudW0xMjM0NSpudW0xMjM0NSk6CiAgICAgICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDQ1KQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBwcmludChjaGFyLCBlbmQ9IiIpCiAgICAgICAgICAgICAgICBzeXMuc3Rkb3V0LmZsdXNoKCkKICAgICAgICBlbGlmIGggPT0gIjYiIG9yIGggPT0gInBvd2VyIiBvciBoID09ICJpbmRpY2VzIjoKICAgICAgICAgICAgbnVtMTIzNDU2ID0gZmxvYXQoaW5wdXQoIk51bWJlcjogIikpCiAgICAgICAgICAgIG51bTEyMzQ1NjcgPSBmbG9hdChpbnB1dCgiUG93ZXI6ICIpKSAgIAogICAgICAgICAgICBwcmludChudW0xMjM0NTYqKm51bTEyMzQ1NjcpCiAgICAgICAgZWxpZiBoID09ICJyb290IiBvciBoID09ICI3IjoKICAgICAgICAgICAgbnVtMTIzNDU2NzggPSBmbG9hdChpbnB1dCgiTnVtYmVyOiAiKSkKICAgICAgICAgICAgbnVtMTIzNDU2Nzg5ID0gZmxvYXQoaW5wdXQoIlJvb3QgbnVtYmVyOiAiKSkgICAgCiAgICAgICAgICAgIHByaW50KG51bTEyMzQ1Njc4KiooMS9udW0xMjM0NTY3ODkpKQogICAgICAgICAgICAgICAgICAgCiAgICAgICAgZWxzZToKICAgICAgICAgICAgY2xlYXIoKQogICAgICAgICAgICBmb3IgY2hhciBpbiBjb2xvcmVkKCJJbnZhbGlkIGlucHV0IGZvciAnIiwgInJlZCIpOgogICAgICAgICAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNDUpCiAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgcHJpbnQoY2hhciwgZW5kPSIiKQogICAgICAgICAgICAgICAgICAgIHN5cy5zdGRvdXQuZmx1c2goKQogICAgICAgICAgICBmb3IgY2hhciBpbiBjb2xvcmVkKCJQeXRob24gQ2FsY3VsYXRvciIsICJjeWFuIik6CiAgICAgICAgICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA0NSkKICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICBwcmludChjaGFyLCBlbmQ9IiIpCiAgICAgICAgICAgICAgICAgICAgc3lzLnN0ZG91dC5mbHVzaCgpIAogICAgICAgICAgICBmb3IgY2hhciBpbiBjb2xvcmVkKCInLiIsICJyZWQiKToKICAgICAgICAgICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDQ1KQogICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgIHByaW50KGNoYXIsIGVuZD0iIikKICAgICAgICAgICAgICAgICAgICBzeXMuc3Rkb3V0LmZsdXNoKCkgICAgICAgICAgICAgICAKICAgICAgICAgICAgcHJpbnQoIiIpICAgICAgICAgICAgCiAgICBlbGlmIGUgPT0gIm5hbWUiIG9yIGUgPT0gImkgd2FudCB0byBjaGFuZ2UgdGhlIG5hbWUiIG9yIGUgPT0gImNoYW5nZSBuYW1lIiBvciBlID09ICJpIHdhbnQgdG8gY2hhbmdlIG15IG5hbWUiOgogICAgICAgICAgICAgICAgY2xlYXIoKQogICAgICAgICAgICAgICAgZm9yIGNoYXIgaW4gIlBsZWFzZSBlbnRlciBuZXcgbmFtZSBiZWxvdyI6CiAgICAgICAgICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA0NSkKICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICBwcmludChjaGFyLCBlbmQ9IiIpCiAgICAgICAgICAgICAgICAgICAgc3lzLnN0ZG91dC5mbHVzaCgpIAogICAgICAgICAgICAgICAgcHJpbnQoIiIpCiAgICAgICAgICAgICAgICBuYW1lID0gaW5wdXQoKQogICAgICAgICAgICAgICAgZm9yIGNoYXIgaW4gbmFtZTEzOgogICAgICAgICAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNDUpCiAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgcHJpbnQoY2hhciwgZW5kPSIiKQogICAgICAgICAgICAgICAgICAgIHN5cy5zdGRvdXQuZmx1c2goKQogICAgICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA3KSAgICAgCiAgICAgICAgICAgICAgICBmb3IgY2hhciBpbiBuYW1lOgogICAgICAgICAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNDUpCiAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgcHJpbnQoY2hhciwgZW5kPSIiKQogICAgICAgICAgICAgICAgICAgIHN5cy5zdGRvdXQuZmx1c2goKQogICAgICAgICAgICAgICAgdGltZS5zbGVlcCgxKQogICAgICAgICAgICAgICAgcHJpbnQoIiIpCiAgICAgICAgICAgICAgICBmb3IgY2hhciBpbiBuYW1lMTQ6CiAgICAgICAgICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA0NSkKICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICBwcmludChjaGFyLCBlbmQ9IiIpCiAgICAgICAgICAgICAgICAgICAgc3lzLnN0ZG91dC5mbHVzaCgpCiAgICAgICAgICAgICAgICBwcmludCgiIikgICAgCiAgICAKICAgIGVsaWYgZSA9PSAiL25hbWUiOgogICAgICAgIGZvciBjaGFyIGluIG5hbWUxMzoKICAgICAgICAgICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDQ1KQogICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgIHByaW50KGNoYXIsIGVuZD0iIikKICAgICAgICAgICAgICAgICAgICBzeXMuc3Rkb3V0LmZsdXNoKCkKICAgICAgICB0aW1lLnNsZWVwKDEpCiAgICAgICAgZm9yIGNoYXIgaW4gbmFtZToKICAgICAgICAgICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDQ1KQogICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgIHByaW50KGNoYXIsIGVuZD0iIikKICAgICAgICAgICAgICAgICAgICBzeXMuc3Rkb3V0LmZsdXNoKCkKICAgICAgICB0aW1lLnNsZWVwKDEpCiAgICAgICAgICAgICAgICAKICAgICAgICBwcmludCgiIikKICAgIGVsaWYgZSA9PSAic2h1dCB1cCIgb3IgZT09ICJxdWl0IiBvciBlPT0gImV4aXQiOgogICAgICAgIGZvciBjaGFyIGluICJBcmUgeW91IHN1cmUgeW91IHdhbnQgdG8gZXhpdD8iOgogICAgICAgICAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNDUpCiAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgcHJpbnQoY2hhciwgZW5kPSIiKQogICAgICAgICAgICAgICAgICAgIHN5cy5zdGRvdXQuZmx1c2goKQogICAgICAgICAgICAgICAgCiAgICAgICAgcHJpbnQoIiIpCiAgICAgICAgZXhpdDEgPSBpbnB1dCgpCiAgICAgICAgZXhpdDIgPSAiR29vZGJ5ZSEiLCAiU2VlIHlvdSBsYXRlci4iLCAiRG9uJ3QgZm9yZ2V0IHRvIHVwdm90ZSEiLCAiSSBob3BlIHlvdSBlbmpveWVkIHlvdXIgZXhwZXJpZW5jZSEiCiAgICAgICAgcmFuZXhpdCA9IHJhbmRvbS5jaG9pY2UoKGV4aXQyKSkKICAgICAgICBpZiBleGl0MS5sb3dlcigpLnN0YXJ0c3dpdGgoInkiKToKICAgICAgICAgICAgZm9yIGNoYXIgaW4gY29sb3JlZChyYW5leGl0LCAicmVkIik6CiAgICAgICAgICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA0NSkKICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICBwcmludChjaGFyLCBlbmQ9IiIpCiAgICAgICAgICAgICAgICAgICAgc3lzLnN0ZG91dC5mbHVzaCgpCiAgICAgICAgICAgIHByaW50KCIiKQogICAgICAgICAgICBxdWl0KCkKICAgIGVsaWYgZSA9PSAiaGVsbG8iOgogICAgICAgIHJlc3AgPSByYW5kb20uY2hvaWNlKCh0LHUpKQogICAgICAgIGlmIHJlc3AgPT0gdDoKICAgICAgICAgICAgZm9yIGNoYXIgaW4gdDoKICAgICAgICAgICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDQ1KQogICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgIHByaW50KGNoYXIsIGVuZD0iIikKICAgICAgICAgICAgICAgICAgICBzeXMuc3Rkb3V0LmZsdXNoKCkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICBwcmludCgiIikKICAgICAgICBlbGlmIHJlc3AgPT0gdToKICAgICAgICAgICAgZm9yIGNoYXIgaW4gdToKICAgICAgICAgICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDQ1KQogICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgIHByaW50KGNoYXIsIGVuZD0iIikKICAgICAgICAgICAgICAgICAgICBzeXMuc3Rkb3V0LmZsdXNoKCkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICBwcmludCgiIikgICAgICAgIAogICAgZWxpZiBlID09ICJob3cgYXJlIHlvdSIgb3IgZSA9PSAiaG93IGFyZSB5b3U/IiBvciBlID09ICJob3cgZG8geW91IGRvIiBvciBlID09ICJob3cgZG8geW91IGRvPyI6CiAgICAgICAgaG93ID0gcmFuZG9tLmNob2ljZSgodix3KSkKICAgICAgICBpZiBob3cgPT0gdjoKICAgICAgICAgICAgZm9yIGNoYXIgaW4gdjoKICAgICAgICAgICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDQ1KQogICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgIHByaW50KGNoYXIsIGVuZD0iIikKICAgICAgICAgICAgICAgICAgICBzeXMuc3Rkb3V0LmZsdXNoKCkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICBwcmludCgiIikKICAgICAgICBlbGlmIGhvdyA9PSB3OgogICAgICAgICAgICBmb3IgY2hhciBpbiB3OgogICAgICAgICAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNDUpCiAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgcHJpbnQoY2hhciwgZW5kPSIiKQogICAgICAgICAgICAgICAgICAgIHN5cy5zdGRvdXQuZmx1c2goKQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgIHByaW50KCIiKSAgICAKICAgIGVsaWYgZSA9PSAiam9rZSIgb3IgZSA9PSAidGVsbCBtZSBhIGpva2UiIG9yIGUgPT0gInRlbGwgbWUgYW5vdGhlciBqb2tlIiBvciBlID09ICJhbm90aGVyIGpva2UiOgogICAgICAgIGpva2VzID0gcmFuZG9tLmNob2ljZSgoam9rZTEsIGpva2UyLCBqb2tlMywgam9rZTQsIGpva2U1LCBqb2tlNiwgam9rZTcsIGpva2U4LCBqb2tlOSwgam9rZTEwLCBqb2tlMTEsIGpva2UxMiwgam9rZTEzLCBqb2tlMTQsIGpva2UxNSwgam9rZTE2LCBqb2tlMTcsIGpva2UxOCwgam9rZTE5LCBqb2tlMjApKQogICAgICAgIGlmIGpva2VzID09IGpva2UxOgogICAgICAgICAgICBmb3IgY2hhciBpbiBqb2tlMToKICAgICAgICAgICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDQ1KQogICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgIHByaW50KGNoYXIsIGVuZD0iIikKICAgICAgICAgICAgICAgICAgICBzeXMuc3Rkb3V0LmZsdXNoKCkKICAgICAgICBlbGlmIGpva2VzID09IGpva2UyOgogICAgICAgICAgICBmb3IgY2hhciBpbiBqb2tlMjoKICAgICAgICAgICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDQ1KQogICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgIHByaW50KGNoYXIsIGVuZD0iIikKICAgICAgICAgICAgICAgICAgICBzeXMuc3Rkb3V0LmZsdXNoKCkKICAgICAgICBlbGlmIGpva2VzID09IGpva2UzOgogICAgICAgICAgICBmb3IgY2hhciBpbiBqb2tlMzoKICAgICAgICAgICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDQ1KQogICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgIHByaW50KGNoYXIsIGVuZD0iIikKICAgICAgICAgICAgICAgICAgICBzeXMuc3Rkb3V0LmZsdXNoKCkKICAgICAgICBlbGlmIGpva2VzID09IGpva2U0OgogICAgICAgICAgICBmb3IgY2hhciBpbiBqb2tlNDoKICAgICAgICAgICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDQ1KQogICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgIHByaW50KGNoYXIsIGVuZD0iIikKICAgICAgICAgICAgICAgICAgICBzeXMuc3Rkb3V0LmZsdXNoKCkgCiAgICAgICAgZWxpZiBqb2tlcyA9PSBqb2tlNToKICAgICAgICAgICAgZm9yIGNoYXIgaW4gam9rZTU6CiAgICAgICAgICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA0NSkKICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICBwcmludChjaGFyLCBlbmQ9IiIpCiAgICAgICAgICAgICAgICAgICAgc3lzLnN0ZG91dC5mbHVzaCgpCiAgICAgICAgZWxpZiBqb2tlcyA9PSBqb2tlNjoKICAgICAgICAgICAgZm9yIGNoYXIgaW4gam9rZTY6CiAgICAgICAgICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA0NSkKICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICBwcmludChjaGFyLCBlbmQ9IiIpCiAgICAgICAgICAgICAgICAgICAgc3lzLnN0ZG91dC5mbHVzaCgpCiAgICAgICAgZWxpZiBqb2tlcyA9PSBqb2tlNzoKICAgICAgICAgICAgZm9yIGNoYXIgaW4gam9rZTc6CiAgICAgICAgICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA0NSkKICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICBwcmludChjaGFyLCBlbmQ9IiIpCiAgICAgICAgICAgICAgICAgICAgc3lzLnN0ZG91dC5mbHVzaCgpCiAgICAgICAgZWxpZiBqb2tlcyA9PSBqb2tlODoKICAgICAgICAgICAgZm9yIGNoYXIgaW4gam9rZTg6CiAgICAgICAgICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA0NSkKICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICBwcmludChjaGFyLCBlbmQ9IiIpCiAgICAgICAgICAgICAgICAgICAgc3lzLnN0ZG91dC5mbHVzaCgpIAogICAgICAgIGVsaWYgam9rZXMgPT0gam9rZTk6CiAgICAgICAgICAgIGZvciBjaGFyIGluIGpva2U5OgogICAgICAgICAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNDUpCiAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgcHJpbnQoY2hhciwgZW5kPSIiKQogICAgICAgICAgICAgICAgICAgIHN5cy5zdGRvdXQuZmx1c2goKQogICAgICAgIGVsaWYgam9rZXMgPT0gam9rZTEwOgogICAgICAgICAgICBmb3IgY2hhciBpbiBqb2tlMTA6CiAgICAgICAgICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA0NSkKICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICBwcmludChjaGFyLCBlbmQ9IiIpCiAgICAgICAgICAgICAgICAgICAgc3lzLnN0ZG91dC5mbHVzaCgpCiAgICAgICAgZWxpZiBqb2tlcyA9PSBqb2tlMTE6CiAgICAgICAgICAgIGZvciBjaGFyIGluIGpva2UxMToKICAgICAgICAgICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDQ1KQogICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgIHByaW50KGNoYXIsIGVuZD0iIikKICAgICAgICAgICAgICAgICAgICBzeXMuc3Rkb3V0LmZsdXNoKCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgZWxpZiBqb2tlcyA9PSBqb2tlMTI6CiAgICAgICAgICAgIGZvciBjaGFyIGluIGpva2UxMjoKICAgICAgICAgICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDQ1KQogICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgIHByaW50KGNoYXIsIGVuZD0iIikKICAgICAgICAgICAgICAgICAgICBzeXMuc3Rkb3V0LmZsdXNoKCkKICAgICAgICBlbGlmIGpva2VzID09IGpva2UxMzoKICAgICAgICAgICAgZm9yIGNoYXIgaW4gam9rZTEzOgogICAgICAgICAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNDUpCiAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgcHJpbnQoY2hhciwgZW5kPSIiKQogICAgICAgICAgICAgICAgICAgIHN5cy5zdGRvdXQuZmx1c2goKQogICAgICAgIGVsaWYgam9rZXMgPT0gam9rZTE0OgogICAgICAgICAgICBmb3IgY2hhciBpbiBqb2tlMTQ6CiAgICAgICAgICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA0NSkKICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICBwcmludChjaGFyLCBlbmQ9IiIpCiAgICAgICAgICAgICAgICAgICAgc3lzLnN0ZG91dC5mbHVzaCgpCiAgICAgICAgZWxpZiBqb2tlcyA9PSBqb2tlMTU6CiAgICAgICAgICAgIGZvciBjaGFyIGluIGpva2UxNToKICAgICAgICAgICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDQ1KQogICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgIHByaW50KGNoYXIsIGVuZD0iIikKICAgICAgICAgICAgICAgICAgICBzeXMuc3Rkb3V0LmZsdXNoKCkKICAgICAgICBlbGlmIGpva2VzID09IGpva2UxNjoKICAgICAgICAgICAgZm9yIGNoYXIgaW4gam9rZTE2OgogICAgICAgICAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNDUpCiAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgcHJpbnQoY2hhciwgZW5kPSIiKQogICAgICAgICAgICAgICAgICAgIHN5cy5zdGRvdXQuZmx1c2goKQogICAgICAgIGVsaWYgam9rZXMgPT0gam9rZTE3OgogICAgICAgICAgICBmb3IgY2hhciBpbiBqb2tlMTc6CiAgICAgICAgICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA0NSkKICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICBwcmludChjaGFyLCBlbmQ9IiIpCiAgICAgICAgICAgICAgICAgICAgc3lzLnN0ZG91dC5mbHVzaCgpCiAgICAgICAgZWxpZiBqb2tlcyA9PSBqb2tlMTg6CiAgICAgICAgICAgIGZvciBjaGFyIGluIGpva2UxODoKICAgICAgICAgICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDQ1KQogICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgIHByaW50KGNoYXIsIGVuZD0iIikKICAgICAgICAgICAgICAgICAgICBzeXMuc3Rkb3V0LmZsdXNoKCkKICAgICAgICBlbGlmIGpva2VzID09IGpva2UxOToKICAgICAgICAgICAgZm9yIGNoYXIgaW4gam9rZTE5OgogICAgICAgICAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNDUpCiAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgcHJpbnQoY2hhciwgZW5kPSIiKQogICAgICAgICAgICAgICAgICAgIHN5cy5zdGRvdXQuZmx1c2goKQogICAgICAgIGVsaWYgam9rZXMgPT0gam9rZTIwOgogICAgICAgICAgICBmb3IgY2hhciBpbiBqb2tlMjA6CiAgICAgICAgICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA0NSkKICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICBwcmludChjaGFyLCBlbmQ9IiIpCiAgICAgICAgICAgICAgICAgICAgc3lzLnN0ZG91dC5mbHVzaCgpCiAgICAgICAgcHJpbnQoIiIpCiAgICBlbGlmIGUgPT0gImNhbGVuZGFyIjoKICAgICAgICB3ZWxjb21lID0gIldlbGNvbWUgdG8gdGhlIHB5dGhvbiBjYWxlbmRhciEiCiAgICAgICAgZm9yIGNoYXIgaW4gd2VsY29tZToKICAgICAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNDUpCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIHByaW50KGNoYXIsIGVuZD0iIikKICAgICAgICAgICAgICAgIHN5cy5zdGRvdXQuZmx1c2goKQogICAgICAgIHRpbWUuc2xlZXAoMSkKICAgICAgICBwcmludCgiIikgICAgICAgIAogICAgICAgIHJlc3AgPSBpbnB1dCgiVHlwZSBvZiBjYWxlbmRhciAobW9udGggb3IgeWVhcik6ICIpCiAgICAgICAgcmVzcG8gPSByZXNwLmxvd2VyKCkKICAgICAgICBpZiByZXNwbyA9PSAieWVhciI6CiAgICAgICAgICAgIHkgPSBpbnQoaW5wdXQoIlllYXI6ICIpKQogICAgICAgICAgICBwcm9jZXNzID0gIlByb2Nlc3NpbmcuLi4iCiAgICAgICAgICAgIGZvciBjaGFyIGluIHByb2Nlc3M6CiAgICAgICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDQ1KQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBwcmludChjaGFyLCBlbmQ9IiIpCiAgICAgICAgICAgICAgICBzeXMuc3Rkb3V0LmZsdXNoKCkKICAgICAgICAgICAgdGltZS5zbGVlcCgyKQogICAgICAgICAgICBjbGVhcigpCiAgICAgICAgICAgIHByaW50KGNhbGVuZGFyLmNhbGVuZGFyKHkpKQogICAgICAgIGVsaWYgcmVzcG8gPT0gIm1vbnRoIjogICAgIAogICAgICAgICAgICB6ID0gaW50KGlucHV0KCJFbnRlciB5ZWFyOiAiKSkKICAgICAgICAgICAgbSA9IGludChpbnB1dCgiTnVtYmVyIG9mIG1vbnRoIChFLmcuIEZlYiA9IDIpOiAiKSkKICAgICAgICAgICAgcHJvY2Vzc2luZyA9ICJQcm9jZXNzaW5nLi4uIgogICAgICAgICAgICBmb3IgY2hhciBpbiBwcm9jZXNzaW5nOgogICAgICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA0NSkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgcHJpbnQoY2hhciwgZW5kPSIiKQogICAgICAgICAgICAgICAgc3lzLnN0ZG91dC5mbHVzaCgpCiAgICAgICAgICAgIHRpbWUuc2xlZXAoMikKICAgICAgICAgICAgY2xlYXIoKQogICAgICAgICAgICBwcmludChjYWxlbmRhci5tb250aCh6LG0pKQogICAgICAgIGVsc2U6CiAgICAgICAgICAgIHJlcGxpdC5jbGVhcigpCiAgICAgICAgICAgIGZvciBjaGFyIGluIGNvbG9yZWQoIkludmFsaWQgaW5wdXQgZm9yICciLCAicmVkIik6CiAgICAgICAgICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA0NSkKICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICBwcmludChjaGFyLCBlbmQ9IiIpCiAgICAgICAgICAgICAgICAgICAgc3lzLnN0ZG91dC5mbHVzaCgpCiAgICAgICAgICAgIGZvciBjaGFyIGluIGNvbG9yZWQoIlB5dGhvbiBDYWxlbmRhciIsICJjeWFuIik6CiAgICAgICAgICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA0NSkKICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICBwcmludChjaGFyLCBlbmQ9IiIpCiAgICAgICAgICAgICAgICAgICAgc3lzLnN0ZG91dC5mbHVzaCgpIAogICAgICAgICAgICBmb3IgY2hhciBpbiBjb2xvcmVkKCInLiIsICJyZWQiKToKICAgICAgICAgICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDQ1KQogICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgIHByaW50KGNoYXIsIGVuZD0iIikKICAgICAgICAgICAgICAgICAgICBzeXMuc3Rkb3V0LmZsdXNoKCkKICAgICAgICAgICAgcHJpbnQoIiIpICAgICAgICAgCiAgICBlbGlmIGUgPT0gIi9oZWxwIiBvciBlID09ICJoZWxwIiBvciBlID09ICJoZWxwISIgb3IgZSA9PSAiaGVscCBtZSIgb3IgZSA9PSAiaGVscCBtZSEiIG9yIGUgPT0gImkgbmVlZCBoZWxwIiBvciBlID09ICJpIG5lZWQgaGVscCEiOgogICAgICAgIGhlbHBpbmcgPSAiSSBjYW4gaGVscCB5b3Ugd2l0aCB0aGUgY29tbWFuZHM6ICIKICAgICAgICBmb3IgY2hhciBpbiBoZWxwaW5nOgogICAgICAgICAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNDUpCiAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgcHJpbnQoY2hhciwgZW5kPSIiKQogICAgICAgICAgICAgICAgICAgIHN5cy5zdGRvdXQuZmx1c2goKQogICAgICAgIHByaW50KCkKICAgICAgICB0aW1lLnNsZWVwKDEpICAgICAgICAgICAgCiAgICAgICAgcHJpbnQoIiBfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18iKQogICAgICAgIHByaW50KCJ8ICAgICAgICAgICAgfCAgICAgICAgICAgICB8ICAgICAgfCAgICAgICAgICB8ICAgICAgICAgIHwgICAgICAgIHwgICAgICAgICB8ICAgICAgICAgICAgfCAgICAgICB8ICAgICAgfCIpCiAgICAgICAgcHJpbnQoInwgQ2FsY3VsYXRvciB8IENoYW5nZSBOYW1lIHwgSm9rZSB8IENhbGVuZGFyIHwgRGF0ZXRpbWUgfCBSaWRkbGUgfCBDcmVkaXRzIHwgTWF0aHMgUXVpeiB8IFRpbWVyIHwgRXhpdCB8IikKICAgICAgICBwcmludCgifF9fX19fX19fX19fX3xfX19fX19fX19fX19ffF9fX19fX3xfX19fX19fX19ffF9fX19fX19fX198X19fX19fX198X19fX19fX19ffF9fX19fX19fX19fX3xfX19fX19ffF9fX19fX3wiKQogICAgICAgIHByaW50KCIiKQogICAgZWxpZiBlID09ICJkYXRldGltZSIgb3IgZSA9PSAiZGF0ZSIgb3IgZSA9PSAidGltZSI6CiAgICAgICAgZGF0ZSA9ICJEYXRlOiAiCiAgICAgICAgZm9yIGNoYXIgaW4gZGF0ZToKICAgICAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNDUpCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIHByaW50KGNoYXIsIGVuZD0iIikKICAgICAgICAgICAgICAgIHN5cy5zdGRvdXQuZmx1c2goKQogICAgICAgIHByaW50KCIiKQogICAgICAgIHRpbWUuc2xlZXAoMSkgICAgICAgIAogICAgICAgIGRhdGUgPSAoIiVkIiUgbm93LmRheSwiLyIsICIlZCIlIG5vdy5tb250aCwiLyIsICIlZCIlIG5vdy55ZWFyKQogICAgICAgIGZvciBjaGFyIGluIGRhdGU6CiAgICAgICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDQ1KQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBwcmludChjaGFyLCBlbmQ9IiIpCiAgICAgICAgICAgICAgICBzeXMuc3Rkb3V0LmZsdXNoKCkKICAgICAgICBwcmludCgiIikgCiAgICAgICAgdGltZTExID0gIlRpbWU6ICIKICAgICAgICBmb3IgY2hhciBpbiB0aW1lMTE6CiAgICAgICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDQ1KQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBwcmludChjaGFyLCBlbmQ9IiIpCiAgICAgICAgICAgICAgICBzeXMuc3Rkb3V0LmZsdXNoKCkKICAgICAgICBwcmludCgiIikgICAgICAgIAogICAgICAgIHRpbWUuc2xlZXAoMSkKICAgICAgICB0aW1lMTIgPSAoIiVkIiUgbm93LmhvdXIsICI6IiwgIiVkIiUgbm93Lm1pbnV0ZSwgIjoiLCAiJWQiJSBub3cuc2Vjb25kKQogICAgICAgIGZvciBjaGFyIGluIHRpbWUxMjoKICAgICAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNDUpCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIHByaW50KGNoYXIsIGVuZD0iIikKICAgICAgICAgICAgICAgIHN5cy5zdGRvdXQuZmx1c2goKQogICAgICAgIHByaW50KCIiKSAKICAgIGVsaWYgZSA9PSAid2hvIGFyZSB5b3UiIG9yIGU9PSAid2hvIGFyZSB5b3U/IiBvciBlID09ICJ3aGF0IGlzIHlvdXIgbmFtZT8iIG9yIGUgPT0gIndobyBhcmUgeW91PyIgb3IgZSA9PSAiaW5mbyIgb3IgZSA9PSAid2hhdCBhcmUgeW91PyI6CiAgICAgICAgcHJpbnQoIkkgYW0gQS5JLlIuIEl0IHRvb2sgbXkgcHJvZ3JhbW1lciBhIExPTkcgdGltZSB0byBwcm9ncmFtIG1lLCBzbyBwbGVhc2UgdXB2b3RlIGZvciBtZS4iKQogICAgZWxpZiBlID09ICJjcmVkaXRzIjoKICAgICAgICAKICAgICAgICBmb3IgY2hhciBpbiAiQS5JLlIgKGFrYSBNRSkgd2FzIGNyZWF0ZWQgb3ZlciBhIHRpbWUgcGVyaW9kIG9mIGFib3V0IGEgbW9udGggYnkgQFNKQ19NdWhhbW1hZC4iOgogICAgICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA0NSkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgcHJpbnQoY2hhciwgZW5kPSIiKQogICAgICAgICAgICAgICAgc3lzLnN0ZG91dC5mbHVzaCgpCiAgICAgICAgcHJpbnQoIiIpIAogICAgICAgIAogICAgICAgIGZvciBjaGFyIGluICJZb3UgY2FuIHB1dCBzdWdnZXN0aW9uIG9uIG5ldyBjb21tYW5kcyBpbiB0aGUgY29tbWVudCBzZWN0aW9uIGFuZCBAU0pDX011aGFtbWFkIHdpbGwgdHJ5IGhpcyBiZXN0IHRvIGFkZCB0aGUgY29tbWFuZCB0byBBLkkuUi4iOgogICAgICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA0NSkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgcHJpbnQoY2hhciwgZW5kPSIiKQogICAgICAgICAgICAgICAgc3lzLnN0ZG91dC5mbHVzaCgpCiAgICAgICAgcHJpbnQoIiIpCiAgICAgICAgCiAgICAgICAgZm9yIGNoYXIgaW4gIlAuUy4gVXB2b3RlIGZvciBuZXcgdGhpbmdzLiI6CiAgICAgICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDQ1KQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBwcmludChjaGFyLCBlbmQ9IiIpCiAgICAgICAgICAgICAgICBzeXMuc3Rkb3V0LmZsdXNoKCkKICAgICAgICBwcmludCgiIikKICAgICAgICBmb3IgY2hhciBpbiAiX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fXyI6CiAgICAgICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDQ1KQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBwcmludChjaGFyLCBlbmQ9IiIpCiAgICAgICAgICAgICAgICBzeXMuc3Rkb3V0LmZsdXNoKCkKICAgICAgICBwcmludCgiIikKICAgICAgICB0aW1lLnNsZWVwKDEpCiAgICAgICAgCiAgICAgICAgZm9yIGNoYXIgaW4gIkpva2VzIGZyb20gTGF1Z2hGYWN0b3J5IG9uIGh0dHA6Ly93d3cubGF1Z2hmYWN0b3J5LmNvbS9qb2tlcy9sYXRlc3Qtam9rZXMuIjoKICAgICAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNDUpCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIHByaW50KGNoYXIsIGVuZD0iIikKICAgICAgICAgICAgICAgIHN5cy5zdGRvdXQuZmx1c2goKQogICAgICAgIHByaW50KCIiKQogICAgZWxpZiBlID09ICJyaWRkbGUiIG9yIGUgPT0gInRlbGwgbWUgYSByaWRkbGUiIG9yIGUgPT0gInRlbGwgbWUgYW5vdGhlciByaWRkbGUiIG9yIGUgPT0gImFub3RoZXIgcmlkZGxlIjoKICAgICAgICByaWRhbnMgPSByYW5kb20uY2hvaWNlKChyaWRkbGUxLCByaWRkbGUyLCByaWRkbGUzLCByaWRkbGU0KSkKICAgICAgICBmb3IgY2hhciBpbiByaWRhbnM6CiAgICAgICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDQ1KQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBwcmludChjaGFyLCBlbmQ9IiIpCiAgICAgICAgICAgICAgICBzeXMuc3Rkb3V0LmZsdXNoKCkKICAgICAgICBwcmludCgiIikgICAgICAgIAogICAgICAgIGlmIHJpZGFucyA9PSByaWRkbGUxOgogICAgICAgICAgICBhbnMxID0gaW5wdXQoIllvdXIgYW5zd2VyOiAiKQogICAgICAgICAgICBhbiA9IGFuczEubG93ZXIoKQogICAgICAgICAgICBpZiBhbnMxLnN0YXJ0c3dpdGgoInkiKToKICAgICAgICAgICAgICAgIGZvciBjaGFyIGluICJUaGF0J3MgY29ycmVjdCEiOgogICAgICAgICAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNDUpCiAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgcHJpbnQoY2hhciwgZW5kPSIiKQogICAgICAgICAgICAgICAgICAgIHN5cy5zdGRvdXQuZmx1c2goKQogICAgICAgICAgICAgICAgcHJpbnQoIiIpICAgIAogICAgICAgICAgICBlbHNlOgogICAgICAgICAgICAgICAgZm9yIGNoYXIgaW4gIlRoYXQncyB3cm9uZy4gVGhzIHJpZ2h0IGFuc3dlciBpczogWWVzLiBUaGUgRW1waXJlIFN0YXRlIEJ1aWxkaW5nIGNhbid0IGp1bXAuIjoKICAgICAgICAgICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDQ1KQogICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgIHByaW50KGNoYXIsIGVuZD0iIikKICAgICAgICAgICAgICAgICAgICBzeXMuc3Rkb3V0LmZsdXNoKCkKICAgICAgICAgICAgICAgIHByaW50KCIiKQogICAgICAgIGVsaWYgcmlkYW5zID09IHJpZGRsZTI6CiAgICAgICAgICAgIGFuczIgPSBpbnB1dCgiWW91ciBhbnN3ZXI6ICIpCiAgICAgICAgICAgIGFucyA9IGFuczIubG93ZXIoKQogICAgICAgICAgICBpZiBhbnMgPT0gImNhc2hldyI6CiAgICAgICAgICAgICAgICBmb3IgY2hhciBpbiAiVGhhdCdzIGNvcnJlY3QhIjoKICAgICAgICAgICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDQ1KQogICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgIHByaW50KGNoYXIsIGVuZD0iIikKICAgICAgICAgICAgICAgICAgICBzeXMuc3Rkb3V0LmZsdXNoKCkKICAgICAgICAgICAgICAgIHByaW50KCIiKSAKICAgICAgICAgICAgZWxzZToKICAgICAgICAgICAgICAgIGZvciBjaGFyIGluICJUaGF0J3Mgd3JvbmcuIFRocyByaWdodCBhbnN3ZXIgaXM6IENhc2hldy4iOgogICAgICAgICAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNDUpCiAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgcHJpbnQoY2hhciwgZW5kPSIiKQogICAgICAgICAgICAgICAgICAgIHN5cy5zdGRvdXQuZmx1c2goKQogICAgICAgICAgICAgICAgcHJpbnQoIiIpIAogICAgICAgIGVsaWYgcmlkYW5zID09IHJpZGRsZTM6CiAgICAgICAgICAgIGFuczMgPSBpbnB1dCgiWW91ciBhbnN3ZXI6ICIpCiAgICAgICAgICAgIGFuczEzID0gYW5zMy5sb3dlcigpCiAgICAgICAgICAgIGlmIGFuczEzID09ICJoZSB3YXMgYm9ybiBvbiBmZWJydWFyeSAyOXRoIiBvciBhbnMxMyA9PSAiaGUgd2FzIGJvcm4gaW4gYSBsZWFwIHllYXIiOgogICAgICAgICAgICAgICAgZm9yIGNoYXIgaW4gIlRoYXQncyBjb3JyZWN0ISI6CiAgICAgICAgICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA0NSkKICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICBwcmludChjaGFyLCBlbmQ9IiIpCiAgICAgICAgICAgICAgICAgICAgc3lzLnN0ZG91dC5mbHVzaCgpCiAgICAgICAgICAgICAgICBwcmludCgiIikKICAgICAgICAgICAgZWxzZToKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgZm9yIGNoYXIgaW4gIlRoYXQncyB3cm9uZy4gVGhzIHJpZ2h0IGFuc3dlciBpczogSGUgd2FzIGJvcm4gb24gRmVicnVhcnkgMjl0aC4iOgogICAgICAgICAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNDUpCiAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgcHJpbnQoY2hhciwgZW5kPSIiKQogICAgICAgICAgICAgICAgICAgIHN5cy5zdGRvdXQuZmx1c2goKQogICAgICAgICAgICAgICAgcHJpbnQoIiIpCiAgICAgICAgZWxpZiByaWRhbnMgPT0gcmlkZGxlNDoKICAgICAgICAgICAgYW5zNCA9IGlucHV0KCJZb3VyIGFuc3dlcjogIikKICAgICAgICAgICAgYW5zMTQgPSBhbnM0Lmxvd2VyKCkKICAgICAgICAgICAgaWYgYW5zMTQgPT0gImhlIGRvZXNuJ3QgcGF5IGEgZGltZS4gaGUgcGF5cyAkODcwMCI6CiAgICAgICAgICAgICAgICBmb3IgY2hhciBpbiAiVGhhdCdzIGNvcnJlY3QhIjoKICAgICAgICAgICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDQ1KQogICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgIHByaW50KGNoYXIsIGVuZD0iIikKICAgICAgICAgICAgICAgICAgICBzeXMuc3Rkb3V0LmZsdXNoKCkKICAgICAgICAgICAgICAgIHByaW50KCIiKQogICAgICAgICAgICBlbHNlOgogICAgICAgICAgICAgICAgZm9yIGNoYXIgaW4gIlRoYXQncyB3cm9uZy4gVGhzIHJpZ2h0IGFuc3dlciBpczogSGUgZG9lc24ndCBwYXkgYSBkaW1lLiBIZSBwYXlzICQ4NzAwLiI6CiAgICAgICAgICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA0NSkKICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICBwcmludChjaGFyLCBlbmQ9IiIpCiAgICAgICAgICAgICAgICAgICAgc3lzLnN0ZG91dC5mbHVzaCgpCiAgICAgICAgICAgICAgICBwcmludCgiIikKICAgIGVsaWYgZSA9PSAidGhhbmtzIiBvciBlID09ICJ0aGFuayB5b3UiIG9yIGUgPT0gInRoYW5rcyBicm8iIG9yIGUgPT0gInRoYW5rcyB5ZWFoIiBvciBlID09ICJ0aGFuayB5b3Ugc28gbXVjaCI6CiAgICAgICAgZm9yIGNoYXIgaW4gIk5vIG5lZWQgdG8gbWVudGlvbiBpdC4gOikiOgogICAgICAgICAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNDUpCiAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgcHJpbnQoY2hhciwgZW5kPSIiKQogICAgICAgICAgICAgICAgICAgIHN5cy5zdGRvdXQuZmx1c2goKQogICAgICAgIHByaW50KCIiKQogICAgICAgIAogICAgZWxpZiBlID09ICJtYXRocyIgb3IgZSA9PSAibWF0aCIgb3IgZSA9PSAibWF0aHMgcXVpeiIgb3IgZSA9PSAibWF0aCBxdWl6IjoKICAgICAgICBjbGVhcigpCiAgICAgICAgZm9yIGNoYXIgaW4gIldlbGNvbWUgdG8gdGhlIE1hdGhzIFF1aXohIjoKICAgICAgICAgICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDQ1KQogICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgIHByaW50KGNoYXIsIGVuZD0iIikKICAgICAgICAgICAgICAgICAgICBzeXMuc3Rkb3V0LmZsdXNoKCkKICAgICAgICBwcmludCgiIikKICAgICAgICB0aW1lLnNsZWVwKDEpCiAgICAgICAgY2xlYXIoKQogICAgICAgIGZvciBpIGluIHJhbmdlKDIpOgogICAgICAgICAgICBwcmludCgiV2VsY29tZSB0byB0aGUgTWF0aHMgUXVpeiEiKQogICAgICAgICAgICBwcmludCgiTG9hZGluZy4uLiIpCiAgICAgICAgICAgIHByaW50KCIiKQogICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDcpCiAgICAgICAgICAgIGNsZWFyKCkKICAgICAgICAgICAgcHJpbnQoIldlbGNvbWUgdG8gdGhlIE1hdGhzIFF1aXohIikKICAgICAgICAgICAgcHJpbnQoIkxvYWRpbmcuLi4iKQogICAgICAgICAgICBwcmludCgifCIpCiAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNykKICAgICAgICAgICAgY2xlYXIoKQogICAgICAgICAgICBwcmludCgiV2VsY29tZSB0byB0aGUgTWF0aHMgUXVpeiEiKQogICAgICAgICAgICBwcmludCgiTG9hZGluZy4uLiIpCiAgICAgICAgICAgIHByaW50KCJ8fCIpCiAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNykKICAgICAgICAgICAgY2xlYXIoKQogICAgICAgICAgICBwcmludCgiV2VsY29tZSB0byB0aGUgTWF0aHMgUXVpeiEiKQogICAgICAgICAgICBwcmludCgiTG9hZGluZy4uLiIpCiAgICAgICAgICAgIHByaW50KCJ8fHwiKQogICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDcpCiAgICAgICAgICAgIGNsZWFyKCkKICAgICAgICAgICAgcHJpbnQoIldlbGNvbWUgdG8gdGhlIE1hdGhzIFF1aXohIikKICAgICAgICAgICAgcHJpbnQoIkxvYWRpbmcuLi4iKQogICAgICAgICAgICBwcmludCgifHx8fCIpCiAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNykKICAgICAgICAgICAgY2xlYXIoKQogICAgICAgICAgICBwcmludCgiV2VsY29tZSB0byB0aGUgTWF0aHMgUXVpeiEiKQogICAgICAgICAgICBwcmludCgiTG9hZGluZy4uLiIpCiAgICAgICAgICAgIHByaW50KCJ8fHx8fCIpCiAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNykKICAgICAgICAgICAgY2xlYXIoKQogICAgICAgICAgICBwcmludCgiV2VsY29tZSB0byB0aGUgTWF0aHMgUXVpeiEiKQogICAgICAgICAgICBwcmludCgiTG9hZGluZy4uLiIpCiAgICAgICAgICAgIHByaW50KCIgfHx8fHwiKQogICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDcpCiAgICAgICAgICAgIGNsZWFyKCkKICAgICAgICAgICAgcHJpbnQoIldlbGNvbWUgdG8gdGhlIE1hdGhzIFF1aXohIikKICAgICAgICAgICAgcHJpbnQoIkxvYWRpbmcuLi4iKQogICAgICAgICAgICBwcmludCgiICB8fHx8fCIpCiAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNykKICAgICAgICAgICAgY2xlYXIoKQogICAgICAgICAgICBwcmludCgiV2VsY29tZSB0byB0aGUgTWF0aHMgUXVpeiEiKQogICAgICAgICAgICBwcmludCgiTG9hZGluZy4uLiIpCiAgICAgICAgICAgIHByaW50KCIgICB8fHx8fCIpCiAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNykKICAgICAgICAgICAgY2xlYXIoKQogICAgICAgICAgICBwcmludCgiV2VsY29tZSB0byB0aGUgTWF0aHMgUXVpeiEiKQogICAgICAgICAgICBwcmludCgiTG9hZGluZy4uLiIpCiAgICAgICAgICAgIHByaW50KCIgICAgfHx8fHwiKQogICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDcpCiAgICAgICAgICAgIGNsZWFyKCkKICAgICAgICAgICAgcHJpbnQoIldlbGNvbWUgdG8gdGhlIE1hdGhzIFF1aXohIikKICAgICAgICAgICAgcHJpbnQoIkxvYWRpbmcuLi4iKQogICAgICAgICAgICBwcmludCgiICAgICB8fHx8fCIpCiAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNykKICAgICAgICAgICAgY2xlYXIoKQogICAgICAgICAgICBwcmludCgiV2VsY29tZSB0byB0aGUgTWF0aHMgUXVpeiEiKQogICAgICAgICAgICBwcmludCgiTG9hZGluZy4uLiIpCiAgICAgICAgICAgIHByaW50KCIgICAgICB8fHx8IikKICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA3KQogICAgICAgICAgICBjbGVhcigpCiAgICAgICAgICAgIHByaW50KCJXZWxjb21lIHRvIHRoZSBNYXRocyBRdWl6ISIpCiAgICAgICAgICAgIHByaW50KCJMb2FkaW5nLi4uIikKICAgICAgICAgICAgcHJpbnQoIiAgICAgICB8fHwiKQogICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDcpCiAgICAgICAgICAgIGNsZWFyKCkKICAgICAgICAgICAgcHJpbnQoIldlbGNvbWUgdG8gdGhlIE1hdGhzIFF1aXohIikKICAgICAgICAgICAgcHJpbnQoIkxvYWRpbmcuLi4iKQogICAgICAgICAgICBwcmludCgiICAgICAgICB8fCIpCiAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNykKICAgICAgICAgICAgY2xlYXIoKQogICAgICAgICAgICBwcmludCgiV2VsY29tZSB0byB0aGUgTWF0aHMgUXVpeiEiKQogICAgICAgICAgICBwcmludCgiTG9hZGluZy4uLiIpCiAgICAgICAgICAgIHByaW50KCIgICAgICAgICB8IikKICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA3KQogICAgICAgICAgICBjbGVhcigpCiAgICAgICAgICAgIHByaW50KCJXZWxjb21lIHRvIHRoZSBNYXRocyBRdWl6ISIpCiAgICAgICAgICAgIHByaW50KCJMb2FkaW5nLi4uIikKICAgICAgICAgICAgcHJpbnQoIiAgICAgICAgICAiKQogICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDcpCiAgICAgICAgICAgIGNsZWFyKCkKICAgICAgICBzY29yZSA9IDAKICAgICAgICAKICAgICAgICBjbGVhcigpCiAgICAgICAgcXVlc3Rpb25zMSA9ICJIb3cgbWFueSBxdWVzdGlvbnMgZG8geW91IHdhbnQ/IgogICAgICAgIGZvciBjaGFyIGluIHF1ZXN0aW9uczE6CiAgICAgICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDQ1KQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBwcmludChjaGFyLCBlbmQ9IiIpCiAgICAgICAgICAgICAgICBzeXMuc3Rkb3V0LmZsdXNoKCkKICAgICAgICBwcmludCgiIikgICAgICAgIAogICAgICAgIHJlc3AgPSBpbnQoaW5wdXQoKSkKICAgICAgICBmb3IgY2hhciBpbiAiUHJlcGFyaW5nIHF1ZXN0aW9ucy4uLiI6CiAgICAgICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDQ1KQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBwcmludChjaGFyLCBlbmQ9IiIpCiAgICAgICAgICAgICAgICBzeXMuc3Rkb3V0LmZsdXNoKCkKICAgICAgICBwcmludCgiIikKICAgICAgICB0aW1lLnNsZWVwKDAuMDcpCiAgICAgICAgY2xlYXIoKSAKICAgICAgICBmb3IgaSBpbiByYW5nZSgyKToKICAgICAgICAgICAgcHJpbnQoIlByZXBhcmluZyBxdWVzdGlvbnMuLi4iKQogICAgICAgICAgICBwcmludCgiTG9hZGluZy4uLiIpCiAgICAgICAgICAgIHByaW50KCIiKQogICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDcpCiAgICAgICAgICAgIGNsZWFyKCkKICAgICAgICAgICAgcHJpbnQoIlByZXBhcmluZyBxdWVzdGlvbnMuLi4iKQogICAgICAgICAgICBwcmludCgiTG9hZGluZy4uLiIpCiAgICAgICAgICAgIHByaW50KCJ8IikKICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA3KQogICAgICAgICAgICBjbGVhcigpCiAgICAgICAgICAgIHByaW50KCJQcmVwYXJpbmcgcXVlc3Rpb25zLi4uIikKICAgICAgICAgICAgcHJpbnQoIkxvYWRpbmcuLi4iKQogICAgICAgICAgICBwcmludCgifHwiKQogICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDcpCiAgICAgICAgICAgIGNsZWFyKCkKICAgICAgICAgICAgcHJpbnQoIlByZXBhcmluZyBxdWVzdGlvbnMuLi4iKQogICAgICAgICAgICBwcmludCgiTG9hZGluZy4uLiIpCiAgICAgICAgICAgIHByaW50KCJ8fHwiKQogICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDcpCiAgICAgICAgICAgIGNsZWFyKCkKICAgICAgICAgICAgcHJpbnQoIlByZXBhcmluZyBxdWVzdGlvbnMuLi4iKQogICAgICAgICAgICBwcmludCgiTG9hZGluZy4uLiIpCiAgICAgICAgICAgIHByaW50KCJ8fHx8IikKICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA3KQogICAgICAgICAgICBjbGVhcigpCiAgICAgICAgICAgIHByaW50KCJQcmVwYXJpbmcgcXVlc3Rpb25zLi4uIikKICAgICAgICAgICAgcHJpbnQoIkxvYWRpbmcuLi4iKQogICAgICAgICAgICBwcmludCgifHx8fHwiKQogICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDcpCiAgICAgICAgICAgIGNsZWFyKCkKICAgICAgICAgICAgcHJpbnQoIlByZXBhcmluZyBxdWVzdGlvbnMuLi4iKQogICAgICAgICAgICBwcmludCgiTG9hZGluZy4uLiIpCiAgICAgICAgICAgIHByaW50KCIgfHx8fHwiKQogICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDcpCiAgICAgICAgICAgIGNsZWFyKCkKICAgICAgICAgICAgcHJpbnQoIlByZXBhcmluZyBxdWVzdGlvbnMuLi4iKQogICAgICAgICAgICBwcmludCgiTG9hZGluZy4uLiIpCiAgICAgICAgICAgIHByaW50KCIgIHx8fHx8IikKICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA3KQogICAgICAgICAgICBjbGVhcigpCiAgICAgICAgICAgIHByaW50KCJQcmVwYXJpbmcgcXVlc3Rpb25zLi4uIikKICAgICAgICAgICAgcHJpbnQoIkxvYWRpbmcuLi4iKQogICAgICAgICAgICBwcmludCgiICAgfHx8fHwiKQogICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDcpCiAgICAgICAgICAgIGNsZWFyKCkKICAgICAgICAgICAgcHJpbnQoIlByZXBhcmluZyBxdWVzdGlvbnMuLi4iKQogICAgICAgICAgICBwcmludCgiTG9hZGluZy4uLiIpCiAgICAgICAgICAgIHByaW50KCIgICAgfHx8fHwiKQogICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDcpCiAgICAgICAgICAgIGNsZWFyKCkKICAgICAgICAgICAgcHJpbnQoIlByZXBhcmluZyBxdWVzdGlvbnMuLi4iKQogICAgICAgICAgICBwcmludCgiTG9hZGluZy4uLiIpCiAgICAgICAgICAgIHByaW50KCIgICAgIHx8fHx8IikKICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA3KQogICAgICAgICAgICBjbGVhcigpCiAgICAgICAgICAgIHByaW50KCJQcmVwYXJpbmcgcXVlc3Rpb25zLi4uIikKICAgICAgICAgICAgcHJpbnQoIkxvYWRpbmcuLi4iKQogICAgICAgICAgICBwcmludCgiICAgICAgfHx8fCIpCiAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNykKICAgICAgICAgICAgY2xlYXIoKQogICAgICAgICAgICBwcmludCgiUHJlcGFyaW5nIHF1ZXN0aW9ucy4uLiIpCiAgICAgICAgICAgIHByaW50KCJMb2FkaW5nLi4uIikKICAgICAgICAgICAgcHJpbnQoIiAgICAgICB8fHwiKQogICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDcpCiAgICAgICAgICAgIGNsZWFyKCkKICAgICAgICAgICAgcHJpbnQoIlByZXBhcmluZyBxdWVzdGlvbnMuLi4iKQogICAgICAgICAgICBwcmludCgiTG9hZGluZy4uLiIpCiAgICAgICAgICAgIHByaW50KCIgICAgICAgIHx8IikKICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA3KQogICAgICAgICAgICBjbGVhcigpCiAgICAgICAgICAgIHByaW50KCJQcmVwYXJpbmcgcXVlc3Rpb25zLi4uIikKICAgICAgICAgICAgcHJpbnQoIkxvYWRpbmcuLi4iKQogICAgICAgICAgICBwcmludCgiICAgICAgICAgfCIpCiAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNykKICAgICAgICAgICAgY2xlYXIoKQogICAgICAgICAgICBwcmludCgiUHJlcGFyaW5nIHF1ZXN0aW9ucy4uLiIpCiAgICAgICAgICAgIHByaW50KCJMb2FkaW5nLi4uIikKICAgICAgICAgICAgcHJpbnQoIiAgICAgICAgICAiKQogICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDcpCiAgICAgICAgICAgIGNsZWFyKCkKICAgICAgICBxID0gMQogICAgICAgIGZvciBpIGluIHJhbmdlKHJlc3ApOgogICAgICAgICAgICAKICAgICAgICAgICAgY2xlYXIoKQogICAgICAgICAgICBudW0xID0gcmFuZGludCgxLCAxMDApCiAgICAgICAgICAgIG51bTIgPSByYW5kaW50KDEsIDEwMCkKICAgICAgICAgICAgb3AgPSByYW5kb20uY2hvaWNlKCgiYSIsICJzIiwgIm0iKSkKICAgICAgICAgICAgaWYgb3AgPT0gImEiOgogICAgICAgICAgICAgICAgZm9yIGNoYXIgaW4gKHEsICIuIFdoYXQgaXMgIiwgbnVtMSwgIisiLCBudW0yLCAiPyIpOgogICAgICAgICAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNDUpCiAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgcHJpbnQoY2hhciwgZW5kPSIiKQogICAgICAgICAgICAgICAgICAgIHN5cy5zdGRvdXQuZmx1c2goKQogICAgICAgICAgICAgICAgcHJpbnQoIiIpCiAgICAgICAgICAgICAgICBxID0gcSsxCiAgICAgICAgICAgICAgICBhbnMgPSBmbG9hdChpbnB1dCgpKQogICAgICAgICAgICAgICAgaWYgYW5zID09IG51bTErbnVtMjoKICAgICAgICAgICAgICAgICAgICBzY29yZSA9IHNjb3JlKzEKICAgICAgICAgICAgICAgICAgICBmb3IgY2hhciBpbiAiVGhhdCdzIGNvcnJlY3QhIjoKICAgICAgICAgICAgICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA0NSkKICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgIHByaW50KGNoYXIsIGVuZD0iIikKICAgICAgICAgICAgICAgICAgICAgICAgc3lzLnN0ZG91dC5mbHVzaCgpCiAgICAgICAgICAgICAgICAgICAgcHJpbnQoIiIpCiAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBlbHNlOgogICAgICAgICAgICAgICAgICAgIGZvciBjaGFyIGluICgiVGhhdCdzIHdyb25nLiBUaGUgcmlnaHQgYW5zd2VyIGlzICIsIG51bTErbnVtMiwgIi4iKToKICAgICAgICAgICAgICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA0NSkKICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgIHByaW50KGNoYXIsIGVuZD0iIikKICAgICAgICAgICAgICAgICAgICAgICAgc3lzLnN0ZG91dC5mbHVzaCgpCiAgICAgICAgICAgICAgICAgICAgcHJpbnQoIiIpCiAgICAgICAgICAgIGVsaWYgb3AgPT0gInMiOgogICAgICAgICAgICAgICAgZm9yIGNoYXIgaW4gKHEsICIuIFdoYXQgaXMgIiwgbnVtMSwgIi0iLCBudW0yLCAiPyIpOgogICAgICAgICAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNDUpCiAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgcHJpbnQoY2hhciwgZW5kPSIiKQogICAgICAgICAgICAgICAgICAgIHN5cy5zdGRvdXQuZmx1c2goKQogICAgICAgICAgICAgICAgcHJpbnQoIiIpCiAgICAgICAgICAgICAgICBxID0gcSsxCiAgICAgICAgICAgICAgICBhbnMgPSBmbG9hdChpbnB1dCgpKQogICAgICAgICAgICAgICAgaWYgYW5zID09IG51bTEtbnVtMjoKICAgICAgICAgICAgICAgICAgICBzY29yZSA9IHNjb3JlKzEKICAgICAgICAgICAgICAgICAgICBmb3IgY2hhciBpbiAiVGhhdCdzIGNvcnJlY3QhIjoKICAgICAgICAgICAgICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA0NSkKICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgIHByaW50KGNoYXIsIGVuZD0iIikKICAgICAgICAgICAgICAgICAgICAgICAgc3lzLnN0ZG91dC5mbHVzaCgpCiAgICAgICAgICAgICAgICAgICAgcHJpbnQoIiIpCiAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBlbHNlOgogICAgICAgICAgICAgICAgICAgIGZvciBjaGFyIGluICgiVGhhdCdzIHdyb25nLiBUaGUgcmlnaHQgYW5zd2VyIGlzICIsIG51bTEtbnVtMiwgIi4iKToKICAgICAgICAgICAgICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA0NSkKICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgIHByaW50KGNoYXIsIGVuZD0iIikKICAgICAgICAgICAgICAgICAgICAgICAgc3lzLnN0ZG91dC5mbHVzaCgpCiAgICAgICAgICAgICAgICAgICAgcHJpbnQoIiIpCiAgICAgICAgICAgIGVsaWYgb3AgPT0gIm0iOgogICAgICAgICAgICAgICAgZm9yIGNoYXIgaW4gKHEsICIuIFdoYXQgaXMgIiwgbnVtMSwgIngiLCBudW0yLCAiPyIpOgogICAgICAgICAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNDUpCiAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgcHJpbnQoY2hhciwgZW5kPSIiKQogICAgICAgICAgICAgICAgICAgIHN5cy5zdGRvdXQuZmx1c2goKQogICAgICAgICAgICAgICAgcHJpbnQoIiIpCiAgICAgICAgICAgICAgICBxID0gcSsxCiAgICAgICAgICAgICAgICBhbnMgPSBmbG9hdChpbnB1dCgpKQogICAgICAgICAgICAgICAgaWYgYW5zID09IG51bTEqbnVtMjoKICAgICAgICAgICAgICAgICAgICBzY29yZSA9IHNjb3JlKzEKICAgICAgICAgICAgICAgICAgICBmb3IgY2hhciBpbiAiVGhhdCdzIGNvcnJlY3QhIjoKICAgICAgICAgICAgICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA0NSkKICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgIHByaW50KGNoYXIsIGVuZD0iIikKICAgICAgICAgICAgICAgICAgICAgICAgc3lzLnN0ZG91dC5mbHVzaCgpCiAgICAgICAgICAgICAgICAgICAgcHJpbnQoIiIpCiAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBlbHNlOgogICAgICAgICAgICAgICAgICAgIGZvciBjaGFyIGluICgiVGhhdCdzIHdyb25nLiBUaGUgcmlnaHQgYW5zd2VyIGlzICIsIG51bTEqbnVtMiwgIi4iKToKICAgICAgICAgICAgICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA0NSkKICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgIHByaW50KGNoYXIsIGVuZD0iIikKICAgICAgICAgICAgICAgICAgICAgICAgc3lzLnN0ZG91dC5mbHVzaCgpCiAgICAgICAgICAgICAgICAgICAgcHJpbnQoIiIpICAgICAgICAgICAgICAgIAogICAgICAgICAgICBmb3IgY2hhciBpbiAoIkN1cnJlbnQgc2NvcmU6ICIsIHNjb3JlKToKICAgICAgICAgICAgICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA0NSkKICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgIHByaW50KGNoYXIsIGVuZD0iIikKICAgICAgICAgICAgICAgICAgICAgICAgc3lzLnN0ZG91dC5mbHVzaCgpCiAgICAgICAgICAgIAogICAgICAgICAgICAKICAgICAgICAgICAgZm9yIGNoYXIgaW4gKCIgb3V0IG9mICIsIHJlc3AsICIuIik6CiAgICAgICAgICAgICAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNDUpCiAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICBwcmludChjaGFyLCBlbmQ9IiIpCiAgICAgICAgICAgICAgICAgICAgICAgIHN5cy5zdGRvdXQuZmx1c2goKQogICAgICAgICAgICBwcmludCgiIikKICAgICAgICAgICAgdGltZS5zbGVlcCgxKSAgICAgICAgIAogICAgICAgIAogICAgICAgICAgICAgCiAgICAgICAgcGVyY2VudGFnZSA9IHJvdW5kKChzY29yZS9yZXNwKSoxMDApCiAgICAgICAgZm9yIGNoYXIgaW4gKCJZb3UgZ290ICIsIHBlcmNlbnRhZ2UpOgogICAgICAgICAgICAgICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDQ1KQogICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgcHJpbnQoY2hhciwgZW5kPSIiKQogICAgICAgICAgICAgICAgICAgICAgICBzeXMuc3Rkb3V0LmZsdXNoKCkKICAgICAgICBmb3IgY2hhciBpbiAiJS4iOgogICAgICAgICAgICAgICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDQ1KQogICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgcHJpbnQoY2hhciwgZW5kPSIiKQogICAgICAgICAgICAgICAgICAgICAgICBzeXMuc3Rkb3V0LmZsdXNoKCkKICAgICAgICBwcmludCgiIikgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgCiAgICAgICAgCiAgICAgICAgaWYgcm91bmQoKHNjb3JlL3Jlc3ApKjEwMCkgPT0gMTAwOgogICAgICAgICAgICBmb3IgY2hhciBpbiAiRXhjZWxsZW50LCAiOgogICAgICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA0NSkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgcHJpbnQoY2hhciwgZW5kPSIiKQogICAgICAgICAgICAgICAgc3lzLnN0ZG91dC5mbHVzaCgpCiAgICAgICAgICAgIGZvciBjaGFyIGluIG5hbWU6CiAgICAgICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDQ1KQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBwcmludChjaGFyLCBlbmQ9IiIpCiAgICAgICAgICAgICAgICBzeXMuc3Rkb3V0LmZsdXNoKCkKICAgICAgICAgICAgZm9yIGNoYXIgaW4gIiEiOgogICAgICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA0NSkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgcHJpbnQoY2hhciwgZW5kPSIiKQogICAgICAgICAgICAgICAgc3lzLnN0ZG91dC5mbHVzaCgpCiAgICAgICAgICAgIGZvciBjaGFyIGluICIgWW91IGdvdCAxMDAlISI6CiAgICAgICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDQ1KQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBwcmludChjaGFyLCBlbmQ9IiIpCiAgICAgICAgICAgICAgICBzeXMuc3Rkb3V0LmZsdXNoKCkgICAgICAgICAgICAKICAgICAgICAgICAgcHJpbnQoIiIpIAogICAgICAgIGVsaWYgcm91bmQoKHNjb3JlL3Jlc3ApKjEwMCkgPiA5MDoKICAgICAgICAgICAgZm9yIGNoYXIgaW4gIldlbGwgZG9uZSwgIjoKICAgICAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNDUpCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIHByaW50KGNoYXIsIGVuZD0iIikKICAgICAgICAgICAgICAgIHN5cy5zdGRvdXQuZmx1c2goKQogICAgICAgICAgICBmb3IgY2hhciBpbiBuYW1lOgogICAgICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA0NSkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgcHJpbnQoY2hhciwgZW5kPSIiKQogICAgICAgICAgICAgICAgc3lzLnN0ZG91dC5mbHVzaCgpCiAgICAgICAgICAgIGZvciBjaGFyIGluICIhIjoKICAgICAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNDUpCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIHByaW50KGNoYXIsIGVuZD0iIikKICAgICAgICAgICAgICAgIHN5cy5zdGRvdXQuZmx1c2goKQogICAgICAgICAgICBmb3IgY2hhciBpbiAiIFlvdSBnb3QgbW9yZSB0aGFuIDkwJSEiOgogICAgICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA0NSkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgcHJpbnQoY2hhciwgZW5kPSIiKQogICAgICAgICAgICAgICAgc3lzLnN0ZG91dC5mbHVzaCgpICAgICAgICAgICAgCiAgICAgICAgICAgIHByaW50KCIiKSAKICAgICAgICBlbGlmIHJvdW5kKChzY29yZS9yZXNwKSoxMDApID4gODA6CiAgICAgICAgICAgIGZvciBjaGFyIGluICJXZWxsIGRvbmUsICI6CiAgICAgICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDQ1KQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBwcmludChjaGFyLCBlbmQ9IiIpCiAgICAgICAgICAgICAgICBzeXMuc3Rkb3V0LmZsdXNoKCkKICAgICAgICAgICAgZm9yIGNoYXIgaW4gbmFtZToKICAgICAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNDUpCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIHByaW50KGNoYXIsIGVuZD0iIikKICAgICAgICAgICAgICAgIHN5cy5zdGRvdXQuZmx1c2goKQogICAgICAgICAgICBmb3IgY2hhciBpbiAiLiI6CiAgICAgICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDQ1KQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBwcmludChjaGFyLCBlbmQ9IiIpCiAgICAgICAgICAgICAgICBzeXMuc3Rkb3V0LmZsdXNoKCkKICAgICAgICAgICAgZm9yIGNoYXIgaW4gIiBZb3UgZ290IGhpZ2hlciB0aGFuIDgwJS4iOgogICAgICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA0NSkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgcHJpbnQoY2hhciwgZW5kPSIiKQogICAgICAgICAgICAgICAgc3lzLnN0ZG91dC5mbHVzaCgpICAgICAgICAgICAgCiAgICAgICAgICAgIHByaW50KCIiKSAKICAgICAgICBlbGlmIHJvdW5kKChzY29yZS9yZXNwKSoxMDApID09IDgwOgogICAgICAgICAgICBmb3IgY2hhciBpbiAiV2VsbCBkb25lLCAiOgogICAgICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA0NSkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgcHJpbnQoY2hhciwgZW5kPSIiKQogICAgICAgICAgICAgICAgc3lzLnN0ZG91dC5mbHVzaCgpCiAgICAgICAgICAgIGZvciBjaGFyIGluIG5hbWU6CiAgICAgICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDQ1KQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBwcmludChjaGFyLCBlbmQ9IiIpCiAgICAgICAgICAgICAgICBzeXMuc3Rkb3V0LmZsdXNoKCkKICAgICAgICAgICAgZm9yIGNoYXIgaW4gIi4iOgogICAgICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA0NSkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgcHJpbnQoY2hhciwgZW5kPSIiKQogICAgICAgICAgICAgICAgc3lzLnN0ZG91dC5mbHVzaCgpCiAgICAgICAgICAgIGZvciBjaGFyIGluICIgWW91IGdvdCA4MCUuIjoKICAgICAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNDUpCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIHByaW50KGNoYXIsIGVuZD0iIikKICAgICAgICAgICAgICAgIHN5cy5zdGRvdXQuZmx1c2goKSAgICAgICAgICAgIAogICAgICAgICAgICBwcmludCgiIikgICAgIAogICAgICAgIGVsc2U6CiAgICAgICAgICAgIGZvciBjaGFyIGluICJVbmZvcnR1bmF0ZWx5LCAiOgogICAgICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA0NSkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgcHJpbnQoY2hhciwgZW5kPSIiKQogICAgICAgICAgICAgICAgc3lzLnN0ZG91dC5mbHVzaCgpCiAgICAgICAgICAgIGZvciBjaGFyIGluIG5hbWU6CiAgICAgICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDQ1KQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBwcmludChjaGFyLCBlbmQ9IiIpCiAgICAgICAgICAgICAgICBzeXMuc3Rkb3V0LmZsdXNoKCkKICAgICAgICAgICAgZm9yIGNoYXIgaW4gKCIsIFlvdSBnb3QgIiwgcGVyY2VudGFnZSk6CiAgICAgICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDQ1KQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBwcmludChjaGFyLCBlbmQ9IiIpCiAgICAgICAgICAgICAgICBzeXMuc3Rkb3V0LmZsdXNoKCkKICAgICAgICAgICAgZm9yIGNoYXIgaW4gIiUuIEFzIHRoaXMgaXMgYmVsb3cgODAlLCB5b3UgZmFpbC4iOgogICAgICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA0NSkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgcHJpbnQoY2hhciwgZW5kPSIiKQogICAgICAgICAgICAgICAgc3lzLnN0ZG91dC5mbHVzaCgpICAgICAgICAgICAgICAgIAogICAgICAgICAgICBwcmludCgiIikgCiAgICBlbGlmIGUgPT0gInRpbWVyIjoKICAgICAgICBmb3IgY2hhciBpbiAiV2VsY29tZSB0byB0aGUgUHl0aG9uIFRpbWVyISI6CiAgICAgICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDQ1KQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBwcmludChjaGFyLCBlbmQ9IiIpCiAgICAgICAgICAgICAgICBzeXMuc3Rkb3V0LmZsdXNoKCkKICAgICAgICBwcmludCgiIikKICAgICAgICAKICAgICAgICBtID0gaW50KGlucHV0KCJNaW51dGVzOiAiKSkKICAgICAgICBzID0gaW50KGlucHV0KCJTZWNvbmRzOiAiKSkKICAgICAgICBmb3IgaSBpbiByYW5nZSgobSo2MCkrKHMrMSkpOgogICAgICAgICAgICB0aW1lLnNsZWVwKDEpCiAgICAgICAgICAgIGNsZWFyKCkKICAgICAgICAgICAgcHJpbnQoIG0sICJNaW51dGUocykiLCBzLCAiU2Vjb25kKHMpIExlZnQiKQogICAgICAgICAgICBzID0gcy0xCiAgICAgICAgICAgIGlmIHMgPT0gLTE6CiAgICAgICAgICAgICAgICBzID0gcyArIDYwCiAgICAgICAgICAgICAgICBtID0gbS0xCiAgICAgICAgICAgIGVsaWYgbSA9PSAtMToKICAgICAgICAgICAgICAgIHByaW50KCJUaW1lJ3MgdXAhIikgIAogICAgICAgICAgICAgICAgICAKCiAgICBlbHNlOgogICAgICAgIHdoYXQgPSByYW5kb20uY2hvaWNlKChyZXNwb25zZTEsIHJlc3BvbnNlMiwgcmVzcG9uc2UzLCByZXNwb25zZTQpKQogICAgICAgIGlmIHdoYXQgPT0gcmVzcG9uc2UxOgogICAgICAgICAgICBmb3IgY2hhciBpbiByZXNwb25zZTE6CiAgICAgICAgICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA0NSkKICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICBwcmludChjaGFyLCBlbmQ9IiIpCiAgICAgICAgICAgICAgICAgICAgc3lzLnN0ZG91dC5mbHVzaCgpCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgcHJpbnQoIiIpCiAgICAgICAgZWxpZiB3aGF0ID09IHJlc3BvbnNlMjoKICAgICAgICAgICAgZm9yIGNoYXIgaW4gcmVzcG9uc2UyOgogICAgICAgICAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNDUpCiAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgcHJpbnQoY2hhciwgZW5kPSIiKQogICAgICAgICAgICAgICAgICAgIHN5cy5zdGRvdXQuZmx1c2goKQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgIHByaW50KCIiKSAgCiAgICAgICAgZWxpZiB3aGF0ID09IHJlc3BvbnNlMzoKICAgICAgICAgICAgZm9yIGNoYXIgaW4gcmVzcG9uc2UzOgogICAgICAgICAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNDUpCiAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgcHJpbnQoY2hhciwgZW5kPSIiKQogICAgICAgICAgICAgICAgICAgIHN5cy5zdGRvdXQuZmx1c2goKQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgIHByaW50KCIiKSAgICAgCiAgICAgICAgZWxpZiB3aGF0ID09IHJlc3BvbnNlNDoKICAgICAgICAgICAgZm9yIGNoYXIgaW4gcmVzcG9uc2U0OgogICAgICAgICAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNDUpCiAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgcHJpbnQoY2hhciwgZW5kPSIiKQogICAgICAgICAgICAgICAgICAgIHN5cy5zdGRvdXQuZmx1c2goKQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgIHByaW50KCIiKSAgICAgCiAgICAgICAgdGltZS5zbGVlcCgwLjA3KQogICAgICAgIHdoYXQxID0gY29sb3JlZCgiIEkgY2FuJ3QgcmVzcG9uZCB0bzogJyIsICJyZWQiKQogICAgICAgIHdoYXQyID0gY29sb3JlZCgiJy4gSWYgeW91IGFyZSB1bnN1cmUgb2YgY29tbWFuZHMsIHR5cGUgJyIsICJyZWQiKQogICAgICAgIGhlbHBtZSA9IGNvbG9yZWQoIi9oZWxwIiwgInllbGxvdyIpCgogICAgICAgIGZvciBjaGFyIGluIGNvbG9yZWQobmFtZSsiLCIsICJncmVlbiIpOgogICAgICAgICAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNDUpCiAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgcHJpbnQoY2hhciwgZW5kPSIiKQogICAgICAgICAgICAgICAgICAgIHN5cy5zdGRvdXQuZmx1c2goKQogICAgICAgIGZvciBjaGFyIGluIHdoYXQxOgogICAgICAgICAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNDUpCiAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgcHJpbnQoY2hhciwgZW5kPSIiKQogICAgICAgICAgICAgICAgICAgIHN5cy5zdGRvdXQuZmx1c2goKQogICAgICAgIGZvciBjaGFyIGluIGNvbG9yZWQoZCwgImN5YW4iKToKICAgICAgICAgICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDQ1KQogICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgIHByaW50KGNoYXIsIGVuZD0iIikKICAgICAgICAgICAgICAgICAgICBzeXMuc3Rkb3V0LmZsdXNoKCkKICAgICAgICBmb3IgY2hhciBpbiB3aGF0MjoKICAgICAgICAgICAgICAgICAgICB0aW1lLnNsZWVwKDAuMDQ1KQogICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgIHByaW50KGNoYXIsIGVuZD0iIikKICAgICAgICAgICAgICAgICAgICBzeXMuc3Rkb3V0LmZsdXNoKCkKICAgICAgICBmb3IgY2hhciBpbiBoZWxwbWU6CiAgICAgICAgICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA0NSkKICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICBwcmludChjaGFyLCBlbmQ9IiIpCiAgICAgICAgICAgICAgICAgICAgc3lzLnN0ZG91dC5mbHVzaCgpCiAgICAgICAgZm9yIGNoYXIgaW4gY29sb3JlZCgiJy4iLCAicmVkIik6CiAgICAgICAgICAgICAgICAgICAgdGltZS5zbGVlcCgwLjA0NSkKICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICBwcmludChjaGFyLCBlbmQ9IiIpCiAgICAgICAgICAgICAgICAgICAgc3lzLnN0ZG91dC5mbHVzaCgpICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgcHJpbnQoIiIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgIA=="},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
import time, replit, random, calendar, datetime, sys
from random import randint

now = datetime.datetime.now()
from termcolor import colored
colors = "red", "yellow", "cyan", "magenta", "green"
def clear():
    replit.clear()
for i in range(70):
    print(colored("Welcome to SJC_Muhammad Coding!", random.choice((colors))))
    print(colored("This is SJC_Muhammad's new account as his old one was blocked.", random.choice((colors))))
    time.sleep(0.07)    
    clear()
time.sleep(1)
clear()


greeting = "Hello!" 
intro = " I am A.I.R!"
intro2 = "A.I.R stands for Artificial Intellingence Robot."
upvote = "Please upvote!"  
cmd = "Here is the list of commands: "
op = "Operations: "

name13 = "Your name is, "
name14 = "If you want me to display your name, just type /name as a command"
name15 = "Your name is: "
clear()
print(colored(" ___      ___   __________   ___          ___           _________    ___", "magenta")) 
time.sleep(0.07)
print(colored("|   |    |   | |   _______| |   |        |   |         / _______ \  |   |", "red"))
time.sleep(0.07)
print(colored("|   |____|   | |  |_______  |   |        |   |        | |       | | |   |", "cyan"))
time.sleep(0.07)
print(colored("|            | |   _______| |   |        |   |        | |       | | |   |", "yellow"))
time.sleep(0.07)
print(colored("|    ____    | |  |_______  |   |        |   |        | |       | | |___|", "green"))
time.sleep(0.07)
print(colored("|   |    |   | |          | |   |______  |   |______  | |_______| |  ___", "white"))
time.sleep(0.07)
print(colored("|___|    |___| |__________| |__________| |__________|  \_________/  |___|", "magenta"))
time.sleep(1)
print("_________________________________________________________________________ ")
for char in greeting:
                time.sleep(0.045)
                
                print(char, end="")
                sys.stdout.flush()
time.sleep(1)                
for char in intro:
                time.sleep(0.045)
                
                print(char, end="")
                sys.stdout.flush()
print("")
time.sleep(1)
for char in intro2:
                time.sleep(0.045)
                
                print(char, end="")
                sys.stdout.flush()               
time.sleep(1)
print("")
for char in colored(upvote, "magenta", "on_white"):
                time.sleep(0.045)
                
                print(char, end="")
                sys.stdout.flush()  
time.sleep(2)
print("")
name = input(colored("Enter your name: ", "yellow"))                      
time.sleep(1)
for char in cmd:
                time.sleep(0.045)
                sys.stdout.write("\033[00;0m")
                print(char, end="")
                sys.stdout.flush()  
time.sleep(1)
print("")
print(" ______________________________________________________________________________________________________")
print("|            |             |      |          |          |        |         |            |       |      |")
print("| Calculator | Change Name | Joke | Calendar | Datetime | Riddle | Credits | Maths Quiz | Timer | Exit |")
print("|____________|_____________|______|__________|__________|________|_________|____________|_______|______|")
print("")
t = "Hello!"
u = "Hey!"
v = ("I'm fine, thank you")
w = ("I'm quite alright")
joke1 = ("My friend says that onion is the only fruit that makes you cry. So I threw a coconut at his face. ")
joke2 = ("Me: Would you like to be the sun of my life? Her: Awww...Yes! Me: Good, stay 92.26 million miles away from me. ")
joke3 = ("I didn't know why the basketball was gettin bigger. Then it hit me. :(")
joke4 = ("My friend is so ugly that he made a happy meal cry.")
joke5 = ("Light travels faster than sound. This is why some people appear bright until you hear them speak.")
joke6 = ("An old teacher asked her student, 'If I say 'I am beautiful', which tense is that?'. The student answers, 'It's obviously the past.'")
joke7 = ("Man: I want to give myself to you. Woman: Sorry, I don't accept cheap gifts.")
joke8 = ("I never forget a face! But in your case I'll make an exception!")
joke9 = ("I hear you are very kind to animals, so please give that face back to the gorilla.")
joke10 = ("You've got the perfect weapon against muggers. Your face.")
joke11 = ("Me: Were you born on a highway? Him: No. Why? Me: Cos that's where most accidents happen.")
joke12 = ("If I ever need a brain transplant, I'd choose yours because I'd want a brain that had never been used. ")
joke13 = ("How did you get here? Did someone leave your cage open?")
joke14 = ("If beauty was a drop of water, you'd be the Sahara Desert.")
joke15 = ("If ugliness were bricks, you'd be the Great Wall of China!")
joke16 = ("Everyone has a right to be ugly but you abuse the privilege.")
joke17 = ("Sure, I'd love to help you out. Now, which way did you come in?")
joke18 = ("I heard you went to have your head examined but the doctors found nothing there.")
joke19 = ("I'd ask how old you are, but I don't think you can count that high. ")
joke20 = ("When God was throwing intelligence down to the Earth, you were holding an umbrella.")
riddle1 = ("Can a kangaroo higher than the Empire State Building?")
riddle2 = ("What is a rich person's favorite nut?")
riddle3 = ("A man is 24 years old, but he only has had 6 birthdays. How is this possible?")
riddle4 = ("A man goes to buy a used car. He finds a nice Corvette for $8700 and he buys it without paying a dime. How is that possible?")
color1 = ("yellow")
color2 = ("cyan")
color3 = ("magenta")
color4 = ("red")
color5 = ("green")
response1 = ("???")
response2 = ("I don't get what you mean.")
response3 = ("Sorry what?")
response4 = ("What?")
abcd = colored("Welcome to ", "green")
abcde = colored("Python Calculator!")
abcdef = colored("Python Calendar!")
h1 = "on_white"
h2 = "on_red"
h3 = "on_green"
h4 = "on_cyan"
h5 = "on_yellow"


                
while True:
    for char in colored("                                          ", "white", random.choice((h1,h2,h3,h4,h5))):
                time.sleep(0.045)
                
                print(char, end="")
                sys.stdout.flush()
    print("")
    d = input(colored("Command: ", random.choice((color2, color3, color1 , color4, color5))))
    for char in colored("Command entered: '", "cyan"):
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
    for char in colored(d, "yellow"):
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
    for char in colored("'", "cyan"):
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
    print("") 
    for char in colored("Executing...", "red"):
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()               
    time.sleep(0.07)                
    e = d.lower()
    clear()
    if e == "calculator" or e == "calc" or e == "calcus":
        for char in abcd:
                time.sleep(0.045)
                
                print(char, end="")
                sys.stdout.flush()
        for char in abcde:
                time.sleep(0.045)
                
                print(char, end="")
                sys.stdout.flush()        
        print("")        
        for char in op:
                time.sleep(0.045)
                
                print(char, end="")
                sys.stdout.flush()  
        print("")
        print(("1. Add", "red"))
        time.sleep(0.07)
        print(colored("2. Subtract", "green"))
        time.sleep(0.07)
        print(colored("3. Multiply", "cyan"))
        time.sleep(0.07)
        print(colored("4. Divide", "white"))
        time.sleep(0.07)
        print(colored("5. Square", "magenta"))
        time.sleep(0.07)
        print(colored("6. Power", "yellow"))
        time.sleep(0.07)
        print(colored("7. Root", "red"))
        time.sleep(0.07)
        g = input(colored("Operation: ", random.choice((color1, color2, color3, color4, color5))))
        h = g.lower()
      
        if h == "1" or h == "add":
            num1 = float(input("First number: "))
            num2 = float(input("Second number: "))
            print(colored(num1+num2, "cyan"))
                    
        elif h == "2" or h == "minus" or h == "subtract":
            num12 = float(input("First number: "))
            num23 = float(input("Second number: "))
            print(colored(num12-num23, "cyan"))
        
        elif h == "3" or h == "times" or h == "time" or h == "multiply":
            num123 = float(input("First number: "))
            num234 = float(input("Second number: "))
            print(colored(num123*num234, "cyan"))
                    
        elif h == "4" or h =="divide":
            num1234 = float(input("First number: "))
            num2345 = float(input("Second number: "))
            print(colored(num1234/num2345, "cyan"))
        elif h == "5" or h == "square":
            num12345 = float(input("Number: "))
            for char in ("Your answer: ", num12345*num12345):
                time.sleep(0.045)
                
                print(char, end="")
                sys.stdout.flush()
        elif h == "6" or h == "power" or h == "indices":
            num123456 = float(input("Number: "))
            num1234567 = float(input("Power: "))   
            print(num123456**num1234567)
        elif h == "root" or h == "7":
            num12345678 = float(input("Number: "))
            num123456789 = float(input("Root number: "))    
            print(num12345678**(1/num123456789))
                   
        else:
            clear()
            for char in colored("Invalid input for '", "red"):
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
            for char in colored("Python Calculator", "cyan"):
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush() 
            for char in colored("'.", "red"):
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()               
            print("")            
    elif e == "name" or e == "i want to change the name" or e == "change name" or e == "i want to change my name":
                clear()
                for char in "Please enter new name below":
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush() 
                print("")
                name = input()
                for char in name13:
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
                time.sleep(0.07)     
                for char in name:
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
                time.sleep(1)
                print("")
                for char in name14:
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
                print("")    
    
    elif e == "/name":
        for char in name13:
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
        time.sleep(1)
        for char in name:
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
        time.sleep(1)
                
        print("")
    elif e == "shut up" or e== "quit" or e== "exit":
        for char in "Are you sure you want to exit?":
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
                
        print("")
        exit1 = input()
        exit2 = "Goodbye!", "See you later.", "Don't forget to upvote!", "I hope you enjoyed your experience!"
        ranexit = random.choice((exit2))
        if exit1.lower().startswith("y"):
            for char in colored(ranexit, "red"):
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
            print("")
            quit()
    elif e == "hello":
        resp = random.choice((t,u))
        if resp == t:
            for char in t:
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
                
            print("")
        elif resp == u:
            for char in u:
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
                
            print("")        
    elif e == "how are you" or e == "how are you?" or e == "how do you do" or e == "how do you do?":
        how = random.choice((v,w))
        if how == v:
            for char in v:
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
                
            print("")
        elif how == w:
            for char in w:
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
                
            print("")    
    elif e == "joke" or e == "tell me a joke" or e == "tell me another joke" or e == "another joke":
        jokes = random.choice((joke1, joke2, joke3, joke4, joke5, joke6, joke7, joke8, joke9, joke10, joke11, joke12, joke13, joke14, joke15, joke16, joke17, joke18, joke19, joke20))
        if jokes == joke1:
            for char in joke1:
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
        elif jokes == joke2:
            for char in joke2:
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
        elif jokes == joke3:
            for char in joke3:
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
        elif jokes == joke4:
            for char in joke4:
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush() 
        elif jokes == joke5:
            for char in joke5:
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
        elif jokes == joke6:
            for char in joke6:
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
        elif jokes == joke7:
            for char in joke7:
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
        elif jokes == joke8:
            for char in joke8:
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush() 
        elif jokes == joke9:
            for char in joke9:
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
        elif jokes == joke10:
            for char in joke10:
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
        elif jokes == joke11:
            for char in joke11:
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()                                                                                  
        elif jokes == joke12:
            for char in joke12:
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
        elif jokes == joke13:
            for char in joke13:
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
        elif jokes == joke14:
            for char in joke14:
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
        elif jokes == joke15:
            for char in joke15:
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
        elif jokes == joke16:
            for char in joke16:
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
        elif jokes == joke17:
            for char in joke17:
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
        elif jokes == joke18:
            for char in joke18:
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
        elif jokes == joke19:
            for char in joke19:
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
        elif jokes == joke20:
            for char in joke20:
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
        print("")
    elif e == "calendar":
        welcome = "Welcome to the python calendar!"
        for char in welcome:
                time.sleep(0.045)
                
                print(char, end="")
                sys.stdout.flush()
        time.sleep(1)
        print("")        
        resp = input("Type of calendar (month or year): ")
        respo = resp.lower()
        if respo == "year":
            y = int(input("Year: "))
            process = "Processing..."
            for char in process:
                time.sleep(0.045)
                
                print(char, end="")
                sys.stdout.flush()
            time.sleep(2)
            clear()
            print(calendar.calendar(y))
        elif respo == "month":     
            z = int(input("Enter year: "))
            m = int(input("Number of month (E.g. Feb = 2): "))
            processing = "Processing..."
            for char in processing:
                time.sleep(0.045)
                
                print(char, end="")
                sys.stdout.flush()
            time.sleep(2)
            clear()
            print(calendar.month(z,m))
        else:
            replit.clear()
            for char in colored("Invalid input for '", "red"):
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
            for char in colored("Python Calendar", "cyan"):
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush() 
            for char in colored("'.", "red"):
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
            print("")         
    elif e == "/help" or e == "help" or e == "help!" or e == "help me" or e == "help me!" or e == "i need help" or e == "i need help!":
        helping = "I can help you with the commands: "
        for char in helping:
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
        print()
        time.sleep(1)            
        print(" ______________________________________________________________________________________________________")
        print("|            |             |      |          |          |        |         |            |       |      |")
        print("| Calculator | Change Name | Joke | Calendar | Datetime | Riddle | Credits | Maths Quiz | Timer | Exit |")
        print("|____________|_____________|______|__________|__________|________|_________|____________|_______|______|")
        print("")
    elif e == "datetime" or e == "date" or e == "time":
        date = "Date: "
        for char in date:
                time.sleep(0.045)
                
                print(char, end="")
                sys.stdout.flush()
        print("")
        time.sleep(1)        
        date = ("%d"% now.day,"/", "%d"% now.month,"/", "%d"% now.year)
        for char in date:
                time.sleep(0.045)
                
                print(char, end="")
                sys.stdout.flush()
        print("") 
        time11 = "Time: "
        for char in time11:
                time.sleep(0.045)
                
                print(char, end="")
                sys.stdout.flush()
        print("")        
        time.sleep(1)
        time12 = ("%d"% now.hour, ":", "%d"% now.minute, ":", "%d"% now.second)
        for char in time12:
                time.sleep(0.045)
                
                print(char, end="")
                sys.stdout.flush()
        print("") 
    elif e == "who are you" or e== "who are you?" or e == "what is your name?" or e == "who are you?" or e == "info" or e == "what are you?":
        print("I am A.I.R. It took my programmer a LONG time to program me, so please upvote for me.")
    elif e == "credits":
        
        for char in "A.I.R (aka ME) was created over a time period of about a month by @SJC_Muhammad.":
                time.sleep(0.045)
                
                print(char, end="")
                sys.stdout.flush()
        print("") 
        
        for char in "You can put suggestion on new commands in the comment section and @SJC_Muhammad will try his best to add the command to A.I.R.":
                time.sleep(0.045)
                
                print(char, end="")
                sys.stdout.flush()
        print("")
        
        for char in "P.S. Upvote for new things.":
                time.sleep(0.045)
                
                print(char, end="")
                sys.stdout.flush()
        print("")
        for char in "__________________________________":
                time.sleep(0.045)
                
                print(char, end="")
                sys.stdout.flush()
        print("")
        time.sleep(1)
        
        for char in "Jokes from LaughFactory on http://www.laughfactory.com/jokes/latest-jokes.":
                time.sleep(0.045)
                
                print(char, end="")
                sys.stdout.flush()
        print("")
    elif e == "riddle" or e == "tell me a riddle" or e == "tell me another riddle" or e == "another riddle":
        ridans = random.choice((riddle1, riddle2, riddle3, riddle4))
        for char in ridans:
                time.sleep(0.045)
                
                print(char, end="")
                sys.stdout.flush()
        print("")        
        if ridans == riddle1:
            ans1 = input("Your answer: ")
            an = ans1.lower()
            if ans1.startswith("y"):
                for char in "That's correct!":
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
                print("")    
            else:
                for char in "That's wrong. Ths right answer is: Yes. The Empire State Building can't jump.":
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
                print("")
        elif ridans == riddle2:
            ans2 = input("Your answer: ")
            ans = ans2.lower()
            if ans == "cashew":
                for char in "That's correct!":
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
                print("") 
            else:
                for char in "That's wrong. Ths right answer is: Cashew.":
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
                print("") 
        elif ridans == riddle3:
            ans3 = input("Your answer: ")
            ans13 = ans3.lower()
            if ans13 == "he was born on february 29th" or ans13 == "he was born in a leap year":
                for char in "That's correct!":
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
                print("")
            else:
                
                for char in "That's wrong. Ths right answer is: He was born on February 29th.":
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
                print("")
        elif ridans == riddle4:
            ans4 = input("Your answer: ")
            ans14 = ans4.lower()
            if ans14 == "he doesn't pay a dime. he pays $8700":
                for char in "That's correct!":
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
                print("")
            else:
                for char in "That's wrong. Ths right answer is: He doesn't pay a dime. He pays $8700.":
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
                print("")
    elif e == "thanks" or e == "thank you" or e == "thanks bro" or e == "thanks yeah" or e == "thank you so much":
        for char in "No need to mention it. :)":
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
        print("")
        
    elif e == "maths" or e == "math" or e == "maths quiz" or e == "math quiz":
        clear()
        for char in "Welcome to the Maths Quiz!":
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
        print("")
        time.sleep(1)
        clear()
        for i in range(2):
            print("Welcome to the Maths Quiz!")
            print("Loading...")
            print("")
            time.sleep(0.07)
            clear()
            print("Welcome to the Maths Quiz!")
            print("Loading...")
            print("|")
            time.sleep(0.07)
            clear()
            print("Welcome to the Maths Quiz!")
            print("Loading...")
            print("||")
            time.sleep(0.07)
            clear()
            print("Welcome to the Maths Quiz!")
            print("Loading...")
            print("|||")
            time.sleep(0.07)
            clear()
            print("Welcome to the Maths Quiz!")
            print("Loading...")
            print("||||")
            time.sleep(0.07)
            clear()
            print("Welcome to the Maths Quiz!")
            print("Loading...")
            print("|||||")
            time.sleep(0.07)
            clear()
            print("Welcome to the Maths Quiz!")
            print("Loading...")
            print(" |||||")
            time.sleep(0.07)
            clear()
            print("Welcome to the Maths Quiz!")
            print("Loading...")
            print("  |||||")
            time.sleep(0.07)
            clear()
            print("Welcome to the Maths Quiz!")
            print("Loading...")
            print("   |||||")
            time.sleep(0.07)
            clear()
            print("Welcome to the Maths Quiz!")
            print("Loading...")
            print("    |||||")
            time.sleep(0.07)
            clear()
            print("Welcome to the Maths Quiz!")
            print("Loading...")
            print("     |||||")
            time.sleep(0.07)
            clear()
            print("Welcome to the Maths Quiz!")
            print("Loading...")
            print("      ||||")
            time.sleep(0.07)
            clear()
            print("Welcome to the Maths Quiz!")
            print("Loading...")
            print("       |||")
            time.sleep(0.07)
            clear()
            print("Welcome to the Maths Quiz!")
            print("Loading...")
            print("        ||")
            time.sleep(0.07)
            clear()
            print("Welcome to the Maths Quiz!")
            print("Loading...")
            print("         |")
            time.sleep(0.07)
            clear()
            print("Welcome to the Maths Quiz!")
            print("Loading...")
            print("          ")
            time.sleep(0.07)
            clear()
        score = 0
        
        clear()
        questions1 = "How many questions do you want?"
        for char in questions1:
                time.sleep(0.045)
                
                print(char, end="")
                sys.stdout.flush()
        print("")        
        resp = int(input())
        for char in "Preparing questions...":
                time.sleep(0.045)
                
                print(char, end="")
                sys.stdout.flush()
        print("")
        time.sleep(0.07)
        clear() 
        for i in range(2):
            print("Preparing questions...")
            print("Loading...")
            print("")
            time.sleep(0.07)
            clear()
            print("Preparing questions...")
            print("Loading...")
            print("|")
            time.sleep(0.07)
            clear()
            print("Preparing questions...")
            print("Loading...")
            print("||")
            time.sleep(0.07)
            clear()
            print("Preparing questions...")
            print("Loading...")
            print("|||")
            time.sleep(0.07)
            clear()
            print("Preparing questions...")
            print("Loading...")
            print("||||")
            time.sleep(0.07)
            clear()
            print("Preparing questions...")
            print("Loading...")
            print("|||||")
            time.sleep(0.07)
            clear()
            print("Preparing questions...")
            print("Loading...")
            print(" |||||")
            time.sleep(0.07)
            clear()
            print("Preparing questions...")
            print("Loading...")
            print("  |||||")
            time.sleep(0.07)
            clear()
            print("Preparing questions...")
            print("Loading...")
            print("   |||||")
            time.sleep(0.07)
            clear()
            print("Preparing questions...")
            print("Loading...")
            print("    |||||")
            time.sleep(0.07)
            clear()
            print("Preparing questions...")
            print("Loading...")
            print("     |||||")
            time.sleep(0.07)
            clear()
            print("Preparing questions...")
            print("Loading...")
            print("      ||||")
            time.sleep(0.07)
            clear()
            print("Preparing questions...")
            print("Loading...")
            print("       |||")
            time.sleep(0.07)
            clear()
            print("Preparing questions...")
            print("Loading...")
            print("        ||")
            time.sleep(0.07)
            clear()
            print("Preparing questions...")
            print("Loading...")
            print("         |")
            time.sleep(0.07)
            clear()
            print("Preparing questions...")
            print("Loading...")
            print("          ")
            time.sleep(0.07)
            clear()
        q = 1
        for i in range(resp):
            
            clear()
            num1 = randint(1, 100)
            num2 = randint(1, 100)
            op = random.choice(("a", "s", "m"))
            if op == "a":
                for char in (q, ". What is ", num1, "+", num2, "?"):
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
                print("")
                q = q+1
                ans = float(input())
                if ans == num1+num2:
                    score = score+1
                    for char in "That's correct!":
                        time.sleep(0.045)
                        
                        print(char, end="")
                        sys.stdout.flush()
                    print("")
                    
                    
                else:
                    for char in ("That's wrong. The right answer is ", num1+num2, "."):
                        time.sleep(0.045)
                        
                        print(char, end="")
                        sys.stdout.flush()
                    print("")
            elif op == "s":
                for char in (q, ". What is ", num1, "-", num2, "?"):
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
                print("")
                q = q+1
                ans = float(input())
                if ans == num1-num2:
                    score = score+1
                    for char in "That's correct!":
                        time.sleep(0.045)
                        
                        print(char, end="")
                        sys.stdout.flush()
                    print("")
                    
                    
                else:
                    for char in ("That's wrong. The right answer is ", num1-num2, "."):
                        time.sleep(0.045)
                        
                        print(char, end="")
                        sys.stdout.flush()
                    print("")
            elif op == "m":
                for char in (q, ". What is ", num1, "x", num2, "?"):
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
                print("")
                q = q+1
                ans = float(input())
                if ans == num1*num2:
                    score = score+1
                    for char in "That's correct!":
                        time.sleep(0.045)
                        
                        print(char, end="")
                        sys.stdout.flush()
                    print("")
                    
                    
                else:
                    for char in ("That's wrong. The right answer is ", num1*num2, "."):
                        time.sleep(0.045)
                        
                        print(char, end="")
                        sys.stdout.flush()
                    print("")                
            for char in ("Current score: ", score):
                        time.sleep(0.045)
                        
                        print(char, end="")
                        sys.stdout.flush()
            
            
            for char in (" out of ", resp, "."):
                        time.sleep(0.045)
                        
                        print(char, end="")
                        sys.stdout.flush()
            print("")
            time.sleep(1)         
        
             
        percentage = round((score/resp)*100)
        for char in ("You got ", percentage):
                        time.sleep(0.045)
                        
                        print(char, end="")
                        sys.stdout.flush()
        for char in "%.":
                        time.sleep(0.045)
                        
                        print(char, end="")
                        sys.stdout.flush()
        print("")                                    
            
        
        if round((score/resp)*100) == 100:
            for char in "Excellent, ":
                time.sleep(0.045)
                
                print(char, end="")
                sys.stdout.flush()
            for char in name:
                time.sleep(0.045)
                
                print(char, end="")
                sys.stdout.flush()
            for char in "!":
                time.sleep(0.045)
                
                print(char, end="")
                sys.stdout.flush()
            for char in " You got 100%!":
                time.sleep(0.045)
                
                print(char, end="")
                sys.stdout.flush()            
            print("") 
        elif round((score/resp)*100) > 90:
            for char in "Well done, ":
                time.sleep(0.045)
                
                print(char, end="")
                sys.stdout.flush()
            for char in name:
                time.sleep(0.045)
                
                print(char, end="")
                sys.stdout.flush()
            for char in "!":
                time.sleep(0.045)
                
                print(char, end="")
                sys.stdout.flush()
            for char in " You got more than 90%!":
                time.sleep(0.045)
                
                print(char, end="")
                sys.stdout.flush()            
            print("") 
        elif round((score/resp)*100) > 80:
            for char in "Well done, ":
                time.sleep(0.045)
                
                print(char, end="")
                sys.stdout.flush()
            for char in name:
                time.sleep(0.045)
                
                print(char, end="")
                sys.stdout.flush()
            for char in ".":
                time.sleep(0.045)
                
                print(char, end="")
                sys.stdout.flush()
            for char in " You got higher than 80%.":
                time.sleep(0.045)
                
                print(char, end="")
                sys.stdout.flush()            
            print("") 
        elif round((score/resp)*100) == 80:
            for char in "Well done, ":
                time.sleep(0.045)
                
                print(char, end="")
                sys.stdout.flush()
            for char in name:
                time.sleep(0.045)
                
                print(char, end="")
                sys.stdout.flush()
            for char in ".":
                time.sleep(0.045)
                
                print(char, end="")
                sys.stdout.flush()
            for char in " You got 80%.":
                time.sleep(0.045)
                
                print(char, end="")
                sys.stdout.flush()            
            print("")     
        else:
            for char in "Unfortunately, ":
                time.sleep(0.045)
                
                print(char, end="")
                sys.stdout.flush()
            for char in name:
                time.sleep(0.045)
                
                print(char, end="")
                sys.stdout.flush()
            for char in (", You got ", percentage):
                time.sleep(0.045)
                
                print(char, end="")
                sys.stdout.flush()
            for char in "%. As this is below 80%, you fail.":
                time.sleep(0.045)
                
                print(char, end="")
                sys.stdout.flush()                
            print("") 
    elif e == "timer":
        for char in "Welcome to the Python Timer!":
                time.sleep(0.045)
                
                print(char, end="")
                sys.stdout.flush()
        print("")
        
        m = int(input("Minutes: "))
        s = int(input("Seconds: "))
        for i in range((m*60)+(s+1)):
            time.sleep(1)
            clear()
            print( m, "Minute(s)", s, "Second(s) Left")
            s = s-1
            if s == -1:
                s = s + 60
                m = m-1
            elif m == -1:
                print("Time's up!")  
                  

    else:
        what = random.choice((response1, response2, response3, response4))
        if what == response1:
            for char in response1:
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
                
            print("")
        elif what == response2:
            for char in response2:
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
                
            print("")  
        elif what == response3:
            for char in response3:
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
                
            print("")     
        elif what == response4:
            for char in response4:
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
                
            print("")     
        time.sleep(0.07)
        what1 = colored(" I can't respond to: '", "red")
        what2 = colored("'. If you are unsure of commands, type '", "red")
        helpme = colored("/help", "yellow")

        for char in colored(name+",", "green"):
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
        for char in what1:
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
        for char in colored(d, "cyan"):
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
        for char in what2:
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
        for char in helpme:
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()
        for char in colored("'.", "red"):
                    time.sleep(0.045)
                    
                    print(char, end="")
                    sys.stdout.flush()                        
        print("")