/BCPTICH - Phân tích số nguyên

<Problem>

https://www.spoj.com/PTIT/problems/BCPTICH/
              #include <iostream>
        #include <cmath>
        using namespace std;
         
        int doSomething(int n) {
          int count = 0;
          for (int i = 2; i <= trunc(sqrt(n)); i++) {
            if (n % i == 0) {
              int x = n / i;
              int y = i;
              
              // x = r + l;
              // y = r - l + 1;
              
              if ((x + y - 1) % 2 == 0) {
                int r = (x + y - 1) / 2;
                int l = x - r;
                
                if (l >= 1 && l < r) {
                  count++;
                }
              }
            }
          }
          return count;
        }
         
        int main() {
          int t;
          cin >> t;
          
          while (t--) {
            int stt, n;
            cin >> stt >> n;
            
            int res = doSomething(n * 2);
            cout << stt << " " << res << endl;
          }
          
          return 0;
        }