malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int n;   char s[105];   string S;   multiset<string> st;   vector<string> v;   inline bool cmp(string a, string b) { return a.length() < b.length(); }   int cnt[26];   char ans[105];   int f[105][26];   int main() {     scanf( %d , &n);     if (n <= 3) {       if (n == 1) {         printf( ? 1 1 n ), fflush(stdout);         scanf( %s , s);         printf( ! %s n , s);         return 0;       }       printf( ? 2 %d n , n), fflush(stdout);       for (int i = 1; i <= n * (n - 1) / 2; i++) {         scanf( %s , s);         S = s;         sort(S.begin(), S.end());         st.insert(S);       }       printf( ? 1 %d n , n), fflush(stdout);       for (int i = 1; i <= n * (n + 1) / 2; i++) {         scanf( %s , s);         S = s;         sort(S.begin(), S.end());         if (st.find(S) == st.end())           v.push_back(S);         else           st.erase(st.find(S));       }       sort(v.begin(), v.end(), cmp);       printf( !  );       for (int i = 0; i < n; i++) {         if (i == 0) {           printf( %c , v[i][0]);           continue;         }         for (int j = 0; j < i + 1; j++) cnt[v[i][j] -  a ]++;         for (int j = 0; j < i; j++) cnt[v[i - 1][j] -  a ]--;         for (int j = 0; j < 26; j++) {           if (cnt[j]) {             cnt[j] = 0, printf( %c , j +  a );             break;           }         }       }       puts(  );       return 0;     }     int m = (n + 1) / 2;     printf( ? 2 %d n , m), fflush(stdout);     for (int i = 1; i <= m * (m - 1) / 2; i++) {       scanf( %s , s);       S = s;       sort(S.begin(), S.end());       st.insert(S);     }     printf( ? 1 %d n , m), fflush(stdout);     for (int i = 1; i <= m * (m + 1) / 2; i++) {       scanf( %s , s);       S = s;       sort(S.begin(), S.end());       if (st.find(S) == st.end())         v.push_back(S);       else         st.erase(st.find(S));     }     sort(v.begin(), v.end(), cmp);     for (int i = 0; i < m; i++) {       if (i == 0) {         ans[i + 1] = v[i][0];         continue;       }       for (int j = 0; j < i + 1; j++) cnt[v[i][j] -  a ]++;       for (int j = 0; j < i; j++) cnt[v[i - 1][j] -  a ]--;       for (int j = 0; j < 26; j++) {         if (cnt[j]) {           cnt[j] = 0, ans[i + 1] = j +  a ;           break;         }       }     }     printf( ? 1 %d n , n), fflush(stdout);     for (int i = 1; i <= n * (n + 1) / 2; i++) {       scanf( %s , s);       int len = strlen(s);       for (int j = 0; j < len; j++) {         f[len][s[j] -  a ]++;       }     }     for (int i = m; i; i--) {       for (int j = 0; j < 26; j++) {         int x = f[i][j] - f[i - 1][j];         for (int k = i; k < n + 1 - i; k++) x -= ans[k] == j +  a ;         if (x) {           ans[n + 1 - i] = j +  a ;           break;         }       }     }     printf( !  );     for (int i = 1; i <= n; i++) printf( %c , ans[i]);     puts(  );   }
#include <bits/stdc++.h>   using namespace std;   long long a, b;   vector<long long> A, B, C;   int main() {     scanf( %lld %lld , &a, &b);     for (long long i = 1; i <= sqrt(a); i++)       if (a % i == 0) A.push_back(i);     for (long long i = 1; i <= sqrt(b); i++)       if (b % i == 0) B.push_back(i);     for (long long i = 1; i <= sqrt(a + b); i++)       if ((a + b) % i == 0) C.push_back(i);     long long ans;     for (long long i : C) {       for (long long j : A) {         if (j <= i && a / j <= (a + b) / i) ans = 2 * i + (2 * (a + b) / i);       }       for (long long j : B) {         if (j <= i && b / j <= (a + b) / i) ans = 2 * i + (2 * (a + b) / i);       }     }     printf( %lld n , ans);   }
#include <bits/stdc++.h>   using namespace std;   vector<int> a, b, e;   char s[5];   long long ans;   int c;   int main() {     int n, f;     scanf( %d , &n);     while (n--) {       scanf( %s %d , &s, &f);       if (s[0] ==  0  && s[1] ==  1 )         a.push_back(f);       else if (s[0] ==  1  && s[1] ==  0 )         b.push_back(f);       else if (s[0] ==  0  && s[1] ==  0 )         e.push_back(f);       else {         c++;         ans += f;       }     }     int temp = c + 2 * min((int)a.size(), (int)b.size());     c += min((int)a.size(), (int)b.size());     if (!a.empty()) sort(a.rbegin(), a.rend());     if (!b.empty()) sort(b.rbegin(), b.rend());     for (int i = 0; i < min((int)a.size(), (int)b.size()); ++i) {       ans += a[i];       ans += b[i];     }     if (a.size() > b.size()) {       for (int i = min(a.size(), b.size()); i < a.size(); ++i) e.push_back(a[i]);     } else if (b.size() > a.size()) {       for (int i = min(a.size(), b.size()); i < b.size(); ++i) e.push_back(b[i]);     }     if (!e.empty()) sort(e.rbegin(), e.rend());     for (int i = 0; i < e.size(); ++i) {       if (((temp + 2) / 2) <= c) {         ans += e[i];         temp++;       }     }     printf( %lld , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   ifstream fin( Sisend.txt );   int n, c;   bool b[100005];   vector<int> v, v1;   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cerr.tie(0);     cin >> n;     for (int(i) = (0); ((i)) < ((n)); ((i))++) {       cin >> c;       v.emplace_back(c);     }     sort(v.rbegin(), v.rend());     int l = 1, r = v.size() / 2 + 1;     int vas = 0;     v1.emplace_back(v[0]);     while (r < v.size()) {       while (r < v.size() and v[r] == v[l]) r++;       v1.emplace_back(v[r]), v1.emplace_back(v[l]);       b[r] = 1;       vas++;       l++;       r++;     }     while (l < v.size()) {       if (!b[l]) {         v1.emplace_back(v[l]);       }       l++;     }     cout << vas << endl;     for (int i : v1) cout << i <<    ;   }
#include <bits/stdc++.h>   using namespace std;   const int INF = 2e9;   const long long BIG_INF = 1e18;   const long long MOD = 1e9 + 7;   const int maxn = 1e5 + 5;   vector<int> g[maxn];   int p[maxn], max_height, deep_v;   void dfs(int v, int height) {     if (height > max_height) {       max_height = height;       deep_v = v;     }     for (int j = 0; j < (int)g[v].size(); j++) {       int to = g[v][j];       dfs(to, height + 1);     }   }   void out(int v) {     if (v) out(p[v]);     ;     cout << v <<    ;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int n;     cin >> n;     for (int i = 1; i < n; i++) {       int u;       cin >> u;       p[i] = u;       g[u].push_back(i);     }     dfs(0, 0);     vector<int> ans;     int v = deep_v;     while (1) {       while (v && (int)g[p[v]].size() == 1) v = p[v];       if (!v) break;       int par = p[v];       g[par].erase(find(g[par].begin(), g[par].end(), v));       int to = g[par][0];       ans.push_back(v);       g[to].push_back(v);       p[v] = to;     }     out(deep_v);     cout <<   n ;     reverse(ans.begin(), ans.end());     cout << (int)ans.size() <<   n ;     for (int i = 0; i < (int)ans.size(); i++) cout << ans[i] <<    ;     cout <<   n ;     return 0;   }
#include <bits/stdc++.h>   int main() {     char a[19];     int i, c = 0, t = 0, x = 0;     scanf( %s , &a);     for (i = 0; a[i] !=   0 ; i++) {       t = t + a[i];     }     x = a[0] - 1 + (i - 1) *  9 ;     if (t >= x)       printf( %s , a);     else {       if (a[1] !=  9 ) {         for (i = 0; a[i] !=   0 ; i++) {           if (c > 0)             printf( 9 );           else {             if (a[i] >  1 ) printf( %c , a[i] - 1);             c++;           }         }       } else {         c = 0;         printf( %c , a[0]);         for (i = 1; a[i] !=   0 ; i++) {           if (c == 0) {             if (a[i + 1] ==  9 )               printf( 9 );             else {               printf( 8 );               c++;             }           } else             printf( 9 );         }       }     }   }
#include <bits/stdc++.h>   using namespace std;   long long n;   long long a[1006];   long long fac[1000006];   long long power(long long a, long long i) {     if (i == 0) return 1 % 1000000007;     long long t = power(a, i / 2);     long long ans = t * t % 1000000007;     if (i % 2 == 1) ans = ans * a % 1000000007;     return ans;   }   long long work(long long m, long long i) {     return ((fac[m] % 1000000007) *             (power(fac[i] * fac[m - i] % 1000000007, 1000000007 - 2) %              1000000007)) %            1000000007;   }   int main() {     fac[0] = 1;     for (int i = 1; i < 1000006; i++) fac[i] = (fac[i - 1] * i) % 1000000007;     long long ans = 1;     long long sum = 0;     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> a[i];       sum += a[i];     }     for (int i = n; i >= 1; i--) {       ans = ans * work(sum - 1, a[i] - 1) % 1000000007;       sum -= a[i];     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void solve() {     long long int n, k;     cin >> n >> k;     long long int a[n], s = 0;     vector<pair<long long int, long long int> > v;     for (int i = 0; i < n; i++) {       cin >> a[i];       if (a[i] <= k) {         v.push_back({a[i], i + 1});         s += a[i];       }     }     if (s < (k + 1) / 2) {       cout << -1 << endl;       return;     }     s = 0;     sort(v.begin(), v.end());     vector<long long int> ans;     for (int i = v.size() - 1; i >= 0; i--) {       if (s + v[i].first >= (k + 1) / 2 and s + v[i].first <= k) {         s += v[i].first;         ans.push_back(v[i].second);         break;       } else if (s + v[i].first < (k + 1) / 2) {         ans.push_back(v[i].second);         s += v[i].first;       }     }     if (ans.size() == 0) {       cout << -1 << endl;     }     sort(ans.begin(), ans.end());     cout << ans.size() << endl;     for (int i = 0; i < ans.size(); i++) {       cout << ans[i] <<    ;     }     cout << endl;   }   int main() {     int t;     cin >> t;     while (t--) {       solve();     }   }
#include <bits/stdc++.h>   using namespace std;   const int MAX = 1e6 + 5;   int main() {     ios_base::sync_with_stdio(0);     long long q;     cin >> q;     while (q--) {       long long n;       cin >> n;       long long cnt = 0;       long long flag = 1;       while (n != 1) {         if (n % 2 == 0) {           n = n / 2;           cnt++;         } else if (n % 3 == 0) {           n = (2 * n) / 3;           cnt++;         } else if (n % 5 == 0) {           n = (4 * n) / 5;           cnt++;         } else {           cout <<  -1  << endl;           flag = 0;           break;         }       }       if (flag) cout << cnt << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int x;     while (cin >> x) {       map<char, int> p1;       string str, strr;       ;       bool l = 0;       int sum;       cin >> str;       for (int i = 0; i < str.size(); i++) {         p1[str[i]]++;       }       for (int i = 0; i < str.size(); i++) {         if (p1[str[i]] % x != 0) {           l = 1;           break;         }       }       if (l == 0) {         for (char i =  a ; i <=  z ; i++) {           sum = 0;           if (p1[i] > 0) {             sum = p1[i] / x;           }           while (sum--) {             strr += i;           }         }         while (x--) {           cout << strr;         }       } else         cout << -1;       cout << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   const int N = 200200;   const int mod = 1e9 + 7;   int n, a, b;   vector<int> q;   int main() {     cin >> n >> a >> b;     q.push_back(a);     q.push_back(a);     q.push_back(a);     q.push_back(a);     q.push_back(b);     q.push_back(b);     sort(q.begin(), q.end());     int res = 1e9;     do {       int ans = 1, cur = n;       for (int i = 0; i < q.size(); ++i)         if (cur - q[i] >= 0)           cur -= q[i];         else           ans++, cur = n - q[i];       res = min(res, ans);     } while (next_permutation(q.begin(), q.end()));     cout << res;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using lli = long long int;   lli mod = 1000000007.0;   int main(void) {     long long t;     cin >> t;     lli x;     lli n;     while (t--) {       cin >> n;       x = 1;       for (lli i = 2 * n; i >= 3; i--) {         x *= i;         x = x % mod;       }       cout << x << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, x[210], y[210], ans, dp[210][210];   long long S[210][210];   bool in[210][210][210];   int gogo(int x) {     if (x % n == 0) return n;     return x % n;   }   long long cp(int a, int b, int c) {     return 1LL * (x[a] - x[c]) * (y[b] - y[c]) -            1LL * (y[a] - y[c]) * (x[b] - x[c]);   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) scanf( %d%d , &x[i], &y[i]);     for (int i = 1; i <= n; i++)       for (int j = i; j <= n; j++) {         for (int p = i + 1; p < j; p++) S[i][j] += cp(p, p + 1, i);       }     for (int i = 1; i <= n; i++)       for (int j = 1; j < i; j++) {         for (int p = gogo(i + 1); p != j; p = gogo(p + 1))           S[i][j] += cp(gogo(p), gogo(p + 1), i);       }     for (int i = 1; i <= n; i++)       for (int j = i + 1; j <= n; j++)         for (int p = j + 1; p <= n; p++)           if (abs(cp(j, p, i)) + abs(S[i][j]) + abs(S[j][p]) + abs(S[p][i]) ==                   abs(S[1][n]) &&               cp(j, p, i)) {             in[i][j][p] = true;           }     for (int i = 1; i <= n; i++) dp[i][i + 1] = 1;     for (int i = n; i; i--)       for (int j = i + 1; j <= n; j++)         for (int p = i + 1; p < j; p++)           if (in[i][p][j])             dp[i][j] = (dp[i][j] + 1LL * dp[i][p] * dp[p][j]) % 1000000007;     ans = dp[1][n];     printf( %d n , ans);   }
#include <bits/stdc++.h>   using namespace std;   int round_up(int i) {     while (i & (i - 1)) {       i = ((i - 1) | i) + 1;     }     return i;   }   class seg_t {    public:     vector<int> seg, ar;     int n;     seg_t(vector<int>& a) {       n = a.size();       ar = a;       int si = round_up(n);       seg.resize(si * 2);       build(0, 0, n - 1);     }     void build(int i, int l, int r) {       if (l == r) {         seg[i] = ar[l];         return;       }       int mid = (l + r) / 2;       build(i * 2 + 1, l, mid);       build(i * 2 + 2, mid + 1, r);       seg[i] = min(seg[i * 2 + 1], seg[i * 2 + 2]);     }     int q(int i, int l, int r, int lind, int rind, int val) {       if (r < lind || r > rind) {         return -1;       }       if (l == r) {         if (seg[i] >= val) return -1;         return l;       }       if (lind <= l && r <= rind) {         if (seg[i] >= val) return -1;       }       int mid = (l + r) / 2;       int t = q(i * 2 + 1, l, mid, lind, rind, val);       if (t >= 0) return t;       return q(i * 2 + 2, mid + 1, r, lind, rind, val);     }     int qq(int i, int l, int r, int lind, int rind) {       if (r < lind || r > rind) {         return 1000000000;       }       if (lind <= l && r <= rind) {         return seg[i];       }       int mid = (l + r) / 2;       return min(qq(i * 2 + 1, l, mid, lind, rind),                  qq(i * 2 + 2, mid + 1, r, lind, rind));     }   };   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     int n;     cin >> n;     vector<int> a(2 * n);     for (int i = 0; i < n; i++) {       cin >> a[i];       a[i + n] = a[i];     }     seg_t t(a);     vector<int> b(2 * n);     for (int i = 0; i < n; i++) {       int tmp = t.q(0, 0, 2 * n - 1, i, n * 2 - 1, (a[i] + 1) / 2);       if (tmp == -1)         b[i] = 1000000000;       else         b[i] = tmp;       b[i + n] = b[i] + n;     }     seg_t tt(b);     for (int i = 0; i < n; i++) {       int tmp = tt.qq(0, 0, 2 * n - 1, i, n * 2 - 1);       if (tmp >= 1000000000)         cout << -1 <<    ;       else         cout << tmp - i <<    ;     }     cout << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   using ld = long double;   using pii = pair<int, int>;   int const N = 1e5 + 20, MAX = 7000 + 20;   int n, q;   bitset<MAX> bt[N];   int a[MAX];   vector<int> dv[MAX];   bitset<MAX> save[MAX];   void pre() {     a[1] = 1;     for (int i = 1; i < MAX; i++) {       for (int j = 2 * i; j < MAX; j += i) a[j] ^= a[i], dv[j].push_back(i);       dv[i].push_back(i);     }     for (int i = 1; i < MAX; i++) {       for (int j = 1; i * j < MAX; j++) {         if (a[j]) save[i][i * j] = 1;       }     }   }   int main() {     pre();     scanf( %d %d  , &n, &q);     while (q--) {       int tp, x, y, z, v;       scanf( %d  , &tp);       if (tp == 1) {         scanf( %d %d  , &x, &v);         x--;         bt[x].reset();         for (int u : dv[v]) bt[x][u] = 1;       } else if (tp == 2) {         scanf( %d %d %d  , &x, &y, &z);         x--, y--, z--;         bt[x] = (bt[y] ^ bt[z]);       } else if (tp == 3) {         scanf( %d %d %d  , &x, &y, &z);         x--, y--, z--;         bt[x] = (bt[y] & bt[z]);       } else if (tp == 4) {         scanf( %d %d  , &x, &v);         x--;         bitset<MAX> tmp = (bt[x] & save[v]);         putchar( 0  + (tmp.count() & 1));       }     }     putchar(  n );   }
#include <bits/stdc++.h>   using namespace std;   int n;   int k;   vector<pair<long double, long double> > vp;   const long double PI = 2 * acos(0.0);   bool check(long double r) {     vector<pair<long double, int> > events;     for (int i = 0; i < n; ++i) {       long double ang = atan2(vp[i].second, vp[i].first);       long double d =           sqrt(vp[i].first * vp[i].first + vp[i].second * vp[i].second);       if (d > 2 * r) continue;       long double alph = (PI - acos(1 - (d * d) / (2 * (r * r)))) / 2;       long double ang_in = ang - alph;       long double ang_out = ang + alph;       if (ang_in < 0) {         ang_in += 2 * PI;         ang_out += 2 * PI;       }       events.emplace_back(ang_in, 1);       events.emplace_back(ang_out, -1);       events.emplace_back(ang_in + 2 * PI, 1);       events.emplace_back(ang_out + 2 * PI, -1);     }     sort(events.begin(), events.end());     int ck = 0;     for (int i = 0; i < (int)events.size(); ++i) {       ck += events[i].second;       if (ck >= k) return true;     }     return false;   }   int main() {     cout.setf(ios::fixed);     cout << setprecision(10);     cin >> n;     cin >> k;     for (int i = 0; i < n; ++i) {       int first, second;       cin >> first >> second;       vp.emplace_back(first, second);     }     long double l = 0;     long double r = 2e5;     while (r - l > 1e-6) {       long double mid = (l + r) / 2;       if (check(mid)) {         r = mid;       } else {         l = mid;       }     }     cout << l << endl;   }
#include <bits/stdc++.h>   using namespace std;   int a[] = {2, 7, 2, 3, 3, 4, 2, 5, 1, 2};   const int Q = 1e9 + 7;   int main() {     string s, t;     cin >> s >> t;     vector<int> p(t.length());     for (int i = 1; i < t.length(); ++i) {       int k = p[i - 1];       while (k > 0) {         if (t[k] == t[i]) {           p[i] = k + 1;           break;         }         k = p[k - 1];       }       if (!p[i] && t[i] == t[0]) p[i] = 1;     }     vector<int> x(s.length());     if (s[0] == t[0]) x[0] = 1;     for (int i = 1; i < s.length(); ++i) {       int k = x[i - 1];       if (k == t.length()) k = p[k - 1];       while (k > 0) {         if (s[i] == t[k]) {           x[i] = k + 1;           break;         }         k = p[k - 1];       }       if (!x[i] && s[i] == t[0]) x[i] = 1;     }     vector<int> sum(s.length() + 1), r(s.length() + 1), h(s.length() + 1);     sum[0] = 0;     h[0] = 0;     for (int i = 0; i < s.length(); ++i) {       if (x[i] == t.length()) {         r[i + 1] = (h[i - t.length() + 1] + i - t.length() + 2) % Q;       } else {         r[i + 1] = r[i];       }       sum[i + 1] = (sum[i] + r[i + 1]) % Q;       h[i + 1] = (h[i] + sum[i + 1]) % Q;     }     cout << sum[s.length()];     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long check(long long x) {     long long i = 0, ans = 0;     while (x > 0) {       if ((x & (1)) == 1) {         ans = max(ans, i);       }       x = x >> 1;       i++;     }     return ans;   }   void solve() {     long long n;     cin >> n;     long long a[n + 1];     map<long long, long long> mp;     for (long long i = 0; i < n; i++) {       cin >> a[i];       mp[check(a[i])]++;     }     long long ans = 0;     for (auto x : mp) {       if (x.second > 1) ans += ((x.second) * (x.second - 1)) / 2;     }     cout << ans << endl;     return;   }   int main() {     int t;     cin >> t;     while (t--) {       solve();     }   }
#include <bits/stdc++.h>   using namespace std;   int cnt = 0;   vector<int> ans;   vector<vector<int> > adj;   void dfs(int u, int col) {     if (ans[u] != -1) return;     ans[u] = col;     for (int i = 0; i < adj[u].size(); ++i) dfs(adj[u][i], col);   }   char conv(int first) {     if (first == 0) return  b ;     if (first == 1) return  a ;     if (first == 2) return  c ;   }   int main() {     cout.setf(ios::fixed);     cout.precision(7);     ios_base::sync_with_stdio(false);     cin.tie(0);     int n, m;     cin >> n >> m;     adj = vector<vector<int> >(n);     vector<int> deg(n, 0);     for (int asdf = 0; asdf < m; ++asdf) {       int first, second;       cin >> first >> second;       --first;       --second;       adj[first].push_back(second);       adj[second].push_back(first);       ++deg[first];       ++deg[second];     }     ans = vector<int>(n, -1);     int qt = 0;     for (int i = 0; i < n; ++i)       if (deg[i] == n - 1) {         ans[i] = 0;         ++qt;       }     for (int i = 0; i < n; ++i)       if (ans[i] == -1) {         ++cnt;         dfs(i, cnt);       }     bool ok = true;     if (cnt >= 3) ok = false;     int n1 = 0, m1 = 0, n2 = 0, m2 = 0;     for (int i = 0; i < n; ++i) {       if (ans[i] == 1) {         ++n1;         m1 += deg[i] - qt;       } else if (ans[i] == 2) {         ++n2;         m2 += deg[i] - qt;       }     }     if (n1 * (n1 - 1) != m1) ok = false;     if (n2 * (n2 - 1) != m2) ok = false;     if (not ok)       cout <<  No n ;     else {       cout <<  Yes n ;       for (int i = 0; i < n; ++i) cout << conv(ans[i]);       cout <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   int n;   int a[111][111];   char c[111];   int main() {     int i, j, k;     int p, q, r;     int t, tt, ttt;     scanf( %d , &n);     for (i = 1; i <= n; i++) {       scanf( %s , c);       for (j = 1; j <= n; j++) {         if (c[j - 1] ==  E )           a[i][j] = 1;         else           a[i][j] = 0;       }     }     for (i = 1; i <= n; i++) {       for (j = 1; j <= n; j++) {         if (a[i][j] == 0) break;       }       if (j == n + 1) break;     }     if (i != n + 1) {       for (j = 1; j <= n; j++) {         for (i = 1; i <= n; i++) {           if (a[i][j] == 0) break;         }         if (i == n + 1) break;       }       if (j != n + 1) {         printf( -1 );       } else {         for (j = 1; j <= n; j++) {           for (i = 1; i <= n; i++) {             if (a[i][j] == 0) {               printf( %d %d n , i, j);               break;             }           }         }       }     } else {       for (i = 1; i <= n; i++) {         for (j = 1; j <= n; j++) {           if (a[i][j] == 0) {             printf( %d %d n , i, j);             break;           }         }       }     }     scanf(   );     return 0;   }