| Contests - ACM Student Chapter - PSUT |
|---|
| Private |
| Spectator |
| ZU JCPC Qualification 2026 |
|---|
| Finished |
Hyasat is a dedicated software engineer who just inherited a legacy codebase. Upon running the linter, he discovers exactly $$$N$$$ warnings.To help clear the backlog, he has built two automated code-refactoring tools:
Because these tools are highly specialized, they will crash the entire system if they attempt to clear more warnings than are actually remaining.
Hyasat wants to completely eliminate all $$$N$$$ warnings using the minimum total number of tool runs.
Help him find the minimum number of times he needs to run his tools, or determine if it is impossible to clear exactly $$$N$$$ warnings without crashing the system.
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases.
Each test case consists of a single line containing one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the number of warnings in the codebase.
For each test case, output a single integer: the minimum total number of tool runs required to clear exactly $$$n$$$ warnings. If it is impossible to clear the warnings exactly, output -1.
5101417324
223-14
| Name |
|---|

