Count pairs from an array having GCD equal to the minimum element in the pair

  #include using namespace std;  int CountPairs(int arr[], int N){        int res = 0;              map mp;          for (int i = 0; i < N; i++) {        mp[arr[i]]++;    }        for (auto p : mp) {                  int x = p.first;                          int y = p.second;                  if (x == 1) {                          res += N - 1;            continue;        }                  res += (y * (y - 1)) / 2;                          for (int j = 2;             j