malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const long long INF = 1e9 + 7;   const int N = 5e5 + 10;   int a[N];   int dp[2][N];   int minv[N];   int sum[N];   int n, k, p;   class BIT {     int a[110];       public:     void init() { memset((a), (0x1f), sizeof(a)); }     inline int lowbit(int x) { return x & -x; }     void add(int x, int v) {       x = p - x;       while (x < 110) {         a[x] = min(a[x], v);         x += lowbit(x);       }     }     int sum(int x) {       int ret = INF;       while (x) {         ret = min(ret, a[x]);         x -= lowbit(x);       }       return ret;     }   } b;   template <class T>   inline void readint(T &ret) {     char c;     ret = 0;     while ((c = getchar()) <  0  || c >  9 )       ;     while (c >=  0  && c <=  9 ) {       ret = ret * 10 + (c -  0 ), c = getchar();     }   }   int main() {     readint(n);     readint(k);     readint(p);     int o = 0;     for (int i = 1; i <= n; i++) {       readint(a[i]);       a[i] %= p;       sum[i] = sum[i - 1] + a[i];       dp[o][i] = (a[i] + dp[o][i - 1]) % p;     }     for (int i = 2; i <= k; i++) {       o ^= 1;       b.init();       memset((dp[o]), (0x1f), sizeof(dp[o]));       b.add(0, sum[i - 1]);       int tot = 0;       for (int j = i; j <= n; j++) {         tot = (tot + a[j]);         if (tot >= p) tot -= p;         dp[o][j] = min(b.sum(tot) - p, b.sum(p)) + tot;         int t = (p - tot);         if (t == p) t = 0;         b.add(t, dp[o ^ 1][j] + t);       }     }     printf( %d n , dp[o][n]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, k, s[444], dp[444][55][444];   int main() {     cin >> n >> k;     s[0] = 0;     for (int i = 1; i <= n; i++) cin >> s[i], s[i] += s[i - 1];     int ans = 0;     for (int i = 1; i <= n; i++)       for (int j = 2; j <= min(i, k); j++)         for (int l = 1; l <= i - j + 1; l++)           for (int h = 1; h <= i - l - j + 2; h++)             dp[i][j][l] =                 max(dp[i][j][l], dp[i - l][j - 1][h] +                                      abs(s[i] + s[i - l - h] - 2 * s[i - l]));     for (int i = 1; i <= n; i++)       for (int j = 1; j <= i - k + 1; j++) ans = max(ans, dp[i][k][j]);     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int INF = 0x3f3f3f3f, N = 5050;   int dp[N][N / 2][2], a[N];   int main() {     int n;     scanf( %d , &n), a[0] = a[n + 1] = -INF;     for (int i = 1; i <= n; i++) scanf( %d , a + i);     memset(dp, INF, sizeof dp);     for (int i = 1; i <= n; i++) dp[i][0][0] = 0;     dp[1][1][1] = (a[1] > a[2]) ? 0 : a[2] - a[1] + 1;     dp[2][1][1] = max(0, a[1] - a[2] + 1) + max(0, a[3] - a[2] + 1),     dp[2][1][0] = dp[1][1][1];     for (int i = 3; i <= n; i++)       for (int j = 1; j <= (i + 1) / 2; j++) {         dp[i][j][0] = min(dp[i - 1][j][0], dp[i - 1][j][1]);         dp[i][j][1] = min(dp[i - 2][j - 1][0] + max(0, a[i - 1] - a[i] + 1),                           dp[i - 2][j - 1][1] +                               max(0, min(a[i - 2] - a[i], a[i - 1] - a[i] + 1))) +                       max(0, (a[i + 1] - a[i] + 1));       }     for (int i = 1; i <= (n + 1) / 2; i++)       printf( %d  , min(dp[n][i][0], dp[n][i][1]));     return 0;   }
#include <bits/stdc++.h>   using namespace std;   map<string, int> m;   int main() {     int n;     cin >> n;     string h;     cin >> h;     m[h]++;     for (int i = 0; i < n; i++) {       string s;       cin >> s;       string a =   , b =   ;       for (int i = 0; i < 3; i++) a += s[i];       for (int i = 5; i < 8; i++) b += s[i];       m[a]++;       m[b]++;     }     cout << (m[h] % 2 ?  home  :  contest ) << endl;   }
#include <bits/stdc++.h>   using namespace std;   bool check(int hr, int min) {     if (hr % 10 == 7 || hr / 10 == 7 || min % 10 == 7) {       return true;     }     return false;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int x, hr, min, res = 0;     cin >> x >> hr >> min;     while (!check(hr, min)) {       min -= x;       if (min < 0) {         min += 60;         hr--;       }       if (hr < 0) {         hr += 24;       }       res++;     }     cout << res <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   unsigned long long k, n, i, j, m;   unsigned long long v[105][105];   vector<unsigned long long> l;   int main() {     cin >> n >> m;     for (i = 1; i <= n; i++)       for (j = 1; j <= m; j++) {         cin >> v[i][j];         k = max(k, v[i][j]);       }     k++;     if (n == 1) {       cout <<  YES n ;       cout << k <<   n ;       cout << 0 <<   n ;       for (i = 1; i <= m; i++) cout << v[1][i] <<    ;       cout <<   n ;       return 0;     }     if (m == 1) {       cout <<  YES n ;       cout << k <<   n ;       for (i = 1; i <= n; i++) cout << v[i][1] <<    ;       cout <<   n ;       cout << 0 <<   n ;       return 0;     }     unsigned long long a = v[1][1] + v[2][2];     unsigned long long b = v[1][2] + v[2][1];     unsigned long long j = max(a, b) - min(a, b);     if (j == 0) j = k;     if (k > j) {       cout <<  NO n ;       return 0;     }     k = j;     unsigned long long x = 0;     l.push_back(x);     for (i = 2; i <= n; i++) {       if (v[i][1] < v[i - 1][1])         x = (x + k - v[i - 1][1] + v[i][1]) % k;       else         x = (x + v[i][1] - v[i - 1][1]) % k;       l.push_back(x);     }     for (i = 0; i < l.size(); i++) {       for (j = 1; j <= m; j++) {         if ((l[i] + v[1][j]) % k != v[i + 1][j]) {           cout <<  NO n ;           return 0;         }       }     }     cout <<  YES n ;     cout << k <<   n ;     for (i = 0; i < l.size(); i++) cout << l[i] <<    ;     cout <<   n ;     for (i = 1; i <= m; i++) cout << v[1][i] <<    ;     cout <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   char s[500005];   int A[500005][2];   int B[500005];   int C[500005];   int main() {     ios::sync_with_stdio(false);     int n;     memset(A, 0, sizeof(A));     memset(B, 0, sizeof(B));     memset(C, 0, sizeof(C));     cin >> n;     for (int i = 0; i < n; i++) {       cin >> s;       int len = strlen(s);       if (s[0] ==  )  && s[len - 1] ==  ( ) continue;       for (int j = 0; j < len; j++) {         if (s[j] ==  ( )           A[i][0]++;         else if (s[j] ==  )  && A[i][0] > 0)           A[i][0]--;         else           A[i][1]--;       }       if (A[i][0] >= 0 && A[i][1] == 0) C[i] = A[i][0];       if (A[i][0] == 0 && A[i][1] <= 0) C[i] = A[i][1];       if (C[i] >= 0 && (A[i][0] == 0 || A[i][1] == 0)) B[C[i]]++;     }     int ans = 0;     for (int i = 0; i < n; i++) {       if (C[i] < 0) {         int t = 0 - C[i];         if (B[t] > 0) {           ans++;           B[t]--;         }       }     }     ans += B[0] / 2;     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, k, p, i;   struct reg {     int x, y, z;   } v[100100];   inline bool cmp1(reg a, reg b) {     if (a.x != b.x) return a.x > b.x;     return a.y > b.y;   }   inline bool cmp2(reg a, reg b) { return a.y < b.y; }   char s[5000];   int main() {     int n, sol = 0;     cin >> n;     cin >> (s + 1);     for (i = n + 1; s[i]; i += n)       if (s[i - 1] == s[i - 2] && s[i - 2] == s[i - 3]) ++sol;     cout << sol <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, a, b, mas[30], summ[100005];   long long sum, countt;   string s;   map<pair<char, long long>, int> matr;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     for (int i = 0; i < 26; ++i) cin >> mas[i];     cin >> s;     for (int i = 0; i < s.size(); ++i) {       if (matr.count(make_pair(s[i], sum))) countt += matr[make_pair(s[i], sum)];       sum += mas[s[i] -  a ];       matr[make_pair(s[i], sum)]++;     }     cout << countt;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int INF_INT = 2147483647;   const long long INF_LL = 9223372036854775807LL;   int gcd(int a, int b) { return ((b == 0) ? a : gcd(b, a % b)); }   int lcm(int a, int b) { return a * b / gcd(a, b); }   void solve() {     int n;     cin >> n;     long long tmp = 1;     while (n) {       if (tmp % 3 == 0 || tmp % 10 == 3) {         tmp++;         continue;       }       tmp++;       n--;     }     cout << tmp - 1 << endl;   }   int main() {     ios::sync_with_stdio();     cin.tie();     ;     int t;     cin >> t;     while (t--) solve();   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   using pii = pair<int, int>;   template <class T>   using V = vector<T>;   template <class T>   using VV = V<V<T>>;   constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }   template <class T, class U>   void chmin(T &t, const U &u) {     if (t > u) t = u;   }   template <class T, class U>   void chmax(T &t, const U &u) {     if (t < u) t = u;   }   template <class T, class U>   ostream &operator<<(ostream &os, const pair<T, U> &p) {     os <<  (  << p.first <<  ,  << p.second <<  ) ;     return os;   }   template <class T>   ostream &operator<<(ostream &os, const vector<T> &v) {     os <<  { ;     for (int i = 0; i < (v.size()); i++) {       if (i) os <<  , ;       os << v[i];     }     os <<  } ;     return os;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(nullptr);     int tc;     cin >> tc;     while (tc--) {       int n, m;       cin >> n >> m;       V<int> ans;       VV<int> g(n);       for (int i = 0; i < (m); i++) {         int a, b;         cin >> a >> b;         --a, --b;         g[a].push_back(b);       }       VV<int> st(n, V<int>(3));       for (int i = 0; i < (n); i++) {         int c;         if (st[i][1]) {           c = 2;         } else if (st[i][0]) {           c = 1;         } else {           c = 0;         }         if (c == 2) ans.push_back(i);         for (int to : g[i]) {           st[to][c] = 1;         }       }       cout << ans.size() <<   n ;       for (auto v : ans) cout << v + 1 <<    ;       cout <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, A, B;   double p[25];   double a[625][625], l[625][625], u[625][625];   vector<int> g[25];   double y[625], x[625], b[625];   int id[25][25];   void edge(int ea, int b, int c, int d, double e) {     if (ea < b) swap(ea, b);     if (c < d) swap(c, d);     a[id[ea][b]][id[c][d]] += e;   }   int main() {     scanf( %d %d %d %d , &n, &m, &A, &B);     A--, B--;     if (A < B) swap(A, B);     for (int i = 0; i < (int)(m); i++) {       int ue, v;       scanf( %d %d , &ue, &v);       ue--, v--;       g[ue].push_back(v);       g[v].push_back(ue);     }     for (int i = 0; i < (int)(n); i++) scanf( %lf , &p[i]);     int N = 0;     for (int i = 0; i < (int)(n); i++)       for (int j = 0; j < (int)(i + 1); j++) id[i][j] = ++N;     for (int i = 0; i < (int)(N + 1); i++)       for (int j = 0; j < (int)(N + 1); j++) a[i][j] = 0;     for (int i = 0; i < (int)(n); i++)       for (int j = 0; j < (int)(i + 1); j++) {         if (i == j) {           edge(i, j, i, j, 1);           continue;         }         edge(i, j, i, j, p[i] * p[j]);         for (int q = 0; q < (int)(g[i].size()); q++) {           int qi = g[i][q];           edge(i, j, qi, j, (1 - p[i]) / g[i].size() * p[j]);           for (int qq = 0; qq < (int)(g[j].size()); qq++) {             int qj = g[j][qq];             edge(i, j, qi, qj,                  (1 - p[i]) / g[i].size() * (1 - p[j]) / g[j].size());           }         }         for (int qq = 0; qq < (int)(g[j].size()); qq++) {           int qj = g[j][qq];           edge(i, j, i, qj, (1 - p[j]) / g[j].size() * p[i]);         }       }     for (int i = 0; i < (int)(n); i++)       for (int j = 0; j < (int)(i); j++) a[id[i][j]][id[i][j]] -= 1;     for (int j = 1; j <= N; j++) u[1][j] = a[1][j];     for (int j = 2; j <= N; j++) l[j][1] = a[j][1] / u[1][1];     for (int i = 2; i <= N; i++) {       for (int j = i; j <= N; j++) {         u[i][j] = a[i][j];         for (int k = 1; k <= i - 1; k++) u[i][j] -= l[i][k] * u[k][j];       }       for (int j = i + 1; j <= N; j++) {         l[j][i] = a[j][i];         for (int k = 1; k <= i - 1; k++) l[j][i] -= l[j][k] * u[k][i];         l[j][i] /= u[i][i];       }     }     for (int i = 1; i <= N; i++) l[i][i] = 1.0;     for (int d = 0; d < (int)(n); d++) {       for (int i = 0; i < (int)(n); i++)         for (int j = 0; j < (int)(i + 1); j++)           if (i != j) {             b[id[i][j]] = 0;           } else             b[id[i][j]] = i == d;       for (int i = 1; i <= N; i++) {         y[i] = b[i];         for (int j = 1; j < i; j++) y[i] -= l[i][j] * y[j];       }       for (int i = N; i >= 1; i--) {         x[i] = y[i];         for (int j = i + 1; j <= N; j++) x[i] -= u[i][j] * x[j];         x[i] /= u[i][i];       }       if (d) printf(   );       printf( %.8f , x[id[A][B]]);     }     printf(  n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const double eps = 1E-9;   const double Exp = 2.718281828459045;   const double pi = 3.14159;   const double E = 2.7182818284590452354;   const int Max_Bit = 63;   const int INF = 2000000000;   const long long LINF = 1000000000000000007ll;   const int MOD = 1000000007;   const int NMAX = 105;   const int MMAX = 1005;   const int base = 1000 * 1000 * 1000;   int n, m, k, a[NMAX][NMAX][NMAX];   int ok(int i, int j, int l) {     bool flag = false;     if (a[i][j][l] == 1) {       if (i < n && a[i + 1][j][l] == 1 &&           ((i > 1 && a[i - 1][j][l] == 1) ||            (j > 1 && a[i][j - 1][l] == 1 && a[i + 1][j - 1][l] == 0) ||            (l > 1 && a[i][j][l - 1] == 1 && a[i + 1][j][l - 1] == 0)))         flag = true;       if (j < m && a[i][j + 1][l] == 1 &&           ((j > 1 && a[i][j - 1][l] == 1) ||            (i > 1 && a[i - 1][j][l] == 1 && a[i - 1][j + 1][l] == 0) ||            (l > 1 && a[i][j][l - 1] == 1 && a[i][j + 1][l - 1] == 0)))         flag = true;       if (l < k && a[i][j][l + 1] == 1 &&           ((l > 1 && a[i][j][l - 1] == 1) ||            (i > 1 && a[i - 1][j][l] == 1 && a[i - 1][j][l + 1] == 0) ||            (j > 1 && a[i][j - 1][l] == 1 && a[i][j - 1][l + 1] == 0)))         flag = true;     }     if (flag) return 1;     return 0;   }   int main() {     scanf( %d%d%d , &n, &m, &k);     for (int i = 1; i <= n; i++)       for (int j = 1; j <= m; j++) {         string second;         cin >> second;         for (int l = 1; l <= k; l++) a[i][j][l] = int(second[l - 1] -  0 );       }     int ans = 0;     for (int i = 1; i <= n; i++)       for (int j = 1; j <= m; j++)         for (int l = 1; l <= k; l++) ans += ok(i, j, l);     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 200000;   long long x[N], y[N];   vector<int> ids[N];   int order[N];   long long cross(int a, int b, int c) {     return x[c] * y[c] * (x[b] * y[a] - x[a] * y[b]);   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     int n;     cin >> n;     for (int i = 0; i < n; ++i) {       cin >> x[i] >> y[i];     }     iota(order, order + n, 0);     sort(order, order + n,          [&](int a, int b) { return x[a] == x[b] ? y[a] > y[b] : x[a] > x[b]; });     vector<int> hull;     for (int i = 0, j = 0; i < n; i = j) {       int a = order[i];       while (hull.size() >= 2) {         int b = hull[hull.size() - 1], c = hull[hull.size() - 2];         if (cross(a, c, b) + cross(b, a, c) + cross(c, b, a) >= 0) {           break;         }         hull.pop_back();       }       hull.push_back(a);       while (j < n && x[order[j]] == x[a] && y[order[j]] == y[a]) {         ids[a].push_back(order[j++]);       }     }     while (hull.size() >= 2) {       int a = hull[hull.size() - 1], b = hull[hull.size() - 2];       if (y[b] < y[a]) {         break;       }       hull.pop_back();     }     vector<int> ans;     for (auto i : hull) {       ans.insert(ans.begin(), ids[i].begin(), ids[i].end());     }     sort(ans.begin(), ans.end());     for (auto i : ans) {       cout << i + 1 <<    ;     }     cout <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1000005;   class fenwick {     int n;     vector<int> v;       public:     fenwick(int _n) : n(_n) { v.resize(n); }     void update(int at, int by) {       while (at < v.size()) {         v[at] += by;         at |= (at + 1);       }     }     int query(int at) {       int res = 0;       while (at >= 0) {         res += v[at];         at = (at & (at + 1)) - 1;       }       return res;     }   };   map<int, int> indexes;   int get_index(int x) {     if (indexes.count(x) == 0) {       int sz = indexes.size();       indexes[x] = sz;     }     return indexes[x];   }   vector<int> f(vector<int> &v) {     int n = v.size();     vector<int> cnt(maxn, 0);     vector<int> ret;     for (auto &x : v) {       cnt[x]++;       ret.push_back(cnt[x]);     }     return ret;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     ;     int n;     cin >> n;     vector<int> v(n);     for (int i = 0; i < n; ++i) {       int x;       cin >> x;       v[i] = get_index(x);     }     auto left = f(v);     reverse(v.begin(), v.end());     auto right = f(v);     reverse(right.begin(), right.end());     fenwick ft = fenwick(maxn);     for (int i = 0; i < n; ++i) {       ft.update(right[i], 1);     }     long long ans = 0;     for (int i = 0; i < n; ++i) {       ft.update(right[i], -1);       int cnt = ft.query(left[i] - 1);       ans += cnt;     }     cout << ans <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long int mod = 998244353;   vector<long long int> prime;   long long int n = 1000001;   vector<bool> vis(n, true);   void sieve() {     vis[0] = vis[1] = false;     for (long long int i = 2; i * i <= n; i++)       if (vis[i])         for (long long int j = i * i; j <= n; j += i) vis[j] = false;     for (long long int i = 2; i <= n; i++)       if (vis[i]) prime.push_back(i);   }   bool check(long long int n, long long int k) {     if (n < 2 * k) return false;     if (k == 1) return vis[n];     if (k == 2) {       if (n % 2) return vis[n - 2];       return true;     }     return true;   }   int32_t main() {     sieve();     long long int n;     cin >> n;     for (auto it = lower_bound(prime.begin(), prime.end(), n); it != prime.end();          it++) {       if (*it > ((n * (n - 1)) >> 1)) break;       if (!check((*it) << 1, n)) continue;       long long int m = *it;       cout << m << endl;       m -= n;       for (long long int i = 1; i <= n; i++) {         long long int z = i + 1;         if (z > n) z = 1;         cout << i <<     << z << endl;       }       long long int diff = 2, init = (n >> 1) + (n & 1);       while (m--) {         cout << init <<     << init + diff << endl;         diff += 2;         init--;       }       return 0;     }     cout <<  -1 ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MOD = 1e9 + 7;   const int MAXN = 1e5 + 3;   const int inf = 2e9;   int max(int a, int b) {     if (a > b)       return a;     else       return b;   }   int min(int a, int b) {     if (a < b)       return a;     else       return b;   }   bool cmp(pair<int, int> p1, pair<int, int> p2) {     if (p1.first < p2.first)       return true;     else if (p1.first == p2.first) {       if (p1.second < p2.second) return true;       return false;     }     return false;   }   void solve() {     int n, m, d;     cin >> n >> m >> d;     int a[n][m];     for (int i = (int)0; i < (int)n; ++i) {       for (int j = (int)0; j < (int)m; ++j) {         cin >> a[i][j];       }     }     int check = a[0][0] % d;     vector<int> v;     bool pr = false;     for (int i = (int)0; i < (int)n; ++i) {       for (int j = (int)0; j < (int)m; ++j) {         if (a[i][j] % d == check) {           v.push_back(a[i][j]);         } else {           pr = true;           break;         }       }     }     if (pr)       cout << -1 <<   n ;     else {       sort((v).begin(), (v).end());       int cc = (n * m);       int bi = (cc / 2);       int ans = 0;       for (int i = (int)0; i < (int)cc; ++i) {         ans += abs(v[i] - v[bi]);       }       cout << ans / d <<   n ;     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     int t;     t = 1;     while (t--) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long gcd(long long a, long long b) {     if ((a == 0) || (b == 0)) return a + b;     return gcd(b, a % b);   }   long long pow_mod(long long a, long long b) {     long long res = 1;     while (b) {       if (b & 1) res = (res * a) % 1000000007;       a = (a * a) % 1000000007;       b >>= 1;     }     return (res % 1000000007);   }   long long pow_2(long long a, long long b) {     long long res = 1;     while (b) {       if (b & 1) res = (res * a);       a = (a * a);       b >>= 1;     }     return res;   }   bool isPrime(long long a) {     for (int i = 3; (i * i) <= a; i += 2) {       if ((a % i) == 0) return false;     }     if ((a != 2) && ((a % 2) == 0)) return false;     if (a == 1) return false;     return true;   }   string con_ll_to_str(int a) {     stringstream mystr;     mystr << a;     return mystr.str();   }   long long con_str_to_ll(string st) {     long long numb = 0;     int len = st.size(), i, j = 0;     for (i = len - 1; i >= 0; i--) {       numb += (pow_2(10, j) * (st[i] -  0 ));       j++;     }     return numb;   }   long long baseno_to_decimal(string st, long long basee) {     long long i = 0, j, anss = 0;     for (j = (int)st.length() - 1; j >= 0; j--) {       anss += (st[j] -  0 ) * pow_2(basee, i);       i++;     }     return anss;   }   string decimal_to_string(long long num, long long basee) {     long long i = 0, j, opop;     string anss =   ;     vector<string> stri;     stri.push_back( 0 );     stri.push_back( 1 );     stri.push_back( 2 );     stri.push_back( 3 );     stri.push_back( 4 );     stri.push_back( 5 );     stri.push_back( 6 );     stri.push_back( 7 );     stri.push_back( 8 );     stri.push_back( 9 );     stri.push_back( A );     stri.push_back( B );     stri.push_back( C );     stri.push_back( D );     stri.push_back( E );     stri.push_back( F );     if (num == 0) {       return  0 ;     }     while (num) {       opop = num % basee;       anss += stri[opop];       num /= basee;     }     reverse(anss.begin(), anss.end());     return anss;   }   const int dx[] = {0, 1, 1, 1, 0, -1, -1, -1};   const int dy[] = {1, 1, 0, -1, -1, -1, 0, 1};   long long arr[100010];   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     long long T, N, K, i, j;     string st =   ;     cin >> N >> K;     if (K > N) {       cout <<  -1 ;       return 0;     }     if (K == 1 && N > 1) {       cout <<  -1 ;       return 0;     }     if (N == 1) {       cout <<  a ;       return 0;     }     long long opop = (N - K + 2);     for (i = 1; i <= opop; i++) {       if (i % 2) {         st.push_back( a );       } else {         st.push_back( b );       }     }     long long po = st.length(), pu = 0;     for (i = po + 1; i <= N; i++) {       st.push_back( c  + pu);       pu++;     }     cout << st;     return 0;   }