func_code_string: #include <bits/stdc++.h>   using namespace std;   vector<pair<int, int> > v;   int n, r, m;   bool cmp(const pair<int, int>& a, const pair<int, int>& b) {     return a.first * a.first + a.second * a.second >            b.first * b.first + b.second * b.second;   }   inline int get_dis(const int& first, const int& second) {     return first * first + second * second;   }   void init() {     v.clear();     for (int i = -r; i <= r; ++i)       for (int j = -r; j <= r; ++j)         if (i * i + j * j <= r * r) v.push_back(make_pair(i, j));     sort(v.begin(), v.end(), cmp);     m = min((int)v.size(), 30 - n * 2);   }   int b[120], ans[120], ansdist;   int dist[39][39];   void dfs(int first, int last, int sum) {     if (first == n) {       if (sum > ansdist) {         for (int i = 0; i < n; ++i) ans[i] = b[i];         ansdist = sum;       }       return;     }     int ndist;     for (int i = last; i < m; ++i) {       ndist = 0;       for (int j = 0; j < first; ++j) ndist += dist[i][b[j]];       b[first] = i;       dfs(first + 1, i, sum + ndist);     }   }   void solve() {     for (int i = 0; i < m; ++i)       for (int j = 0; j < m; ++j)         dist[i][j] = get_dis(v[i].first - v[j].first, v[i].second - v[j].second);     ansdist = 0;     dfs(0, 0, 0);     printf( %d n , ansdist);     for (int i = 0; i < n; ++i)       printf( %d %d n , v[ans[i]].first, v[ans[i]].second);   }   int main() {     while (scanf( %d%d , &n, &r) != EOF) {       init();       solve();     }     return 0;   }   