malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int t, sx, sy, ex, ey;   string s;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cin >> t >> sx >> sy >> ex >> ey >> s;     for (int i = 0; i < t; i++) {       if (s[i] ==  S  && sy > ey) {         sy--;       } else if (s[i] ==  N  && sy < ey) {         sy++;       } else if (s[i] ==  E  && sx < ex) {         sx++;       } else if (s[i] ==  W  && sx > ex) {         sx--;       }       if (sx == ex && sy == ey) {         cout << i + 1 <<   n ;         return 0;       }     }     cout << -1 <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   ifstream fin( input.txt );   ofstream fout( output.txt );   int gcd(int a, int b) {     while (a && b) a > b ? a %= b : b %= a;     return a + b;   }   int val(char c) {     if (c >=  0  && c <=  9 )       return (int)c -  0 ;     else       return (int)c -  A  + 10;   }   long long pows(int a, int b) {     long long res = 1;     for (int i = 0; i < b; ++i) {       res *= a;     }     return res;   }   long long logx(long long base, long long num) {     int cnt = 0;     while (num != 1) {       num /= base;       ++cnt;     }     return cnt;   }   long long divisibles(long long a, long long b, long long m) {     if (a % m == 0)       return (b / m) - (a / m) + 1;     else       return (b / m) - (a / m);   }   vector<int> root(100001, 0);   vector<int> size(100001, 0);   int find(int x) {     while (x != root[x]) x = root[x];     return x;   }   bool same(int a, int b) { return find(a) == find(b); }   void unite(int a, int b) {     a = find(a);     b = find(b);     if (size[a] < size[b]) swap(a, b);     size[a] += size[b];     root[b] = a;   }   vector<int> vis(100001, 0);   vector<int> adj[100001];   int main() {     std::ios::sync_with_stdio(false);     set<double> s;     double n, x, y;     cin >> n >> x >> y;     for (int i = 0; i < n; ++i) {       double a, b;       cin >> a >> b;       b = y - b;       a = x - a;       if (!a) {         s.insert(INT_MAX);         continue;       }       s.insert(b / a);     }     cout << s.size() <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 200005, P = 1e9 + 7;   int dp[N][3], val[3], n;   int add(int a, int b) { return (a += b) >= P ? a - P : a; }   int qpow(int a, int b) {     int res = 1;     while (b) {       if (b & 1) res = 1ll * res * a % P;       a = 1ll * a * a % P;       b >>= 1;     }     return res;   }   int main() {     string s;     cin >> n >> s;     s =  %  + s;     int qs = count(s.begin(), s.end(),  ? );     const int f3 = qpow(3, qs), inv3 = qpow(3, P - 2);     for (int i = 1; i <= n; ++i) {       if (s[i] ==  a ) {         dp[i][1] = dp[i][2] = 0;         dp[i][0] = 1;         val[0] = add(val[0], 1);       } else if (s[i] ==  b ) {         dp[i][0] = dp[i][2] = 0;         dp[i][1] = val[0];         val[1] = add(val[1], dp[i][1]);       } else if (s[i] ==  c ) {         dp[i][0] = dp[i][1] = 0;         dp[i][2] = val[1];         val[2] = add(val[2], dp[i][2]);       } else {         dp[i][0] = inv3;         dp[i][1] = (long long)inv3 * val[0] % P;         dp[i][2] = (long long)inv3 * val[1] % P;         val[0] = add(val[0], inv3);         val[1] = add(val[1], dp[i][1]);         val[2] = add(val[2], dp[i][2]);       }     }     cout << (long long)val[2] * f3 % P <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5;   int N, A[maxn];   unordered_map<int, int> cnt;   unordered_map<int, int> cnt_popped;   int main() {     bool on[26] = {};     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     cin >> N;     string S;     getline(cin, S);     for (auto j = (0); j != (N); ++j) {       getline(cin, S);       for (char ch : S) {         on[ch -  a ] = !on[ch -  a ];       }       int mask = 0;       for (auto i = (0); i != (26); ++i) {         if (on[i]) {           mask |= 1 << i;           on[i] = false;         }       }       A[j] = mask;     }     long long ret = 0;     for (auto k = (0); k != (N); ++k) {       int m = A[k];       ret += cnt[m];       ret += cnt_popped[m];       for (int i = 0, j = 1; i < 26; i++, j <<= 1) {         if (m & j) {           ret += cnt[m ^ j];           cnt_popped[m ^ j]++;         }       }       cnt[m]++;     }     cout << ret << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   inline long long getnum() {     char c = getchar();     long long num, sign = 1;     for (; c <  0  || c >  9 ; c = getchar())       if (c ==  - ) sign = -1;     for (num = 0; c >=  0  && c <=  9 ;) {       c -=  0 ;       num = num * 10 + c;       c = getchar();     }     return num * sign;   }   vector<int> V[100003];   double D[100003];   int ch[100003], par[100003];   void dfs(int n) {     ch[n] = 0;     for (int i = 0; i < V[n].size(); i++) {       int x = V[n][i];       dfs(x);       ch[n] += ch[x];     }     double sum = 0.5;     for (int i = 0; i < V[n].size(); i++) {       int x = V[n][i];       D[x] = sum * (ch[n] - ch[x]);     }     ch[n]++;   }   void ddfs(int n) {     D[n] += 1.0 + D[par[n]];     for (int i = 0; i < V[n].size(); i++) ddfs(V[n][i]);   }   int main() {     int n = getnum();     for (int i = 2; i <= n; i++) {       par[i] = getnum();       V[par[i]].push_back(i);     }     dfs(1);     ddfs(1);     for (int i = 1; i <= n; i++) printf( %0.8f  , D[i]);   }
#include <bits/stdc++.h>   int main() {     int n, y[27] = {}, i, c = 0;     char x[100001];     scanf( %d %s , &n, x);     for (i = 0; i < n; i++)       if (!y[x[i] - 97]) {         y[x[i] - 97]++;         c++;       }     if (n <= 26)       printf( %d , n - c);     else       printf( -1 );   }
#include<bits/stdc++.h>   using namespace std;      bool possible(int *arr, int n)   {    int s=0;    s = accumulate(arr,arr+n,s);    if(s%2)     return false;    bitset<2000000> b;    b[0] = 1;    for(int i=0;i<n;i++)     b = b|(b<<arr[i]);    return b[s/2];   }      int main()   {    int n;     cin>>n;     int arr[n];     for(int i=0;i<n;i++)     {      cin>>arr[i];     }     if(possible(arr,n))     {      pair<int,int> mn;      mn = make_pair(__builtin_ctz(arr[0]),1);      for(int i=1;i<n;i++)      {       mn = min(make_pair(__builtin_ctz(arr[i]),i+1),mn);      }      cout<<1<<endl<<mn.second<<endl;     }     else     {      cout<<0<<endl;     }    return 0;   }
#include <bits/stdc++.h>   using namespace std;   string s, v;   bool g(char k) {     return (k ==  a  || k ==  e  || k ==  i  || k ==  o  || k ==  u );   }   int main() {     ios_base::sync_with_stdio(0);     cin >> s;     long long tek = 0;     char t1 =  - , t2 =  - ;     for (long long i = 0; i < s.size(); i++) {       if (!g(s[i])) {         if (t1 ==  - ) {           t1 = s[i];           ++tek;           v += s[i];         } else if (t2 ==  - ) {           t2 = s[i];           ++tek;           v += s[i];         } else if (s[i] == t1 && s[i] == t2) {           ++tek;           v += s[i];         } else {           char k = s[i];           v +=    ;           cout << v;           t1 = k;           t2 =  - ;           tek = 1;           v =   ;           v += t1;         }       } else {         t1 =  - ;         t2 =  - ;         tek = 0;         v += s[i];       }     }     cout << v;   }
#include <bits/stdc++.h>   using namespace std;   const int M = 100500;   vector<int> a, b, diff, c;   int cnt[220000];   int cnt1[220000];   int cnt3[220000];   int cntt[220000];   int cntt2[220000];   int cntt3[220000];   int cnt2[220000];   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int n;     cin >> n;     for (int i = 0; i < n; i++) {       int x;       cin >> x;       cnt[x + M]++;       cntt[x + M]++;       a.push_back(x);       diff.push_back(x + M);     }     sort(a.begin(), a.end());     sort(diff.begin(), diff.end());     diff.resize(unique(diff.begin(), diff.end()) - diff.begin());     if (diff.size() == 1 || (diff.size() == 2 && abs(diff[0] - diff[1]) == 1)) {       cout << n << endl;       for (int i = 0; i < a.size(); i++) cout << a[i] <<    ;       return 0;     } else if (diff.size() == 2 && abs(diff[0] - diff[1]) == 2) {       diff.push_back(a[0] + 1 + M);       sort(diff.begin(), diff.end());     }     while (cnt[diff[0]] > 0 && cnt[diff[2]] > 0) {       cnt[diff[0]]--;       cnt[diff[2]]--;       cnt2[diff[1]] += 2;     }     cnt2[diff[1]] += cntt[diff[1]];     for (int i = 0; i < cnt2[diff[1]]; i++) b.push_back(diff[1] - M);     for (int i = 0; i < cnt[diff[2]]; i++) b.push_back(diff[2] - M);     for (int i = 0; i < cnt[diff[0]]; i++) b.push_back(diff[0] - M);     for (int i = 0; i < b.size(); i++) cntt2[b[i] + M]++;     int ans1 = 0;     for (int i = 0; i < diff.size(); i++)       ans1 += min(cntt2[diff[i]], cntt[diff[i]]);     while (cnt[diff[1]] >= 2) {       cnt1[diff[0]]++;       cnt3[diff[2]]++;       cnt[diff[1]] -= 2;     }     cnt1[diff[0]] += cntt[diff[0]];     cnt3[diff[2]] += cntt[diff[2]];     for (int i = 0; i < cnt1[diff[0]]; i++) c.push_back(diff[0] - M);     for (int i = 0; i < cnt[diff[1]]; i++) c.push_back(diff[1] - M);     for (int i = 0; i < cnt3[diff[2]]; i++) c.push_back(diff[2] - M);     for (int i = 0; i < c.size(); i++) cntt3[c[i] + M]++;     int ans2 = 0;     for (int i = 0; i < diff.size(); i++)       ans2 += min(cntt3[diff[i]], cntt[diff[i]]);     if (ans1 < ans2) {       cout << ans1 << endl;       for (int i = 0; i < b.size(); i++) cout << b[i] <<    ;     } else {       cout << ans2 << endl;       for (int i = 0; i < c.size(); i++) cout << c[i] <<    ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long f1[120000], f2[120000], f3[120000], f4[120000], ans;   vector<int> E[120000];   int n, a[120000];   void dfs1(int x, int fa) {     f1[x] = f2[x] = a[x];     for (int i : E[x])       if (i != fa) {         dfs1(i, x);         f1[x] = max(f1[i], f1[x]);         f1[x] = max(f1[x], f2[x] + f2[i]);         f2[x] = max(f2[x], f2[i] + a[x]);       }   }   void dfs2(int x, int fa) {     pair<long long, long long> ip[5];     pair<long long, long long> iq[5];     for (int i = (0); i <= (3); ++i) ip[i] = iq[i] = make_pair(-1e18, 0);     for (int i : E[x])       if (i != fa) {         ip[0] = make_pair(f2[i] + a[x], i);         sort(ip, ip + 4);         iq[0] = make_pair(f1[i], i);         sort(iq, iq + 3);       }     ip[0] = make_pair(f4[x], -1);     sort(ip, ip + 4);     for (int i : E[x])       if (i != fa) {         f3[i] = f3[x];         if (i == ip[3].second)           f3[i] = max(f3[i], ip[2].first + ip[1].first - a[x]);         else if (i == ip[2].second)           f3[i] = max(f3[i], ip[1].first + ip[3].first - a[x]);         else           f3[i] = max(f3[i], ip[2].first + ip[3].first - a[x]);         if (i == iq[2].second)           f3[i] = max(f3[i], iq[1].first);         else           f3[i] = max(f3[i], iq[2].first);         if (i == ip[3].second)           f4[i] = ip[2].first + a[i];         else           f4[i] = ip[3].first + a[i];         dfs2(i, x);       }   }   int main() {     scanf( %d , &n);     for (int i = (1); i <= (n); ++i) scanf( %d , &a[i]);     for (int i = (1); i <= (n - 1); ++i) {       int x, y;       scanf( %d%d , &x, &y);       E[x].push_back(y);       E[y].push_back(x);     }     dfs1(1, 0);     f4[1] = a[1];     dfs2(1, 0);     ans = 0;     for (int i = (1); i <= (n); ++i) ans = max(ans, f1[i] + f3[i]);     printf( %I64d n , ans);   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 100005;   const int MOD = 1000000007;   int N;   int a[MAXN];   vector<int> ch[MAXN];   int dp[MAXN][2];   inline int add(int x, int y) {     x += y;     if (x >= MOD) x -= MOD;     return x;   }   inline int mul(int x, int y) { return (long long)x * y % MOD; }   void load() {     scanf( %d , &N);     for (int i = 1; i < N; i++) {       int x;       scanf( %d , &x);       ch[x].push_back(i);     }     for (int i = 0; i < N; i++) scanf( %d , a + i);   }   int dfs(int x) {     vector<int> tmp;     for (int i = 0; i < ch[x].size(); i++) tmp.push_back(dfs(ch[x][i]));     int prod = 1, sz = tmp.size();     for (int i = 0; i < sz; i++) prod = mul(prod, tmp[i]);     if (a[x])       dp[x][1] = prod;     else {       dp[x][0] = prod;       vector<int> suff(sz + 1);       suff[sz] = 1;       for (int i = sz - 1; i >= 0; i--) suff[i] = mul(suff[i + 1], tmp[i]);       prod = 1;       for (int i = 0; i < sz; i++) {         dp[x][1] = add(dp[x][1], mul(mul(prod, suff[i + 1]), dp[ch[x][i]][1]));         prod = mul(prod, tmp[i]);       }     }     return add(dp[x][0], dp[x][1]);   }   int solve() {     dfs(0);     return dp[0][1];   }   int main() {     load();     printf( %d n , solve());     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     ;     int t;     cin >> t;     while (t--) {       int n, m;       cin >> n >> m;       string a;       cin >> a;       int arr[n + 5];       set<int> st;       int mark[n + 5];       memset(mark, 0, sizeof mark);       for (int i = 0; i < m; i++) {         int x;         cin >> x;         mark[0]++;         mark[x]--;       }       mark[0]++;       for (int i = 1; i <= n; i++) {         mark[i] += mark[i - 1];       }       int ans[28];       memset(ans, 0, sizeof ans);       for (int i = 0; i < n; i++) {         int x = a[i] -  a ;         ans[x] += mark[i];       }       for (int i = 0; i < 26; i++) {         cout << ans[i] <<    ;       }       cout << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long n, m;     cin >> n >> m;     vector<int> v;     vector<bool> b;     vector<int> u;     vector<int> s;     vector<int> t(m, 0);     for (int i = 0; i < n + m; i++) {       long long x;       cin >> x;       v.push_back(x);     }     for (int i = 0; i < n + m; i++) {       long long x;       cin >> x;       b.push_back(x);     }     for (int i = 0; i < n + m; i++) {       if (b[i])         s.push_back(v[i]);       else         u.push_back(v[i]);     }     for (int i = 0; i < u.size(); i++) {       long long x, y;       y = (upper_bound(s.begin(), s.end(), u[i]) - s.begin());       if (y == 0)         t[0]++;       else if (y == m)         t[m - 1]++;       else {         x = y - 1;         if (abs(s[y] - u[i]) >= abs(s[x] - u[i]))           t[x]++;         else           t[y]++;       }     }     for (int i = 0; i < m; i++) cout << t[i] <<    ;     cout << endl;   }
#include <bits/stdc++.h>   using namespace std;   int dcmp(double a, double b) {     return ((fabs(a - b) < (1e-9)) ? 0 : (a < b) ? -1 : +1);   }   double crossP(const complex<double> &v1, const complex<double> &v2) {     return (conj(v1) * v2).imag();   }   double dotP(const complex<double> &v1, const complex<double> &v2) {     return (conj(v1) * v2).real();   }   double lengthSqr(const complex<double> &p) { return dotP(p, p); }   double length(const complex<double> &p) { return hypot(p.real(), p.imag()); }   double fixAngle(double a) { return ((a > 1) ? 1 : (a < -1) ? -1 : a); }   bool same(const complex<double> &p1, const complex<double> &p2) {     return ((dcmp(p1.real(), p2.real()) == 0 && dcmp(p1.imag(), p2.imag()) == 0)                 ? 1                 : 0);   }   double getAngle_A_abc(double a, double b, double c) {     return acos(fixAngle((b * b + c * c - a * a) / (2 * b * c)));   }   const int N = 3000 + 9;   map<int, vector<int> > v;   multiset<int> q;   long long calc(int mx, int n, int d) {     q.clear();     long long cost = 0;     for (const auto &a : v) {       const vector<int> &x = a.second;       int s = ((int)((x).size()));       int i = 0;       while (s > mx) d++, cost += x[i], s--, i++;       while (i < ((int)((x).size())) && d <= mx) q.emplace(x[i++]);     }     auto it = q.begin();     while (d <= mx) d++, cost += *it++;     return cost;   }   int main() {     int t, n;     scanf( %d %d , &t, &n);     long long d = 0;     for (__typeof(t) i = 0; i < t; ++i) {       int p, c;       scanf( %d %d , &p, &c);       --p;       if (p)         v[p].emplace_back(c);       else         d++;     }     int max_v = 0;     for (auto &a : v)       max_v = max(max_v, ((int)((a.second).size()))),       sort(a.second.begin(), a.second.end());     long long ans = (~(1LL << 63));     for (__typeof(max_v + 1) i = 0; i < max_v + 1; ++i)       ans = min(ans, calc(i, n, d));     printf( %I64d , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   map<int, int> xMap;   map<int, int> yMap;   vector<pair<int, int> > row[200005], col[200005];   int x[200005], y[200005], tmr[200005], parent[200005];   int findrep(int u) {     if (parent[u] != u) parent[u] = findrep(parent[u]);     return parent[u];   }   void Union(int x, int y) {     int px = findrep(x);     int py = findrep(y);     if (px != py) {       parent[px] = py;     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     int t, n, m, i, j, k;     cin >> t;     while (t--) {       xMap.clear();       yMap.clear();       cin >> n >> k;       for (i = 0; i <= n; i++) {         row[i].clear();         col[i].clear();       }       int id1 = 0, id2 = 0;       for (i = 0; i < n; i++) {         cin >> x[i] >> y[i] >> tmr[i];         if (!xMap[x[i]]) {           id1++;           xMap[x[i]] = id1;         }         if (!yMap[y[i]]) {           id2++;           yMap[y[i]] = id2;         }         row[yMap[y[i]]].push_back({x[i], i});         col[xMap[x[i]]].push_back({y[i], i});       }       for (i = 1; i <= id1; i++) sort(col[i].begin(), col[i].end());       for (i = 1; i <= id2; i++) sort(row[i].begin(), row[i].end());       for (i = 0; i < n; i++) parent[i] = i;       for (i = 1; i <= id1; i++) {         int sz = col[i].size();         for (j = 1; j < sz; j++) {           if (col[i][j].first - col[i][j - 1].first <= k) {             Union(col[i][j].second, col[i][j - 1].second);           }         }       }       for (i = 1; i <= id2; i++) {         int sz = row[i].size();         for (j = 1; j < sz; j++) {           if (row[i][j].first - row[i][j - 1].first <= k) {             Union(row[i][j].second, row[i][j - 1].second);           }         }       }       for (i = 0; i < n; i++) {         j = findrep(i);         tmr[j] = min(tmr[j], tmr[i]);       }       vector<int> tt;       for (i = 0; i < n; i++) {         if (findrep(i) == i) tt.push_back(tmr[i]);       }       sort(tt.begin(), tt.end());       int ans = -1;       int sz = tt.size();       for (i = sz - 1; i >= 0; i--) {         if (tt[i] <= ans) break;         ans++;       }       cout << ans << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int i, j;     int n;     cin >> n;     long long int a[n + 1];     map<long long, long long> m;     for (i = 1; i <= n; i++) {       cin >> a[i];       m[a[i]]++;     }     long long ans = 0;     multiset<long long> s;     for (auto it = m.begin(); it != m.end(); it++) {       s.insert(it->second);       ans = max(ans, it->second);     }     vector<long long int> v1;     long long ans2 = 0, ans1 = 0;     for (i = 1; i <= ans; i++) {       v1.clear();       long long p = i;       ans1 = 0;       while (1) {         auto it = s.lower_bound(p);         if (it == s.end()) break;         v1.push_back(*it);         s.erase(s.find(*it));         ans1 += p;         p = p * 2;       }       ans2 = max(ans2, ans1);       for (j = v1.size() - 1; j >= 0; j--) {         s.insert(v1[j]);       }     }     cout << ans2 << endl;   }
#include <bits/stdc++.h>   #pragma GCC optimization( unroll-loops )   #pragma GCC optimize( Ofast )   #pragma GCC target( sse,sse2,sse3,ssse3,sse4 )   using namespace std;   const int BASE = 1000000;   char what[1 << 20];   pair<int, int> nxt[10][1 << 20];   inline long long Calc(long long x) {     long long suff = x / BASE, pref = x % BASE;     long long ans = suff;     while (suff > 0) {       ans += nxt[what[suff]][pref].first;       pref = nxt[what[suff]][pref].second;       pref += BASE - max(what[suff], what[pref]);       --suff;     }     return ans + nxt[0][pref].first;   }   int main() {     for (int i = 1; i <= BASE; ++i) {       int val = 0;       for (int x = i; x > 0; x /= 10) {         val = max(val, x % 10);       }       what[i] = val;       for (int d = 0; d < 10; ++d) {         if (i >= max(d, val)) {           nxt[d][i] = make_pair(nxt[d][i - max(d, val)].first + 1,                                 nxt[d][i - max(d, val)].second);         } else {           nxt[d][i] = make_pair(0, i);         }       }     }     long long n;     cin >> n;     cout << Calc(n) <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 200, mo = 1000000000 + 7;   int n, b, k, x, s[10];   long long d[maxn];   struct node {     long long s[maxn][maxn];     void init() { memset(s, 0, sizeof(s)); }     void give(node zjz) {       for (int i = 0; i < x; i++)         for (int j = 0; j < x; j++) s[i][j] = zjz.s[i][j];     }     void work(node zjz) {       node zkj;       zkj.init();       for (int i = 0; i < x; i++)         for (int j = 0; j < x; j++)           for (int t = 0; t < x; t++) {             zkj.s[i][j] += s[i][t] * zjz.s[t][j];             zkj.s[i][j] %= mo;           }       this->give(zkj);     }   };   node a, aa;   void ksm(int m) {     if (m == 0) {       for (int i = 0; i < x; i++)         for (int j = 0; j < x; j++)           if (i == j)             aa.s[i][j] = 1;           else             aa.s[i][j] = 0;       return;     }     if (m == 1) {       aa.give(a);       return;     }     ksm(m / 2);     aa.work(aa);     if (m % 2) aa.work(a);   }   int main() {     cin >> n >> b >> k >> x;     for (int i = 1; i <= n; i++) {       int t;       scanf( %d , &t);       s[t]++;     }     a.init();     for (int j = 0; j < x; j++)       for (int jj = 0; jj < 10; jj++) {         int j0 = (j * 10 + jj) % x;         a.s[j0][j] += s[jj];         a.s[j0][j] %= mo;       }     ksm(b - 1);     for (int i = 0; i < 10; i++) d[i % x] += s[i];     long long ans = 0;     for (int i = 0; i < x; i++) {       ans += aa.s[k][i] * d[i];       ans %= mo;     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     long long int n, t, z = 0;     cin >> n >> t;     if (n == 1 && t == 10)       cout << -1 << endl;     else if (t == 10) {       for (int i = 0; i < n - 1; i++) {         cout << 1;       }       cout << 0 << endl;     } else {       for (int i = 0; i < n; i++) {         cout << t;       }     }     return 0;   }