malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   long long vis[200005], cnt[200005], arr[200005];   void solve() {     long long i, j, k, l, m, n, x, sz = 0, flag = 1, mx = 0;     cin >> n;     for (i = 0; i <= n; i++) vis[i] = cnt[i] = 0;     for (i = 0; i < n; i++) {       cin >> arr[i];       cnt[arr[i]]++;       if (cnt[arr[i]] == 2) sz = max(sz, arr[i]);       mx = max(mx, arr[i]);       if (cnt[arr[i]] == 3) flag = 0;     }     vector<long long> ans;     if (sz + mx != n) flag = 0;     if (!flag) {       cout << 0 << endl;       return;     }     for (i = 0; i < sz; i++) {       vis[arr[i]] = 1;     }     flag = 1;     for (i = 1; i <= sz; i++) {       if (vis[i])         continue;       else         flag = 0;     }     if (flag) ans.push_back(sz);     flag = 1;     if (sz != mx) {       for (i = 0; i <= mx; i++) vis[i] = 0;       for (i = 0; i < mx; i++) {         vis[arr[i]] = 1;       }       for (i = 1; i <= mx; i++)         if (!vis[i]) flag = 0;       if (flag) ans.push_back(mx);     }     cout << ans.size() << endl;     for (i = 0; i < ans.size(); i++) {       cout << ans[i] <<     << n - ans[i] << endl;     }   }   int32_t main() {     ios::sync_with_stdio(false);     cin.tie(0);     long long t;     t = 1;     cin >> t;     while (t--) solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int q1() {     int a1, a2, a3, a4;     int a[100009];     int n;     cin >> n;     for (int i = 0; i < n; i++) {       cin >> a1 >> a2 >> a3 >> a4;       a[i] = a4 + a3 + a2 + a1;     }     int t = a[0];     sort(a, a + n);     int j = 1;     for (int i = n - 1; i >= 0; i--) {       if (a[i] == t) {         cout << j << endl;         return 1;       }       j++;     }   }   int main() {     q1();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int m, l, r, a[1200000];   string s;   int main() {     cin >> s;     m = s.size();     l = 1;     r = m;     for (int i = 0; i < m; i++)       if (s[i] ==  l ) {         a[r] = i + 1;         r--;       } else {         a[l] = i + 1;         l++;       }     for (int i = 1; i <= m; i++) cout << a[i] << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 50 + 5;   const int maxm = 2e5 + 5;   int n, k;   int a[maxm];   vector<int> res[maxm];   int main() {     cin >> n >> k;     for (int i = 0; i < n; ++i) cin >> a[i];     for (int i = 0; i < n; ++i) {       int tmp = a[i], j = 0;       while (true) {         res[tmp].push_back(j);         if (!tmp) break;         tmp /= 2;         j++;       }     }     int ans = 0x3f3f3f3f;     for (int i = 0; i < maxm; ++i) {       if (res[i].size() < k) continue;       sort(res[i].begin(), res[i].end());       int tmp = 0;       for (int j = 0; j < k; ++j) tmp += res[i][j];       ans = min(ans, tmp);     }     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     int A[n + 1];     A[0] = 0;     for (int i = 1; i < n + 1; i++) {       cin >> A[i];     }     int dollar = A[1];     int cou = 0;     for (int i = 1; i < n; i++) {       cou = cou + A[i] - A[i + 1];       if (cou < 0) {         dollar = dollar + abs(cou);         cou = 0;       }     }     cout << dollar;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e6 + 22;   int n, mn = N + 1, q;   int par[N], ans[N];   bool mark[N];   vector<int> G[N];   void dfs(int v, int p, int rr) {     rr = min(rr, v);     ans[v] = rr;     par[v] = p;     for (int i = 0; i < (G[v].size()); i++) {       int u = G[v][i];       if (u == p) continue;       dfs(u, v, rr);     }   }   int main() {     cin >> n >> q;     for (int i = 0; i < (n - 1); i++) {       int u, v;       scanf( %d%d , &u, &v);       u--, v--;       G[u].push_back(v), G[v].push_back(u);     }     q--;     int x, tp, last = -1;     cin >> tp >> x;     x = (x + last + 1) % n;     mark[x] = true;     dfs(x, -1, x);     for (int Q = 0; Q < (q); Q++) {       scanf( %d%d , &tp, &x);       x = (x + last + 1) % n;       if (tp == 1) {         while (!mark[x]) {           mark[x] = true;           mn = min(mn, x);           x = par[x];         }       } else {         printf( %d n , min(ans[x], mn) + 1);         last = min(ans[x], mn);       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     t = 1;     while (t--) {       int n, k;       cin >> n >> k;       string s;       cin >> s;       int b[26] = {0};       for (int i = 0; i < n; i++) {         b[s[i] -  A ]++;       }       int mn = INT_MAX;       for (int i = 0; i < k; i++) {         mn = min(mn, (b[i]));       }       cout << mn * k;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, u, r;   int a[30], b[30], p[30], k[30];   long long res;   bool first;   void doit(int v[]) {     long long tmp = 0;     for (int i = 0; i < n; i++) {       tmp += v[i] * k[i];     }     res = max(res, tmp);     if (first) {       first = false;       res = tmp;     }   }   void dfs(int v[], int _u, bool can) {     int next[30];     if (_u % 2 == 0) {       doit(v);     }     if (_u == 0) {       return;     }     if (can) {       for (int i = 0; i < n; i++) {         next[i] = v[i] ^ b[i];       }       dfs(next, _u - 1, 0);     }     for (int i = 0; i < n; i++) {       next[i] = v[p[i]] + r;     }     dfs(next, _u - 1, 1);   }   int main() {     cin >> n >> u >> r;     for (int i = 0; i < n; i++) scanf( %d , &a[i]);     for (int i = 0; i < n; i++) scanf( %d , &b[i]);     for (int i = 0; i < n; i++) scanf( %d , &k[i]);     for (int i = 0; i < n; i++) scanf( %d , &p[i]);     for (int i = 0; i < n; i++) p[i]--;     first = 1;     res = 0;     dfs(a, u, 1);     cout << res;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct Event {     char r;     int pos;     Event(char r =    , int pos = -1) : r(r), pos(pos) {}   };   bool operator<(Event a, Event b) {     if (a.r != b.r) return a.r > b.r;     return a.pos < b.pos;   }   vector<Event> v;   int main() {     string s;     cin >> s;     for (int i = 0; i < int(s.length()); i++) v.push_back(Event(s[i], i));     sort(v.begin(), v.end());     vector<Event> ans;     for (int i = 0; i < int(v.size()); i++)       if (ans.size() == 0 || (ans[int(ans.size()) - 1].pos < v[i].pos))         ans.push_back(v[i]);     for (int i = 0; i < int(ans.size()); i++) cout << ans[i].r;     cout << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int Maxn = 110;   int N, A[Maxn];   map<int, int> K, dp;   int SG(int x) {     set<int> S;     if (dp.count(x)) return dp[x];     if (x == 0) return 0;     for (int i = 1; i <= 30; i++) {       int y = (x >> i) | (x & ((1 << (i - 1)) - 1));       if (y != x)         S.insert(SG(y));       else         break;     }     int p = 0;     while (!S.empty()) {       int now = *S.begin();       if (now == p)         p++;       else if (now > p)         return dp[x] = p;       S.erase(S.begin());     }     return dp[x] = p;   }   int main() {     scanf( %d , &N);     for (int i = 1; i <= N; i++) scanf( %d , &A[i]);     for (int i = 1; i <= N; i++) {       int x = A[i];       for (int j = 2; j * j <= x; j++) {         int k = 0;         while (x % j == 0) {           x /= j;           k++;         }         if (k) K[j] |= (1 << (k - 1));       }       if (x != 1) K[x] |= 1;     }     int tmp = 0;     dp[0] = 0;     for (auto i : K) tmp ^= SG(i.second);     if (tmp == 0)       printf( Arpa n );     else       printf( Mojtaba n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};   long long ddx[8] = {1, 1, 0, -1, -1, -1, 0, 1},             ddy[8] = {0, 1, 1, 1, 0, -1, -1, -1};   long long gcd(long long a, long long b) {     if (!a) return b;     return gcd(b % a, a);   }   long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }   unordered_map<char, long long> mp;   string s;   long long n;   bool fun(long long x) {     long long cnt = 0;     for (auto it : mp) {       long long val = it.second;       cnt += it.second / x;       if (it.second % x != 0) {         cnt++;       }     }     if (cnt <= n)       return true;     else       return false;   }   void test_case() {     cin >> s;     cin >> n;     for (auto it : s) {       mp[it]++;     }     if (mp.size() > n) {       cout << -1 <<   n ;       return;     }     long long l, r;     l = 1;     r = 1000;     long long ans = 1000;     while (l <= r) {       long long mid = l + (r - l) / 2;       if (fun(mid)) {         ans = min(ans, mid);         r = mid - 1;       } else {         l = mid + 1;       }     }     cout << ans <<   n ;     string st =   ;     for (auto it : mp) {       long long val = it.second;       long long cnt = 0;       cnt = it.second / ans;       if (it.second % ans != 0) {         cnt++;       }       while (cnt--) {         st += it.first;       }     }     while (st.size() != n) {       st +=  a ;     }     cout << st <<   n ;   }   signed main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cout << fixed << setprecision(20);     long long t = 1;     while (t--) {       test_case();     }   }
#include <bits/stdc++.h>   const long double eps = 1e-6;   struct Point {     long long x, y;     Point(long long _x = 0, long long _y = 0) : x(_x), y(_y) {}     Point operator-(const Point &B) const { return Point(x - B.x, y - B.y); }     long double operator*(const Point &B) const {       return (long double)x * B.y - (long double)y * B.x;     }   } stk[1023000];   int top;   long long k, b;   long long calc(Point A) { return A.y + k * A.x + b; }   inline int read() {     int n = 0;     char a;     bool z = false;     while (a = getchar()) {       if (a >  9  || a <  0 )         if (z)           break;         else           continue;       if (!z) z = true;       n = (n << 3) + (n << 1) + (a ^ 48);     }     return n;   }   int main() {     long long n = read();     int Q = read(), opt;     Point now;     stk[top = 1] = Point();     while (Q--) {       opt = read();       switch (opt) {         case 1:           stk[top = 1] = Point();           n += read();           k = b = 0;           break;         case 2:           now = Point(n, -(n * k + b));           n += read();           while (top > 1 &&                  (now - stk[top - 1]) * (stk[top] - stk[top - 1]) > -eps)             --top;           stk[++top] = now;           break;         case 3:           b += read();           k += read();           break;       }       while (top > 1 && calc(stk[top]) >= calc(stk[top - 1])) --top;       printf( %lld %lld n , stk[top].x + 1, calc(stk[top]));     }     return 0;   }
#include <bits/stdc++.h>   #pragma GCC optimize(2)   using namespace std;   void qread(int &x) {     int neg = 1;     x = 0;     char c = getchar();     while (c <  0  || c >  9 ) {       if (c ==  - ) neg = -1;       c = getchar();     }     while (c >=  0  && c <=  9 ) x = 10 * x + c -  0 , c = getchar();     x *= neg;   }   const int maxn = 405;   int test, n, mod;   int dp[maxn][maxn * 2], fac[maxn];   int quickpow(int x, int pow) {     int res = 1;     for (; pow; pow >>= 1) {       if (pow & 1) res = 1LL * res * x % mod;       x = 1LL * x * x % mod;     }     return res;   }   void work() {     for (int(i) = 1; (i) <= 400; i++) dp[i][i + 400] = 1;     for (int(i) = 1; (i) <= 400; i++) {       int inv = quickpow(dp[i][i], mod - 2);       for (int j = i + 1; j <= 2 * 400; j++)         dp[i][j] = 1LL * dp[i][j] * inv % mod;       dp[i][i] = 1;       for (int j = i + 1; j <= 400; j++) {         for (int k = i + 1; k <= 2 * 400; k++)           dp[j][k] = (dp[j][k] - 1LL * dp[j][i] * dp[i][k] % mod + mod) % mod;         dp[j][i] = 0;       }     }   }   int main() {     scanf( %d%d , &test, &mod);     fac[0] = 1;     for (int(i) = 1; (i) <= 400; i++) fac[i] = 1LL * fac[i - 1] * i % mod;     for (int(i) = 1; (i) <= 400; i++) {       dp[i][1] = fac[i];       for (int k = 2; k <= i; k++) {         for (int m = 0; m <= i - k; m++)           dp[i][k] =               (dp[i][k] + 1LL * fac[m + 1] * dp[i - m - 1][k - 1] % mod) % mod;       }     }     work();     while (test--) {       scanf( %d , &n);       if (n == 2) {         puts( 2 );         continue;       }       int ans = ((mod - dp[n][401]) % mod + ((n & 1) ? 2 : -2) + mod) % mod;       printf( %d n , ans);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 10;   int n, k;   int pr[N], sz[N];   int root(int x) { return pr[x] = (pr[x] == x ? x : root(pr[x])); }   void merge(int x, int y) {     x = root(x);     y = root(y);     if (x == y) return;     if (rand() & 1) {       pr[x] = y;       sz[y] += sz[x];     } else {       pr[y] = x;       sz[x] += sz[y];     }   }   int main() {     for (int i = 0; i < N; i++) {       pr[i] = i;       sz[i] = 1;     }     scanf( %d %d , &n, &k);     for (int i = 0; i < k; i++) {       int u, v;       scanf( %d %d , &u, &v);       u--;       v--;       merge(u, v);     }     int sat = 0;     for (int i = 0; i < n; i++)       if (root(i) == i) sat += sz[i] - 1;     printf( %d n , k - sat);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n;   int A[3005][5], dp[3005][3];   int solve(int x, bool a) {     int &r = dp[x][a];     if (r != -1) return r;     if (x == n) {       if (a == 0) {         return r = A[x][1];       } else {         return r = A[x][2];       }     }     if (a == 0) {       return r = max(solve(x + 1, 0) + A[x][2], solve(x + 1, 1) + A[x][1]);     } else {       return r = max(solve(x + 1, 1) + A[x][2], solve(x + 1, 0) + A[x][3]);     }   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= 3; i++)       for (int j = 1; j <= n; j++) {         scanf( %d , A[j] + i);       }     memset(dp, -1, sizeof dp);     cout << solve(1, 0) << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int INF = 0x3f3f3f3f;   const int MAXN = 5000 + 5;   const int MOD = 1e9 + 7;   const double pi = cos(-1);   int n, d, ans[MAXN], fa[MAXN];   int c, now, maxx, cnt, pos;   int ch[MAXN];   int getdepth() {     int ans_t = now;     c++;     if (c == maxx) {       c = 1;       maxx *= 2;       now++;     }     return ans_t;   }   int main() {     int T;     cin >> T;     while (T--) {       cin >> n >> d;       cnt = 0;       memset(ch, 0, sizeof ch);       for (int i = 1; i <= n - 1; i++) {         cnt += i;         ans[i] = i;       }       pos = n - 1, now = 1, c = 1, maxx = 2;       if (cnt < d) {         printf( NO n );         continue;       }       while (cnt > d) {         int dep = getdepth();         if (dep >= pos) break;         if (cnt - (pos - dep) >= d) {           cnt -= (pos - dep);           ans[pos] = dep;         } else {           ans[pos] -= (cnt - d);           cnt = d;         }         pos--;       }       if (cnt > d)         printf( NO n );       else {         printf( YES n );         ans[0] = 0;         for (int i = 1; i <= n - 1; i++) {           for (int j = 0; j <= n - 1; j++) {             if (ans[j] == ans[i] - 1 && ch[j] < 2) {               ch[j]++;               fa[i] = j;               break;             }           }         }         for (int i = 1; i <= n - 1; i++) printf( %d  , fa[i] + 1);         printf(  n );       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 3e5 + 10;   long long n, m, q, u, v, l, r, c, res, sum[N], p[N], lmt[N], vst[N];   vector<long long> adj[N], vec;   void dfs(int u, int p) {     vst[u] = 1;     vec.push_back(u);     for (auto v : adj[u]) {       if (vst[v] == 2) continue;       if (vst[v] == 1) {         if (v != p) {           long long mn = u;           long long mx = u;           for (int j = vec.size() - 1; j >= 0; j--) {             mn = min(mn, vec[j]);             mx = max(mx, vec[j]);             if (vec[j] == v) break;           }           lmt[mn] = min(lmt[mn], mx - 1);         }       } else         dfs(v, u);     }     vec.pop_back();     vst[u] = 2;   }   void solve() {     cin >> n >> m;     for (int i = 1; i <= m; i++) {       cin >> u >> v;       adj[u].push_back(v);       adj[v].push_back(u);     }     for (int i = 1; i <= n; i++) {       vst[i] = 0;       lmt[i] = n;     }     for (int i = 1; i <= n; i++) {       if (vst[i]) continue;       dfs(i, -1);     }     lmt[n] = n;     sum[n] = 1;     for (int i = n - 1; i >= 1; i--) {       if (lmt[i + 1] < lmt[i]) lmt[i] = lmt[i + 1];       sum[i] = lmt[i] - i + 1;     }     sum[0] = 0;     for (int i = 1; i <= n; i++) sum[i] += sum[i - 1];     cin >> q;     for (int i = 1, j; i <= q; i++) {       cin >> l >> r;       j = lower_bound(lmt + l, lmt + r + 1, r) - lmt;       c = r + 1 - j;       res = ((c * (c + 1)) / 2) + sum[j - 1] - sum[l - 1];       cout << res <<   n ;     }   }   int main() {     std::ios::sync_with_stdio(0);     cin.tie(0);     solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   template <typename T>   ostream& operator<<(ostream& os, const vector<T>& v) {     for (T e : v) {       os << e <<    ;     }     return os;   }   constexpr ll mod = 998244353;   constexpr int maxn = 502;   ll lte[maxn];   ll dp[maxn];   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     ll n, k;     cin >> n >> k;     --k;     for (int i = 1; i <= n; ++i) {       ll total = 0;       for (int j = 1; j <= n; ++j) {         if (j <= i) {           dp[j] = total + 1;           total += dp[j];           total %= mod;         } else {           dp[j] = total;           total += dp[j];           total -= dp[j - i];           total %= mod;         }       }       lte[i] = (2 * dp[n] % mod + mod) % mod;     }     for (int i = n; i >= 1; --i) {       lte[i] = (lte[i] - lte[i - 1] + mod) % mod;     }     ll ans = 0;     for (int i = 1; i <= min(n, k); ++i) {       ll d = k / i;       for (int j = 1; j <= min(d, n); ++j) {         ans = (ans + lte[i] * lte[j]) % mod;       }     }     cout << ans * ((mod + 1) / 2) % mod << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int in[2 * 100010], s[2 * 100010];   int n;   int main() {     scanf( %d , &n);     memset(in, 0, sizeof(in));     memset(s, 0, sizeof(s));     for (int i = 0; i < n; i++) {       int xx;       scanf( %d , &xx);       s[i] = xx;       in[xx] = i + 1;     }     int t = 0;     for (int i = 0; i < n; i++) {       int x, j;       scanf( %d , &x);       if (in[x])         for (j = t; j < n && s[j] != x; j++) in[s[j]] = 0;       else {         printf( 0  );         continue;       }       printf( %d  , j - t + 1);       t = j + 1;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int N, M;   long long K;   int A[505][505];   vector<int> goods, bads;   int remap[505];   double P[505][505];   typedef double matrix[105][105];   void mult(matrix A, matrix B, matrix C) {     matrix temp;     memset(temp, 0, sizeof(temp));     for (int i = 0; i < 105; i++)       for (int j = 0; j < 105; j++)         for (int k = 0; k < 105; k++) temp[i][j] += A[i][k] * B[k][j];     memcpy(C, temp, sizeof(matrix));   }   matrix Q, R;   int V[505];   int main() {     cin >> N >> M >> K;     for (int i = 1; i <= N; i++) {       int x;       cin >> x;       if (x || i == 1)         bads.push_back(i);       else         goods.push_back(i);     }     for (int i = 0; i < bads.size(); i++) remap[bads[i]] = i;     for (int i = 0; i < goods.size(); i++) remap[goods[i]] = bads.size() + i;     for (int i = 0; i < M; i++) {       int u, v;       cin >> u >> v;       u = remap[u], v = remap[v];       A[u][v]++;       A[v][u]++;     }     for (int i = 0; i < N; i++) {       double deg = 0;       for (int j = 0; j < N; j++) deg += A[i][j];       for (int j = 0; j < N; j++) P[i][j] += A[i][j] / deg;     }     while (N > bads.size()) {       N--;       for (int i = 0; i < N; i++) P[N][i] /= (1.0 - P[N][N]);       for (int i = 0; i < N; i++)         for (int j = 0; j < N; j++) P[i][j] += P[i][N] * P[N][j];     }     N--;     for (int i = 1; i <= N; i++) P[0][i] /= (1.0 - P[0][0]);     for (int i = 1; i <= N; i++)       for (int j = 1; j <= N; j++) Q[i][j] = P[i][j] + P[i][0] * P[0][j];     for (int i = 1; i <= N; i++) R[i][i] = 1;     K -= 2;     for (int b = 0; b <= 63; b++) {       if (K & (1LL << b)) mult(Q, R, R);       mult(Q, Q, Q);     }     double total = 0;     for (int i = 1; i <= N; i++) total += P[0][i] * R[i][N];     cout << total <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     long long arr[n];     int i;     map<long long, int> mp;     for (i = 0; i < n; i++) {       int t;       cin >> t;       mp[t]++;     }     auto it = mp.begin();     int maxe = 0;     while (it != mp.end()) {       if (it->second > maxe) maxe = it->second;       it++;     }     cout << n - maxe << endl;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     int count0(0), count5(0);     for (int i = 1; i <= n; i++) {       int a;       cin >> a;       if (a == 0) count0++;       if (a == 5) count5++;     }     if (count0 == 0)       cout << -1;     else if (count5 < 9)       cout << 0;     else {       for (int i = 0; i < floor(count5 / 9); i++) {         cout << 555555555;       }       for (int i = 0; i < count0; i++) cout << 0;     }   }
#include <bits/stdc++.h>   using namespace std;   int A[20][6], n, B[4];   bool check(int l) {     int a0 = 0, a1 = 0, i, j;     for (i = 0; i < 4; i++)       for (j = i + 1; j < 4; j++)         if (B[i] == B[j]) return 0;     for (i = 0; i < 4; i++) {       a0 += (int)(B[i] == A[l][i + 2]);       for (j = 0; j < 4; j++) a1 += (int)(B[i] == A[l][j + 2]);     }     a1 -= a0;     return (a1 == A[l][1] && a0 == A[l][0]);   }   int main() {     int res = 0, ans = 0, i, j, tmp;     bool fl = 1;     scanf( %d , &n);     for (i = 0; i < n; i++) {       scanf( %d%d%d , &tmp, &A[i][0], &A[i][1]);       for (j = 0; j < 4; j++) A[i][j + 2] = tmp % 10, tmp /= 10;     }     for (B[0] = 0; B[0] < 10; B[0]++)       for (B[1] = 0; B[1] < 10; B[1]++)         for (B[2] = 0; B[2] < 10; B[2]++)           for (B[3] = 0; B[3] < 10; B[3]++) {             fl = 1;             for (i = 0; i < n; i++) {               fl = (fl && check(i));             }             if (fl == 1) res++, ans = B[0] + B[1] * 10 + B[2] * 100 + B[3] * 1000;           }     if (res == 1) {       if (ans >= 1000)         printf( %d n , ans);       else         printf( 0%d n , ans);     }     if (res > 1) puts( Need more data );     if (res == 0) puts( Incorrect data );     return 0;   }