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gICBzaXplX3QgX19tXzsKICAgIHNpemVfdCBfX28xXzsKICAgIHNpemVfdCBfX28yXzsKCiAgICBfTElCQ1BQX0FMV0FZU19JTkxJTkUKICAgIF9fY3NoaWZ0X2V4cHIoaW50IF9fbiwgY29uc3QgX1JtRXhwciYgX19lKQogICAgICAgIDogX19leHByXyhfX2UpLAogICAgICAgICAgX19zaXplXyhfX2Uuc2l6ZSgpKQogICAgICAgIHsKICAgICAgICAgICAgX19uICU9IHN0YXRpY19jYXN0PGludD4oX19zaXplXyk7CiAgICAgICAgICAgIGlmIChfX24gPj0gMCkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgX19tXyA9IF9fc2l6ZV8gLSBfX247CiAgICAgICAgICAgICAgICBfX28xXyA9IF9fbjsKICAgICAgICAgICAgICAgIF9fbzJfID0gX19uIC0gX19zaXplXzsKICAgICAgICAgICAgfQogICAgICAgICAgICBlbHNlCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIF9fbV8gPSAtX19uOwogICAgICAgICAgICAgICAgX19vMV8gPSBfX24gKyBfX3NpemVfOwogICAgICAgICAgICAgICAgX19vMl8gPSBfX247CiAgICAgICAgICAgIH0KICAgICAgICB9CnB1YmxpYzoKCiAgICBfTElCQ1BQX0FMV0FZU19JTkxJTkUKICAgIHJlc3VsdF90eXBlIG9wZXJhdG9yW10oc2l6ZV90IF9faSkgY29uc3QKICAgICAgICB7CiAgICAgICAgICAgIGlmIChfX2kgPCBfX21fKQogICAgICAgICAgICAgICAgcmV0dXJuIF9fZXhwcl9bX19pICsgX19vMV9dOwogICAgICAgICAgICByZXR1cm4gX19leHByX1tfX2kgKyBfX28yX107CiAgICAgICAgfQoKICAgIF9MSUJDUFBfQUxXQVlTX0lOTElORQogICAgc2l6ZV90IHNpemUoKSBjb25zdCB7cmV0dXJuIF9fc2l6ZV87fQoKICAgIHRlbXBsYXRlIDxjbGFzcz4gZnJpZW5kIGNsYXNzIF9fdmFsX2V4cHI7Cn07Cgp0ZW1wbG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AgICAgICB2b2lkCiAgICA+Ojp0eXBlCiAgICBvcGVyYXRvcj0oY29uc3QgX0V4cHImIF9fdikgY29uc3Q7CgogICAgdGVtcGxhdGUgPGNsYXNzIF9FeHByPgogICAgdHlwZW5hbWUgZW5hYmxlX2lmCiAgICA8CiAgICAgICAgX19pc192YWxfZXhwcjxfRXhwcj46OnZhbHVlLAogICAgICAgIHZvaWQKICAgID46OnR5cGUKICAgIG9wZXJhdG9yKj0oY29uc3QgX0V4cHImIF9fdikgY29uc3Q7CgogICAgdGVtcGxhdGUgPGNsYXNzIF9FeHByPgogICAgdHlwZW5hbWUgZW5hYmxlX2lmCiAgICA8CiAgICAgICAgX19pc192YWxfZXhwcjxfRXhwcj46OnZhbHVlLAogICAgICAgIHZvaWQKICAgID46OnR5cGUKICAgIG9wZXJhdG9yLz0oY29uc3QgX0V4cHImIF9fdikgY29uc3Q7CgogICAgdGVtcGxhdGUgPGNsYXNzIF9FeHByPgogICAgdHlwZW5hbWUgZW5hYmxlX2lmCiAgICA8CiAgICAgICAgX19pc192YWxfZXhwcjxfRXhwcj46OnZhbHVlLAogICAgICAgIHZvaWQKICAgID46OnR5cGUKICAgIG9wZXJhdG9yJT0oY29uc3QgX0V4cHImIF9fdikgY29uc3Q7CgogICAgdGVtcGxhdGUgPGNsYXNzIF9FeHByPgogICAgdHlwZW5hbWUgZW5hYmxlX2lmCiAgICA8CiAgICAgICAgX19pc192YWxfZXhwcjxfRXhwcj46OnZhbHVlLAogICAgICAgIHZvaWQKICAgID46OnR5cGUKICAgIG9wZXJhdG9yKz0oY29uc3QgX0V4cHImIF9fdikgY29uc3Q7CgogICAgdGVtcGxhdGUgPGNsYXNzIF9FeHByPgogICAgdHlwZW5hbWUgZW5hYmxlX2lmCiAgICA8CiAgICAgICAgX19pc192YWxfZXhwcjxfRXhwcj46OnZhbHVlLAogICAgICAgIHZvaWQKICAgID46OnR5cGUKICAgIG9wZXJhdG9yLT0oY29uc3QgX0V4cHImIF9fdikgY29uc3Q7CgogICAgdGVtcGxhdGUgPGNsYXNzIF9FeHByPgogICAgdHlwZW5hbWUgZW5hYmxlX2lmCiAgICA8CiAgICAgICAgX19pc192YWxfZXhwcjxfRXhwcj46OnZhbHVlLAogICAgICAgIHZvaWQKICAgID46OnR5cGUKICAgIG9wZXJhdG9yXj0oY29uc3QgX0V4cHImIF9fdikgY29uc3Q7CgogICAgdGVtcGxhdGUgPGNsYXNzIF9FeHByPgogICAgdHlwZW5hbWUgZW5hYmxlX2lmCiAgICA8CiAgICAgICAgX19pc192YWxfZXhwcjxfRXhwcj46OnZhbHVlLAogICAgICAgIHZvaWQKICAgID46OnR5cGUKICAgIG9wZXJhdG9yJj0oY29uc3QgX0V4cHImIF9fdikgY29uc3Q7CgogICAgdGVtcGxhdGUgPGNsYXNzIF9FeHByPgogICAgdHlwZW5hbWUgZW5hYmxlX2lmCiAgICA8CiAgICAgICAgX19pc192YWxfZXhwcjxfRXhwcj46OnZhbHVlLAogICAgICAgIHZvaWQKICAgID46OnR5cGUKICAgIG9wZXJhdG9yfD0oY29uc3QgX0V4cHImIF9fdikgY29uc3Q7CgogICAgdGVtcGxhdGUgPGNsYXNzIF9FeHByPgogICAgdHlwZW5hbWUgZW5hYmxlX2lmCiAgICA8CiAgICAgICAgX19pc192YWxfZXhwcjxfRXhwcj46OnZhbHVlLAogICAgICAgIHZvaWQKICAgID46OnR5cGUKICAgIG9wZXJhdG9yPDw9KGNvbnN0IF9FeHByJiBfX3YpIGNvbnN0OwoKICAgIHRlbXBsYXRlIDxjbGFzcyBfRXhwcj4KICAgIHR5cGVuYW1lIGVuYWJsZV9pZgogICAgPAogICAgICAgIF9faXNfdmFsX2V4cHI8X0V4cHI+Ojp2YWx1ZSwKICAgICAgICB2b2lkCiAgICA+Ojp0eXBlCiAgICBvcGVyYXRvcj4+PShjb25zdCBfRXhwciYgX192KSBjb25zdDsKCiAgICBjb25zdCBzbGljZV9hcnJheSYgb3BlcmF0b3I9KGNvbnN0IHNsaWNlX2Fyc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3QKewogICAgdmFsdWVfdHlwZSogX190ID0gX192cF87CiAgICBmb3IgKHNpemVfdCBfX2kgPSAwOyBfX2kgPCBfX3NpemVfOyArK19faSwgX190ICs9IF9fc3RyaWRlXykKICAgICAgICAqX190ID4+PSBfX3ZbX19pXTsKfQoKdGVtcGxhdGUgPGNsYXNzIF9UcD4KaW5saW5lIF9MSUJDUFBfQUxXQVlTX0lOTElORQp2b2lkCnNsaWNlX2FycmF5PF9UcD46Om9wZXJhdG9yPShjb25zdCB2YWx1ZV90eXBlJiBfX3gpIGNvbnN0CnsKICAgIHZhbHVlX3R5cGUqIF9fdCA9IF9fdnBfOwogICAgZm9yIChzaXplX3QgX19uID0gX19zaXplXzsgX19uOyAtLV9fbiwgX190ICs9IF9fc3RyaWRlXykKICAgICAgICAqX190ID0gX194Owp9CgovLyBnc2xpY2UKCmNsYXNzIGdzbGljZQp7CiAgICB2YWxhcnJheTxzaXplX3Q+IF9fc2l6ZV87CiAgICB2YWxhcnJheTxzaXplX3Q+IF9fc3RyaWRlXzsKICAgIHZhbGFycmF5PHNpemVfdD4gX18xZF87CiAgICAKcHVibGljOgogICAgX0xJQkNQUF9BTFdBWVNfSU5MSU5FCiAgICBnc2xpY2UoKSB7fQoKICAgIF9MSUJDUFBfQUxXQVlTX0lOTElORQogICAgZ3NsaWNlKHNpemVfdCBfX3N0YXJ0LCBjb25zdCB2YWxhcnJheTxzaXplX3Q+JiBfX3NpemUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHZhbGFycmF5PHNpemVfdD4mIF9fc3RyaWRlKQogICAgICAgIDogX19zaXplXyhfX3NpemUpLAogICAgICAgICAgX19zdHJpZGVfKF9fc3RyaWRlKQogICAgICAgIHtfX2luaXQoX19zdGFydCk7fQoKI2lmZGVmIF9MSUJDUFBfTU9WRQoKICAgIF9MSUJDUFBfQUxXQVlTX0lOTElORQogICAgZ3NsaWNlKHNpemVfdCBfX3N0YXJ0LCBjb25zdCB2YWxhcnJheTxzaXplX3Q+JiAgX19zaXplLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWxhcnJheTxzaXplX3Q+JiYgX19zdHJpZGUpCiAgICAgICAgOiBfX3NpemVfKF9fc2l6ZSksCiAgICAgICAgICBfX3N0cmlkZV8obW92ZShfX3N0cmlkZSkpCiAgICAgICAge19faW5pdChfX3N0YXJ0KTt9CgogICAgX0xJQkNQUF9BTFdBWVNfSU5MSU5FCiAgICBnc2xpY2Uoc2l6ZV90IF9fc3RhcnQsICAgICAgIHZhbGFycmF5PHNpemVfdD4mJiBfX3NpemUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHZhbGFycmF5PHNpemVfdD4mICBfX3N0cmlkZSkKICAgICAgICA6IF9fc2l6ZV8obW92ZShfX3NpemUpKSwKICAgICAgICAgIF9fc3RyaWRlXyhfX3N0cmlkZSkKICAgICAgICB7X19pbml0KF9fc3RhcnQpO30KCiAgICBfTElCQ1BQX0FMV0FZU19JTkxJTkUKICAgIGdzbGljZShzaXplX3QgX19zdGFydCwgICAgICAgdmFsYXJyYXk8c2l6ZV90PiYmIF9fc2l6ZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsYXJyYXk8c2l6ZV90PiYmIF9fc3RyaWRlKQogICAgICAgIDogX19zaXplXyhtb3ZlKF9fc2l6ZSkpLAogICAgICAgICAgX19zdHJpZGVfKG1vdmUoX19zdHJpZGUpKQogICAgICAgIHtfX2luaXQoX19zdGFydCk7fQoKI2VuZGlmCgovLyAgZ3NsaWNlKGNvbnN0IGdzbGljZSYpICAgICAgICAgICAgPSBkZWZhdWx0OwovLyAgZ3NsaWNlKGdzbGljZSYmKSAgICAgICAgICAgICAgICAgPSBkZWZhdWx0OwovLyAgZ3NsaWNlJiBvcGVyYXRvcj0oY29uc3QgZ3NsaWNlJikgPSBkZWZhdWx0OwovLyAgZ3NsaWNlJiBvcGVyYXRvcj0oZ3NsaWNlJiYpICAgICAgPSBkZWZhdWx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5hYmxlX2lmCiAgICA8CiAgICAgICAgX19pc192YWxfZXhwcjxfRXhwcj46OnZhbHVlLAogICAgICAgIHZvaWQKICAgID46OnR5cGUKICAgIG9wZXJhdG9yKj0oY29uc3QgX0V4cHImIF9fdikgY29uc3Q7CgogICAgdGVtcGxhdGUgPGNsYXNzIF9FeHByPgogICAgdHlwZW5hbWUgZW5hYmxlX2lmCiAgICA8CiAgICAgICAgX19pc192YWxfZXhwcjxfRXhwcj46OnZhbHVlLAogICAgICAgIHZvaWQKICAgID46OnR5cGUKICAgIG9wZXJhdG9yLz0oY29uc3QgX0V4cHImIF9fdikgY29uc3Q7CgogICAgdGVtcGxhdGUgPGNsYXNzIF9FeHByPgogICAgdHlwZW5hbWUgZW5hYmxlX2lmCiAgICA8CiAgICAgICAgX19pc192YWxfZXhwcjxfRXhwcj46OnZhbHVlLAogICAgICAgIHZvaWQKICAgID46OnR5cGUKICAgIG9wZXJhdG9yJT0oY29uc3QgX0V4cHImIF9fdikgY29uc3Q7CgogICAgdGVtcGxhdGUgPGNsYXNzIF9FeHByPgogICAgdHlwZW5hbWUgZW5hYmxlX2lmCiAgICA8CiAgICAgICAgX19pc192YWxfZXhwcjxfRXhwcj46OnZhbHVlLAogICAgICAgIHZvaWQKICAgID46OnR5cGUKICAgIG9wZXJhdG9yKz0oY29uc3QgX0V4cHImIF9fdikgY29uc3Q7CgogICAgdGVtcGxhdGUgPGNsYXNzIF9FeHByPgogICAgdHlwZW5hbWUgZW5hYmxlX2lmCiAgICA8CiAgICAgICAgX19pc192YWxfZXhwcjxfRXhwcj46OnZhbHVlLAogICAgICAgIHZvaWQKICAgID46OnR5cGUKICAgIG9wZXJhdG9yLT0oY29uc3QgX0V4cHImIF9fdikgY29uc3Q7CgogICAgdGVtcGxhdGUgPGNsYXNzIF9FeHByPgogICAgdHlwZW5hbWUgZW5hYmxlX2lmCiAgICA8CiAgICAgICAgX19pc192YWxfZXhwcjxfRXhwcj46OnZhbHVlLAogICAgICAgIHZvaWQKICAgID46OnR5cGUKICAgIG9wZXJhdG9yXj0oY29uc3QgX0V4cHImIF9fdikgY29uc3Q7CgogICAgdGVtcGxhdGUgPGNsYXNzIF9FeHByPgogICAgdHlwZW5hbWUgZW5hYmxlX2lmCiAgICA8CiAgICAgICAgX19pc192YWxfZXhwcjxfRXhwcj46OnZhbHVlLAogICAgICAgIHZvaWQKICAgID46OnR5cGUKICAgIG9wZXJhdG9yJj0oY29uc3QgX0V4cHImIF9fdikgY29uc3Q7CgogICAgdGVtcGxhdGUgPGNsYXNzIF9FeHByPgogICAgdHlwZW5hbWUgZW5hYmxlX2lmCiAgICA8CiAgICAgICAgX19pc192YWxfZXhwcjxfRXhwcj46OnZhbHVlLAogICAgICAgIHZvaWQKICAgID46OnR5cGUKICAgIG9wZXJhdG9yfD0oY29uc3QgX0V4cHImIF9fdikgY29uc3Q7CgogICAgdGVtcGxhdGUgPGNsYXNzIF9FeHByPgogICAgdHlwZW5hbWUgZW5hYmxlX2lmCiAgICA8CiAgICAgICAgX19pc192YWxfZXhwcjxfRXhwcj46OnZhbHVlLAogICAgICAgIHZvaWQKICAgID46OnR5cGUKICAgIG9wZXJhdG9yPDw9KGNvbnN0IF9FeHByJiBfX3YpIGNvbnN0OwoKICAgIHRlbXBsYXRlIDxjbGFzcyBfRXhwcj4KICAgIHR5cGVuYW1lIGVuYWJsZV9pZgogICAgPAogICAgICAgIF9faXNfdmFsX2V4cHI8X0V4cHI+Ojp2YWx1ZSwKICAgICAgICB2b2lkCiAgICA+Ojp0eXBlCiAgICBvcGVyYXRvcj4+PShjb25zdCBfRXhwciYgX192KSBjb25zdDsKCiAgICBjb25zdCBtYXNrX2FycmF5JiBvcGVyYXRvcj0oY29uc3QgbWFza19hcnJheSYgX19tYSkgY29uc3Q7CgogICAgdm9pZCBvcGVyYXRvcj0oY29uc3QgdmFsdWVfdHlwZSYgX194KSBjb25zdDsKCi8vICBtYXNrX2FycmF5KGNvbnN0IG1hc2tfYXJyYXkmKSAgICAgICA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2V4cHJfKF9fZSksCiAgICAgICAgICBfXzFkXyhjb3VudChfX3ZiLl9fYmVnaW5fLCBfX3ZiLl9fZW5kXywgdHJ1ZSkpCiAgICAgICAgICB7CiAgICAgICAgICAgICAgc2l6ZV90IF9faiA9IDA7CiAgICAgICAgICAgICAgZm9yIChzaXplX3QgX19pID0gMDsgX19pIDwgX192Yi5zaXplKCk7ICsrX19pKQogICAgICAgICAgICAgICAgICBpZiAoX192YltfX2ldKQogICAgICAgICAgICAgICAgICAgICAgX18xZF9bX19qKytdID0gX19pOwogICAgICAgICAgfQoKcHVibGljOgogICAgX0xJQkNQUF9BTFdBWVNfSU5MSU5FCiAgICByZXN1bHRfdHlwZSBvcGVyYXRvcltdKHNpemVfdCBfX2kpIGNvbnN0CiAgICAgICAge3JldHVybiBfX2V4cHJfW19fMWRfW19faV1dO30KCiAgICBfTElCQ1BQX0FMV0FZU19JTkxJTkUKICAgIHNpemVfdCBzaXplKCkgY29uc3Qge3JldHVybiBfXzFkXy5zaXplKCk7fQoKICAgIHRlbXBsYXRlIDxjbGFzcz4gZnJpZW5kIGNsYXNzIHZhbGFycmF5Owp9OwoKLy8gaW5kaXJlY3RfYXJyYXkKCnRlbXBsYXRlIDxjbGFzcyBfVHA+CmNsYXNzIGluZGlyZWN0X2FycmF5CnsKcHVibGljOgogICAgdHlwZWRlZiBfVHAgdmFsdWVfdHlwZTsKCnByaXZhdGU6CiAgICB2YWx1ZV90eXBlKiAgICAgIF9fdnBfOwogICAgdmFsYXJyYXk8c2l6ZV90PiBfXzFkXzsKCnB1YmxpYzoKICAgIHRlbXBsYXRlIDxjbGFzcyBfRXhwcj4KICAgIHR5cGVuYW1lIGVuYWJsZV9pZgogICAgPAogICAgICAgIF9faXNfdmFsX2V4cHI8X0V4cHI+Ojp2YWx1ZSwKICAgICAgICB2b2lkCiAgICA+Ojp0eXBlCiAgICBvcGVyYXRvcj0oY29uc3QgX0V4cHImIF9fdikgY29uc3Q7CgogICAgdGVtcGxhdGUgPGNsYXNzIF9FeHByPgogICAgdHlwZW5hbWUgZW5hYmxlX2lmCiAgICA8CiAgICAgICAgX19pc192YWxfZXhwcjxfRXhwcj46OnZhbHVlLAogICAgICAgIHZvaWQKICAgID46OnR5cGUKICAgIG9wZXJhdG9yKj0oY29uc3QgX0V4cHImIF9fdikgY29uc3Q7CgogICAgdGVtcGxhdGUgPGNsYXNzIF9FeHByPgogICAgdHlwZW5hbWUgZW5hYmxlX2lmCiAgICA8CiAgICAgICAgX19pc192YWxfZXhwcjxfRXhwcj46OnZhbHVlLAogICAgICAgIHZvaWQKICAgID46OnR5cGUKICAgIG9wZXJhdG9yLz0oY29uc3QgX0V4cHImIF9fdikgY29uc3Q7CgogICAgdGVtcGxhdGUgPGNsYXNzIF9FeHByPgogICAgdHlwZW5hbWUgZW5hYmxlX2lmCiAgICA8CiAgICAgICAgX19pc192YWxfZXhwcjxfRXhwcj46OnZhbHVlLAogICAgICAgIHZvaWQKICAgID46OnR5cGUKICAgIG9wZXJhdG9yJT0oY29uc3QgX0V4cHImIF9fdikgY29uc3Q7CgogICAgdGVtcGxhdGUgPGNsYXNzIF9FeHByPgogICAgdHlwZW5hbWUgZW5hYmxlX2lmCiAgICA8CiAgICAgICAgX19pc192YWxfZXhwcjxfRXhwcj46OnZhbHVlLAogICAgICAgIHZvaWQKICAgID46OnR5cGUKICAgIG9wZXJhdG9yKz0oY29uc3QgX0V4cHImIF9fdikgY29uc3Q7CgogICAgdGVtcGxhdGUgPGNsYXNzIF9FeHByPgogICAgdHlwZW5hbWUgZW5hYmxlX2lmCiAgICA8CiAgICAgICAgX19pc192YWxfZXhwcjxfRXhwcj46OnZhbHVlLAogICAgICAgIHZvaWQKICAgID46OnR5cGUKICAgIG9wZXJhdG9yLT0oY29uc3QgX0V4cHImIF9fdikgY29uc3Q7CgogICAgdGVtcGxhdGUgPGNsYXNzIF9FeHByPgogICAgdHlwZW5hbWUgZW5hYmxlX2lmCiAgICA8CiAgICAgICAgX19pc192YWxfZXhw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gX19leHByX1tfX2ldOwogICAgICAgIHJldHVybiBfX3I7CiAgICB9CgogICAgX0xJQkNQUF9BTFdBWVNfSU5MSU5FCiAgICByZXN1bHRfdHlwZSBtaW4oKSBjb25zdAogICAgewogICAgICAgIHNpemVfdCBfX24gPSBzaXplKCk7CiAgICAgICAgcmVzdWx0X3R5cGUgX19yID0gX19uID8gKCp0aGlzKVswXSA6IHJlc3VsdF90eXBlKCk7CiAgICAgICAgZm9yIChzaXplX3QgX19pID0gMTsgX19pIDwgX19uOyArK19faSkKICAgICAgICB7CiAgICAgICAgICAgIHJlc3VsdF90eXBlIF9feCA9IF9fZXhwcl9bX19pXTsKICAgICAgICAgICAgaWYgKF9feCA8IF9fcikKICAgICAgICAgICAgICAgIF9fciA9IF9feDsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIF9fcjsKICAgIH0KCiAgICBfTElCQ1BQX0FMV0FZU19JTkxJTkUKICAgIHJlc3VsdF90eXBlIG1heCgpIGNvbnN0CiAgICB7CiAgICAgICAgc2l6ZV90IF9fbiA9IHNpemUoKTsKICAgICAgICByZXN1bHRfdHlwZSBfX3IgPSBfX24gPyAoKnRoaXMpWzBdIDogcmVzdWx0X3R5cGUoKTsKICAgICAgICBmb3IgKHNpemVfdCBfX2kgPSAxOyBfX2kgPCBfX247ICsrX19pKQogICAgICAgIHsKICAgICAgICAgICAgcmVzdWx0X3R5cGUgX194ID0gX19leHByX1tfX2ldOwogICAgICAgICAgICBpZiAoX19yIDwgX194KQogICAgICAgICAgICAgICAgX19yID0gX194OwogICAgICAgIH0KICAgICAgICByZXR1cm4gX19yOwogICAgfQoKICAgIF9MSUJDUFBfQUxXQVlTX0lOTElORQogICAgX192YWxfZXhwcjxfX3NoaWZ0X2V4cHI8X1ZhbEV4cHI+ID4gc2hpZnQgKGludCBfX2kpIGNvbnN0CiAgICAgICAge3JldHVybiBfX3ZhbF9leHByPF9fc2hpZnRfZXhwcjxfVmFsRXhwcj4gPihfX3NoaWZ0X2V4cHI8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gICAgewojZW5kaWYKICAgICAgICAgICAgZm9yIChjb25zdCB2YWx1ZV90eXBlKiBfX3AgPSBfX2lsLmJlZ2luKCk7IF9fbjsgKytfX2VuZF8sICsrX19wLCAtLV9fbikKICAgICAgICAgICAgICAgIDo6bmV3IChfX2VuZF8pIHZhbHVlX3R5cGUoKl9fcCk7CiNpZm5kZWYgX0xJQkNQUF9OT19FWENFUFRJT05TCiAgICAgICAgfQogICAgICAgIGNhdGNoICguLi4pCiAgICAgICAgewogICAgICAgICAgICByZXNpemUoMCk7CiAgICAgICAgICAgIHRocm93OwogICAgICAgIH0KI2VuZGlmCiAgICB9Cn0KCiNlbmRpZgoKdGVtcGxhdGUgPGNsYXNzIF9UcD4KdmFsYXJyYXk8X1RwPjo6dmFsYXJyYXkoY29uc3Qgc2xpY2VfYXJyYXk8dmFsdWVfdHlwZT4mIF9fc2EpCiAgICA6IF9fYmVnaW5fKDApLAogICAgICBfX2VuZF8oMCkKewogICAgc2l6ZV90IF9fbiA9IF9fc2EuX19zaXplXzsKICAgIGlmIChfX24pCiAgICB7CiAgICAgICAgX19iZWdpbl8gPSBfX2VuZF8gPSBzdGF0aWNfY2FzdDx2YWx1ZV90eXBlKj4oOjpvcGVyYXRvciBuZXcoX19uICogc2l6ZW9mKHZhbHVlX3R5cGUpKSk7CiNpZm5kZWYgX0xJQkNQUF9OT19FWENFUFRJT05TCiAgICAgICAgdHJ5CiAgICAgICAgewojZW5kaWYKICAgICAgICAgICAgZm9yIChjb25zdCB2YWx1ZV90eXBlKiBfX3AgPSBfX3NhLl9fdnBfOyBfX247ICsrX19lbmRfLCBfX3AgKz0gX19zYS5fX3N0cmlkZV8sIC0tX19uKQogICAgICAgICAgICAgICAgOjpuZXcgKF9fZW5kXykgdmFsdWVfdHlwZSgqX19wKTsKI2lmbmRlZiBfTElCQ1BQX05PX0VYQ0VQVElPTlMKICAgICAgICB9CiAgICAgICAgY2F0Y2ggKC4uLikKICAgICAgICB7CiAgICAgICAgICAgIHJlc2l6ZSgwKTsKICAgICAgICAgICAgdGhyb3c7CiAgICAgICAgfQojZW5kaWYKICAgIH0KfQoKdGVtcGxhdGUgPGNsYXNzIF9UcD4KdmFsYXJyYXk8X1RwPjo6dmFsYXJyYXkoY29uc3QgZ3NsaWNlX2FycmF5PHZhbHVlX3R5cGU+JiBfX2dhKQogICAgOiBfX2JlZ2luXygwKSwKICAgICAgX19lbmRfKDApCnsKICAgIHNpemVfdCBfX24gPSBfX2dhLl9fMWRfLnNpemUoKTsKICAgIGlmIChfX24pCiAgICB7CiAgICAgICAgX19iZWdpbl8gPSBfX2VuZF8gPSBzdGF0aWNfY2FzdDx2YWx1ZV90eXBlKj4oOjpvcGVyYXRvciBuZXcoX19uICogc2l6ZW9mKHZhbHVlX3R5cGUpKSk7CiNpZm5kZWYgX0xJQkNQUF9OT19FWENFUFRJT05TCiAgICAgICAgdHJ5CiAgICAgICAgewojZW5kaWYKICAgICAgICAgICAgdHlwZWRlZiBjb25zdCBzaXplX3QqIF9JcDsKICAgICAgICAgICAgY29uc3QgdmFsdWVfdHlwZSogX19zID0gX19nYS5fX3ZwXzsKICAgICAgICAgICAgZm9yIChfSXAgX19pID0gX19nYS5fXzFkXy5fX2JlZ2luXywgX19lID0gX19nYS5fXzFkXy5fX2VuZF87CiAgICAgICAgICAgICAgICAgICAgX19pICE9IF9fZTsgKytfX2ksICsrX19lbmRfKQogICAgICAgICAgICAgICAgOjpuZXcgKF9fZW5kXykgdmFsdWVfdHlwZShfX3NbKl9faV0pOwojaWZuZGVmIF9MSUJDUFBfTk9fRVhDRVBUSU9OUwogICAgICAgIH0KICAgICAgICBjYXRjaCAoLi4uKQogICAgICAgIHsKICAgICAgICAgICAgcmVzaXplKDApOwogICAgICAgICAgICB0aHJvdzsKICAgICAgICB9CiNlbmRpZgogICAgfQp9Cgp0ZW1wbGF0ZSA8Y2xhc3MgX1RwPgp2YWxhcnJheTxfVHA+Ojp2YWxhcnJheShjb25zdCBtYXNrX2FycmF5PHZhbHVlX3R5cGU+JiBfX21hKQogICAgOiBfX2JlZ2luXygwKSwKICAgICAgX19lbmRfKDApCnsKICAgIHNpemVfdCBfX24gPSBfX21hLl9fMWRfLnNpemUoKTsKICAgIGlmIChfX24pCiAgICB7CiAgICAgICAgX19iZWdpbl8gPSBfX2VuZF8gPSBzdGF0aWNfY2FzdDx2YWx1ZV90eXBlKj4oOjpvcGVyYXRvciBuZXcoX19uICogc2l6ZW9mKHZhbHVlX3R5cGUpKSk7CiNpZm5kZWYgX0xJQkNQUF9OT19FWENFUFRJT05TCiAgICAgICAgdHJ5CiAgICAgICAgewojZW5kaWYKICAgICAgICAgICAgdHlwZWRlZiBjb25zdCBzaXplX3QqIF9JcDsKICAgICAgICAgICAgY29uc3QgdmFsdWVfdHlwZSogX19zID0gX19tYS5fX3ZwXzsKICAgICAgICAgICAgZm9yIChfSXAgX19pID0gX19tYS5fXzFkXy5fX2JlZ2luXywgX19lID0gX19tYS5fXzFkXy5fX2VuZF87CiAgICAgICAgICAgICAgICAgICAgX19pICE9IF9fZTsgKytfX2ksICsrX19lbmRfKQogICAgICAgICAgICAgICAgOjpuZXcgKF9fZW5kXykgdmFsdWVfdHlwZShfX3NbKl9faV0pOwojaWZuZGVmIF9MSUJDUFBfTk9fRVhDRVBUSU9OUwogICAgICAgIH0KICAgICAgICBjYXRjaCAoLi4uKQogICAgICAgIHsKICAgICAgICAgICAgcmVzaXplKDApOwogICAgICAgICAgICB0aHJvdzsKICAgICAgICB9CiNlbmRpZgogICAgfQp9Cgp0ZW1wbGF0ZSA8Y2xhc3MgX1RwPgp2YWxhcnJheTxfVHA+Ojp2YWxhcnJheShjb25zdCBpbmRpcmVjdF9hcnJheTx2YWx1ZV90eXBlPiYgX19pYSkKICAgIDogX19iZWdpbl8oMCksCiAgICAgIF9fZW5kXygwKQp7CiAgICBzaXplX3QgX19uID0gX19pYS5fXzFkXy5zaXplKCk7CiAgICBpZiAoX19uKQogICAgewogICAgICAgIF9fYmVnaW5fID0gX19lbmRfID0gc3RhdGljX2Nhc3Q8dmFsdWVfdHlwZSo+KDo6b3BlcmF0b3IgbmV3KF9fbiAqIHNpemVvZih2YWx1ZV90eXBlKSkpOwojaWZuZGVmIF9MSUJDUFBfTk9fRVhDRVBUSU9OUwogICAgICAgIHRyeQogICAgICAgIHsKI2VuZGlmCiAgICAgICAgICAgIHR5cGVkZWYgY29uc3Qgc2l6ZV90KiBfSXA7CiAgICAgICAgICAgIGNvbnN0IHZhbHVlX3R5cGUqIF9fcyA9IF9faWEuX192cF87CiAgICAgICAgICAgIGZvciAoX0lwIF9faSA9IF9faWEuX18xZF8uX19iZWdpbl8sIF9fZSA9IF9faWEuX18xZF8uX19lbmRfOwogICAgICAgICAgICAgICAgICAgIF9faSAhPSBfX2U7ICsrX19pLCArK19fZW5kXykKICAgICAgICAgICAgICAgIDo6bmV3IChfX2VuZF8pIHZhbHVlX3R5cGUoX19zWypfX2ldKTsKI2lmbmRlZiBfTElCQ1BQX05PX0VYQ0VQVElPTlMKICAgICAgICB9CiAgICAgICAgY2F0Y2ggKC4uLikKICAgICAgICB7CiAgICAgICAgICAgIHJlc2l6ZSgwKTsKICAgICAgICAgICAgdGhyb3c7CiAgICAgICAgfQojZW5kaWYKICAgIH0KfQoKdGVtcGxhdGUgPGNsYXNzIF9UcD4KaW5saW5lIF9MSUJDUFBfQUxXQVlTX0lOTElORQp2YWxhcnJheTxfVHA+Ojp+dmFsYXJyYXkoKQp7CiAgICByZXNpemUoMCk7Cn0KCnRlbXBsYXRlIDxjbGFzcyBfVHA+CnZhbGFycmF5PF9UcD4mCnZhbGFycmF5PF9UcD46Om9wZXJhdG9yPShjb25zdCB2YWxhcnJheSYgX192KQp7CiAgICBpZiAodGhpcyAhPSAmX192KQogICAgewogICAgICAgIGlmIChzaXplKCkgIT0gX192LnNpemUoKSkKICAgICAgICAgICAgcmVzaXplKF9fdi5zaXplKCkpOwogICAgICAgIF9TVEQ6OmNvcHkoX192Ll9fYmVnaW5fLCBfX3YuX19lb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X19wID0gX19iZWdpbl87IF9fbjsgKytfX3IuX19lbmRfLCArK19fcCwgLS1fX24pCiAgICAgICAgICAgIDo6bmV3IChfX3IuX19lbmRfKSB2YWx1ZV90eXBlKCsqX19wKTsKICAgIH0KICAgIHJldHVybiBfX3I7Cn0KCnRlbXBsYXRlIDxjbGFzcyBfVHA+CnZhbGFycmF5PF9UcD4KdmFsYXJyYXk8X1RwPjo6b3BlcmF0b3ItKCkgY29uc3QKewogICAgdmFsYXJyYXk8dmFsdWVfdHlwZT4gX19yOwogICAgc2l6ZV90IF9fbiA9IHNpemUoKTsKICAgIGlmIChfX24pCiAgICB7CiAgICAgICAgX19yLl9fYmVnaW5fID0KICAgICAgICAgICAgX19yLl9fZW5kXyA9CiAgICAgICAgICAgICAgICBzdGF0aWNfY2FzdDx2YWx1ZV90eXBlKj4oOjpvcGVyYXRvciBuZXcoX19uICogc2l6ZW9mKHZhbHVlX3R5cGUpKSk7CiAgICAgICAgZm9yIChjb25zdCB2YWx1ZV90eXBlKiBfX3AgPSBfX2JlZ2luXzsgX19uOyArK19fci5fX2VuZF8sICsrX19wLCAtLV9fbikKICAgICAgICAgICAgOjpuZXcgKF9fci5fX2VuZF8pIHZhbHVlX3R5cGUoLSpfX3ApOwogICAgfQogICAgcmV0dXJuIF9fcjsKfQoKdGVtcGxhdGUgPGNsYXNzIF9UcD4KdmFsYXJyYXk8X1RwPgp2YWxhcnJheTxfVHA+OjpvcGVyYXRvcn4oKSBjb25zdAp7CiAgICB2YWxhcnJheTx2YWx1ZV90eXBlPiBfX3I7CiAgICBzaXplX3QgX19uID0gc2l6ZSgpOwogICAgaWYgKF9fbikKICAgIHsKICAgICAgICBfX3IuX19iZWdpbl8gPQogICAgICAgICAgICBfX3IuX19lbmRfID0KICAgICAgICAgICAgICAgIHN0YXRpY19jYXN0PHZhbHVlX3R5cGUqPig6Om9wZXJhdG9yIG5ldyhfX24gKiBzaXplb2YodmFsdWVfdHlwZSkpKTsKICAgICAgICBmb3IgKGN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WYgKF9fYmVnaW5fID09IF9fZW5kXykKICAgICAgICByZXR1cm4gdmFsdWVfdHlwZSgpOwogICAgcmV0dXJuICpfU1REOjptaW5fZWxlbWVudChfX2JlZ2luXywgX19lbmRfKTsKfQoKdGVtcGxhdGUgPGNsYXNzIF9UcD4KaW5saW5lIF9MSUJDUFBfQUxXQVlTX0lOTElORQpfVHAKdmFsYXJyYXk8X1RwPjo6bWF4KCkgY29uc3QKewogICAgaWYgKF9fYmVnaW5fID09IF9fZW5kXykKICAgICAgICByZXR1cm4gdmFsdWVfdHlwZSgpOwogICAgcmV0dXJuICpfU1REOjptYXhfZWxlbWVudChfX2JlZ2luXywgX19lbmRfKTsKfQoKdGVtcGxhdGUgPGNsYXNzIF9UcD4KdmFsYXJyYXk8X1RwPgp2YWxhcnJheTxfVHA+OjpzaGlmdChpbnQgX19pKSBjb25zdAp7CiAgICB2YWxhcnJheTx2YWx1ZV90eXBlPiBfX3I7CiAgICBzaXplX3QgX19uID0gc2l6ZSgpOwogICAgaWYgKF9fbikKICAgIHsKICAgICAgICBfX3IuX19iZWdpbl8gPQogICAgICAgICAgICBfX3IuX19lbmRfID0KICAgICAgICAgICAgICAgIHN0YXRpY19jYXN0PHZhbHVlX3R5cGUqPig6Om9wZXJhdG9yIG5ldyhfX24gKiBzaXplb2YodmFsdWVfdHlwZSkpKTsKICAgICAgICBjb25zdCB2YWx1ZV90eXBlKiBfX3NiOwogICAgICAgIHZhbHVlX3R5cGUqIF9fdGI7CiAgICAgICAgdmFsdWVfdHlwZSogX190ZTsKICAgICAgICBpZiAoX19pID49IDApCiAgICAgICAgewogICAgICAgICAgICBfX2kgPSBfU1REOjptaW4oX19pLCBzdGF0aWNfY2FzdDxpbnQ+KF9fbikpOwogICAgICAgICAgICBfX3NiID0gX19iZWdpbl8gKyBfX2k7CiAgICAgICAgICAgIF9fdGIgPSBfX3IuX19iZWdpbl87CiAgICAgICAgICAgIF9fdGUgPSBfX3IuX19iZWdpbl8gKyAoX19uIC0gX19pKTsKICAgICAgICB9CiAgICAgICAgZWxzZQogICAgICAgIHsKICAgICAgICAgICAgX19pID0gX1NURDo6bWluKC1fX2ksIHN0YXRpY19jYXN0PGludD4oX19uKSk7CiAgICAgICAgICAgIF9fc2IgPSBfX2JlZ2luXzsKICAgICAgICAgICAgX190YiA9IF9fci5fX2JlZ2luXyArIF9faTsKICAgICAgICAgICAgX190ZSA9IF9fci5fX2JlZ2luXyArIF9fbjsKICAgICAgICB9CiAgICAgICAgZm9yICg7IF9fci5fX2VuZF8gIT0gX190YjsgKytfX3IuX19lbmRfKQogICAgICAgICAgICA6Om5ldyAoX19yLl9fZW5kXykgdmFsdWVfdHlwZSgpOwogICAgICAgIGZvciAoOyBfX3IuX19lbmRfICE9IF9fdGU7ICsrX19yLl9fZW5kXywgKytfX3NiKQogICAgICAgICAgICA6Om5ldyAoX19yLl9fZW5kXykgdmFsdWVfdHlwZSgqX19zYik7CiAgICAgICAgZm9yIChfX3RlID0gX19yLl9fYmVnaW5fICsgX19uOyBfX3IuX19lbmRfICE9IF9fdGU7ICsrX19yLl9fZW5kXykKICAgICAgICAgICAgOjpuZXcgKF9fci5fX2VuZF8pIHZhbHVlX3R5cGUoKTsKICAgIH0KICAgIHJldHVybiBfX3I7Cn0KCnRlbXBsYXRlIDxjbGFzcyBfVHA+CnZhbGFycmF5PF9UcD4KdmFsYXJyYXk8X1RwPjo6Y3NoaWZ0KGludCBfX2kpIGNvbnN0CnsKICAgIHZhbGFycmF5PHZhbHVlX3R5cGU+IF9fcjsKICAgIHNpemVfdCBfX24gPSBzaXplKCk7CiAgICBpZiAoX19uKQogICAgewogICAgICAgIF9fci5fX2JlZ2luXyA9CiAgICAgICAgICAgIF9fci5fX2VuZF8gPQogICAgICAgICAgICAgICAgc3RhdGljX2Nhc3Q8dmFsdWVfdHlwZSo+KDo6b3BlcmF0b3IgbmV3KF9fbiAqIHNpemVvZih2YWx1ZV90eXBlKSkpOwogICAgICAgIF9faSAlPSBzdGF0aWNfY2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