#include <bits/stdc++.h> n using namespace std; n using ll = long long; n using ld = long double; n template <class S, class T> n ostream &operator<<(ostream &os, const pair<S, T> v) { n   os <<  (   << v.first <<  ,   << v.second <<  ) ; n   return os; n } n template <class T> n ostream &operator<<(ostream &os, const vector<T> &v) { n   for (int i = 0; i < v.size(); i++) { n     if (i > 0) { n       os <<    ; n     } n     os << v[i]; n   } n   return os; n } n template <class T> n ostream &operator<<(ostream &os, const vector<vector<T>> &v) { n   for (int i = 0; i < v.size(); i++) { n     if (i > 0) { n       os << endl; n     } n     os << v[i]; n   } n   return os; n } n template <class T> n ostream &operator<<(ostream &os, const vector<set<T>> &v) { n   for (int i = 0; i < v.size(); i++) { n     if (i > 0) { n       os << endl; n     } n     os << v[i]; n   } n   return os; n } n template <class T> n ostream &operator<<(ostream &os, const set<T> &v) { n   int i = 0; n   for (auto it : v) { n     if (i > 0) { n       os <<    ; n     } n     os << it; n     i++; n   } n   return os; n } n using Graph = vector<vector<int>>; n const ll MAX_S = 2e5; n vector<ll> check(vector<ll> &x) { n   vector<ll> anss(x.size()); n   for (int i = 0; i < int(x.size()) - 1; ++i) { n     anss[i + 1] = x[i + 1] - x[i]; n   } n   anss[0] = x[0]; n   return anss; n } n using Value = ll; n const Value ini = ll(1e18); n Value connect(Value al, const Value ar) { return min(al, ar); } n Value dat[1100001]; n struct segtree { n   int N; n   segtree() {} n   segtree(int n) { n     N = 1; n     while (N < n) N *= 2; n     for (int x = 0; x < N; ++x) { n       dat[x + N - 1] = ini; n     } n     for (int x = N - 2; x >= 0; --x) { n       dat[x] = connect(dat[x * 2 + 1], dat[x * 2 + 2]); n     } n   } n   void update(int k, const Value &a) { n     k += N - 1; n     dat[k] = a; n     while (k > 0) { n       k = (k - 1) >> 1; n       dat[k] = connect(dat[k * 2 + 1], dat[k * 2 + 2]); n     } n   } n   Value query(int a, int b) { return query(a, b, 0, 0, N); } n   Value query(int a, int b, int k, int l, int r) { n     if (r <= a || b <= l) return ini; n     if (a <= l && r <= b) return dat[k]; n     const int m = (l + r) / 2; n     return connect(query(a, b, k * 2 + 1, l, m), query(a, b, k * 2 + 2, m, r)); n   } n }; n vector<int> nums(int(3e5)); n ll to_n(string st) { n   ll num = 0; n   for (auto c : st) { n     num *= 2; n     num += c -  0 ; n   } n   return num; n } n string to_s(int sz, ll num) { n   string st; n   for (int i = 0; i < sz; ++i) { n     st.push_back( 0  + (num % 2)); n     num /= 2; n   } n   reverse(st.begin(), st.end()); n   return st; n } n const int mod = 998244353; n struct Mod { n  public: n   int num; n   Mod() : Mod(0) { ; } n   Mod(long long int n) : num((n % mod + mod) % mod) {} n   Mod(int n) : Mod(static_cast<long long int>(n)) { ; } n   operator int() { return num; } n }; n Mod operator+(const Mod a, const Mod b) { return Mod((a.num + b.num) % mod); } n Mod operator+(const long long int a, const Mod b) { return Mod(a) + b; } n Mod operator+(const Mod a, const long long int b) { return b + a; } n Mod operator++(Mod &a) { return a + Mod(1); } n Mod operator-(const Mod a, const Mod b) { n   return Mod((mod + a.num - b.num) % mod); n } n Mod operator-(const long long int a, const Mod b) { return Mod(a) - b; } n Mod operator--(Mod &a) { return a - Mod(1); } n Mod operator*(const Mod a, const Mod b) { n   return Mod(((long long)a.num * b.num) % mod); n } n Mod operator*(const long long int a, const Mod b) { return Mod(a) * b; } n Mod operator*(const Mod a, const long long int b) { return Mod(b) * a; } n Mod operator*(const Mod a, const int b) { return Mod(b) * a; } n Mod operator+=(Mod &a, const Mod b) { return a = a + b; } n Mod operator+=(long long int &a, const Mod b) { return a = a + b; } n Mod operator-=(Mod &a, const Mod b) { return a = a - b; } n Mod operator-=(long long int &a, const Mod b) { return a = a - b; } n Mod operator*=(Mod &a, const Mod b) { return a = a * b; } n Mod operator*=(long long int &a, const Mod b) { return a = a * b; } n Mod operator*=(Mod &a, const long long int &b) { return a = a * b; } n Mod operator^(const Mod a, const int n) { n   if (n == 0) return Mod(1); n   Mod res = (a * a) ^ (n / 2); n   if (n % 2) res = res * a; n   return res; n } n Mod mod_pow(const Mod a, const long long n) { n   if (n == 0) return Mod(1); n   Mod res = mod_pow((a * a), (n / 2)); n   if (n % 2) res = res * a; n   return res; n } n Mod inv(const Mod a) { return a ^ (mod - 2); } n Mod operator/(const Mod a, const Mod b) { n   assert(b.num != 0); n   return a * inv(b); n } n Mod operator/(const long long int a, const Mod b) { return Mod(a) / b; } n Mod operator/=(Mod &a, const Mod b) { return a = a / b; } n Mod fact[1024000], factinv[1024000]; n void init(const int amax = 1024000) { n   fact[0] = Mod(1); n   factinv[0] = 1; n   for (int i = 0; i < amax - 1; ++i) { n     fact[i + 1] = fact[i] * Mod(i + 1); n     factinv[i + 1] = factinv[i] / Mod(i + 1); n   } n } n Mod comb(const int a, const int b) { n   return fact[a] * factinv[b] * factinv[a - b]; n } n int main() { n   int N; n   cin >> N; n   vector<Mod> pers(int(1e6)); n   vector<int> cnts(int(1e6)); n   for (int i = 0; i < N; ++i) { n     int k; n     scanf( %d , &k); n     for (int j = 0; j < k; ++j) { n       int a; n       scanf( %d , &a); n       a--; n       cnts[a]++; n       pers[a] += Mod(1) / Mod(N) / Mod(k); n     } n   } n   Mod answer = Mod(0); n   for (int i = 0; i < int(1e6); ++i) { n     answer += pers[i] * Mod(cnts[i]) / Mod(N); n   } n   cout << answer.num << endl; n   return 0; n } n


#include <bits/stdc++.h> n using namespace std; n template <typename T> n void print(T v) { n   cout << v <<   n ; n } n template <typename T> n void print(vector<T> a) { n   for (int i = 0; i < a.size(); i++) { n     cout << a[i] <<    ; n   } n   cout <<   n ; n } n long long help(long long a, long long b, long long x, long long y, n                long long n) { n   long long da = min(n, a - x); n   a -= da; n   n -= da; n   long long db = min(n, b - y); n   b -= db; n   return a * b; n } n void solve() { n   long long a, b, x, y, n; n   cin >> a >> b >> x >> y >> n; n   print(min(help(a, b, x, y, n), help(b, a, y, x, n))); n } n int main() { n   ios_base::sync_with_stdio(0); n   cin.tie(0); n   cout.tie(0); n   int t; n   cin >> t; n   while (t--) solve(); n   return 0; n } n


#include <bits/stdc++.h> n using namespace std; n int n, m; n char ch[201][201]; n int main() { n   cin >> m >> n; n   n *= 2; n   m *= 2; n   for (int i = 1; i <= n; i += 2) n     for (int j = 1; j <= m; j += 2) { n       cin >> ch[i][j]; n       ch[i + 1][j] = ch[i][j + 1] = ch[i + 1][j + 1] = ch[i][j]; n     } n   for (int j = 1; j <= m; j++) { n     for (int i = 1; i <= n; i++) cout << ch[i][j]; n     cout << endl; n   } n   return 0; n } n


#include <bits/stdc++.h> n using namespace std; n int main() { n   string s; n   int n; n   int arr[26]; n   int arr2[26]; n   cin >> s; n   int value; n   int sum = 0; n   int add; n   int length = s.size(); n   cin >> n; n   for (int i = 0; i < 26; i++) { n     cin >> arr[i]; n     arr2[i] = arr[i]; n   } n   sort(arr2, arr2 + 26); n   int largest = arr2[25]; n   for (int i = 0; i < length; i++) { n     value = s[i]; n     int x = abs(97 - value); n     sum = sum + ((i + 1) * arr[x]); n   } n   int last = length + n; n   int sum1 = 0; n   for (int i = length + 1; i <= last; i++) { n     sum1 = sum1 + (i * largest); n   } n   cout << sum1 + sum; n } n


#include <bits/stdc++.h> n using namespace std; n template <typename T, typename U> n std::istream& operator>>(std::istream& i, pair<T, U>& p) { n   i >> p.first >> p.second; n   return i; n } n template <typename T> n std::istream& operator>>(std::istream& i, vector<T>& t) { n   for (auto& v : t) { n     i >> v; n   } n   return i; n } n template <typename T, typename U> n std::ostream& operator<<(std::ostream& o, const pair<T, U>& p) { n   o << p.first <<     << p.second; n   return o; n } n template <typename T> n std::ostream& operator<<(std::ostream& o, const vector<T>& t) { n   if (t.empty()) o <<   n ; n   for (size_t i = 0; i < t.size(); ++i) { n     o << t[i] <<    n [i == t.size() - 1]; n   } n   return o; n } n template <typename T> n using minheap = priority_queue<T, vector<T>, greater<T>>; n template <typename T> n using maxheap = priority_queue<T, vector<T>, less<T>>; n template <typename T> n bool in(T a, T b, T c) { n   return a <= b && b < c; n } n unsigned int logceil(int first) { n   return first ? 8 * sizeof(int) - __builtin_clz(first) : 0; n } n namespace std { n template <typename T, typename U> n struct hash<pair<T, U>> { n   hash<T> t; n   hash<U> u; n   size_t operator()(const pair<T, U>& p) const { n     return t(p.first) ^ (u(p.second) << 7); n   } n }; n }  // namespace std n template <typename T, typename F> n T bsh(T l, T h, const F& f) { n   T r = -1, m; n   while (l <= h) { n     m = (l + h) / 2; n     if (f(m)) { n       l = m + 1; n       r = m; n     } else { n       h = m - 1; n     } n   } n   return r; n } n template <typename F> n double bshd(double l, double h, const F& f, double p = 1e-9) { n   unsigned int r = 3 + (unsigned int)log2((h - l) / p); n   while (r--) { n     double m = (l + h) / 2; n     if (f(m)) { n       l = m; n     } else { n       h = m; n     } n   } n   return (l + h) / 2; n } n template <typename T, typename F> n T bsl(T l, T h, const F& f) { n   T r = -1, m; n   while (l <= h) { n     m = (l + h) / 2; n     if (f(m)) { n       h = m - 1; n       r = m; n     } else { n       l = m + 1; n     } n   } n   return r; n } n template <typename F> n double bsld(double l, double h, const F& f, double p = 1e-9) { n   unsigned int r = 3 + (unsigned int)log2((h - l) / p); n   while (r--) { n     double m = (l + h) / 2; n     if (f(m)) { n       h = m; n     } else { n       l = m; n     } n   } n   return (l + h) / 2; n } n template <typename T> n T gcd(T a, T b) { n   if (a < b) swap(a, b); n   return b ? gcd(b, a % b) : a; n } n template <typename T> n class vector2 : public vector<vector<T>> { n  public: n   vector2() {} n   vector2(size_t a, size_t b, T t = T()) n       : vector<vector<T>>(a, vector<T>(b, t)) {} n }; n template <typename T> n class vector3 : public vector<vector2<T>> { n  public: n   vector3() {} n   vector3(size_t a, size_t b, size_t c, T t = T()) n       : vector<vector2<T>>(a, vector2<T>(b, c, t)) {} n }; n template <typename T> n class vector4 : public vector<vector3<T>> { n  public: n   vector4() {} n   vector4(size_t a, size_t b, size_t c, size_t d, T t = T()) n       : vector<vector3<T>>(a, vector3<T>(b, c, d, t)) {} n }; n template <typename T> n class vector5 : public vector<vector4<T>> { n  public: n   vector5() {} n   vector5(size_t a, size_t b, size_t c, size_t d, size_t e, T t = T()) n       : vector<vector4<T>>(a, vector4<T>(b, c, d, e, t)) {} n }; n class TaskD { n  public: n   vector<int> P; n   void fact(int a, vector<int>& f) { n     while (a != 1) { n       int b = P[a], c = 0; n       while (P[a] == b) { n         c++; n         a /= b; n       } n       f.push_back(c + 1); n     } n     sort(f.begin(), f.end()); n     reverse(f.begin(), f.end()); n     while (f.size() < Prm.size()) f.push_back(1); n   } n   vector<vector<int>> HH; n   vector<int> Used, CNT; n   map<vector<int>, int> J; n   vector<int> X; n   void genAll(int p, int m, int c, int d) { n     if (p == Prm.size()) { n       HH.push_back(X); n       CNT.push_back(d); n       int second = J.size(); n       if (c <= 1e6) Used.push_back(second); n       J[X] = second; n     } else { n       X[p] = 1; n       genAll(p + 1, 1, c, d * X[p]); n       while (true) { n         X[p]++; n         c *= Prm[p]; n         if (c > 55050240) return; n         if (X[p] > m) return; n         genAll(p + 1, X[p], c, d * X[p]); n       } n     } n   } n   vector<int> Prm; n   void solve(istream& cin, ostream& cout) { n     Prm = {2, 3, 5, 7, 11, 13, 17}; n     P.assign(1e6 + 5, 0); n     for (int i = 2; i < 1e6 + 3; ++i) { n       if (P[i] == 0) { n         for (int j = i; j < 1e6 + 3; j += i) P[j] = i; n       } n     } n     map<vector<int>, int> IDX{ n         {{1, 1, 1, 1, 1, 1, 1}, 0},    {{2, 1, 1, 1, 1, 1, 1}, 1}, n         {{2, 2, 1, 1, 1, 1, 1}, 2},    {{2, 2, 2, 1, 1, 1, 1}, 3}, n         {{2, 2, 2, 2, 1, 1, 1}, 4},    {{2, 2, 2, 2, 2, 1, 1}, 5}, n         {{2, 2, 2, 2, 2, 2, 1}, 6},    {{2, 2, 2, 2, 2, 2, 2}, 7}, n         {{3, 1, 1, 1, 1, 1, 1}, 8},    {{3, 2, 1, 1, 1, 1, 1}, 9}, n         {{3, 2, 2, 1, 1, 1, 1}, 10},   {{3, 2, 2, 2, 1, 1, 1}, 11}, n         {{3, 2, 2, 2, 2, 1, 1}, 12},   {{3, 2, 2, 2, 2, 2, 1}, 13}, n         {{3, 3, 1, 1, 1, 1, 1}, 14},   {{3, 3, 2, 1, 1, 1, 1}, 15}, n         {{3, 3, 2, 2, 1, 1, 1}, 16},   {{3, 3, 2, 2, 2, 1, 1}, 17}, n         {{3, 3, 2, 2, 2, 2, 1}, 18},   {{3, 3, 3, 1, 1, 1, 1}, 19}, n         {{3, 3, 3, 2, 1, 1, 1}, 20},   {{3, 3, 3, 2, 2, 1, 1}, 21}, n         {{3, 3, 3, 2, 2, 2, 1}, 22},   {{3, 3, 3, 3, 1, 1, 1}, 23}, n         {{3, 3, 3, 3, 2, 1, 1}, 24},   {{4, 1, 1, 1, 1, 1, 1}, 25}, n         {{4, 2, 1, 1, 1, 1, 1}, 26},   {{4, 2, 2, 1, 1, 1, 1}, 27}, n         {{4, 2, 2, 2, 1, 1, 1}, 28},   {{4, 2, 2, 2, 2, 1, 1}, 29}, n         {{4, 2, 2, 2, 2, 2, 1}, 30},   {{4, 3, 1, 1, 1, 1, 1}, 31}, n         {{4, 3, 2, 1, 1, 1, 1}, 32},   {{4, 3, 2, 2, 1, 1, 1}, 33}, n         {{4, 3, 2, 2, 2, 1, 1}, 34},   {{4, 3, 2, 2, 2, 2, 1}, 35}, n         {{4, 3, 3, 1, 1, 1, 1}, 36},   {{4, 3, 3, 2, 1, 1, 1}, 37}, n         {{4, 3, 3, 2, 2, 1, 1}, 38},   {{4, 3, 3, 3, 1, 1, 1}, 39}, n         {{4, 3, 3, 3, 2, 1, 1}, 40},   {{4, 4, 1, 1, 1, 1, 1}, 41}, n         {{4, 4, 2, 1, 1, 1, 1}, 42},   {{4, 4, 2, 2, 1, 1, 1}, 43}, n         {{4, 4, 2, 2, 2, 1, 1}, 44},   {{4, 4, 3, 1, 1, 1, 1}, 45}, n         {{4, 4, 3, 2, 1, 1, 1}, 46},   {{4, 4, 3, 2, 2, 1, 1}, 47}, n         {{4, 4, 3, 3, 1, 1, 1}, 48},   {{4, 4, 4, 1, 1, 1, 1}, 49}, n         {{4, 4, 4, 2, 1, 1, 1}, 50},   {{5, 1, 1, 1, 1, 1, 1}, 51}, n         {{5, 2, 1, 1, 1, 1, 1}, 52},   {{5, 2, 2, 1, 1, 1, 1}, 53}, n         {{5, 2, 2, 2, 1, 1, 1}, 54},   {{5, 2, 2, 2, 2, 1, 1}, 55}, n         {{5, 2, 2, 2, 2, 2, 1}, 56},   {{5, 3, 1, 1, 1, 1, 1}, 57}, n         {{5, 3, 2, 1, 1, 1, 1}, 58},   {{5, 3, 2, 2, 1, 1, 1}, 59}, n         {{5, 3, 2, 2, 2, 1, 1}, 60},   {{5, 3, 2, 2, 2, 2, 1}, 61}, n         {{5, 3, 3, 1, 1, 1, 1}, 62},   {{5, 3, 3, 2, 1, 1, 1}, 63}, n         {{5, 3, 3, 2, 2, 1, 1}, 64},   {{5, 3, 3, 3, 1, 1, 1}, 65}, n         {{5, 4, 1, 1, 1, 1, 1}, 66},   {{5, 4, 2, 1, 1, 1, 1}, 67}, n         {{5, 4, 2, 2, 1, 1, 1}, 68},   {{5, 4, 2, 2, 2, 1, 1}, 69}, n         {{5, 4, 3, 1, 1, 1, 1}, 70},   {{5, 4, 3, 2, 1, 1, 1}, 71}, n         {{5, 4, 3, 2, 2, 1, 1}, 72},   {{5, 4, 3, 3, 1, 1, 1}, 73}, n         {{5, 4, 4, 1, 1, 1, 1}, 74},   {{5, 4, 4, 2, 1, 1, 1}, 75}, n         {{5, 5, 1, 1, 1, 1, 1}, 76},   {{5, 5, 2, 1, 1, 1, 1}, 77}, n         {{5, 5, 2, 2, 1, 1, 1}, 78},   {{5, 5, 2, 2, 2, 1, 1}, 79}, n         {{5, 5, 3, 1, 1, 1, 1}, 80},   {{5, 5, 3, 2, 1, 1, 1}, 81}, n         {{5, 5, 4, 1, 1, 1, 1}, 82},   {{5, 5, 5, 1, 1, 1, 1}, 83}, n         {{6, 1, 1, 1, 1, 1, 1}, 84},   {{6, 2, 1, 1, 1, 1, 1}, 85}, n         {{6, 2, 2, 1, 1, 1, 1}, 86},   {{6, 2, 2, 2, 1, 1, 1}, 87}, n         {{6, 2, 2, 2, 2, 1, 1}, 88},   {{6, 2, 2, 2, 2, 2, 1}, 89}, n         {{6, 3, 1, 1, 1, 1, 1}, 90},   {{6, 3, 2, 1, 1, 1, 1}, 91}, n         {{6, 3, 2, 2, 1, 1, 1}, 92},   {{6, 3, 2, 2, 2, 1, 1}, 93}, n         {{6, 3, 3, 1, 1, 1, 1}, 94},   {{6, 3, 3, 2, 1, 1, 1}, 95}, n         {{6, 3, 3, 2, 2, 1, 1}, 96},   {{6, 3, 3, 3, 1, 1, 1}, 97}, n         {{6, 4, 1, 1, 1, 1, 1}, 98},   {{6, 4, 2, 1, 1, 1, 1}, 99}, n         {{6, 4, 2, 2, 1, 1, 1}, 100},  {{6, 4, 2, 2, 2, 1, 1}, 101}, n         {{6, 4, 3, 1, 1, 1, 1}, 102},  {{6, 4, 3, 2, 1, 1, 1}, 103}, n         {{6, 4, 4, 1, 1, 1, 1}, 104},  {{6, 4, 4, 2, 1, 1, 1}, 105}, n         {{6, 5, 1, 1, 1, 1, 1}, 106},  {{6, 5, 2, 1, 1, 1, 1}, 107}, n         {{6, 5, 2, 2, 1, 1, 1}, 108},  {{6, 5, 2, 2, 2, 1, 1}, 109}, n         {{6, 5, 3, 1, 1, 1, 1}, 110},  {{6, 5, 3, 2, 1, 1, 1}, 111}, n         {{6, 5, 4, 1, 1, 1, 1}, 112},  {{6, 6, 1, 1, 1, 1, 1}, 113}, n         {{6, 6, 2, 1, 1, 1, 1}, 114},  {{6, 6, 2, 2, 1, 1, 1}, 115}, n         {{6, 6, 3, 1, 1, 1, 1}, 116},  {{6, 6, 4, 1, 1, 1, 1}, 117}, n         {{7, 1, 1, 1, 1, 1, 1}, 118},  {{7, 2, 1, 1, 1, 1, 1}, 119}, n         {{7, 2, 2, 1, 1, 1, 1}, 120},  {{7, 2, 2, 2, 1, 1, 1}, 121}, n         {{7, 2, 2, 2, 2, 1, 1}, 122},  {{7, 2, 2, 2, 2, 2, 1}, 123}, n         {{7, 3, 1, 1, 1, 1, 1}, 124},  {{7, 3, 2, 1, 1, 1, 1}, 125}, n         {{7, 3, 2, 2, 1, 1, 1}, 126},  {{7, 3, 2, 2, 2, 1, 1}, 127}, n         {{7, 3, 3, 1, 1, 1, 1}, 128},  {{7, 3, 3, 2, 1, 1, 1}, 129}, n         {{7, 3, 3, 3, 1, 1, 1}, 130},  {{7, 4, 1, 1, 1, 1, 1}, 131}, n         {{7, 4, 2, 1, 1, 1, 1}, 132},  {{7, 4, 2, 2, 1, 1, 1}, 133}, n         {{7, 4, 2, 2, 2, 1, 1}, 134},  {{7, 4, 3, 1, 1, 1, 1}, 135}, n         {{7, 4, 3, 2, 1, 1, 1}, 136},  {{7, 4, 4, 1, 1, 1, 1}, 137}, n         {{7, 5, 1, 1, 1, 1, 1}, 138},  {{7, 5, 2, 1, 1, 1, 1}, 139}, n         {{7, 5, 2, 2, 1, 1, 1}, 140},  {{7, 5, 3, 1, 1, 1, 1}, 141}, n         {{7, 5, 3, 2, 1, 1, 1}, 142},  {{7, 5, 4, 1, 1, 1, 1}, 143}, n         {{7, 6, 1, 1, 1, 1, 1}, 144},  {{7, 6, 2, 1, 1, 1, 1}, 145}, n         {{7, 6, 2, 2, 1, 1, 1}, 146},  {{7, 6, 3, 1, 1, 1, 1}, 147}, n         {{7, 7, 1, 1, 1, 1, 1}, 148},  {{7, 7, 2, 1, 1, 1, 1}, 149}, n         {{8, 1, 1, 1, 1, 1, 1}, 150},  {{8, 2, 1, 1, 1, 1, 1}, 151}, n         {{8, 2, 2, 1, 1, 1, 1}, 152},  {{8, 2, 2, 2, 1, 1, 1}, 153}, n         {{8, 2, 2, 2, 2, 1, 1}, 154},  {{8, 3, 1, 1, 1, 1, 1}, 155}, n         {{8, 3, 2, 1, 1, 1, 1}, 156},  {{8, 3, 2, 2, 1, 1, 1}, 157}, n         {{8, 3, 2, 2, 2, 1, 1}, 158},  {{8, 3, 3, 1, 1, 1, 1}, 159}, n         {{8, 3, 3, 2, 1, 1, 1}, 160},  {{8, 4, 1, 1, 1, 1, 1}, 161}, n         {{8, 4, 2, 1, 1, 1, 1}, 162},  {{8, 4, 2, 2, 1, 1, 1}, 163}, n         {{8, 4, 3, 1, 1, 1, 1}, 164},  {{8, 4, 3, 2, 1, 1, 1}, 165}, n         {{8, 4, 4, 1, 1, 1, 1}, 166},  {{8, 5, 1, 1, 1, 1, 1}, 167}, n         {{8, 5, 2, 1, 1, 1, 1}, 168},  {{8, 5, 2, 2, 1, 1, 1}, 169}, n         {{8, 5, 3, 1, 1, 1, 1}, 170},  {{8, 6, 1, 1, 1, 1, 1}, 171}, n         {{8, 6, 2, 1, 1, 1, 1}, 172},  {{8, 6, 3, 1, 1, 1, 1}, 173}, n         {{8, 7, 1, 1, 1, 1, 1}, 174},  {{8, 7, 2, 1, 1, 1, 1}, 175}, n         {{8, 8, 1, 1, 1, 1, 1}, 176},  {{9, 1, 1, 1, 1, 1, 1}, 177}, n         {{9, 2, 1, 1, 1, 1, 1}, 178},  {{9, 2, 2, 1, 1, 1, 1}, 179}, n         {{9, 2, 2, 2, 1, 1, 1}, 180},  {{9, 2, 2, 2, 2, 1, 1}, 181}, n         {{9, 3, 1, 1, 1, 1, 1}, 182},  {{9, 3, 2, 1, 1, 1, 1}, 183}, n         {{9, 3, 2, 2, 1, 1, 1}, 184},  {{9, 3, 2, 2, 2, 1, 1}, 185}, n         {{9, 3, 3, 1, 1, 1, 1}, 186},  {{9, 3, 3, 2, 1, 1, 1}, 187}, n         {{9, 4, 1, 1, 1, 1, 1}, 188},  {{9, 4, 2, 1, 1, 1, 1}, 189}, n         {{9, 4, 2, 2, 1, 1, 1}, 190},  {{9, 4, 3, 1, 1, 1, 1}, 191}, n         {{9, 4, 4, 1, 1, 1, 1}, 192},  {{9, 5, 1, 1, 1, 1, 1}, 193}, n         {{9, 5, 2, 1, 1, 1, 1}, 194},  {{9, 5, 2, 2, 1, 1, 1}, 195}, n         {{9, 5, 3, 1, 1, 1, 1}, 196},  {{9, 6, 1, 1, 1, 1, 1}, 197}, n         {{9, 6, 2, 1, 1, 1, 1}, 198},  {{9, 7, 1, 1, 1, 1, 1}, 199}, n         {{9, 7, 2, 1, 1, 1, 1}, 200},  {{9, 8, 1, 1, 1, 1, 1}, 201}, n         {{10, 1, 1, 1, 1, 1, 1}, 202}, {{10, 2, 1, 1, 1, 1, 1}, 203}, n         {{10, 2, 2, 1, 1, 1, 1}, 204}, {{10, 2, 2, 2, 1, 1, 1}, 205}, n         {{10, 2, 2, 2, 2, 1, 1}, 206}, {{10, 3, 1, 1, 1, 1, 1}, 207}, n         {{10, 3, 2, 1, 1, 1, 1}, 208}, {{10, 3, 2, 2, 1, 1, 1}, 209}, n         {{10, 3, 3, 1, 1, 1, 1}, 210}, {{10, 3, 3, 2, 1, 1, 1}, 211}, n         {{10, 4, 1, 1, 1, 1, 1}, 212}, {{10, 4, 2, 1, 1, 1, 1}, 213}, n         {{10, 4, 2, 2, 1, 1, 1}, 214}, {{10, 4, 3, 1, 1, 1, 1}, 215}, n         {{10, 5, 1, 1, 1, 1, 1}, 216}, {{10, 5, 2, 1, 1, 1, 1}, 217}, n         {{10, 6, 1, 1, 1, 1, 1}, 218}, {{10, 6, 2, 1, 1, 1, 1}, 219}, n         {{10, 7, 1, 1, 1, 1, 1}, 220}, {{11, 1, 1, 1, 1, 1, 1}, 221}, n         {{11, 2, 1, 1, 1, 1, 1}, 222}, {{11, 2, 2, 1, 1, 1, 1}, 223}, n         {{11, 2, 2, 2, 1, 1, 1}, 224}, {{11, 3, 1, 1, 1, 1, 1}, 225}, n         {{11, 3, 2, 1, 1, 1, 1}, 226}, {{11, 3, 2, 2, 1, 1, 1}, 227}, n         {{11, 3, 3, 1, 1, 1, 1}, 228}, {{11, 4, 1, 1, 1, 1, 1}, 229}, n         {{11, 4, 2, 1, 1, 1, 1}, 230}, {{11, 4, 2, 2, 1, 1, 1}, 231}, n         {{11, 4, 3, 1, 1, 1, 1}, 232}, {{11, 5, 1, 1, 1, 1, 1}, 233}, n         {{11, 5, 2, 1, 1, 1, 1}, 234}, {{11, 6, 1, 1, 1, 1, 1}, 235}, n         {{11, 7, 1, 1, 1, 1, 1}, 236}, {{12, 1, 1, 1, 1, 1, 1}, 237}, n         {{12, 2, 1, 1, 1, 1, 1}, 238}, {{12, 2, 2, 1, 1, 1, 1}, 239}, n         {{12, 2, 2, 2, 1, 1, 1}, 240}, {{12, 3, 1, 1, 1, 1, 1}, 241}, n         {{12, 3, 2, 1, 1, 1, 1}, 242}, {{12, 3, 2, 2, 1, 1, 1}, 243}, n         {{12, 3, 3, 1, 1, 1, 1}, 244}, {{12, 4, 1, 1, 1, 1, 1}, 245}, n         {{12, 4, 2, 1, 1, 1, 1}, 246}, {{12, 5, 1, 1, 1, 1, 1}, 247}, n         {{12, 5, 2, 1, 1, 1, 1}, 248}, {{12, 6, 1, 1, 1, 1, 1}, 249}, n         {{13, 1, 1, 1, 1, 1, 1}, 250}, {{13, 2, 1, 1, 1, 1, 1}, 251}, n         {{13, 2, 2, 1, 1, 1, 1}, 252}, {{13, 2, 2, 2, 1, 1, 1}, 253}, n         {{13, 3, 1, 1, 1, 1, 1}, 254}, {{13, 3, 2, 1, 1, 1, 1}, 255}, n         {{13, 3, 3, 1, 1, 1, 1}, 256}, {{13, 4, 1, 1, 1, 1, 1}, 257}, n         {{13, 4, 2, 1, 1, 1, 1}, 258}, {{13, 5, 1, 1, 1, 1, 1}, 259}, n         {{13, 6, 1, 1, 1, 1, 1}, 260}, {{14, 1, 1, 1, 1, 1, 1}, 261}, n         {{14, 2, 1, 1, 1, 1, 1}, 262}, {{14, 2, 2, 1, 1, 1, 1}, 263}, n         {{14, 2, 2, 2, 1, 1, 1}, 264}, {{14, 3, 1, 1, 1, 1, 1}, 265}, n         {{14, 3, 2, 1, 1, 1, 1}, 266}, {{14, 4, 1, 1, 1, 1, 1}, 267}, n         {{14, 5, 1, 1, 1, 1, 1}, 268}, {{15, 1, 1, 1, 1, 1, 1}, 269}, n         {{15, 2, 1, 1, 1, 1, 1}, 270}, {{15, 2, 2, 1, 1, 1, 1}, 271}, n         {{15, 3, 1, 1, 1, 1, 1}, 272}, {{15, 3, 2, 1, 1, 1, 1}, 273}, n         {{15, 4, 1, 1, 1, 1, 1}, 274}, {{16, 1, 1, 1, 1, 1, 1}, 275}, n         {{16, 2, 1, 1, 1, 1, 1}, 276}, {{16, 2, 2, 1, 1, 1, 1}, 277}, n         {{16, 3, 1, 1, 1, 1, 1}, 278}, {{16, 4, 1, 1, 1, 1, 1}, 279}, n         {{17, 1, 1, 1, 1, 1, 1}, 280}, {{17, 2, 1, 1, 1, 1, 1}, 281}, n         {{17, 2, 2, 1, 1, 1, 1}, 282}, {{17, 3, 1, 1, 1, 1, 1}, 283}, n         {{18, 1, 1, 1, 1, 1, 1}, 284}, {{18, 2, 1, 1, 1, 1, 1}, 285}, n         {{19, 1, 1, 1, 1, 1, 1}, 286}, {{19, 2, 1, 1, 1, 1, 1}, 287}, n         {{20, 1, 1, 1, 1, 1, 1}, 288}}; n     vector<string> DIST{ n          0 , n          10 , n          210 , n          3210 , n          43210 , n          543210 , n          6543210 , n          76543210 , n          211234560 , n          3211234510 , n          43211234210 , n          543211233210 , n          6543211243210 , n          76543211543210 , n          432223452112340 , n          5432223432112310 , n          65432223432112210 , n          765432225432113210 , n          8765432265432143210 , n          65433334432223211230 , n          765433335432223211210 , n          8765433365432243211210 , n          98765433765432543213210 , n          876544446543334322221120 , n          9876544476543354322321110 , n          21012345112345234564567670 , n          321012342112342234534565610 , n          4321012332112322234334545210 , n          54321012432112322233334443210 , n          654321015432114322233334443210 , n          7654321065432154322433344543210 , n          43211234210123112342345452112340 , n          543211233210122112322343432112310 , n          6543211243210132112222333432112210 , n          76543211543210432113222335432113210 , n          876543216543215432143223365432143210 , n          6543222343211221012112323432223211230 , n          76543222543211321012112225432223211210 , n          876543226543214321032112265432243211210 , n          8765433365432243211210111654333432222110 , n          98765433765432543213210217654335432232110 , n          432101233211232223433454521012311234234450 , n          5432101243211232223333444321012211232233410 , n          65432101543211432223333444321013211222233210 , n          765432106543215432243334454321043211322333210 , n          6543211243210132112222333432112210121122321120 , n          76543211543210432113222335432113210121122321110 , n          876543216543215432143223365432143210321224321210 , n          8765432265432143210321122654322432112101143222110 , n          65432101543211432223333444321013211222233210111220 , n          765432106543215432243334454321043211322333210211210 , n          3212345621234523456456767123456234564566734564566560 , n          43212345321234223453456562123451234534556234534554510 , n          543212344321233223433454532123421234234451234234434210 , n          6543212354321243223333444432123321232233421231233233210 , n          76543212654321543224333445432124321232233321221221243210 , n          876543217654326543254334465432154321432334321321221543210 , n          5432234532123421234234545322345123452344523453454452112340 , n          65432234432123321232234344322342123412334223423433432112310 , n          765432235432124321232233354322332123212233223123223432112210 , n          8765432265432154321432233654322432123212243222121225432113210 , n          98765432765432654325432437654325432143232543232123265432143210 , n          765433345432233212321232354333432234123233334234334432223211230 , n          8765433365432243212321222654333432232121243332232335432223211210 , n          98765433765432543214321327654335432232121543332213365432243211210 , n          987654447654335432232122176544454333322125444333244654333432222110 , n          5432123443212332234334545321234212342344512342344342101231123423440 , n          65432123543212432233334444321233212322334212312332332101221123223310 , n          765432126543215432243334454321243212322333212212212432101321122223210 , n          876543217654326543254334465432154321432334321321221543210432113223321  n          0 , n          7654322354321243212322333543223321232122332231232234321122101211222112  n          0 , n          8765432265432154321432233654322432123212243222121225432113210121123211  n          10 , n          9876543276543265432543243765432543214323254323212326543214321032124321  n          210 , n          9876543376543254321432132765433543223212154333221336543224321121014322  n          2110 , n          7654321265432154322433344543212432123223332122122124321013211222232101  n          11220 , n          8765432176543265432543344654321543214323343213212215432104321132233210  n          211210 , n          6543234554323443234334545432345323452344523453454453212342123423441234  n          2344340 , n          7654323465432354323433444543234432343233432342343344321233212322332123  n          12332310 , n          8765432376543265432543344654323543234323343233232235432124321232233212  n          212212210 , n          9876543287654376543654354765432654325434354324323326543215432143234321  n          3212213210 , n          8765433465432354323432333654334432343232343342343345432233212321223223  n          12322321120 , n          9876543376543265432543243765433543234323254333232336543224321232124322  n          212122321110 , n          8765432376543265432543344654323543234323343233232235432124321232233212  n          2122122101110 , n          9876543487654376543654354765434654345434354344343346543235432343234323  n          32322332122110 , n          3212345610123412345345656212345123453455623453455451234562345645663456  n          456656456756670 , n          4321234521012311234234545211234012342344512342344342123451234534552345  n          3455453456455610 , n          5432123432101221123223434321123101231233421231233233212342123423441234  n          23443423453445210 , n          6543212343210132112222333432112210121122321120122124321233212322332123  n          123323323423343210 , n          7654321254321043211322233543211321012112232111011215432124321232233212  n          2122124323322343210 , n          8765432165432154321432233654321432103212243212101216543215432143234321  n          32122154324334543210 , n          5432234532112310123123434322234112341233422342343343223451234523442345  n          345445345645562112340 , n          6543223443211221012112323432223211230122332231232234322342123412332234  n          2343342345344532112310 , n          7654322354321132101211222543222321121011232221121225432233212321223223  n          12322332342334432112210 , n          8765432265432143210321122654322432112101143222110326543224321232124322  n          212122432332235432113210 , n          7654333454322232112101212543333322231121243332232335433343223412323334  n          2343343345344543222321120 , n          8765433365432243211210111654333432222110143332221336543334322321214333  n          22323343342334543222321110 , n          9876543376543254321321021765433543223211054333221437654335432232125433  n          322133543332336543224321210 , n          9876544476543354322321110765444543333221154443332447654445433332215444  n          3332445444334465433343222110 , n          5432123432101221123223434321123101231233421231233233212342123423441234  n          23443423453445210123112323440 , n          6543212343210132112222333432112210121122321120122124321233212322332123  n          123323323423343210122112223310 , n          7654321254321043211322233543211321012112232111011215432124321232233212  n          2122124323322343210132112223210 , n          8765432165432154321432233654321432103212243212101216543215432143234321  n          32122154324334543210432132233210 , n          7654322354321132101211222543222321121011232221121225432233212321223223  n          123223323423344321122101112221120 , n          8765432265432143210321122654322432112101143222110326543224321232124322  n          2121224323322354321132102112321110 , n          7654321254321043211322233543211321012112232111011215432124321232233212  n          21221243233223432101321122232101110 , n          8765432165432154321432233654321432103212243212101216543215432143234321  n          321221543243345432104321322332102110 , n          6543234543212332123223434432234212341233432342343343212341012312332123  n          1233231234233432123421232344123423340 , n          7654323454321243212322333543223321232122332231232234321232101211222112  n          01221221231223432123321222332123122310 , n          8765432365432154321432233654322432123212243222121325432123210121123211  n          101121321221125432124321322332122112210 , n          9876543276543265432543243765432543214323254323212326543214321032124321  n          2101214321322365432154324323432132213210 , n          8765433465432243212321222654333432232121243332232335432233211210113222  n          11212232231223543223321221223223122321120 , n          9876543376543254321432132765433543223212154333221436543224321121014322  n          211032432221226543224321321243222122321110 , n          8765432365432154321432233654322432123212243222121325432123210121123211  n          1011213212211254321243213223321221122101110 , n          6543234543212321012112323432234211230122332231232234323452123412333234  n          23433423453445321234101212332123122312342330 , n          7654323454321232101211222543223321121011243222121325432343212321223223  n          123223323423344321232101112221120112212312210 , n          8765432365432143210321122654322432112101143222110326543234321232124322  n          2121324323322354321232102112321110213212211210 , n          8765433465432243211210111654333432222110154333221436543344322321214333  n          22323343342334543223321110113222112232231222110 , n          8765432365432143210321122654322432112101143222110326543234321232124322  n          212132432332235432123210211232111021321221121010 , n          4321234521234523456456767212345234564566723454566452234563456756773456  n          5677564567676712345634565677345656564567676456660 , n          5432123432123422345345656321234123453455612343455343223452345645662345  n          45664534565656212345234545662345454534565653455510 , n          6543212343212332234334545432123212342344521232344234322343234534552234  n          345534334545453212342234345512343434234545423444210 , n          7654321254321243223333444543212321232233432121233125432234323433443223  n          2344234334343443212332233344212323233234343323333210 , n          8765432165432154322433344654321432123223343212122216543225432343344322  n          32332254334334543212432233343212221243233324323243210 , n          9876543276543265432543344765432543214323354323212327654326543254345432  n          432332654354456543215432433443213221543243354343543210 , n          6543223443212321234234545432234212342344522342344344323452234534552345  n          3455453456455632123412343455123434342345454234442112340 , n          7654322354321232123223434543223321231233432231233235432343223423443234  n          23443433453445432123212323442123232322343431233332112310 , n          8765432265432143212322333654322432122122343222122226543234322332334323  n          223323433433345432123212223332121212322323221222432112210 , n          9876543276543254321432233765432543213212254323211327654325432243235432  n          3222325433433465432143213223432121214322322321215432113210 , n          8765433365432243212212323654333432232122343332232336543344323422334334  n          23433443453445543223321212333223122332342332122243222321120 , n          9876543376543254321321222765433543223211254333221337654335432332225433  n          323233543433346543224321212243222122432322232111543222321110 , n          :987654487654365432432121876544654334322165444332448765446543343226544  n          4332446544434476543354323211543332335433323432226543334322210 , n          6543212343212332234334545432123212342344521232344234322343234534552234  n          34553433454545321234223434551234343423454542344421012311232340 , n          7654321254321243223333444543212321232233432121233125432234323433443223  n          234423433434344321233223334421232323323434322333321012211222310 , n          8765432165432154322433344654321432123223343212122216543225432343344322  n          3233225433433454321243223334321222124323332322324321013211223210 , n          9876543276543265432543344765432543214323354323212327654326543254345432  n          43233265435445654321543243344321322154324334323254321043213233210 , n          8765432265432143212322333654322432122122343222122226543234322332334323  n          223323433433345432123212223332121212322323221222432112210111221120 , n          9876543276543254321432233765432543213212254323211327654325432243235432  n          3222325433433465432143213223432121214322322321215432113210212321110 , n          8765432165432154322433344654321432123223343212122216543225432343344322  n          32332254334334543212432233343212221243233323223243210132112232101110 , n          7654323454322343234334545543234322342344532342344344321232123423442123  n          234423223434344322343234345522343434123434323444321234212323412342330 , n          8765432365432254323433444654323432233233443232233235432123212322333212  n          123312322323235432234323334432232323212323232333432123321222321231221  n          0 , n          9876543276543265432543344765432543224323354323222326543214321232234321  n          2122214322322365432254324334432232223212221432325432124321323321221121  n          0 , n          9876543376543254322432333765433543233222354333232336543224321221224322  n          2122224323222365432343223233432322233212121322225432233212212322312221  n          10 , n          :987654387654365432543243876543654324323265434322437654325432132125432  n          3211325432323376543254324323543232324321212432326543224321322432221232  n          110 , n          9876543276543265432543344765432543224323354323222326543214321232234321  n          2122214322322365432254324334432232223212221432325432124321323321221121  n          0110 , n          7654323454321232123223434543223321231233432231233235432343223423443234  n          2344343345344543212321232344212323232234343123333212341012123212312212  n          32330 , n          8765432365432143212322333654322432122122343222122326543234322332334323  n          2233234334333454321232122233321212123223232212224321232101112211201121  n          212210 , n          9876543276543254321432233765432543213212254323211327654325432243235432  n          3222325433433465432143213223432121214322322321215432123210212321110232  n          1211210 , n          9876543376543254321321222765433543223211254333221437654335432332225433  n          3232335434333465432243212122432221224323222321115432233211101322211232  n          21222110 , n          8765432365432343234334545654323432342344543232344236543344334534554334  n          3455344445454554323432343455323434343345454234444321232123234212323222  n          334312330 , n          9876543276543254323433444765432543233233454323233327654335433443445433  n          3344335444444565432343233344432323234334343323335432123212223321212132  n          2232212210 , n          3210123421123412345345656101234123453455612343455342123452345645662345  n          4566453456565622234523454566234545453456565345551234563456567345656545  n          66764566560 , n          4321012332112321234234545210123112342344501232344233212342234534551234  n          3455342345454532123412343455123434342345454234442123452345456234545434  n          556534554510 , n          5432101243211232123223434321012211231233410121233124321233223423442123  n          2344233234343443212321232344212323232234343123333212342234345123434323  n          4454234434210 , n          6543210154321143212322333432101321122122321011122015432124322332333212  n          2233124323332354321232122233321212123223232212224321233223234212323232  n          33433233233210 , n          7654321065432154321432233543210432113212232102111106543215432243234321  n          3222215432433465432143213223432121214322322321215432124322323321222143  n          233243223243210 , n          5432112332101221123123434321123101231233411231233233212342123423441234  n          2344342345344521012311232344012323231234343223333212341234345123434323  n          4454234434211230 , n          6543211243210132112212323432112210121122321120122124321233212322332123  n          1233233234233432101221121233101212122123232212224321232123234212323222  n          33431233233211210 , n          7654321154321043211321222543211321012111232111011115432124321232223212  n          2122124323322343210132112122210111013212221321115432123212223321212132  n          223221223243211210 , n          8765432165432154321432132654321432103212143212101216543215432143234321  n          3212215432433454321043213212321021104321322432226543214321322432121243  n          2322321243543213210 , n          7654322254321132101211212543222321121011232221121225432233212321223223  n          1232233234233443211221011122211201122123122101115432233212123322312232  n          32332122324321221120 , n          8765432265432143210321121654322432112101143222110226543224321232124322  n          2121224323322354321132102111321110113212211210106543224321212432221243  n          222232114354321321110 , n          5432101243211232123223434321012211231233410121233124321233223423442123  n          2344233234343432122321232344122323232334343123333212342234345123434323  n          4454234434210121123230 , n          6543210154321143212322333432101321122122321011122015432124322332333212  n          2233124323332343211232122233211212123223232212224321233223234212323232  n          33432233233210121121210 , n          7654321065432154321432233543210432113212232102111106543215432243234321  n          3222215432433454321143213223321121114322322321215432124322323321222143  n          233232223243210321121210 , n          7654321154321043211321222543211321012111232111011115432124321232223212  n          2122124323322343210132112122210111013212221212125432123212223321212132  n          2232212232432112101112110 , n          8765432165432154321432132654321432103212143212101216543215432143234321  n          3212215432433454321043213212321021104321322321216543214321322432121243  n          23223212435432132102132110 , n          7654321065432154321432233543210432113212232102111106543215432243234321  n          3222215432433454321243213223321221124323322321215432124322323321222143  n          233232223243210321121210110 , n          6543212354321243223323434432123321232233421231233233210122112312331012  n          1233122123232343212332232344212323232223232233334322343234345223434312  n          3343234434321232123231232330 , n          7654321265432154322432333543212432123222332122122124321013211221222101  n          1122013212221254321243223233321222123212121322225432234323334322323221  n          22323233334321232122221212210 , n          8765432176543265432543243654321543214323243213212215432104321132123210  n          2111104321322365432154324323432132214321212432326543225432433432232232  n          122143234354321432132321211210 , n          8765432265432154321432232654322432123212243222121225432113210121113211  n          1011113212211254321243213222321221122101110321216543234322323432322232  n          1121322243543223212213221222110 , n          6543212343210132112212323432112210121122321120122124321233212322332123  n          1233233234233432101221121233101212122123232222224321232123234212323222  n          33431233233212310121221212212320 , n          7654321254321043211321222543211321012111232111011215432124321232223212  n          2122124323322343210132112122210111013212221321115432123212223321212132  n          223221223243212210111211011212110 , n          8765432265432143210321121654322432112101143222110326543224321232124322  n          2121224323322354321132102111321110113212211210106543224321212432221243  n          2222321143543213211103211113221210 , n          7654321254321243223323434543212321232233432121233125432234323433443223  n          2344234334343443212332232344212323233234343323333210122112123101212121  n          22322222124321221232321223222331230 , n          8765432165432154322432333654321432123222343212122216543225432343334322  n          3233225433433454321243223233321222124323332432224321013211212210111032  n          122132112154321321222321121322221210 , n          6543210154321143212322323432101321122122321011122015432124322332333212  n          2233124323332354322232122233322212223233233212224321233223234212323232  n          3343323323321012112121011212122222120 , n          4321234521234501234234545212345123452344523453454452123452345634552345  n          4565453456565632345612343455234534453456455234442345672345456345645545  n          65663455451234534563434545534554545640 , n          5432123432123410123123434321234212341233412342343343212341234523441234  n          3454342345454521234501232344123423342345344123333234561234345234534434  n          545523443421234234523234344234434345310 , n          6543212343212321012112323432123211230122321231232234321232123412332123  n          2343232234343432123410121233212312231234233012224323452123234223423323  n          4344123323321232234121232331233232342210 , n          7654321254321232101211222543212321121011232122121125432123212321223212  n          1232123223232343212321011122211201122123122101115432343212123322312232  n          32332122324321221230121212221223212313210 , n          8765432165432143210321122654321432112101143212110216543214321232124321  n          2121214322322354321232102112321110213212211210106543234321212432221243  n          222232114354321321210321211321121032243210 , n          6543223443212321123012323432234212341232322342343344322342123423432234  n          2344342345344532123411231233123423341234343123234323452234234234534423  n          4454234334322341234232343442343233343211230 , n          7654322354321232112101212543223321231121232231232235432233212312323223  n          1233233234233443212321120122212312232123232112125432343223123323423332  n          33432232334322321231222323322321222323211210 , n          8765432265432143211210111654322432122110143222121226543224321221214322  n          2122224323222354321232111011321211123212121211016543234322212432322243  n          223232214354322321211322122322121132243211210 , n          9876543276543254321321021765432543213211054323211327654325432132125432  n          3211325432323365432143212101432121214321212321117654325432321543232354  n          3323432254654324321214322124322321433543213210 , n          8765433365432243212211201654333432232121243332232336543334322321224333  n          2232334334233454322332121121322312233223122212126543344323222433423343  n          32333232435432332231232323332322223324321221120 , n          9876543376543254321321110765433543223211154333221337654335432232115433  n          3221335433323365432243212110432221224322212321117654335432321543332354  n          332343225465432432221432222432232143354321321110 , n          6543212343212321012112323432123211230122321231232234321232123412332123  n          2343232234343432123410121233212312231234233012224323452123234223423323  n          4344123323321232234121232331233232342210121123230 , n          7654321254321232101211222543212321121011232122121125432123212321223212  n          1232123223232343212321011122211201122123122101115432343212123322312232  n          32332122324321221230121212221222212313210121121210 , n          8765432165432143210321122654321432112101143212110216543214321232124321  n          2121214322322354321232102112321110213212211210106543234321212432221243  n          222232114354321321210321211321121032243210321121210 , n          8765432265432143211210111654322432122110143222121226543224321221214322  n          2122224323222354321232111011321211123212121211016543234322212432322243  n          2232322143543223212113221223221211322432112101112110 , n          8765432165432143210321122654321432112101143212110216543214321232124321  n          2121214322322354321232102112321110213212211210106543234321212432221243  n          22223211435432132121032121132112103224321032112121010 , n          7654323454322332123212323543234322341232332342343344321232123401222123  n          1232232123232343223421231233323423342234122123235433453234234334534423  n          423323433443234323423234344123323334332123212323123230 , n          8765432365432243212321222654323432232121243233232235432123212310113212  n          2121123212121254322332122122322312232123011212126543344323223433423332  n          3122323243543233223123232332122322332432123212122121210 , n          9876543276543254321432132765432543223212154323221326543214321221014321  n          2110214321212265432243213212432221323212102321217654335432322543332343  n          22124322546543243222143232232123214335432143212132121210 , n          9876543376543254322321221765433543233221254333232336543224321221104322  n          2121224322212265432343222121432322233212111322127654345433322543433343  n          222243325465433432322433233322132243354322321221322122110 , n          7654323454321232123101212543223321232121232231232235432343212312323223  n          1233233234233443212321230122212312232123232223125432343234123323423332  n          3343234234432342123233232332342123233321231012122121212320 , n          8765432365432143212210111654322432122110143222121326543234321221214322  n          2122224323222354321232121011321221123212121212016543234323212432322243  n          22323231435432332122232212232312123234321221011121101212110 , n          8765432365432343212212323654323432232122343232232236543234323422334323  n          2343234334343454323432121233322312233234233212224321232123012212312221  n          223232312354323323412323233323323212243212212323212222233120 , n          9876543276543254321321222765432543223211254323221327654325432332225432  n          3232325433333465432343212122432221224323222321115432123212101321221132  n          1121212032654324323214322224322321213543213212223211132222110 , n          7654321254321232101211212543212321121011232122121125432123212321223212  n          1232123223232343212321011122211201122123122101115432343212123322312232  n          32332122324321221230121212221223212313210121121210111212222120 , n          5432345632234512345345656212345234563455623454565451012341234534551234  n          3455342345454521234523454566234545452345454345553234563456567345656534  n          556545665623456345645345565234434545512345345656345553455455640 , n          6543234543223421234234545321234223452344512343454342101231123423440123  n          2344231234343432123412343455123434341234343234444323452345456234545423  n          4454345545323452345342344541233234344212342345452344423443445310 , n          7654323454322332123223434432123322341233421232343233210122112322331012  n          1233122123232343212321232344212323232123232123335432343234345223434312  n          33432344344323422342312334301221232333212322343412333123323342210 , n          8765432365432243212322333543212432232122332122232124321013211222232101  n          1122013212221254321232122233321212123212221212226543234323234322323221  n          223232334354323322312212232101121232243212322323212222122322313210 , n          9876543276543254321432233654321543223212243213221215432104321132233210  n          2112104321322365432143213223432121214321322321217654325432323432232232  n          1221432254654324322213212212101321433543214322323212132124332243210 , n          7654334554323432234123434432234212342343422342344343211231012312331123  n          1233231234233443223421232344123423340123232123335433453234345234534412  n          33432344344334523453423434412322333443223412343423434223323343211230 , n          8765433465432343223212323543223321232232332231233234321122101211222112  n          0122122123122354322332121233212312231012121212226543344323234323423321  n          223232334354334323423223233112122233343223212323223232122122323211210 , n          9876543376543254322321222654322432123221243222122225432113210121123211  n          1011113212211265432243212122321221122101110321117654335432323432322232  n          112143225465433432322322122211032143354322321222322123211213224321121  n          0 , n          9876544476543354323322312654333432232122343332232335432223211210113222  n          1121223223122365433343222122322312232112011322127654445433323433423332  n          2122433254654344334233232332121322433543233223122122210112132243222211  n          0 , n          :987654487654365432432221765433543223212254333221336543224321121014322  n          2110224322212276543354323211432221223211101432218765446543432543332343  n          2212543365765435433324322223211432544654324322213212121013243354322321  n          10 , n          7654323454322332123223434432123322341233421232343233210122112322331012  n          1233122123232343212321232344212323231223332123335432343234345223434312  n          3343234434432342234231233430122123233321232234341233312332334221012112  n          230 , n          8765432365432243212322333543212432232122332122232124321013211222232101  n          1122013212221254321232122233321212122112221212226543234323234322323221  n          2232323343543233223122122321011212322432123223232122221222223132101211  n          2210 , n          9876543276543254321432233654321543223212243213221215432104321132233210  n          2112104321322365432143213223432121213211221321217654325432323432232232  n          1221432254654324322213212212101321433543214322323212132123232243210321  n          22210 , n          9876543376543254322321222654322432123221243222122225432113210121123211  n          1011113212211265432243212122321221122101110321117654335432323432322232  n          1121432254654334323223221222110321433543223212223221221212132243211210  n          112110 , n          8765434565433443234323434543234432342343432342344344321233212312332123  n          1233231012121254323432232344323423342123232223336543454334345334534422  n          3343334444543453345342343441232233344432343234342343412332334332123212  n          2312320 , n          9876543476543354323432333654323543233232343233233235432124321221223212  n          2122122101110165432343223233432322233212121322227654345433334433433332  n          2232433354654344334233232332121322433543234323233232321223233243212321  n          12212110 , n          8765434565432343223212323543234321232232332231233234321232101211222112  n          0122122123122354323432121233212312231012121212226543454323234323423321  n          2232323343543343234233342332231232343432232123233232323221223232123101  n          122121120 , n          9876543476543254322321222654323432123221243222122325432123210121123211  n          1011213212211265432343212122321221122101110321117654345432323432322232  n          1121432254654334323223231222120321434543223212223221232112132343212210  n          1121102110 , n          9876543476543354323323434654323432343233443232343235432123212322333212  n          1233123223232365432343232344322323232123232323335432343223123212323210  n          1121212232654344334233233432122323233543233234343233332332312243212212  n          23212222120 , n          5432345632123422345345656322345123453455623453455452123452345645662345  n          4566453456565621234523454566234545453456565345553234563456567345656545  n          6676456656334562345453454553455345455233453456563455545664556412345345  n          563455454550 , n          6543234543212332234334545432234212342344522342344343212342234534551234  n          3455342345454532123422343455123434342345454234444323452345456234545434  n          5565345545323451234342343442344234344322342345452344434553445321234234  n          4523443434410 , n          7654323454321243223333444543223321232233432231233234321233223433442123  n          2344233234343443212332233344212323233234343223335432343234345323434323  n          4454234434432342123232232331233123233432233234342233323442334232123223  n          34123323233210 , n          8765432365432154322433344654322432123223343222122225432124322333343212  n          2233124323332354321243223334321222124323332322326543234323334432323232  n          3343323343543233212223221222122212323543224323333222232333233243212322  n          332122323223210 , n          7654334554322332123223434543334322341233433342343344322342123423442234  n          2344342345344543223421232344223423341234343123335433453234345334534423  n          4454234434432342234232343442343233343321232234341233323443334232234123  n          3423433423321120 , n          8765433465432243212322333654333432232122343332232335432233212322333223  n          1233233234233454322332122233322312232123232212226543344323234433423332  n          3343323343543233223123232332232222332432123223232122232332223143223212  n          23223223122321110 , n          9876543376543254321432233765433543223212254333221336543224321232234322  n          2122224323322365432243213223432221223212221321217654335432323543332343  n          2232432254654324322214322223221321433543214322323212143223232254322321  n          223221322134321210 , n          9876544476543354322321222765444543333221254443332446543334322321224333  n          2232334334233465433343222122433322333223122322127654445433323544433443  n          3233433254654334323224332333232322433543223212223221221222132254333322  n          1233323222343222110 , n          7654323454321243223333444543223321232233432231233234321233223433442123  n          2344233234343443212332233344212323232234343233435432343234345323434323  n          4454234434432342123232232331233123233432333234342333323442334332123223  n          34123323233210111220 , n          8765432365432154322433344654322432123223343222122225432124322333343212  n          2233124323332354321243223334321222123223332322326543234323334432323232  n          3343323343543233212223221222122212323543224323333222232333233243212322  n          332122322223210211210 , n          9876543276543265432543344765432543214323354323212326543215432243344321  n          3223215432433465432154324334432132214322332432327654325432434543232343  n          2332432354654324321324322123212322433654325432434323243234343354321432  n          3332124332343213212210 , n          9876543376543254321432233765433543223212254333221336543224321232234322  n          2122224323322365432243213223432221223212221321217654335432323543332343  n          2232432254654324322214322223221321433543214322323212132223232254322321  n          22322132213432121012110 , n          8765434565432354323433444654334432343233443342343345432343212322333223  n          1233232123232354323443233344323423342123232323336543454334345434534432  n          3343334444543343234233343442342233343543233234343233323332334243234212  n          232232121223212212212320 , n          9876543476543265432543344765433543234323354333232336543234321232234322  n          2122223212221265432354324334432332233212221432327654345433434543433343  n          2232433354654334323324332333231322434654324323334322232223243354323321  n          2232212121343213212212110 , n          8765434565432343212322333654334432232122343332232335432343212322333223  n          1233233234233454323432122233322312232123232212226543454323234433423332  n          3343323343543233234123232333342332342432123223232122232332323143223212  n          23323223122321210112121120 , n          9876543476543254323433444765433543233233454333233336543234323433444323  n          2344234334343465432343233344432323233234343323335432343212223322312221  n          2232212232654344323234332333233323333543234334343233343443323254323323  n          343233332314321212221222210 , n          4321234521012311234234545211234012342344512342344342123451234534552345  n          3455453456455610123412343455123434342345454234442123452345456234545434  n          5565345545323451234342343443454234344332342345452344434553445323345345  n          5634554545512343455345545450 , n          5432123432101221123223434321123101231233421231233233212342123423441234  n          2344342345344521012311232344012323231234343123333212341234345123434323  n          4454234434212340123231232332343123233321231234341233323442334232234234  n          45234434344212323442344343410 , n          6543212343210132112222333432112210121122321120122124321233212322332123  n          1233233234233432101221122233101212122123232212224321232123234212323222  n          3343123323321231012122121221232012122432122123232122222331223143223323  n          342233332333212223312332323210 , n          7654321254321043211322233543211321012112232111011215432124321232233212  n          2122124323322343210132112223210111013212221321215432123212223321212132  n          2232212232432122101112110112121101213543213212223211132222132254322432  n          3332224332343213223212232323210 , n          6543223443211221012112323432223211230122332231232234322342123412332234  n          2343342345344532112310121233112312231234233012224322342123234223423323  n          4344123323321231123121232332343122232210121123230122212332223132123223  n          34123323233322312332343342321120 , n          7654322354321132101211222543222321121011232221121225432233212321223223  n          1232233234233443211221011122211201122123122101115432233212123322312232  n          3233212232432122112012121222232111221321012112121011121222112043212322  n          232122322224322212222322312321110 , n          8765432265432143210321122654322432112101143222110326543224321232124322  n          2121224323322354321132102112321110113212211210106543224321212432221243  n          2222321143543213211103211113221210322432103211212101032123221154321432  n          3232124332354323212322132234321210 , n          8765433365432243211210111654333432222110143332221336543334322321214333  n          2232334334233454322232111011322211223223122211016543334322212433322343  n          3233322143543223212113221223232211322432112101112110121211021154322321  n          22322132213543332213332332343222110 , n          6543212343210132112222333432112210121122321120122124321233212322332123  n          1233233234233432101221122233101212122123232122324321232123234212323222  n          3343123323321231012122121221232012122321222123231222223331223243233212  n          232232231223212223312332323210111220 , n          7654321254321043211322233543211321012112232111011215432124321232233212  n          2122124323322343210132112223210111013212221211215432123212223321212132  n          2232212232432122101112110112121101212432113212222111132222122154322321  n          2232213221343213223212232223210211210 , n          7654323454321243212322333543223321232122332231232234321232101211222112  n          0122122123122343212332122233212312231012121212225432343223234323423321  n          2232223333432232123123232332231122232432122123232122222221223132123101  n          12212112011432321222232121232122122120 , n          8765432365432154321432233654322432123212243222121325432123210121123211  n          1011213212211254321243213223321221122101110321216543234322323432322232  n          1121322243543223212213221222120211323543213212223211132112132243212210  n          112110211025432321232212123432132122110 , n          7654323454321232101211222543223321121011243222121325432343212321223223  n          1232233234233443212321011122211201122123122101115432343212123322312232  n          3233212232432122123012121223232221231321012112121011121222212043212212  n          2321222212243222122323223123212101121120 , n          5432345632123422345345656322345123453455623453455453234562345645663456  n          4566564567566721234523454566234545453456565345552123452345456234545434  n          5565345545323452345453454554565345344433453456563455545664545434456345  n          56456556455234545664566565512343455344540 , n          6543234543212332234334545432234212342344532342344344323453234534552345  n          3455453456455632123422343455123434342345454234443212342234345123434323  n          4454234434322341234342343443454234233432342345452344434553434343345234  n          453454453443234345534554544212323442334310 , n          7654323454321243223333444543223321232233432231233235432344323433443234  n          2344344345344543212332233344212323233234343323334321233223334212323232  n          3343223323432232123233232332343123122543233234343233333442323254334323  n          3433433423343233344234434333212223312232210 , n          8765432365432154322433344654322432123223343222122326543235432343344323  n          3233235434433454321243223334321222124323332432325432124322334321222143  n          2332322332543223212223221223232212213654324323334322243333232365433432  n          33433243324543243343233434343213223213233210 , n          7654334554322332123223434543334322341233443342343345433453234523443345  n          3454453456455643223421232344223423342345344123334322342123234223423323  n          4344123323432342234232343443454233233321232234341233323443333243234334  n          342344343434334234434544533322312332334221120 , n          8765433465432243212322333654333432232122343332232336543344323432334334  n          2343344345344554322332122233322312233234233212225432233212223322312232  n          3233212232543233223123232333343222222432123223232122232333222154323433  n          2332334333354333233334334224322212222231321110 , n          9876544476543354322321222765444543333221254443332447654445433432325444  n          3343445445344565433343222122433322334334233322126543334322212433322343  n          3233322143654334323224332334343322323543223212223221232322121265433432  n          33433243323654443324443443354333221333324322210 , n          7654323454321243223333444543223321232233432231233235432344323433443234  n          2344344345344543212332233344212323233234343233434321233223334212323232  n          3343233423432232123233232332343123122432333234342333334442323354344323  n          343343342324323334423443433321222331223321011120 , n          8765432365432154322433344654322432123223343222122326543235432343344323  n          3233235434433454321243223334321222124323332322325432124322334321222143  n          2332322332543223212223221223232212213543224323333222243333232265433432  n          3343324332354324334323343334321322321322321021210 , n          8765434565432354323433444654334432343233443342343345432343212322333223  n          1233233234233454323443233344323423342123232323335432344323334323423321  n          2232323333543343234234343443232233233543233234343233333332323243234212  n          23323223121543432333343232243233233231223212212120 , n          8765434565432343212322333654334432232122354333232436543454323432334334  n          2343344345344554323432122233322312233234233212225432343212223322312232  n          3233212232543233223123232334343322332432123223232122232333323154323323  n          233233332325433323343433422432321223223132121012110 , n          6543234543234533456456767432345234564566723454566453234561234534552345  n          3455453456455621234523454566234545452345454345551012341234345123434323  n          4454234434212342345452344543454345233323453456563455534554534443456234  n          4534544534434563455456545442345456645344123434534440 , n          7654323454323443345445656543234323453455632343455344323452123423442234  n          2344342345344532123422343455123434341234343234442101231123234012323212  n          3343123323321232234341233432343234122432342345452344423443423332345123  n          34234334233434523443454343332343455342332123234233310 , n          8765432365432354334444555654323432343344543232344235432343212322333223  n          1233233234233443212332233344212323232123232323333210122112223101212121  n          2232212212432123223332122322232123011543233234343233332332312243234212  n          233232231225434323333432322432333442312232122231222210 , n          9876543276543265433544455765432543234334454323233326543234321232234322  n          2122224323322354321243223334321222123212221432324321013211223210111032  n          1221321221543214322333212213221212102654324323334322243223221354323321  n          2232213221365434323433232335432433432213432132321333210 , n          8765433465432343234334545654334432342344543342344345433453223412333334  n          2343343345344543223421232344223423342234233123333211231012123112312212  n          3233012212432232123232232332343123122432343234342343412332322343345223  n          23334323232543433433454343243232344232323223123233221120 , n          9876543376543254323433444765433543233233454333233336543344322321224333  n          2232334334233454322332122233322312233223122212224321122101112211201121  n          2122101121543223212223221223232212112543234323233232321223221254334322  n          124332322226543433243433321543232333222143222122221321110 , n          8765432365432354334444555654323432343344543232344235432343212322333223  n          1233233234233443212332233344212323232123232223333210122112223101212121  n          2232122312432123223332122322232123011543233234343233323332312243234212  n          2332322312154343233334323224323334423122321222312232101110 , n          9876543476543365434544555765434543344344554343344346543234323432334323  n          2343233234122354323443233344323423342123232323334321233212223212312210  n          1121212222543234323333232332122223122654344334344343432332312254323323  n          23323323120654343434344342154334344332324323323231232122110 , n          5432123443223423345445656321234123453455612343455342123450123423441234  n          2344342345344532334512343455234534451234343234442123452345456234545423  n          4454345545212342345452344543453344343323452345453454523443445432345123  n          342343342334345234434543434343434553423323454564534123434340 , n          6543212354322332334344555432123212342344521232344233212341012312332123  n          1233231234233443223421232344123423340123232123333212342234345123434312  n          3343234434321232234341233432342233232322341234342343412332334321234012  n          2312322312232341233234323234323234423122323434534232123232310 , n          7654321265432243233334445543212321232233432121233124321232101211222112  n          0122122123122354322332122233212312231012121212224321233223334212323221  n          2232323323432123223332122323231222121432232123233232321221223232123101  n          12212112011432321222232121243322233120114323334231232122212210 , n          7654322354321243223233444543223321231233432231233234322342112301223223  n          1232232234233443212332231233212323231123122223234322342123234223423322  n          3233123323432232123232232331232123232433332234231233301221223332234112  n          122232121224323223223432323321222331212243232342323322312232110 , n          8765432265432154322323334654322432122122343222122225432233211210113222  n          1121223223122354321243222122321212122112011322125432233212223322312232  n          2122212232543223212223221222121212222543323223122122210112132243223211  n          0132212111254323221323222224321322221112543232332224322212232110 , n          7654321265432243233334445543212321232233432121233124321232101211222112  n          0122122123122354323332122233212312231012121212224321233223334212323221  n          2232223323432123223332122322231232121432232123232232312221223232123101  n          12212112011432321222232121243232233120114323334231232122212210110 , n          4321012332112322234334545210123112342344501232344233212341234534551234  n          3455342345454532223423344455223434342345454344542123452345456234545434  n          5565345545101231234341233432344234342212342345452344434553445332345234  n          453454453444334345534554545432333442334434344453445234545451233430 , n          5432101243211232223333444321012211232233410121233124321232123423442123  n          2344232234343443212332233344212323231234343233433212342234345123434323  n          4454234434210121123230122321233123231321232234341233323442334232234123  n          3423433423343232344234434343212223312233432333423343234343421223210 , n          6543210154321143222333344432101321122223321011122015432123212322333212  n          1233123223232354321243223334321222122123232322324321233223334212323232  n          3343323323321012112221011212122212120432123223332122232332223143223212  n          23323223122543232333233232343213223211225432434322343233323321221210 , n          6543211243210132112222333432112210121122321120122124321233212312332123  n          1233233234233432101221122233101212122123232222324321232123234212323222  n          3343123323321121012121121221232012121432222123232222212331223243223223  n          232233232333212223312332333210111220112232122231223432323233221222110 , n          6543210154321143222333344432101321122223321011122015432123212322333212  n          1233123223232343212232233344212223222123232323334321233223334212323232  n          3343233423321012112221011212122123120432123223332122222332323143212212  n          232122221224322323322332323321222331212243233342323432333233212212101  n          0 , n          5432123443223421234234545321234223452344512343454344323452345634552345  n          4565453456565632334512343455234534453456455234443234562345456345645545  n          6566345545212342345342344543455344453212342345452344434553445332345345  n          5634554545543453455456556454334234434453444534545543456455623445412333  n          0 , n          6543212354322332123223434432123322341233421232343235432343234523443234  n          3454343345454543223421232344323423342345344123334323453234345234534434  n          5455234434321232234231233432344233342321232234341233323442334243234234  n          4523443434443342344345445343223123323342433423434434345344532334321222  n          10 , n          7654321265432243212322333543212432232122332122232126543234323432334323  n          2343234334343454322332122233322312233234233212225432344323234323423343  n          4344323333432123223122122323233322231432123223232122232333223154323323  n          3432333323354333233434334234322212232231543332343325434433443233232121  n          210 , n          7654322354321243223212323543223321232232332231233235432344323423433234  n          2344344345344543212332231233212323233234343223235432343234234323434333  n          4454234334432232123232232332343123232432232123232232323431223254334323  n          3433433423343233343234434343212223212232432333323335434343443323332212  n          2110 , n          5432234532123410123123434432345212341233422342343343223451234523442345  n          3454453456455621234501232344123423342345344123333234561234345234534434  n          5455234434212342345232343443454343453101231234341233323442334221234234  n          4523443434432342344345445343234123323342434523434434456344534444423444  n          12330 , n          6543223443212321012112323432234211230122332231232234322342123412333234  n          2343342345344532123410121233212312231234233012224323452123234223423323  n          4344123323321232234121232332343232342210121123230122212331223132123223  n          3412332323332231233234334232123012212231323412323324345233443333332333  n          212210 , n          6543345643234521234234545432345323452344523453454453212342234534551234  n          3455342345454532234512343455234534453345454234444334562345456345645534  n          5565345545323453456343454552344344454212342345452344434553445321234234  n          4523443434432343455345545454345234434343545634545445445344544344334454  n          2344120 , n          7654334554323432123223434543234322341233432342343344321233223423442123  n          2344233234343443223421232344323423342234343123335433453234345334534423  n          4454234434432343345232343441233233343321232234341233323442334232123223  n          3412332323343232344234434343234123323232434523434334334233443233243343  n          32332110 , n          6543456743234532345345656321234223453455612343455342101231123423440123  n          2344231234343432123422343455123434342234343334443223451234345234534423  n          4454234434323452345452344541233234344212342345452344423443434310123123  n          3412332323321232344234434343234345534233434534545344334233443233244343  n          344523120 }; n     int T; n     cin >> T; n     for (int t = 0; t < T; ++t) { n       int a, b; n       cin >> a >> b; n       vector<int> F, G; n       fact(a, F); n       fact(b, G); n       int i = IDX[F], j = IDX[G]; n       if (i < j) swap(i, j); n       cout << (DIST[i][j] -  0 ) <<   n ; n     } n   } n }; n int main() { n   ios_base::sync_with_stdio(false); n   cin.tie(nullptr); n   cout.tie(nullptr); n   TaskD solver; n   std::istream& in(std::cin); n   std::ostream& out(std::cout); n   solver.solve(in, out); n   return 0; n } n


#include <bits/stdc++.h> n using namespace std; n int n, m; n vector<pair<int, int>> G[262144]; n int d1[26][262144]; n pair<int, int> d2[2][262144]; n int vis[2][262144]; n long long mod = 998244353ll; n long long qpow(long long x, long long y) { n   long long a = x, ans = 1; n   while (y) { n     if (y & 1) ans = (ans * a) % mod; n     y >>= 1; n     a = (a * a) % mod; n   } n   return ans; n } n int main() { n   ios::sync_with_stdio(false); n   cin.tie(0); n   cin >> n >> m; n   for (int i = 0; i < m; i++) { n     int u, v; n     cin >> u >> v; n     G[u].push_back(make_pair(v, 0)); n     G[v].push_back(make_pair(u, 1)); n   } n   queue<pair<int, int>> q; n   q.push(make_pair(0, 1)); n   for (int i = 1; i <= n; i++) n     for (int j = 0; j <= 25; j++) d1[j][i] = -1; n   d1[0][1] = 0; n   while (!q.empty()) { n     pair<int, int> top = q.front(); n     q.pop(); n     int flips = top.first, u = top.second; n     for (auto i : G[u]) { n       int v = i.first, f = i.second; n       int flip = ((flips & 1) ^ f); n       if (flips + flip > 25) continue; n       if (d1[flips + flip][v] == -1) { n         d1[flips + flip][v] = d1[flips][u] + 1; n         q.push(make_pair(flips + flip, v)); n       } n     } n   } n   int ans = 2100000000; n   for (int j = 0; j <= 25; j++) n     if (d1[j][n] != -1) { n       ans = min(ans, (1 << j) - 1 + d1[j][n]); n     } n   if (ans < 2100000000) { n     cout << ans << endl; n     return 0; n   } n   priority_queue<pair<pair<int, int>, pair<int, int>>> q2; n   q2.push(make_pair(make_pair(0, 0), make_pair(0, 1))); n   for (int i = 1; i <= n; i++) n     for (int j = 0; j <= 1; j++) d2[j][i] = make_pair(2100000000, 2100000000); n   d2[0][1] = make_pair(0, 0); n   while (!q2.empty()) { n     pair<pair<int, int>, pair<int, int>> top = q2.top(); n     q2.pop(); n     int flipsbit = top.second.first, u = top.second.second; n     if (vis[flipsbit][u]) continue; n     vis[flipsbit][u] = 1; n     int flips = d2[flipsbit][u].first, dist = d2[flipsbit][u].second; n     for (auto i : G[u]) { n       int v = i.first, f = i.second; n       int flip = (flipsbit ^ f); n       int vflipsbit = ((flips + flip) & 1); n       pair<int, int> dv = make_pair(flips + flip, dist + 1); n       if (d2[vflipsbit][v] > dv) { n         d2[vflipsbit][v] = dv; n         q2.push(make_pair(make_pair(-dv.first, -dv.second), n                           make_pair(vflipsbit, v))); n       } n     } n   } n   int flips = d2[0][n].first, dist = d2[0][n].second; n   if (d2[1][n].first < d2[0][n].first) { n     flips = d2[1][n].first, dist = d2[1][n].second; n   } n   long long ans2 = (qpow(2, flips) + dist - 1) % mod; n   cout << ans2 << endl; n } n


#include <bits/stdc++.h> n using namespace std; n int main() { n   int n, m; n   cin >> n >> m; n   long long ans = 0; n   for (int i = (0); i < (n); ++i) { n     long long t, T, x, cost; n     cin >> t >> T >> x >> cost; n     if (t >= T) { n       ans += cost + m * x; n       continue; n     } n     long long aux1 = cost; n     if (m > (T - t)) aux1 += m * x; n     long long aux2 = (long long)ceil((double)(m - (T - t)) / (T - t)) + 1; n     aux2 *= cost; n     ans += min(aux1, aux2); n   } n   cout << ans << endl; n   return 0; n } n


#include <bits/stdc++.h> n using namespace std; n int main() { n   int n, m; n   scanf( %d %d , &n, &m); n   vector<int> att, def, my(m); n   for (int i = 0; i < n; i++) { n     char a, b, c; n     int s; n     scanf(  %c%c%c %d , &a, &b, &c, &s); n     if (a ==  A ) n       att.push_back(s); n     else n       def.push_back(s); n   } n   for (int i = 0; i < m; i++) { n     scanf( %d , &my[i]); n   } n   sort(att.begin(), att.end()); n   sort(def.begin(), def.end()); n   sort(my.begin(), my.end()); n   int res = 0; n   vector<int> used(m, 0); n   int pres = 0; n   int cm = 0; n   for (int i = 0; i < def.size(); i++) { n     while (my[cm] <= def[i] || used[cm]) { n       cm++; n       if (cm >= m) { n         pres = -1023456789; n         break; n       } n     } n     if (cm < m) { n       used[cm] = 1; n     } else n       break; n   } n   if (pres > -1023456789) { n     cm = 0; n     for (int i = 0; i < att.size(); i++) { n       while (my[cm] < att[i] || used[cm]) { n         cm++; n         if (cm >= m) { n           pres = -1023456789; n           break; n         } n       } n       if (cm < m) { n         used[cm] = 1; n         pres += my[cm] - att[i]; n       } else n         break; n     } n   } n   if (pres > -1023456789) { n     for (int i = 0; i < m; i++) n       if (!used[i]) pres += my[i]; n   } n   res = max(res, pres); n   for (int i = 1; i <= min(m, (int)(att.size())); i++) { n     int suc = 0; n     for (int j = 0; j < i; j++) { n       if (my[m - i + j] >= att[j]) { n         suc += my[m - i + j] - att[j]; n       } else n         suc = -1023456789; n     } n     res = max(res, suc); n   } n   printf( %d n , res); n   return 0; n } n


#include <bits/stdc++.h> n using namespace std; n int n; n long long a[1010]; n long long ans; n long long vis[1010]; n map<long long, long long> mp; n void dfs(long long x, long long y, long long cnt) { n   ans = max(cnt, ans); n   if (mp[x + y]) { n     mp[x + y]--; n     dfs(y, x + y, cnt + 1); n     mp[x + y]++; n   } n } n int main() { n   while (cin >> n) { n     for (int i = 1; i <= n; i++) cin >> a[i]; n     for (int i = 1; i <= n; i++) mp[a[i]]++; n     long long kk = 0; n     for (int i = 1; i <= n; i++) n       if (a[i] == 0) kk++; n     ans = 0; n     for (int i = 0; i <= n; i++) vis[i] = 0; n     for (int i = 1; i <= n; i++) { n       for (int j = 1; j <= n; j++) { n         if (i != j) { n           if (a[i] == 0 && a[j] == 0) { n             ans = max(ans, kk); n             continue; n           } n           mp[a[i]]--; n           mp[a[j]]--; n           dfs(a[i], a[j], 2); n           mp[a[i]]++, mp[a[j]]++; n         } n       } n     } n     cout << ans << endl; n   } n   return 0; n } n


#include <bits/stdc++.h> n using namespace std; n int t[24], n; n bool ok(int n) { n   set<int> u; n   int e = 0; n   for (int(i) = (0); (i) < (n); (i)++) n     for (int(j) = (0); (j) < (i); (j)++) { n       e++; n       u.insert(abs(t[i] + t[j])); n     } n   return (e == u.size()); n } n int main() { n   scanf( %d , &n); n   for (int(i) = (0); (i) < (n); (i)++) { n     t[i] = i; n     while (!ok(i + 1)) t[i]++; n   } n   for (int(i) = (0); (i) < (n); (i)++) { n     for (int(j) = (0); (j) < (n); (j)++) n       printf( %d  , i == j ? 0 : abs(t[i] + t[j])); n     puts(  ); n   } n   return 0; n } n


#include <bits/stdc++.h> n using namespace std; n int main() { n   int sum; n   cin >> sum; n   int a, b, c = -1; n   for (int i = 0; i * 7 <= sum; i++) { n     if ((sum - i * 7) % 4 == 0) { n       int j = (sum - i * 7) / 4; n       if (c == -1 || i + j < c) { n         c = i + j; n         a = j; n         b = i; n       } n     } n   } n   if (c == -1) n     cout << -1; n   else { n     for (int i = 0; i < a; i++) cout <<  4 ; n     for (int j = 0; j < b; j++) cout <<  7 ; n     cout <<   n ; n   } n   return 0; n } n


#include <bits/stdc++.h> n using namespace std; n long long n, m, l, r; n vector<long long> A[200001]; n set<pair<int, int> > se; n void add(long long y) { n   for (auto b : A[y]) se.insert({b, y}); n } n void del(long long y) { n   for (auto b : A[y]) se.erase({b, y}); n } n int main() { n   ios_base::sync_with_stdio(false); n   cin.tie(0); n   cin >> n >> m >> l >> r; n   for (long long i = 1; i <= 200000; ++i) n     for (long long j = i; j <= 200000; j += i) n       if (j <= 200000) A[j].push_back(i); n   long long L = m + 1; n   long long R = m; n   for (long long x = 1; x <= n; ++x) { n     long long L_ = (l + x - 1) / x; n     long long R_ = min(m, r / x); n     if (L_ > R_) goto L1; n     while (L > L_) add(--L); n     while (R > R_) del(R--); n     for (long long a : A[x]) { n       auto it = se.upper_bound({a + 1, 0}); n       if (it != se.end()) { n         long long b = it->first; n         long long y = it->second; n         if (x * b <= n * a) { n           cout << x <<     << y <<     << x * b / a <<     << y * a / b; n           goto L2; n         } n       } else n         goto L1; n     } n   L1: n     cout << -1; n   L2: n     cout <<   n ; n   } n   return 0; n } n


#include <bits/stdc++.h> n using namespace std; n const double eps = 1e-8; n long long ii = 1; n vector<long long> prime; n bitset<1000000> bs; n void sieve() { n   bs.set(); n   bs[0] = bs[1] = 0; n   prime.push_back(2); n   for (long long i = 3; i <= 1000000; i += 2) { n     if (bs[i]) { n       for (long long j = i * i; j <= 1000000; j += i) bs[j] = 0; n       prime.push_back(i); n     } n   } n } n void solve() { n   long long n; n   cin >> n; n   long long l = 0; n   long long r = prime.size() - 1; n   long long p = sqrt(n); n   while (l <= r) { n     long long mid = (l + r) / 2; n     if (prime[mid] <= p) n       l = mid + 1; n     else n       r = mid - 1; n   } n   long long cn = l - 1; n   l = 0; n   r = prime.size() - 1; n   while (l <= r) { n     long long mid = (l + r) / 2; n     if (prime[mid] <= n) n       l = mid + 1; n     else n       r = mid - 1; n   } n   cout << r - cn + 1 <<   n ; n } n int32_t main() { n   ios_base::sync_with_stdio(false); n   cin.tie(NULL); n   cout.tie(NULL); n   long long TestCase; n   sieve(); n   cin >> TestCase; n   while (TestCase--) solve(); n   return 0; n } n


#include <bits/stdc++.h> n using namespace std; n struct Lem { n   int m, v, id; n   bool operator<(Lem b) const { return m < b.m || (m == b.m && v < b.v); } n }; n int n, k, h; n Lem a[(100000 + 10)]; n bool can(long double t) { n   int j = k; n   for (int i(n - 1), _l(0); i >= _l; --i) { n     if (j > 0 && (long double)j * h / a[i].v - t <= -1e-7) j--; n   } n   return j == 0; n } n void putAns(long double t) { n   int ans[(100000 + 10)]; n   int j = k; n   for (int i(n - 1), _l(0); i >= _l; --i) { n     if (j > 0 && (long double)j * h / a[i].v - t <= -1e-7) ans[--j] = a[i].id; n   } n   for (int i(0), _n(k - 1); i < _n; ++i) printf( %d  , ans[i]); n   printf( %d n , (ans[k - 1])); n } n int main() { n   scanf( %d , &(n)), scanf( %d , &(k)), scanf( %d , &(h)); n   for (int i(0), _n(n); i < _n; ++i) scanf( %d , &(a[i].m)), a[i].id = i + 1; n   for (int i(0), _n(n); i < _n; ++i) scanf( %d , &(a[i].v)); n   sort(a, a + n); n   long double l = 0, r = 1e10; n   int cnt = 100; n   while (cnt--) { n     long double mid = (l + r) / 2.0; n     if (can(mid)) n       r = mid; n     else n       l = mid; n   } n   putAns(r); n   return 0; n } n


#include <bits/stdc++.h> n using namespace std; n int n, m, k, l, r; n int rd() { n   int re = 0, f = 1; n   char c = getchar(); n   while ((c <  0 ) || (c >  9 )) { n     if (c ==  - ) f = -f; n     c = getchar(); n   } n   while ((c >=  0 ) && (c <=  9 )) { n     re = re * 10 + c -  0 ; n     c = getchar(); n   } n   return re * f; n } n int main() { n   cin >> m >> k; n   cin >> n; n   l = (n > k) ? (n - k) : 0; n   r = (m < n) ? m : n; n   cout << (r - l + 1) <<   n ; n   return 0; n } n


#include <bits/stdc++.h> n using namespace std; n const int MAXN = 130; n int a[MAXN]; n int main() { n   int N; n   cin >> N; n   for (int i = 1; i < (N + 1); ++i) cin >> a[i]; n   bool ok = 0; n   if ((a[N] & 1) == 0 || (a[1] & 1) == 0) n     ok = 0; n   else if (N & 1) n     ok = 1; n   if (ok) n     cout <<  Yes  << endl; n   else n     cout <<  No  << endl; n } n


#include <bits/stdc++.h> n using namespace std; n struct segment_tree { n   long long a[1 << 20][5]; n   int sz[1 << 20]; n   int N; n   void initi(int x) { n     N = 1; n     while (N < x) N <<= 1; n   } n   void pushup(int x) { n     int pos = x + N - 1; n     while (x > 0) { n       x = (x - 1) >> 1; n       sz[x] = sz[(x << 1) + 1] + sz[(x << 1) + 2]; n       for (int i = 0; i < 5; i++) a[x][i] = 0; n       for (int i = 0; i < 5; i++) { n         a[x][i] += a[(x << 1) + 1][i]; n         a[x][(i + sz[(x << 1) + 1]) % 5] += a[(x << 1) + 2][i]; n       } n     } n   } n   void ins(int x, int y) { n     int pos = x + N - 1; n     sz[pos]++; n     a[pos][0] = y; n     pushup(pos); n   } n   void del(int x) { n     int pos = x + N - 1; n     sz[pos]--; n     a[pos][0] = 0; n     pushup(pos); n   } n } tr; n int n; n int s[100010]; n vector<int> v; n vector<int> vc; n map<int, int> mp; n int l; n int main() { n   cin >> n; n   for (int i = 0; i < n; i++) { n     string t; n     int x; n     cin >> t; n     if (t ==  add ) { n       cin >> x; n       v.push_back(x); n       vc.push_back(x); n     } else if (t ==  del ) { n       cin >> x; n       v.push_back(-x); n     } else { n       v.push_back(0); n     } n   } n   sort(vc.begin(), vc.end()); n   tr.initi((int)vc.size()); n   for (int i = 0; i < vc.size(); i++) { n     mp[vc[i]] = i; n   } n   for (int i = 0; i < v.size(); i++) { n     if (!v[i]) { n       printf( %lld n , tr.a[0][2]); n     } else if (v[i] < 0) { n       tr.del(mp[-v[i]]); n     } else { n       tr.ins(mp[v[i]], v[i]); n     } n   } n   return 0; n } n


#include <bits/stdc++.h> n using namespace std; n const int N = 100010; n void answer(int u) { n   printf( ! %d n , u); n   fflush(stdout); n } n int ask(int u) { n   printf( ? %d n , u); n   fflush(stdout); n   int res; n   scanf( %d , &res); n   return res; n } n bool inside(int u, pair<int, int> v) { n   return ((u > v.first) ^ (u >= v.second)) == 1; n } n bool check(pair<int, int> u, pair<int, int> v) { n   if (inside(u.first, v) && inside(u.second, v)) { n     return 1; n   } n   if (inside(v.first, u) && inside(v.second, u)) { n     return 1; n   } n   if (inside(u.first, v) && inside(v.first, u)) { n     return 1; n   } n   if (inside(u.second, v) && inside(v.second, u)) { n     return 1; n   } n   return 0; n } n int main() { n   int n; n   scanf( %d , &n); n   if ((n / 2) % 2 != 0) { n     answer(-1); n     return 0; n   } n   int x = ask(1); n   int y = ask(1 + n / 2); n   if (x == y) { n     answer(1); n     return 0; n   } n   pair<int, int> u(x, y); n   pair<int, int> v(y, x); n   int low = 1, high = n / 2 + 1; n   while (high - low > 1) { n     int mid = (high + low) / 2; n     int foo = ask(mid); n     int bar = ask(mid + n / 2); n     if (foo == bar) { n       answer(mid); n       return 0; n     } n     pair<int, int> a(u.first, foo); n     pair<int, int> b(v.first, bar); n     if (check(a, b)) { n       high = mid; n       u = a; n       v = b; n     } else { n       low = mid; n       u = make_pair(foo, u.second); n       v = make_pair(bar, v.second); n     } n   } n   answer(low); n   return 0; n } n


#include <bits/stdc++.h> n using namespace std; n const int INFL = (int)1e9; n const long long int INFLL = (long long int)1e18; n const double INFD = numeric_limits<double>::infinity(); n const double PI = 3.14159265358979323846; n bool nearlyeq(double x, double y) { return abs(x - y) < 1e-9; } n bool inrange(int x, int t) { return x >= 0 && x < t; } n long long int rndf(double x) { n   return (long long int)(x + (x >= 0 ? 0.5 : -0.5)); n } n long long int floorsqrt(long long int x) { n   long long int m = (long long int)sqrt((double)x); n   return m + (m * m <= x ? 0 : -1); n } n long long int ceilsqrt(long long int x) { n   long long int m = (long long int)sqrt((double)x); n   return m + (x <= m * m ? 0 : 1); n } n long long int rnddiv(long long int a, long long int b) { n   return (a / b + (a % b * 2 >= b ? 1 : 0)); n } n long long int ceildiv(long long int a, long long int b) { n   return (a / b + (a % b == 0 ? 0 : 1)); n } n long long int gcd(long long int m, long long int n) { n   if (n == 0) n     return m; n   else n     return gcd(n, m % n); n } n long long int lcm(long long int m, long long int n) { n   return m * n / gcd(m, n); n } n class Max_Queue { n  private: n   stack<pair<long long int, long long int> > stk0, stk1; n   void rebuffer() { n     while (stk1.size()) { n       long long int x = stk1.top().first; n       long long int y = stk0.size() ? stk0.top().second : LLONG_MIN; n       stk0.push({x, max(x, y)}); n       stk1.pop(); n     } n   } n  n  public: n   void push(long long int x) { n     long long int y = stk1.size() ? stk1.top().second : LLONG_MIN; n     stk1.push({x, max(x, y)}); n   } n   long long int front() { n     if (stk0.empty()) rebuffer(); n     return stk0.top().first; n   } n   void pop() { n     if (stk0.empty()) rebuffer(); n     stk0.pop(); n   } n   size_t size() { return stk0.size() + stk1.size(); } n   void clear() { n     while (stk0.size()) stk0.pop(); n     while (stk1.size()) stk1.pop(); n   } n   long long int get_max() { n     long long int x = LLONG_MIN, y = LLONG_MIN; n     if (stk0.size()) x = stk0.top().second; n     if (stk1.size()) y = stk1.top().second; n     return max(x, y); n   } n }; n long long int dist(long long int s, long long int t, long long int n) { n   if (s <= t) n     return t - s; n   else n     return t + n - s; n } n int main() { n   int n, m; n   cin >> n >> m; n   vector<long long int> a(n, LLONG_MAX); n   vector<long long int> cnt(n, 0); n   for (int i = 0; i < (int)(m); i++) { n     long long int s, t; n     cin >> s >> t; n     s--; n     t--; n     a[s] = min(a[s], dist(s, t, n)); n     cnt[s]++; n   } n   vector<long long int> ans(n, 0); n   Max_Queue mq; n   for (int j = 0; j < (int)(n); j++) { n     long long int buf = -n; n     if (cnt[j] > 0) buf = dist(0, j, n) + (cnt[j] - 1) * n + a[j]; n     mq.push(buf); n   } n   for (int i = 0; i < (int)(n); i++) { n     ans[i] = mq.get_max() - i; n     long long int x = mq.front(); n     mq.pop(); n     mq.push(x + n); n   } n   for (int extra_i = 0; extra_i < (int)(ans.size()); extra_i++) { n     cout << ans[extra_i] <<    ; n   } n   cout << endl; n   ; n } n


#include <bits/stdc++.h> n using namespace std; n int main() { n   int t; n   cin >> t; n   while (t--) { n     int n; n     cin >> n; n     for (int i = 0; i < n; i++) { n       cout << 1 <<    ; n     } n     cout << endl; n   } n   return 0; n } n


#include <bits/stdc++.h> n using namespace std; n void display(vector<int> v1) { n   for (long long int i = 0; i < v1.size(); i++) { n     cout << v1[i] <<    ; n   } n   cout << endl; n } n long long int dx[8] = {0, 1, 0, -1, 1, 1, -1, -1}; n long long int dy[8] = {1, 0, -1, 0, 1, -1, 1, -1}; n int n, dp[9000][2]; n vector<int> v1[2]; n int main() { n   ios_base::sync_with_stdio(false); n   cin.tie(0); n   cin >> n; n   memset(dp, -1, sizeof(dp)); n   for (int p = 0, k; p < 2; p += 1) { n     cin >> k; n     v1[p].resize(k); n     for (long long int i = 0; i < k; i++) { n       cin >> v1[p][i]; n     } n   } n   dp[1][0] = 0; n   dp[1][1] = 0; n   bool flag = true; n   while (flag) { n     flag = false; n     for (int i = n; i >= 2; i--) n       for (int p = 0; p < 2; p++) n         if (dp[i][p] == -1) { n           bool can = false; n           for (int x : v1[p]) { n             int nxt = (i + x) % n + n * !bool((i + x) % n); n             if (!dp[nxt][p ^ 1]) { n               dp[i][p] = 1; n               flag = true; n               can = true; n               break; n             } else if (dp[nxt][p ^ 1] == -1) n               can = true; n           } n           if (!can) dp[i][p] = 0, flag = true; n         } n   } n   for (int p = 0; p < 2; p++) { n     for (int i = 2; i <= n; i++) { n       if (dp[i][p] == -1) { n         cout <<  Loop  ; n       } else if (dp[i][p] == 1) { n         cout <<  Win  ; n       } else { n         cout <<  Lose  ; n       } n     } n     cout << endl; n   } n   return 0; n } n


#include <bits/stdc++.h> n using namespace std; n const int mod = 998244353; n const int N = 5e5 + 5; n long long l[N], r[N], x[N], d[N], s[N], pre[N], dp[N]; n int n, m; n inline long long solve(int u) { n   for (int i = 1; i <= n; i++) d[i] = s[i] = pre[i] = 0; n   for (int i = 1; i <= m; i++) { n     if (x[i] >> u & 1) { n       d[r[i] + 1]--; n       d[l[i]]++; n     } else { n       pre[r[i]] = max(pre[r[i]], l[i]); n     } n   } n   dp[0] = s[0] = 1; n   for (int i = 1; i <= n; i++) { n     d[i] += d[i - 1]; n     pre[i] = max(pre[i], pre[i - 1]); n     if (d[i] > 0) n       dp[i] = 0; n     else if (pre[i - 1] > 0) n       dp[i] = (s[i - 1] - s[pre[i - 1] - 1]) % mod; n     else n       dp[i] = s[i - 1]; n     s[i] = (s[i] + s[i - 1] + dp[i]) % mod; n   } n   return pre[n] == 0 ? s[n] % mod : (s[n] - s[pre[n] - 1]) % mod; n } n int main() { n   int k; n   scanf( %d%d%d , &n, &k, &m); n   for (int i = 1; i <= m; i++) scanf( %lld%lld%lld , &l[i], &r[i], &x[i]); n   long long ans = 1; n   for (int i = 0; i < k; i++) ans = ans * solve(i) % mod; n   printf( %lld n , (ans + mod) % mod); n   return 0; n } n


#include <bits/stdc++.h> n using namespace std; n long long mod = 1e9 + 7; n int inf = 1e9; n double eps = 1e-6; n int main() { n   int n, k; n   cin >> n >> k; n   vector<int> a; n   for (int i = 0; i < n; i++) { n     int t; n     cin >> t; n     a.push_back(t); n   } n   if (k == 1) { n     int ans = a[0]; n     for (int i = 1; i < n; i++) { n       ans = min(ans, a[i]); n     } n     cout << ans; n   } else if (k > 2) { n     int ans = a[0]; n     for (int i = 1; i < n; i++) { n       ans = max(ans, a[i]); n     } n     cout << ans; n   } else { n     int ans = INT_MIN; n     multiset<int> p; n     multiset<int> q; n     p.insert(a[0]); n     for (int i = 1; i < n; i++) { n       q.insert(a[i]); n     } n     ans = max(ans, max(*q.begin(), *p.begin())); n     for (int i = 1; i < n - 1; i++) { n       p.insert(a[i]); n       q.erase(q.find(a[i])); n       ans = max(ans, max(*q.begin(), *p.begin())); n     } n     cout << ans; n   } n   return 0; n } n


#include <bits/stdc++.h> n int a[100005] = {}; n int p[100005] = {}; n int mbuy[100005] = {}; n int main() { n   std::ios_base::sync_with_stdio(false); n   std::cin.tie(NULL); n   std::cout.tie(NULL); n   int n, currmin = 1000000, buy = 0, last = 0; n   std::cin >> n; n   for (int i = 0; i < n; i++) std::cin >> a[i] >> p[i]; n   for (int i = 0; i < n; i++) { n     if (p[i] < currmin) { n       mbuy[last] = buy; n       currmin = p[i]; n       last = i; n       buy = 0; n     } n     buy += a[i]; n   } n   mbuy[last] = buy; n   long long int ans = 0; n   for (int i = 0; i < n; i++) { n     ans += mbuy[i] * p[i]; n   } n   std::cout << ans <<   n ; n } n


#include <bits/stdc++.h> n using namespace std; n const int N = 1e5; n const int inf = 1e7; n int tree[4 * N + 100], ans[2 * N + 100]; n vector<int> R[N + 100], C[N + 100]; n vector<pair<pair<int, int>, pair<int, int> > > qr[N + 100], qc[N + 100]; n void update(int v, int tl, int tr, int idx, int val) { n   if (tl == tr) { n     tree[v] = val; n   } else { n     int tm = (tl + tr) / 2; n     if (idx <= tm) { n       update(v * 2, tl, tm, idx, val); n     } else { n       update(v * 2 + 1, tm + 1, tr, idx, val); n     } n     tree[v] = min(tree[v * 2], tree[v * 2 + 1]); n   } n } n int getMin(int v, int tl, int tr, int l, int r) { n   if (l > r) { n     return inf; n   } n   if (l == tl && r == tr) { n     return tree[v]; n   } n   int tm = (tl + tr) / 2; n   return min(getMin(v * 2, tl, tm, l, min(r, tm)), n              getMin(v * 2 + 1, tm + 1, tr, max(tm + 1, l), r)); n } n int main() { n   int n, m, k, q; n   scanf( %d%d%d%d , &n, &m, &k, &q); n   for (int i = 1; i <= k; i++) { n     int x, y; n     scanf( %d%d , &x, &y); n     R[y].push_back(x); n     C[x].push_back(y); n   } n   for (int i = 1; i <= q; i++) { n     int x1, y1, x2, y2; n     scanf( %d%d%d%d , &x1, &y1, &x2, &y2); n     qc[x2].push_back(make_pair(make_pair(y1, y2), make_pair(x1, i))); n     qr[y2].push_back(make_pair(make_pair(x1, x2), make_pair(y1, i))); n   } n   memset(tree, 0, sizeof tree); n   for (int i = 1; i <= n; i++) { n     for (auto it : C[i]) { n       update(1, 1, m, it, i); n     } n     for (auto it : qc[i]) { n       int mn = getMin(1, 1, m, it.first.first, it.first.second); n       if (mn >= it.second.first) { n         ans[it.second.second] = 1; n       } n     } n   } n   memset(tree, 0, sizeof tree); n   for (int i = 1; i <= m; i++) { n     for (auto it : R[i]) { n       update(1, 1, n, it, i); n     } n     for (auto it : qr[i]) { n       int mn = getMin(1, 1, n, it.first.first, it.first.second); n       if (mn >= it.second.first) { n         ans[it.second.second] = 1; n       } n     } n   } n   for (int i = 1; i <= q; i++) { n     if (ans[i]) { n       printf( YES n ); n     } else { n       printf( NO n ); n     } n   } n } n