malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const int INF = 1000000000;   int main() {     ios_base::sync_with_stdio(0);     int n;     cin >> n;     vector<string> a(n);     map<string, int> M;     for (int i = 0; i < n; ++i) {       cin >> a[i];       M[a[i]] = i;     }     vector<vector<int> > Inv(1 << n, vector<int>(n, 0));     for (int mask = 1; mask < (1 << n); ++mask)       for (int j = 0; j < n; ++j)         if ((mask & (1 << j)) == 0)           for (int l = 0; l < n; ++l)             if ((mask & (1 << l)) > 0 && M[a[j]] < M[a[l]]) ++Inv[mask][j];     int m;     cin >> m;     int p = -1, nr;     for (int i = 0; i < m; ++i) {       int k;       cin >> k;       vector<string> b(k);       for (int j = 0; j < k; ++j) cin >> b[j];       vector<vector<int> > nast(k, vector<int>(n, INF));       if (M.find(b[k - 1]) != M.end()) nast[k - 1][M[b[k - 1]]] = k - 1;       for (int j = k - 2; j >= 0; --j) {         for (int l = 0; l < n; ++l) nast[j][l] = nast[j + 1][l];         if (M.find(b[j]) != M.end()) nast[j][M[b[j]]] = j;       }       vector<vector<int> > dp((1 << n), vector<int>(n * (n - 1) / 2 + 1, INF));       for (int j = 0; j < n; ++j)         if (nast[0][j] != INF) dp[1 << j][0] = nast[0][j];       for (int mask = 1; mask < (1 << n); ++mask) {         for (int inv = 0; inv <= n * (n - 1) / 2; ++inv) {           if (dp[mask][inv] == INF) continue;           for (int j = 0; j < n; ++j) {             if ((mask & (1 << j)) == 0) {               int noweInv = inv + Inv[mask][j];               if (dp[mask][inv] + 1 < k && nast[dp[mask][inv] + 1][j] != INF)                 dp[mask | (1 << j)][noweInv] =                     min(dp[mask | (1 << j)][noweInv], nast[dp[mask][inv] + 1][j]);             }           }         }       }       for (int j = 0; j <= n * (n - 1) / 2; ++j) {         if (dp[(1 << n) - 1][j] != INF && n * (n - 1) / 2 - j + 1 > p) {           p = n * (n - 1) / 2 - j + 1;           nr = i;         }       }     }     if (p == -1)       cout <<  Brand new problem! ;     else {       cout << nr + 1 << endl;       cout <<  [: ;       for (int i = 0; i < p; ++i) cout <<  | ;       cout <<  :] ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 14;   const int Q = 101;   int n, m, q;   long long dp[N][1 << N];   bool edge[N][N];   int a[Q], b[Q], c[Q];   int lowbit(int x) { return x & (-x); }   int in(int i, int S) { return ((S >> i) & 1); }   bool check(int u, int k) {     for (int i = 0; i < n; i++)       if (i != u) {         for (int j = 0; j < n; j++)           if (j != u)             if (edge[i][j] && (in(i, k) ^ in(j, k))) return false;       }     return true;   }   long long DP(int u, int S) {     if (dp[u][S] != -1) return dp[u][S];     dp[u][S] = 0;     int status = S - (1 << u);     int t;     for (t = 0; t < n; t++)       if (in(t, status)) break;     for (int k = status; k; k = (k - 1) & status)       if (in(t, k)) {         if (!check(u, k)) continue;         int v, cnt = 0;         for (int i = 0; i < n; i++) {           if (edge[u][i] && in(i, k)) {             cnt++;             v = i;           }         }         if (cnt >= 2) continue;         bool flag = true;         for (int i = 1; i <= q; i++) {           if (c[i] == u && in(a[i], k) && in(b[i], k)) {             flag = false;             break;           }           if (in(c[i], k) && (!in(a[i], k) || !in(b[i], k))) {             flag = false;             break;           }         }         if (!flag) continue;         if (cnt == 1) {           dp[u][S] += DP(v, k) * DP(u, S - k);         } else {           for (v = 0; v < n; v++)             if (in(v, k)) dp[u][S] += DP(v, k) * DP(u, S - k);         }       }     return dp[u][S];   }   int main() {     scanf( %d%d%d , &n, &m, &q);     for (int i = 1; i <= m; i++) {       int x, y;       scanf( %d%d , &x, &y);       x--, y--;       edge[x][y] = edge[y][x] = true;     }     for (int i = 1; i <= q; i++) {       scanf( %d%d%d , &a[i], &b[i], &c[i]);       a[i]--;       b[i]--;       c[i]--;     }     memset(dp, -1, sizeof(dp));     for (int i = 0; i < n; i++) dp[i][1 << i] = 1;     printf( %lld , DP(0, (1 << n) - 1));     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int t = 1;   void solve() {     long long n, i, k, s = 0, b;     cin >> n >> k;     long long a[n];     for (i = 0; i < n; i++) {       cin >> a[i];     }     sort(a, a + n);     b = a[0];     for (i = 1; i < n; i++) {       long long c = (k - a[i]) / b;       if (c > 0) s += c;     }     cout << s <<   n ;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cin >> t;     while (t--) {       solve();     }   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 3e5 + 20;   const int inf = 0x3f3f3f3f;   const int modd = 1e9 + 7;   inline int read() {     int x = 0, f = 1;     char c = getchar();     while (c !=  -  && (c <  0  || c >  9 )) c = getchar();     if (c ==  - ) f = -1, c = getchar();     while (c >=  0  && c <=  9 ) x = x * 10 + c -  0 , c = getchar();     return f * x;   }   template <class T>   inline void sc(T &x) {     char c;     x = 0;     while ((c = getchar()) <  0 )       ;     while (c >=  0  && c <=  9 ) x = x * 10 + (c - 48), c = getchar();   }   inline long long gcd(long long a, long long b) {     return b == 0 ? a : gcd(b, a % b);   }   inline long long exgcd(long long a, long long b, long long &x, long long &y) {     long long d;     (b == 0 ? (x = 1, y = 0, d = a)             : (d = exgcd(b, a % b, y, x), y -= a / b * x));     return d;   }   inline long long qpow(long long a, long long n) {     long long sum = 1;     while (n) {       if (n & 1) sum = sum * a % modd;       a = a * a % modd;       n >>= 1;     }     return sum;   }   inline long long qmul(long long a, long long n) {     long long sum = 0;     while (n) {       if (n & 1) sum = (sum + a) % modd;       a = (a + a) % modd;       n >>= 1;     }     return sum;   }   inline long long inv(long long a) { return qpow(a, modd - 2); }   int a[maxn];   int main() {     int n, m;     scanf( %d%d , &n, &m);     if (m && n < 3) return printf( -1 n ), 0;     int i = 1;     for (; i <= n;) {       if (m >= (i - 1) / 2) {         a[i] = i, m -= (i - 1) / 2;         i++;         continue;       }       if (m > 0) a[i] = 2 * (i - m) - 1, m = 0, i++;       if (!m) break;     }     for (int j = n; j >= i; j--) a[j] = (int)9e8 - (n - j) * (a[i - 1] + 1);     if (!m) {       for (int i = 1; i <= n; i++) printf( %d%c , a[i],    n [i == n]);       return 0;     }     printf( -1 n );   }
#include <bits/stdc++.h>   using namespace std;   int n, leaf;   vector<int> vt[100005];   int ara[100005], chk[100005], level[100005], child[100005];   map<int, int> mp;   void bfs() {     int i, j, k;     queue<int> qu;     qu.push(0);     chk[0] = 1;     level[0] = 0;     while (!qu.empty()) {       k = qu.front();       qu.pop();       for (i = 0; i < vt[k].size(); ++i) {         j = vt[k][i];         if (!chk[j]) {           qu.push(j);           level[j] = level[k] + 1;           chk[j] = 1;         }       }     }   }   int main() {     long long i, j, k;     long long xr, ans;     scanf( %d , &n);     for (i = 0; i < n; ++i) scanf( %d , &ara[i]);     for (i = 1; i < n; ++i) {       scanf( %d , &k);       k--;       child[k] = 1;       vt[i].push_back(k);       vt[k].push_back(i);     }     bfs();     for (i = 0; i < n; ++i)       if (!child[i]) leaf = i;     for (i = 0, xr = 0, k = n; i < n; ++i) {       if (level[leaf] % 2 == level[i] % 2) xr ^= ara[i], k--, mp[ara[i]]++;       ;     }     ans = 0;     if (xr == 0) {       ans += (k * (k - 1)) / 2;       k = n - k;       ans += (k * (k - 1)) / 2;       for (i = 0; i < n; ++i) {         if (level[leaf] % 2 != level[i] % 2) ans += mp[ara[i]];       }     } else {       for (i = 0; i < n; ++i) {         if (level[leaf] % 2 == level[i] % 2) continue;         k = xr ^ ara[i];         ans += mp[k];       }     }     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   int testnum;   const int maxn = 100005;   int par[maxn];   int size[maxn];   int find(int u) {     if (par[u] == u) return u;     return par[u] = find(par[u]);   }   bool unify(int u, int v) {     int cu = find(u), cv = find(v);     if (cu == cv) return true;     if (size[cu] > size[cv]) {       par[cv] = cu;       size[cu] += size[cv];     } else {       par[cu] = cv;       size[cv] += size[cu];     }     return false;   }   int n, m;   void preprocess() {     for (int i = 0; i < maxn; i++) {       par[i] = i;       size[i] = 1;     }   }   long long mod = 1000000009;   void solve() {     int a, b;     long long ans = 1;     for (int i = 0; i < m; i++) {       scanf( %d , &a);       scanf( %d , &b);       bool z = unify(a, b);       if (z) {         ans = (ans + ans) % mod;       }       cout << (ans - 1) << endl;     }   }   bool input() {     scanf( %d , &n);     scanf( %d , &m);     return true;   }   int main() {     preprocess();     int T = 1;     for (testnum = 1; testnum <= T; testnum++) {       if (!input()) break;       solve();     }   }
#include <bits/stdc++.h>   using namespace std;   int n;   int main() {     scanf(  %d , &n);     if (n <= 2) {       puts( No );       return 0;     }     puts( Yes );     if (n & 1) {       printf( 2 1 %d n , n);       printf( %d  , n - 2);       for (int i = 2; i < n; i++) printf( %d  , i);       puts(  );     } else {       printf( %d n , n / 2);       for (int i = 1; i <= n; i++)         if (i & 1) printf( %d  , i);       puts(  );       printf( %d n , n / 2);       for (int i = 1; i <= n; i++)         if (!(i & 1)) printf( %d  , i);       puts(  );     }   }
#include <bits/stdc++.h>   using namespace std;   const long long MOD = 1000000007;   const long long N = 100000;   template <typename T>   ostream &operator<<(ostream &os, const vector<T> &v) {     os <<  { ;     for (auto it = v.begin(); it != v.end(); ++it) {       if (it != v.begin()) os <<  ,  ;       os << *it;     }     return os <<  } ;   }   template <typename first, typename second>   ostream &operator<<(ostream &os, const pair<first, second> &p) {     return os <<  (  << p.first <<  ,   << p.second <<  ) ;   }   template <typename T>   ostream &operator<<(ostream &os, const set<T> &v) {     os <<  [ ;     for (auto it = v.begin(); it != v.end(); ++it) {       if (it != v.begin()) os <<  ,  ;       os << *it;     }     return os <<  ] ;   }   template <typename T>   ostream &operator<<(ostream &os, const multiset<T> &v) {     os <<  [ ;     for (auto it = v.begin(); it != v.end(); ++it) {       if (it != v.begin()) os <<  ,  ;       os << *it;     }     return os <<  ] ;   }   template <typename first, typename second>   ostream &operator<<(ostream &os, const map<first, second> &v) {     os <<  [ ;     for (auto it = v.begin(); it != v.end(); ++it) {       if (it != v.begin()) os <<  ,  ;       os << it->first <<   =   << it->second;     }     return os <<  ] ;   }   pair<long long, long long> get(multiset<long long> &m) {     auto it = m.end();     it--;     return {*m.begin(), *it};   }   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     long long n;     cin >> n;     long long p;     cin >> p;     long long q;     cin >> q;     long long r;     cin >> r;     vector<long long> a(n);     for (long long i = 0; i < n; i++) {       cin >> a[i];     }     vector<long long> temp;     temp.push_back(p);     temp.push_back(q);     temp.push_back(r);     multiset<long long> m(a.begin(), a.end()), pref;     ;     long long res = LLONG_MIN;     for (long long i = 0; i < n; i++) {       pref.insert(a[i]);       pair<long long, long long> left = get(pref);       pair<long long, long long> ryt = get(m);       long long mid = a[i];       long long cur = mid * temp[1];       if (temp[0] > 0) {         cur += (temp[0] * left.second);       } else {         cur += (temp[0] * left.first);       }       if (temp[2] > 0) {         cur += (temp[2] * ryt.second);       } else {         cur += (temp[2] * ryt.first);       }       res = max(res, cur);       m.erase(m.find(a[i]));     }     cout << res <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int ab, bc, ca, abc;     int temp[4];     for (int i = 0; i < 4; i++) {       cin >> temp[i];     }     sort(temp, temp + 4);     ab = temp[0];     bc = temp[1];     ca = temp[2];     abc = temp[3];     int a, b, c;     a = abc - bc;     b = ab - a;     c = ca - a;     cout << a <<     << b <<     << c << endl;   }
#include <bits/stdc++.h>   using namespace std;   template <class T1>   void deb(T1 e) {     cout << e << endl;   }   template <class T1, class T2>   void deb(T1 e1, T2 e2) {     cout << e1 <<     << e2 << endl;   }   template <class T1, class T2, class T3>   void deb(T1 e1, T2 e2, T3 e3) {     cout << e1 <<     << e2 <<     << e3 << endl;   }   template <class T1, class T2, class T3, class T4>   void deb(T1 e1, T2 e2, T3 e3, T4 e4) {     cout << e1 <<     << e2 <<     << e3 <<     << e4 << endl;   }   template <class T1, class T2, class T3, class T4, class T5>   void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5) {     cout << e1 <<     << e2 <<     << e3 <<     << e4 <<     << e5 << endl;   }   template <class T1, class T2, class T3, class T4, class T5, class T6>   void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5, T6 e6) {     cout << e1 <<     << e2 <<     << e3 <<     << e4 <<     << e5 <<     << e6          << endl;   }   string st;   long long cum1[500010], cum2[500010], cum3[500010], cumhelp3[500010];   bool okay(char ch) {     return ch ==  A  || ch ==  E  || ch ==  I  || ch ==  O  || ch ==  U  ||            ch ==  Y ;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     ;     int mini, i, j, n, baki1, baki2;     cin >> st;     for (i = 0; i < st.size(); i++) {       if (!okay(st[i])) continue;       baki1 = i;       baki2 = st.size() - i - 1;       mini = min(baki1, baki2);       mini++;       cum1[1]++;       cum1[mini + 1]--;       if (baki1 > baki2) swap(baki1, baki2);       if (baki2 > baki1) {         cum2[baki1 + 2] += mini;         cum2[baki2 + 2] -= mini;       }       mini--;       cumhelp3[st.size() - mini + 2]--;       cum3[st.size() - mini + 1] += mini;     }     double ans = 0;     for (i = 1; i <= st.size(); i++) {       cum1[i] += cum1[i - 1];       cum2[i] += cum2[i - 1];       cumhelp3[i] += cumhelp3[i - 1];       cum3[i] += cum3[i - 1] + cumhelp3[i];     }     for (i = 1; i <= st.size(); i++) {       cum1[i] *= (long long)i;       ans += (double)(cum1[i] + cum2[i] + cum3[i]) / (double)i;     }     cout << fixed << setprecision(12) << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, a, b, T, ans = 0;     cin >> n >> a >> b >> T;     vector<int> d(n, 1);     for (int& p : d) {       char c;       cin >> c;       if (c ==  w ) p += b;     }     vector<int> rtime(n), ltime(n);     rtime[0] = d[0], ltime[0] = d[0];     for (int i = 1; i < n; i++) {       rtime[i] = d[i] + a + rtime[i - 1];       ltime[i] = d[n - i] + a + ltime[i - 1];     }     if (d[0] <= T) ans = 1;     for (int i = 1; i < n; i++) {       int time = T - rtime[i];       if (time >= 0) ans = max(ans, 1 + i);       time -= i * a;       if (time > 0) {         time += d[0];         int num_left =             lower_bound(ltime.begin(), ltime.end(), time) - ltime.begin();         if (ltime[num_left] > time && num_left > 0) num_left--;         ans = max(ans, 1 + i + num_left);       }     }     for (int i = 1; i < n; i++) {       int time = T - ltime[i];       if (time >= 0) ans = max(ans, 1 + i);       time -= i * a;       if (time > 0) {         time += d[0];         int num_right =             lower_bound(rtime.begin(), rtime.end(), time) - rtime.begin();         if (rtime[num_right] > time && num_right > 0) num_right--;         ans = max(ans, 1 + i + num_right);       }     }     cout << min(n, ans) << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   signed main() {     ios_base::sync_with_stdio(0), cin.tie(0);     int n, l;     cin >> n >> l;     int arr[n];     for (int i = 0; i < n; i++) {       cin >> arr[i];     }     sort(arr, arr + n);     double maxy = INT_MIN * 1.0;     for (int i = 0; i < n - 1; i++) {       if (arr[i + 1] - arr[i] > maxy) maxy = arr[i + 1] - arr[i];     }     maxy *= 1.0;     if (arr[0] == 0 or arr[n - 1] == l) {       if (arr[0] == 0 and arr[n - 1] == l) {         cout << fixed << setprecision(10) << maxy / 2;       } else if (arr[0] == 0) {         cout << fixed << setprecision(10) << max(maxy / 2, (l - arr[n - 1]) * 1.0)              <<   n ;       } else {         cout << fixed << setprecision(10) << max(maxy / 2, (arr[0]) * 1.0)              <<   n ;       }     } else {       cout << fixed << setprecision(10)            << max(maxy / 2, max(l - arr[n - 1], arr[0]) * 1.0) <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long max(long long a, long long b) {     if (a > b)       return a;     else       return b;   }   long long min(long long a, long long b) {     if (a < b)       return a;     else       return b;   }   long long power(long long B, long long P) {     if (P == 0) return 1;     long long X = power(B, P / 2);     if (P % 2 == 0)       return X * X;     else       return B * X * X;   }   long long fx4[] = {1, -1, 0, 0};   long long fy4[] = {0, 0, 1, -1};   int main() {     long long T, N, M, X, Y, W, K, Q, R, P;     cin >> N >> M;     long long e1 = 0, o1 = 0, e2 = 0, o2 = 0;     for (int i = 1; i <= N; i++) {       cin >> X;       if (X % 2)         o1++;       else         e1++;     }     for (int i = 1; i <= M; i++) {       cin >> X;       if (X % 2)         o2++;       else         e2++;     }     cout << (min(e1, o2) + min(o1, e2)) << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int INF = 0x6fffffff;   const int MINF = 0x80000000;   const long long mod = 1000000007;   const int cons = 100001;   const double pi = 3.141592653589793;   vector<int> pos;   bool isOk(int x, int t) {     double res = 0;     for (int i = 1; i < pos.size(); i++) {       int diff = pos[i] - pos[i - 1];       int l = -1;       int r = x + 1;       while (l + 1 < r) {         int mid = l + r >> 1;         int y = x - mid;         double avail = (double)y / 2 + mid;         if (avail >= (double)diff)           r = mid;         else           l = mid;       }       if (r == x + 1) return false;       diff -= r;       res += (double)r * 2;       res += min((double)diff, ((double)x - r) / 2);     }     return res <= (double)t;   }   int main() {     int n, k, s, t;     cin >> n >> k >> s >> t;     map<int, int> M;     for (int i = 0; i < n; i++) {       int c, v;       scanf( %d%d , &c, &v);       M[c] = max(M[c], v);     }     int cur = 0;     vector<pair<int, int> > dat;     for (auto it : M) {       if (cur < it.second) {         cur = it.second;         dat.push_back(it);       }     }     pos.resize(k);     for (int i = 0; i < k; i++) {       scanf( %d , &pos[i]);     }     pos.push_back(0);     pos.push_back(s);     sort(pos.begin(), pos.end());     int L = -1;     int R = dat.size();     while (L + 1 < R) {       int mid = L + R >> 1;       if (isOk(dat[mid].second, t))         R = mid;       else         L = mid;     }     if (R == dat.size())       puts( -1 );     else       printf( %d n , dat[R].first);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int oo = 1000000001;   int dp[1200][1200], out[1200][5], pre[1200][1200], a[1200];   int i, j, last, n, mi;   int main() {     while (~scanf( %d , &n)) {       for (i = 0; i < n; i++) scanf( %d , &a[i]);       if (n == 1) {         printf( %d n%d n , a[0], 1);         continue;       }       if (n == 2) {         printf( %d n%d %d n , max(a[0], a[1]), 1, 2);         continue;       }       for (i = 0; i < n; i++)         for (j = 0; j < n; j++) dp[i][j] = oo;       dp[1][0] = max(a[1], a[2]);       dp[1][1] = max(a[0], a[2]);       dp[1][2] = max(a[0], a[1]);       for (i = 1; 2 * i + 2 < n; i++) {         for (j = 0; j <= 2 * i; j++) {           if (dp[i + 1][j] - max(a[2 * i + 2], a[2 * i + 1]) > dp[i][j]) {             dp[i + 1][j] = dp[i][j] + max(a[2 * i + 2], a[2 * i + 1]);             pre[i + 1][j] = j;           }           if (dp[i + 1][2 * i + 2] - max(a[j], a[2 * i + 1]) > dp[i][j]) {             dp[i + 1][2 * i + 2] = dp[i][j] + max(a[j], a[2 * i + 1]);             pre[i + 1][2 * i + 2] = j;           }           if (dp[i + 1][2 * i + 1] - max(a[j], a[2 * i + 2]) > dp[i][j]) {             dp[i + 1][2 * i + 1] = dp[i][j] + max(a[j], a[2 * i + 2]);             pre[i + 1][2 * i + 1] = j;           }         }       }       if (n % 2 == 1) {         mi = oo;         for (i = 0; i < n; i++) {           if (mi > dp[n / 2][i] + a[i]) {             mi = dp[n / 2][i] + a[i];             last = i;           }         }         printf( %d n , mi);         out[n / 2][0] = last;         for (i = n / 2; i > 0; i--) {           int te = pre[i][last];           if (last == 2 * i - 1) {             out[i - 1][0] = te;             out[i - 1][1] = 2 * i;             last = te;           } else if (last == 2 * i) {             out[i - 1][0] = te;             out[i - 1][1] = 2 * i - 1;             last = te;           } else {             out[i - 1][0] = 2 * i - 1;             out[i - 1][1] = 2 * i;             last = te;           }         }         for (i = 0; i < n / 2; i++)           printf( %d %d n , out[i][0] + 1, out[i][1] + 1);         printf( %d n , out[n / 2][0] + 1);       } else {         mi = oo;         for (i = 0; i < n; i++) {           if (mi > dp[n / 2 - 1][i] + max(a[i], a[n - 1])) {             mi = dp[n / 2 - 1][i] + max(a[i], a[n - 1]);             last = i;           }         }         printf( %d n , mi);         out[n / 2 - 1][0] = last;         out[n / 2 - 1][1] = n - 1;         for (i = n / 2 - 1; i > 0; i--) {           int te = pre[i][last];           if (last == 2 * i - 1) {             out[i - 1][0] = te;             out[i - 1][1] = 2 * i;             last = te;           } else if (last == 2 * i) {             out[i - 1][0] = te;             out[i - 1][1] = 2 * i - 1;             last = te;           } else {             out[i - 1][0] = 2 * i - 1;             out[i - 1][1] = 2 * i;             last = te;           }         }         for (i = 0; i < n / 2; i++)           printf( %d %d n , out[i][0] + 1, out[i][1] + 1);       }     }   }