malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   template <typename T>   string to_str(T str) {     stringstream stream;     stream << str;     return stream.str();   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long n, d, e;     long long result = 1000000000;     cin >> n >> d >> e;     while (n >= 0) {       result = min(n % (5 * e), result);       n = n - d;     }     cout << result << endl;     return 0;     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);   }
#include <bits/stdc++.h>   using namespace std;   bool debug = 1;   int n, m, k;   int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};   long long ln, lk, lm;   int a[100005];   int main() {     scanf( %d , &n);     for (int(i) = 0; (i) < (int)(n); (i)++) {       scanf( %d , a + i);     }     sort(a, a + n);     vector<int> vp;     for (int i = n - 1; i >= 1;) {       if (a[i] == a[i - 1] || a[i] - 1 == a[i - 1]) {         vp.push_back(a[i - 1]);         i -= 2;       } else         i--;     }     long long ans = 0;     for (int i = 0; i + 1 < vp.size(); i += 2) {       ans += (long long)vp[i] * vp[i + 1];     }     printf( %lld n , ans);   }
#include <bits/stdc++.h>   using namespace std;   uint64_t rnd_data = 0xDEADBEEFDULL;   inline void my_srand(int seed) { rnd_data = ((uint64_t)seed << 16) | 0x330E; }   inline int my_rand() {     rnd_data = rnd_data * 0x5DEECE66DULL + 0xB;     return (rnd_data >> 17) & 0x7FFFFFFF;   }   template <typename T>   void my_random_shuffle(T b, T e) {     for (int i = (1); i <= (int)((int)(e - b) - 1); i++) {       swap(b[i], b[my_rand() % (i + 1)]);     }   }   template <class _T>   inline _T sqr(const _T &x) {     return x * x;   }   template <typename type_t, typename less_t = std::less<type_t>>   inline bool uin(type_t &a, const type_t &b, const less_t &ls = less_t()) {     return ls(b, a) ? a = b, true : false;   }   template <typename type_t, typename less_t = std::less<type_t>>   inline bool uax(type_t &a, const type_t &b, const less_t &ls = less_t()) {     return ls(a, b) ? a = b, true : false;   }   const long double PI = 3.1415926535897932384626433832795L;   const long double EPS = 1e-9;   const int MAXN = 1 << 17;   int n, k;   int a[MAXN];   bool g[MAXN];   int d[MAXN * 2][2][2];   int main() {     scanf( %d%d , &n, &k);     memset((g), 0, sizeof(g));     for (int i = 0; i < (int)(k); i++) {       scanf( %d , &a[i]);       g[a[i] - 1] = true;     }     memset(d, 0x80, sizeof(d));     int z = 1 << (n - 1);     for (int i = 0; i < (int)(z); i++) {       int x = i << 1;       int y = x + 1;       d[z + i][g[x]][g[y]] = g[x] || g[y];       d[z + i][g[y]][g[x]] = g[x] || g[y];     }     for (int i = (z - 1); i >= (int)(1); i--) {       int x = i * 2;       int y = x + 1;       for (int xw = 0; xw < (int)(2); xw++) {         for (int xl = 0; xl < (int)(2); xl++) {           if (d[x][xw][xl] < 0) continue;           for (int yw = 0; yw < (int)(2); yw++) {             for (int yl = 0; yl < (int)(2); yl++) {               if (d[y][yw][yl] < 0) continue;               int gw[2] = {xw, yw};               bool ggl = xl || yl;               for (int t = 0; t < (int)(2); t++) {                 int cur = (xw || yw) + ggl;                 int nw = gw[t];                 int nl0 = gw[t ^ 1];                 int nl = nl0 || ggl;                 cur += nl;                 uax(d[i][nw][nl], d[x][xw][xl] + d[y][yw][yl] + cur);               }             }           }         }       }     }     int ans = 0;     for (int i = 0; i < (int)(2); i++) {       for (int j = 0; j < (int)(2); j++) {         int add = (i || j);         uax(ans, d[1][i][j] + add);       }     }     printf( %d n , ans);     return 0;   }
#include<bits/stdc++.h>   #define FOR(i,l,r) for(int i=l;i<=r;i++)   #define ROF(i,l,r) for(int i=l;i>=r;i--)   #define lson k<<1,l,mid   #define rson k<<1|1,mid+1,r   #define r(x) read(x)   #define rr(x,y) read(x);read(y)   #define rrr(x,y,z) read(x);read(y);read(z)   #define pb(x) push_back(x)   #define mp(x,y) make_pair(x,y)   #define fi first   #define se second   #define sss(str) scanf( %s ,str+1)   using namespace std;   typedef long long LL;   typedef pair<int,int> pt;   const int N=1e6+5;   const int M=2e3+5;   const int mod=1e9+7;   const int INF=2e9;   const double eps=1e-8;   const double pi=acos(-1);   template <class T>   inline void read(T &x) {       char c;x = 1;       while ((c = getchar()) <  0  || c >  9 ) if (c ==  - ) x = -1;       T res = c -  0 ;       while ((c = getchar()) >=  0  && c <=  9 ) res = res * 10 + c -  0 ;       x *= res;   }   int n,m;   char str[N];   int f[N];   void solve(int cas)   {       r(n);       int cnt1=n/2,cnt2=n-cnt1;       LL ans=0;       set<pt> s;       for(int i=cnt1;i>=-cnt1;i-=2){           for(int j=cnt2;j>=-cnt2;j-=2){               s.insert(mp(i,j));               s.insert(mp(j,i));           }       }       cout<<s.size()<<endl;   }   int main()   {       int t;   //    r(t);       t=1;   //    init();       FOR(i,1,t){           solve(i);       }       return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <class T>   T gcd(T a, T b) {     return (b != 0 ? gcd<T>(b, a % b) : a);   }   template <class T>   T lcm(T a, T b) {     return (a / gcd<T>(a, b) * b);   }   long long pwr(long long base, long long p) {     long long ans = 1;     while (p) {       if (p & 1) ans = (ans * base) % (1000000007LL);       base = (base * base) % (1000000007LL);       p >>= 1;     }     return ans;   }   long long modInv(long long n, long long mod) { return pwr(n, mod - 2); }   int bitCount(int n) {     int c = 0;     while (n) {       c++;       n &= n - 1;     }     return c;   }   int main() {     double n, m, cost;     ;     int i, a, b;     cin >> n >> m;     int ver[100000];     for (i = 1; i < n + 1; i++) {       scanf( %d , &ver[i]);     }     double ans = 0;     for (i = 0; i < m; i++) {       cin >> a >> b >> cost;       ans = max(ans, (ver[a] + ver[b]) / cost);     }     printf( %.12lf n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int Inf = (1 << 30) - 1;   const long long lInf = (1LL << 62) - 1;   const long long Mod = 1000000007;   long long fac[1000010];   long long inv[1000010];   long long powm[1000010];   long long pown[1000010];   int a, b;   long long n, m;   long long fpow(long long a, long long b, long long Mod) {     a %= Mod;     b %= Mod;     long long mul = 1;     while (b) {       if (b & 1) (mul *= a) %= Mod;       (a *= a) %= Mod;       b >>= 1;     }     return mul;   }   void init() {     int tmp = max(n, m);     fac[0] = fac[1] = 1;     for (int i = 2; i <= tmp; ++i) fac[i] = fac[i - 1] * i % Mod;     inv[tmp] = fpow(fac[tmp], Mod - 2, Mod);     for (int i = tmp; i >= 1; --i) inv[i - 1] = inv[i] * i % Mod;     powm[0] = pown[0] = 1;     for (int i = 1; i <= tmp; ++i)       powm[i] = powm[i - 1] * m % Mod, pown[i] = pown[i - 1] * n % Mod;   }   long long A(int x, int y) {     if (x - y < 0 || x < 0) return 0;     return fac[x] * inv[x - y] % Mod;   }   long long C(int x, int y) {     if (x - y < 0 || x < 0 || y < 0) return 0;     return fac[x] * inv[y] % Mod * inv[x - y] % Mod;   }   int main() {     ios::sync_with_stdio(false);     cin >> n >> m >> a >> b;     init();     long long ans = 0;     for (long long i = 1; i <= n - 1; ++i) {       long long mul =           A(n - 2, i - 1) * C(m - 1, i - 1) % Mod * powm[n - i - 1] % Mod;       if (n - i - 2 >= 0) (mul *= (i + 1) * pown[n - i - 2] % Mod) %= Mod;       (ans += mul) %= Mod;     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n;   long long A, B;   struct node {     long long vx, vy, w;   } p[400005];   bool cmp(const node p1, const node p2) {     if (p1.w == p2.w) return p1.vx < p2.vx;     return p1.w < p2.w;   }   int main() {     scanf( %d%I64d%I64d , &n, &A, &B);     int i, j;     long long gg;     for (i = 1; i <= n; i++) scanf( %I64d%I64d%I64d , &gg, &p[i].vx, &p[i].vy);     long long ans = 0;     for (i = 1; i <= n; i++) {       p[i].w = p[i].vy - p[i].vx * A;     }     sort(p + 1, p + n + 1, cmp);     for (i = 1; i <= n; i++) {       j = i;       while (j + 1 <= n && p[j + 1].w == p[i].w) j = j + 1;       long long num = j - i + 1;       int k;       for (int t = i; t <= j; t++) {         k = t;         while (k + 1 <= j && p[k + 1].vx == p[t].vx) k = k + 1;         long long siz = k - t + 1;         ans += siz * (num - siz);         t = k;       }       i = j;     }     printf( %I64d , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void solve() {     string S;     cin >> S;     int M;     cin >> M;     for (int i = 0; i < M; i++) {       int l, r, k;       cin >> l >> r >> k;       l--;       rotate(S.begin() + l, S.begin() + r - k % (r - l), S.begin() + r);     }     cout << S <<   n ;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int t = 1;     while (t--) solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t, n;     cin >> t;     while (t--) {       cin >> n;       int a[n];       for (int i = 0; i < n; i++) {         cin >> a[i];       }       sort(a, a + n);       int flag = 0;       for (int i = 0; i < n - 1; i++) {         if ((a[i + 1] - a[i]) > 1 || (a[i + 1] - a[i]) < -1) {           flag = 1;         }       }       if (flag == 1) {         cout <<  NO               <<   n ;       } else {         cout <<  YES               <<   n ;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     long n, m;     cin >> n >> m;     if (m % 2 == 1) {       bool f = true;       long ptr = (m + 1) / 2;       long p1 = ptr - 1, p2 = ptr;       for (long i = 1; i <= n; i++) {         if (f && p2 <= m) {           cout << p2 <<   n ;           p2++;           f = false;         } else if (p1 >= 1) {           cout << p1 <<   n ;           p1--;           f = true;         } else {           i--;           f = !f;           p1 = ptr - 1;           p2 = ptr;         }       }     } else {       bool f = true;       long ptr = (m + 1) / 2;       if (n >= 2)         cout << ptr <<   n  << ptr + 1 <<   n ;       else         cout << ptr;       long p1 = ptr - 1;       long p2 = ptr + 2;       for (long i = 3; i <= n; i++) {         if (f && p1 >= 1) {           cout << p1 <<   n ;           p1--;           f = false;         } else if (p2 <= m) {           cout << p2 <<   n ;           p2++;           f = true;         } else {           i++;           if (i < n)             cout << ptr <<   n  << ptr + 1 <<   n ;           else             cout << ptr <<   n ;           p1 = ptr - 1;           p2 = ptr + 2;         }       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   map<long long, long long> mp;   string s;   long long n, m, k, ans;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     srand(time(0));     cin >> n;     vector<long long> a(n + 1, 0);     for (long long i = 1; i <= n; ++i) cin >> a[i];     for (long long i = n; i >= 1; --i)       if (a[i] && !m)         m = i;       else if (!a[i] && !k)         k = i;     cout << min(m, k);   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 10;   pair<int, int> a[N];   int main() {     int n;     cin >> n;     int mn = 1e9, mx = -1e9;     for (int i = 0; i < n; ++i) {       cin >> a[i].first >> a[i].second;       mn = min(mn, a[i].first);       mx = max(mx, a[i].second);     }     int ans = -1;     for (int i = 0; i < n; ++i) {       if (a[i].first <= mn && a[i].second >= mx) {         ans = i + 1;         break;       }     }     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   int dp[101][101][28];   vector<pair<int, int> > graph[101];   int fun(int x, int y, int val) {     if (dp[x][y][val] != -1) return dp[x][y][val];     for (int i = 0; i < graph[x].size(); i++) {       if (graph[x][i].second >= val) {         bool mark = true;         for (int j = 0; j < graph[y].size(); j++) {           if (graph[y][j].second >= graph[x][i].second) {             if (fun(graph[x][i].first, graph[y][j].first, graph[y][j].second) ==                 0) {               mark = false;               break;             }           }         }         if (mark == true) {           dp[x][y][val] = 1;           return 1;         }       }     }     dp[x][y][val] = 0;     return 0;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(NULL);     int n, m;     cin >> n >> m;     for (int i = 0; i < m; i++) {       int x, y;       char d;       cin >> x >> y >> d;       graph[x - 1].push_back(make_pair(y - 1, d - 96));     }     memset(dp, -1, sizeof(dp));     for (int i = 0; i < n; i++) {       for (int j = 0; j < n; j++) {         if (fun(i, j, 0))           cout <<  A ;         else           cout <<  B ;       }       cout <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   const int N = 2e5 + 10;   int n, m;   int volume[N];   int amount[N];   int parent[N];   int tofill[N];   int weight[N];   std::set<int> notFull;   void reducePath(int index, int lead) {     while (parent[index] != index) {       int oldParent = parent[index];       parent[index] = lead;       index = oldParent;     }   }   int find(int index) {     int lead = index;     while (parent[lead] != lead) {       lead = parent[lead];     }     reducePath(index, lead);     return lead;   }   bool merge(int l, int r) {     int ll = find(l);     int rl = find(r);     if (ll == rl) {       return false;     }     if (weight[ll] < weight[rl]) swap(ll, rl);     parent[rl] = ll;     weight[ll] += weight[rl];     if (tofill[ll] < tofill[rl]) tofill[ll] = tofill[rl];     return true;   }   void fill(int p, int x) {     while (x > 0) {       int lead = find(p);       int f = tofill[lead];       int remainingVolume = volume[f] - amount[f];       int fillAmount = std::min(remainingVolume, x);       amount[f] += fillAmount;       x -= fillAmount;       if (amount[f] == volume[f]) {         if (f == n - 1)           break;         else           ++f;         merge(lead, f);       }     }   }   void fill2(int p, int x) {     auto lb = notFull.lower_bound(p);     while (x > 0 && lb != notFull.end()) {       int remainingVolume = volume[*lb] - amount[*lb];       int fillAmount = std::min(remainingVolume, x);       amount[*lb] += fillAmount;       x -= fillAmount;       if (amount[*lb] == volume[*lb])         lb = notFull.erase(lb);       else         lb++;     }   }   void init() {     for (int i = 0; i < n; ++i) {       parent[i] = i;       tofill[i] = i;       weight[i] = 1;       notFull.insert(i);     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     cin >> n;     for (int i = 0; i < n; ++i) {       cin >> volume[i];     }     init();     cin >> m;     for (int i = 0; i < m; ++i) {       int q;       cin >> q;       if (q == 1) {         int p, x;         cin >> p >> x;         fill2(--p, x);       } else {         int k;         cin >> k;         cout << amount[--k] <<   n ;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m;     scanf( %d %d , &n, &m);     vector<int> v(n + 1);     for (int i = 1; i <= n; i++) scanf( %d , &v[i]);     double ans = 0.0;     int a, b, w;     for (int i = 1; i <= m; i++) {       scanf( %d %d %d , &a, &b, &w);       ans = max(ans, 1.0 * (v[a] + v[b]) / w);     }     printf( %0.9lf n , ans);     return 0;   }
#include <bits/stdc++.h>   const int max_n = 150;   const unsigned int lowest = 31;   const int size = (max_n >> 5) + 1;   struct row {     unsigned int bits[size];     void set_bit(unsigned int j) { bits[j >> 5] |= (1 << (j & lowest)); }     bool get_bit(unsigned int j) {       return ((bits[j >> 5] >> (j & lowest)) & 1) == 1;     }     bool is_zero() {       for (int i = 0; i < size; ++i)         if (bits[i]) return false;       return true;     }   };   row operator&(row a, row b) {     row c;     for (int i = 0; i < size; ++i) c.bits[i] = a.bits[i] & b.bits[i];     return c;   }   row operator|(row a, row b) {     row c;     for (int i = 0; i < size; ++i) c.bits[i] = a.bits[i] | b.bits[i];     return c;   }   row operator~(row a) {     row c;     for (int i = 0; i < size; ++i) c.bits[i] = ~a.bits[i];     return c;   }   row left(row a) {     for (int i = 0; i < size - 1; ++i) {       a.bits[i] >>= 1;       if (a.bits[i + 1] & 1) a.bits[i] |= (1 << lowest);     }     a.bits[size - 1] >>= 1;     return a;   }   row right(row a) {     for (int i = size - 1; i > 0; --i) {       a.bits[i] <<= 1;       if (a.bits[i - 1] & (1 << lowest)) a.bits[i] |= 1;     }     a.bits[0] <<= 1;     return a;   }   int ei, ej, n, m, k;   row table[max_n], where[max_n];   bool check() {     for (int i = 0; i < n; ++i)       if ((i != ei) && !where[i].is_zero()) return false;     for (int j = 0; j < m; ++j)       if ((j != ej) && where[ei].get_bit(j)) return false;     return true;   }   int main() {     memset(table, 0, sizeof(table));     memset(where, 0, sizeof(where));     scanf( %d%d%d n , &n, &m, &k);     for (int i = 0; i < n; ++i) {       for (int j = 0; j < m; ++j) {         char c;         scanf( %c , &c);         if (c ==  E ) ei = i, ej = j, c =  . ;         if (c ==  . ) table[i].set_bit(j), where[i].set_bit(j);       }       scanf(  n );     }     if (check()) {       printf( 0 n );       return 0;     }     for (int i = 1; i <= k; ++i) {       char c;       scanf( %c , &c);       switch (c) {         case  L :           for (int r = 1; r <= n - 2; ++r)             where[r] =                 (left(where[r]) & table[r]) | (where[r] & ~right(table[r]));           break;         case  R :           for (int r = 1; r <= n - 2; ++r)             where[r] =                 (right(where[r]) & table[r]) | (where[r] & ~left(table[r]));           break;         case  D :           for (int r = n - 2; r >= 1; --r)             where[r] = (where[r - 1] & table[r]) | (where[r] & ~table[r + 1]);           break;         case  U :           for (int r = 1; r <= n - 2; ++r)             where[r] = (where[r + 1] & table[r]) | (where[r] & ~table[r - 1]);           break;       }       if (check()) {         printf( %d n , i);         return 0;       }     }     printf( -1 n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, k;   vector<pair<int, int> > g[1001];   int obtenpadre(int u, int padre[1001]) {     if (padre[u] == 0) return u;     padre[u] = obtenpadre(padre[u], padre);     return padre[u];   }   void unir(int u, int v, int padre[1001], int llaves[1001][1001]) {     padre[v] = u;     for (int i = 1; i <= m; i++)       if (llaves[v][i]) llaves[u][i] = 1;   }   void ejecuta(int padre[1001], int llaves[1001][1001]) {     bool cambios = true;     while (cambios) {       cambios = false;       for (int u = 1; u <= n; u++) {         vector<pair<int, int> > &ar = g[u];         for (int i = 0; i < int(ar.size()); i++) {           int v = ar[i].first;           int l = ar[i].second;           int pu = obtenpadre(u, padre);           int pv = obtenpadre(v, padre);           if (pu != pv and (llaves[pu][l] or llaves[pv][l])) {             unir(pu, pv, padre, llaves);             cambios = true;           }         }       }     }   }   map<string, int> posini[2];   int padre[2][1001];   int llaves[2][1001][1001];   int visto[2][1001];   int main() {     cin >> n >> m >> k;     for (int i = 1; i <= m; i++) {       int u, v;       cin >> u >> v;       g[u].push_back(pair<int, int>(v, i));       g[v].push_back(pair<int, int>(u, i));     }     for (int p = 0; p < 2; p++) {       for (int i = 1; i <= k; i++) {         string s;         int h, amount;         cin >> s >> h >> amount;         posini[p][s] = h;         for (int j = 0; j < amount; j++) {           int x;           cin >> x;           llaves[p][h][x] = 1;         }       }       ejecuta(padre[p], llaves[p]);     }     for (map<string, int>::iterator it = posini[0].begin(); it != posini[0].end();          it++) {       string s = it->first;       int h0 = it->second;       int h1 = posini[1][s];       if (obtenpadre(h0, padre[0]) != obtenpadre(h1, padre[0])) {         cout <<  NO  << endl;         exit(0);       }     }     for (int u = 1; u <= n; u++) {       int h0 = obtenpadre(u, padre[0]);       int h1 = obtenpadre(u, padre[1]);       if (visto[0][h0] != visto[1][h1]) {         cout <<  NO  << endl;         exit(0);       }       if (visto[0][h0] == 0) {         visto[0][h0] = visto[1][h1] = 1;         for (int j = 1; j <= m; j++) {           if (llaves[0][h0][j] != llaves[1][h1][j]) {             cout <<  NO  << endl;             exit(0);           }         }       }     }     cout <<  YES  << endl;   }
#include <bits/stdc++.h>   const int inf = 0x3f3f3f3f;   const long long int INF = 0x3f3f3f3f3f3f3f3f;   using namespace std;   inline void INP() {}   long long int n, m;   vector<pair<long long int, long long int> > v;   void solve() {     cin >> n >> m;     long long int mn = INF;     long long int mx = 0;     for (long long int i = 0; i < m; i++) {       long long int x, y;       cin >> x >> y;       v.push_back({-1 * y, x});       mn = min(mn, y);       mx = max(mx, y);     }     sort(begin(v), end(v));     long long int ans = 0;     for (long long int i = 0; i < m; i++) {       if (v[i].second <= n) {         ans += (-1 * v[i].first) * v[i].second;         n -= v[i].second;       } else {         ans += (-1 * v[i].first) * n;         n = 0;       }       if (n == 0) break;     }     cout << ans <<   n ;   }   int32_t main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int t = 1;     while (t--) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 100005;   long long int ara[N];   int main() {     long long int n, i, j, k, s = 0, ts;     cin >> n;     for (i = 1; i <= n; i++) cin >> ara[i];     for (i = 1; i < n; i++) {       for (j = 30; ara[i] > 0 && j >= 0; j--) {         if ((i + (1 << j)) > n) continue;         s += ara[i];         ara[(i + (1 << j))] += ara[i];         ara[i] = 0;       }       cout << s <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int cha[1000100];   int num[1000100];   int a[5010];   int limit[] = {0, 1, 3, 6, 10};   int n, k;   int che[1000100];   bool check(int mod) {     int bad = 0;     int mostI = -1;     for (int i = 0; i < n; i++) {       int t = a[i] % mod;       che[t]++;       if (che[t] > 1) bad++;       if (bad > k) {         mostI = i;         break;       }     }     for (int i = 0; i <= mostI; i++) {       int t = a[i] % mod;       che[t]--;     }     return (bad <= k);   }   int main() {     scanf( %d%d , &n, &k);     for (int i = 0; i < n; i++) scanf( %d , &a[i]);     sort(a, a + n);     for (int i = 0; i <= a[n - 1]; i++) cha[i] = 0;     int maxn = a[n - 1] - a[0];     for (int i = 0; i <= maxn; i++) che[i] = 0;     for (int i = 0; i <= maxn; i++) num[i] = 0;     for (int i = 0; i < n - 1; i++)       for (int j = i + 1; j < n; j++) {         int cc = a[j] - a[i];         num[cc]++;       }     if (n - k == 1) {       printf( 1 n );       return 0;     }     for (int i = 1;; i++) {       int ans = 0;       for (int j = i; j <= maxn; j += i) {         ans += num[j];         if (ans > k) break;       }       if (ans <= limit[k] && check(i)) {         printf( %d n , i);         break;       }     }     return 0;   }