func_code_string: #include <bits/stdc++.h>   using namespace std;   const int gridSize = 1000;   long long getPairs(int n) {     long long result = 0;     for (int i = 1; i < n; i++) result += n - i;     return result;   }   int main() {     std::cout.sync_with_stdio(false);     int n, i, x, y, j;     cin >> n;     bool a[gridSize + 1][gridSize + 1];     for (i = 1; i <= gridSize; i++)       for (j = 1; j <= gridSize; j++) a[i][j] = false;     for (i = 0; i < n; i++) {       cin >> x >> y;       a[x][y] = true;     }     long long result = 0, attacking = 0;     pair<int, int> startPoint(1, 1);     for (i = 1; i <= gridSize; i++) {       attacking = 0;       startPoint = make_pair(1, i);       do {         if (a[startPoint.first][startPoint.second]) attacking++;         startPoint.second++;         startPoint.first++;       } while (startPoint.second <= gridSize && startPoint.first <= gridSize);       if (attacking > 1) result += getPairs(attacking);     }     for (i = 2; i <= gridSize; i++) {       attacking = 0;       startPoint = make_pair(i, 1);       do {         if (a[startPoint.first][startPoint.second]) attacking++;         startPoint.second++;         startPoint.first++;       } while (startPoint.second <= gridSize && startPoint.first <= gridSize);       if (attacking > 1) result += getPairs(attacking);     }     for (i = gridSize; i >= 1; i--) {       attacking = 0;       startPoint = make_pair(1, i);       do {         if (a[startPoint.first][startPoint.second]) attacking++;         startPoint.second--;         startPoint.first++;       } while (startPoint.second >= 1 && startPoint.first <= gridSize);       if (attacking > 1) result += getPairs(attacking);     }     for (i = 2; i <= gridSize; i++) {       attacking = 0;       startPoint = make_pair(i, gridSize);       do {         if (a[startPoint.first][startPoint.second]) attacking++;         startPoint.second--;         startPoint.first++;       } while (startPoint.second >= 1 && startPoint.first <= gridSize);       if (attacking > 1) result += getPairs(attacking);     }     cout << result;     return 0;   }   