malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   void FastIO() {     ios_base::sync_with_stdio(0);     cin.tie(NULL);     cout.tie(NULL);   }   long long int mod = 2e9 + 10;   class SegmentTree {    public:     vector<int> st;     vector<int> lazy;     vector<int> A;     int n;     int left(int p) { return (p << 1) + 1; }     int right(int p) { return (p << 1) + 2; }     void build(int p, int l, int r) {       if (l == r)         st[p] = A[l];       else {         build(left(p), l, (l + r) / 2);         build(right(p), (l + r) / 2 + 1, r);         st[p] = st[left(p)] + st[right(p)];       }     }     SegmentTree(vector<int> a) {       A = a;       n = (int)A.size();       st.assign(4 * n, 0);       lazy.assign(4 * n, 0);       build(0, 0, n - 1);     }     void lazyUpdate(int pos, int l, int r) {       st[pos] += lazy[pos] * (r - l + 1);       if (l != r) {         lazy[left(pos)] += lazy[pos];         lazy[right(pos)] += lazy[pos];       }       lazy[pos] = 0;     }     int query(int pos, int l, int r, int i, int j) {       lazyUpdate(pos, l, r);       if (i > r || j < l || l > r) return 0;       if (i <= l && r <= j) {         return st[pos];       }       long long int q1 = query(left(pos), l, (l + r) / 2, i, j);       long long int q2 = query(right(pos), (l + r) / 2 + 1, r, i, j);       return (q1 + q2) % mod;     }     void update(int pos, int l, int r, int i, int j, int val) {       lazyUpdate(pos, l, r);       if (i > r || j < l || l > r) return;       if (i <= l && r <= j) {         st[pos] += val * (r - l + 1);         if (l != r) {           lazy[left(pos)] += val;           lazy[right(pos)] += val;         }         return;       }       update(left(pos), l, (l + r) / 2, i, j, val);       update(right(pos), (l + r) / 2 + 1, r, i, j, val);       st[pos] = (st[left(pos)] + st[right(pos)]);     }   };   int main() {     FastIO();     int n, k, a, b, q, d, x, p, type;     cin >> n >> k >> a >> b >> q;     vector<int> V1(n, 0), V2(n, 0), V3(n, 0);     SegmentTree ST2(V2);     SegmentTree ST3(V3);     while (q--) {       cin >> type;       if (type == 1) {         cin >> d >> x;         d--;         V1[d] += x;         ST2.update(0, 0, n - 1, d, d, min(b, V1[d]) - V2[d]);         V2[d] = min(b, V1[d]);         ST3.update(0, 0, n - 1, n - d - 1, n - d - 1,                    min(a, V1[d]) - V3[n - d - 1]);         V3[n - d - 1] = min(a, V1[d]);       } else {         cin >> p;         p--;         int temp1 = 0, temp2 = 0;         if (p) {           temp1 = ST2.query(0, 0, n - 1, 0, p - 1);         }         p += k - 1;         p = n - p - 1;         if (p) {           temp2 = ST3.query(0, 0, n - 1, 0, p - 1);         }         cout << temp1 + temp2 <<   n ;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 5;   const double eps = 1e-8;   const int mod = 1e9 + 7;   int jia[N], jian[N], x[N], yes[N];   int out[N][3];   int abbs(int x) {     if (x > 0)       return x;     else       return -x;   }   int main() {     int n, m, t;     scanf( %d%d , &n, &m);     memset(out, 0, sizeof(out));     memset(yes, 0, sizeof(yes));     memset(jia, 0, sizeof(jia));     memset(jian, 0, sizeof(jian));     int alljia = 0, alljian = 0, all = 0;     for (int i = 1; i <= n; i++) {       scanf( %d , &x[i]);       if (x[i] > 0)         jia[x[i]]++, alljia++;       else         jian[-x[i]]++, alljian++;     }     for (int i = 1; i <= n; i++) {       int numzhen = jia[i] + alljian - jian[i];       if (numzhen == m) {         yes[i] = 1;         all++;       }     }     for (int i = 1; i <= n; i++) {       int xx = abbs(x[i]);       if (yes[xx]) {         if (all == 1) {           if (x[i] > 0)             out[i][0] = 1;           else             out[i][1] = 1;         } else {           out[i][2] = 1;         }       } else {         if (x[i] > 0)           out[i][1] = 1;         else           out[i][0] = 1;       }     }     for (int i = 1; i <= n; i++) {       if (out[i][2])         printf( Not defined n );       else if (out[i][0])         printf( Truth n );       else if (out[i][1])         printf( Lie n );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void c_p_c() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);   }   bool prime(long long c) {     for (long long i = 2; i * i <= c; i++) {       if (c % i == 0) return 0;     }     return 1;   }   int32_t main() {     c_p_c();     long long n;     cin >> n;     while (n--) {       long long a, b, s = 0;       cin >> a >> b;       while (a > 0 && b > 0) {         if (a > b) {           s += (a / b);           a -= (a / b) * b;         } else {           s += (b / a);           b -= (b / a) * a;         }       }       cout << s <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   int main() {     int m, n, i, j, k, p, l;     scanf( %d %d , &m, &n);     p = m + n;     int a[m], b[n], c[p];     for (i = 0; i < m; i++) {       scanf( %d , &a[i]);     }     for (i = 0; i < n; i++) {       scanf( %d , &b[i]);     }     k = 0;     for (i = 0; i < m; i++) {       for (j = 0; j < n; j++) {         if (a[i] == b[j]) {           c[k] = a[i];           k++;         }       }     }     l = k;     for (k = 0; k < l; k++) {       printf( %d  , c[k]);     }     return 0;   }
#include <bits/stdc++.h>   #pragma GCC optimize( O1 )   #pragma GCC optimize( O2 )   #pragma GCC optimize( Ofast )   #pragma GCC target( avx,avx2,fma )   using namespace std;   void input() { return; }   template <typename T1, typename... T2>   void input(T1 &x, T2 &...args) {     ((cin >> x), input(args...));   }   void wrt() {     cout <<   n ;     return;   }   template <typename T1, typename... T2>   void wrt(T1 x, T2... args) {     ((cout << x <<    ), wrt(args...));   }   template <typename T>   void inputlst(T &lst, int x, int y) {     for (int i = x; i < y; i++) cin >> lst[i];   }   template <typename T>   void printlst(T &lst, int x, int y) {     for (int i = x; i < y; i++) cout << lst[i] <<    ;     wrt();   }   const long long inf = INT64_MAX, MOD = 1e9 + 7, N = 10;   int main(int argc, char const *argv[]) {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     ;     int test;     cin >> test;     while (test--) {       int n, k, ans;       input(n, k);       vector<int> lst(n + 1);       inputlst(lst, 1, n + 1);       vector<vector<int> > dp(n + 1, vector<int>(n + 1, 0));       ans = n;       for (long long move = 0; move < n + 1; ++move) {         for (long long i = 1; i < n + 1; ++i) {           dp[i][move] =               max(dp[i][move], dp[i - 1][move] + (lst[i] == (i - move)));           dp[i][move + 1] = max(dp[i - 1][move], dp[i][move + 1]);           if (i == n) {             if (dp[i][move] >= k) ans = min(ans, (int)move);             if (dp[i][move + 1] >= k) ans = min(ans, (int)move + 1);           }         }       }       wrt(ans == n ? -1 : ans);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void debug() { cout << endl; }   template <class T, class... R>   void debug(T f, R... r) {     cout <<  [  << f <<  ] ;     debug(r...);   }   template <class T>   T mmin(T a, T b) {     return min(a, b);   }   template <class T, class... R>   T mmin(T a, R... b) {     return min(a, mmin(b...));   }   template <class T>   T mmax(T a, T b) {     return max(a, b);   }   template <class T, class... R>   T mmax(T a, R... b) {     return max(a, mmax(b...));   }   template <class T>   T mgcd(T a, T b) {     return __gcd(a, b);   }   template <class T, class... R>   T mgcd(T a, R... b) {     return __gcd(a, mgcd(b...));   }   void myin() {     freopen( 1.in ,  r , stdin);     freopen( 1.out ,  w , stdout);   }   namespace IO {   const int MX = 4e7;   char buf[MX];   int c, sz;   void begin() {     c = 0;     sz = fread(buf, 1, MX, stdin);   }   inline bool read(int &t) {     while (c < sz && buf[c] !=  -  && (buf[c] <  0  || buf[c] >  9 )) c++;     if (c >= sz) return false;     bool flag = 0;     if (buf[c] ==  - ) flag = 1, c++;     for (t = 0; c < sz &&  0  <= buf[c] && buf[c] <=  9 ; c++)       t = t * 10 + buf[c] -  0 ;     if (flag) t = -t;     return true;   }   }  // namespace IO   const int N = 1e5 + 5;   const int M = 1e5 + 5;   long long a[100005], e[200][200];   vector<long long> v, sz[100];   int main() {     long long n;     scanf( %lld , &n);     for (long long i = 1; i <= n; ++i) {       long long tmp;       scanf( %lld , &a[i]);       if (a[i]) v.push_back(a[i]);       for (long long j = 0; j < 63; ++j) {         if ((1ll << j) & a[i]) sz[j].push_back(a[i]);       }     }     for (long long i = 0; i < 63; ++i)       if (sz[i].size() > 2) {         return !printf( 3 );       }     memset(e, 0x3f, sizeof(e));     long long ans = 0x3f3f3f3f3f3f3f3f;     for (long long i = 0; i < v.size(); ++i) {       for (long long j = 0; j < v.size(); ++j) {         if (i != j && (v[i] & v[j])) e[i][j] = 1;       }     }     for (long long k = 0; k < v.size(); ++k) {       for (long long i = 0; i < v.size(); ++i) {         for (long long j = 0; j < v.size(); ++j) {           if (i == j || i == k || j == k) continue;           if ((v[i] & v[k] && v[k] & v[j])) ans = min(ans, e[i][j] + 2);         }       }       for (long long i = 0; i < v.size(); ++i) {         for (long long j = 0; j < v.size(); ++j) {           e[i][j] = min(e[i][j], e[i][k] + e[k][j]);         }       }     }     if (ans == 0x3f3f3f3f3f3f3f3f) ans = -1;     printf( %lld n , ans);     return 0;   }
#include <bits/stdc++.h>   const long double PI = acos(-1.0);   using namespace std;   int n, m;   long long dp[505][505];   int a[505];   long long cal(int l, int r) {     if (l >= r) return 1;     long long &ret = dp[l][r];     if (ret != -1) return ret;     ret = 0;     int mn = n + 1, idx = 0;     for (int i = l; i <= r; i++) {       if (a[i] < mn) {         mn = a[i];         idx = i;       }     }     long long lft = cal(l, idx - 1);     long long rgh = cal(idx + 1, r);     for (int i = l; i < idx; i++) {       lft += cal(l, i) * cal(i + 1, idx - 1);       lft %= 998244353;     }     for (int i = idx + 1; i <= r; i++) {       rgh += cal(idx + 1, i) * cal(i + 1, r);       rgh %= 998244353;     }     lft %= 998244353;     rgh %= 998244353;     ret = rgh * lft;     ret %= 998244353;     return ret;   }   void init() { memset(dp, -1, sizeof dp); }   void read_input() {     cin >> n >> m;     for (int i = 0; i < n; i++) cin >> a[i];   }   void solve() {     init();     cal(0, n - 1);   }   void print_ans() { cout << cal(0, n - 1) <<   n ; }   int main() {     int t = 1;     while (t--) {       read_input();       solve();       print_ans();       if (t) init();     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, i, j, k, l, m[1100];     char s[1100][34];     scanf( %d , &n);     map<string, int> mp, mp2;     for (i = 0; i < n; i++) {       scanf( %s%d , s[i], &m[i]);       mp[s[i]] += m[i];     }     string name;     int max = 0;     for (map<string, int>::iterator it = mp.begin(); it != mp.end(); it++) {       if (it->second > max) max = it->second;     }     for (i = 0; i < n; i++) {       mp2[s[i]] += m[i];       if (mp[s[i]] >= max && mp2[s[i]] >= max) break;     }     puts(s[i]);     scanf( %*d );   }
#include <bits/stdc++.h>   using namespace std;   struct node {     int st, ed;   } ch[100010];   bool cmp(node a, node b) { return a.st < b.st; }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     int n, l, a;     cin >> n >> l >> a;     for (int i = 0; i < n; i++) {       cin >> ch[i].st >> ch[i].ed;       ch[i].ed += ch[i].st;     }     sort(ch, ch + n, cmp);     int num = 0;     num += (ch[0].st) / a;     for (int i = 0; i < n - 1; i++) {       if (ch[i + 1].st - ch[i].ed >= a) {         num += (ch[i + 1].st - ch[i].ed) / a;       }     }     if (ch[n - 1].ed < l) {       num += (l - ch[n - 1].ed) / a;     }     cout << num << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long int x2, y2, x3, y3;   bool check(long long int x, long long int y) {     long long int xx = x3 * x3 + y3 * y3, tx = x2 + x, ty = y2 + y;     if (xx == 0) return x == x2 && y == y2;     long long int ret1 = tx * x3 + ty * y3, ret2 = tx * y3 - ty * x3;     if (ret1 % xx != 0 || ret2 % xx != 0) return false;     return true;   }   int main() {     long long int x1, y1;     cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;     if (check(x1, y1) || check(-x1, -y1) || check(-y1, x1) || check(y1, -x1))       cout <<  YES n ;     else       cout <<  NO n ;   }
#include <bits/stdc++.h>   using namespace std;   struct debugger {     template <typename T>     debugger& operator,(const T& v) {       cerr << v <<    ;       return *this;     }   } dbg;   vector<int> aa(200);   vector<int> bb(200);   int n, k;   int count(int i, int j) {     for (int h = i; h < n; h++) {       bb[h - i] = aa[h];     }     for (int h = 0; h < i; h++) {       bb[n - i + h] = aa[h];     }     int m = j - i;     sort(bb.begin(), bb.begin() + m);     sort(bb.begin() + m, bb.begin() + n);     int sum = 0;     for (int h = 0; h < m; h++) {       sum += bb[h];     }     for (int s = 0; s < k; s++) {       int p = s;       int q = n - 1 - s;       if (p >= m || q < m || bb[p] >= bb[q]) {         break;       }       sum += bb[q] - bb[p];     }     return sum;   }   int main() {     cin >> n >> k;     for (int i = 0; i < n; i++) {       int a;       cin >> a;       aa[i] = a;     }     int maxVal = INT_MIN;     for (int i = 0; i < n; i++) {       for (int j = i + 1; j <= n; j++) {         int cnt = count(i, j);         maxVal = max(maxVal, cnt);       }     }     cout << maxVal << endl;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t, n;     cin >> t;     for (int l = 0; l < t; l++) {       cin >> n;       int k;       k = 0;       int c;       c = 0;       char arr[n][5];       for (int i = 0; i < n; i++) {         for (int j = 0; j < 5; j++) {           cin >> arr[i][j];         }       }       for (int j = 0; j < 5; j++) {         k = 0;         for (int m = j + 1; m < 5; m++) {           int first = 0;           int second = 0;           int tie = 0;           for (int n1 = 0; n1 < n; n1++) {             if (arr[n1][j] ==  1  && arr[n1][m] ==  1 ) {               tie++;             } else {               if (arr[n1][j] ==  1 ) {                 second++;               }               if (arr[n1][m] ==  1 ) {                 first++;               }             }           }           if (first + second + tie == n && second + tie >= n / 2 &&               first + tie >= n / 2) {             c = 1;           }         }       }       if (c == 0) {         cout <<  NO  << endl;       } else {         cout <<  YES  << endl;       }     }     return 0;   }
#include <bits/stdc++.h>   #pragma GCC optimize( Ofast )   #pragma GCC optimize( unroll-loops )   #pragma GCC target( sse2 )   using namespace std;   template <typename Arg1>   void __f(const char* name, Arg1&& arg1) {     std::cerr << name <<   :   << arg1 <<   n ;   }   template <typename Arg1, typename... Args>   void __f(const char* names, Arg1&& arg1, Args&&... args) {     const char* comma = strchr(names + 1,  , );     std::cerr.write(names, comma - names) <<   :   << arg1 <<   |  ;     __f(comma + 1, args...);   }   long long max(long long a, long long b) { return (a > b) ? a : b; }   long long min(long long a, long long b) { return (a < b) ? a : b; }   void amax(long long& a, long long b) { a = max(a, b) % 1000000007; }   void amin(long long& a, long long b) { a = min(a, b) % 1000000007; }   void inc(long long& a, long long b) { a = (a + b) % 1000000007; }   void dec(long long& a, long long b) { a = (a - b + 1000000007) % 1000000007; }   long long n, a, b;   long long ans = 1e9;   void find(long long la, long long lb, long long level = 0) {     if (la == 0 && lb == 0) {       amin(ans, level);       return;     }     for (long long i = 0; i <= la; i++) {       long long n2 = n - i * a;       if (n2 < 0) break;       long long usedb = min(n2 / b, lb);       n2 -= usedb * b;       long long ii = i;       ii += n2 / a;       long long temp = n2 / a;       n2 -= temp * a;       ii = min(la, ii);       if (usedb == 0 && ii == 0) continue;       find(la - ii, lb - usedb, level + 1);     }   }   long long solve() {     cin >> n >> a >> b;     find(4, 2);     cout << ans;     return 0;   }   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long t = 1;     while (t--) {       solve();     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, k;     cin >> n >> k;     int *arr = new int[2 * n + 1];     cin >> arr[0];     for (int i = 1; i < 2 * n + 1; i += 2) {       cin >> arr[i] >> arr[i + 1];       if (k > 0 && arr[i] > arr[i - 1] + 1 && arr[i] > arr[i + 1] + 1) {         k -= 1;         arr[i] -= 1;       }     }     for (int i = 0; i < 2 * n + 1; i++) cout << arr[i] <<      ;     cout <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 105;   int no[maxn][maxn][15], sum[maxn][maxn][15];   int main() {     int n, q, c, ans, i, j, k, x, y, s, ss, t, x1, x2, y1, y2, tt, num;     while (scanf( %d%d%d , &n, &q, &c) != EOF) {       memset(no, 0, sizeof(no));       memset(sum, 0, sizeof(sum));       for (i = 1; i <= n; i++) {         scanf( %d%d%d , &x, &y, &s);         no[x][y][s]++;       }       for (j = 1; j <= 100; j++) {         for (i = 1; i <= 100; i++) {           for (k = 0; k <= c; k++) {             sum[i][j][k] = sum[i - 1][j][k] + no[i][j][k];           }         }       }       while (q--) {         ans = 0;         scanf( %d%d%d%d%d , &t, &x1, &y1, &x2, &y2);         for (j = y1; j <= y2; j++) {           for (k = 0; k <= c; k++) {             num = sum[x2][j][k] - sum[x1][j][k] + no[x1][j][k];             if (num > 0) {               if (t <= c - k)                 ss = k + t;               else {                 x = t - (c - k);                 tt = x % (c + 1);                 if (tt)                   ss = tt - 1;                 else                   ss = c;               }               ans += num * ss;             }           }         }         printf( %d n , ans);       }     }     return 0;   }
#include <bits/stdc++.h>   const int MaxN = 52, mod_v = 1000000007;   long long f[MaxN][MaxN >> 1][2], C[MaxN][MaxN];   void init_comb(int n) {     for (int i = 0; i <= n; ++i) {       C[i][i] = C[i][0] = 1;       for (int j = 1; j < i; ++j) {         C[i][j] = C[i - 1][j] + C[i - 1][j - 1];         if (C[i][j] >= mod_v) C[i][j] -= mod_v;       }     }   }   int main() {     int n0, k0;     std::cin >> n0 >> k0;     if (k0 << 1 > n0) {       std::cout <<  0 n ;       return 0;     }     init_comb(n0);     f[1][0][0] = 1;     f[0][0][1] = 1;     for (int n = 2; n <= n0; ++n) {       for (int k = 1; k <= std::min(k0, n >> 1); ++k) {         for (int g = 0; g <= 1; ++g) {           long long& val = f[n][k][g];           for (int n1 = 0, n2 = n - 1; n1 <= n2; ++n1, --n2) {             long long ways;             if (n1 != n2)               ways = C[n - 1][n1];             else               ways = C[n - 2][n1 - 1];             if (n1)               ways = ways * n1 * n2 % mod_v;             else               ways = ways * n2 % mod_v;             for (int k1 = 0; k1 + g <= k; ++k1) {               int k2 = k - k1 - g;               if (g == 0) {                 val += f[n1][k1][1] * f[n2][k2][1] % mod_v * ways % mod_v;               } else {                 val +=                     (f[n1][k1][1] * f[n2][k2][0] + f[n1][k1][0] * f[n2][k2][1] +                      f[n1][k1][0] * f[n2][k2][0]) %                     mod_v * ways % mod_v;               }             }             val %= mod_v;           }         }       }     }     std::cout << (f[n0][k0][0] + f[n0][k0][1]) % mod_v << std::endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<int> v1;   int status[(100000007 / 32) + 10];   bool check1(int n, int pos) { return (bool)(n & (1 << pos)); }   int set1(int n, int pos) { return n = n | (1 << pos); }   void sieve() {     int i, j, k;     k = int(sqrt(100000007));     for (i = 3; i <= k; i += 2) {       if (check1(status[i / 32], i % 32) == 0) {         for (j = i * i; j <= 100000007; j += 2 * i) {           status[j / 32] = set1(status[j / 32], j % 32);         }       }     }     v1.push_back(2);     for (i = 3; i < 100000007; i += 2) {       if (check1(status[i / 32], i % 32) == 0) v1.push_back(i);     }   }   vector<long long int> v2;   void factor(long long int k) {     long long int i, a;     v2.clear();     for (i = 0; i < v1.size(); i++) {       if (k == 1) break;       a = v1[i];       while (k % a == 0) {         if (k == 1) break;         v2.push_back(a);         k /= a;       }     }     if (k != 1) v2.push_back(k);   }   int main() {     sieve();     long long int a, b, c, d, i, j, k, l, m, n;     cin >> n;     factor(n);     if (v2.size() == 1 || v2.size() == 0) {       cout <<  1  << endl;       cout <<  0  << endl;       return 0;     }     if (v2.size() == 2) {       cout <<  2  << endl;       return 0;     }     cout <<  1  << endl;     cout << v2[0] * v2[1] << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 100 + 5;   const int inf = 1e9 + 7;   int n, m;   int num[MAXN];   map<int, int> q;   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; ++i) scanf( %d , &num[i]);     for (int i = 2; i <= n; ++i) {       q[num[i] - num[i - 1]]++;     }     if (q.size() == 1)       printf( %d n , num[n] + num[2] - num[1]);     else       printf( %d n , num[n]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   string ulaz, jed =  1 , dva =  14 , tri =  144 ;   bool je[10];   int main() {     cin >> ulaz;     int l = ulaz.size();     for (int i = 0; i < l; i++) je[i] = false;     for (int i = 0; i < l; i++) {       if (je[i] == true) continue;       if (i + 2 < l) {         string nov;         nov = ulaz[i];         nov += ulaz[i + 1];         nov += ulaz[i + 2];         if (nov == tri) {           je[i] = true;           je[i + 1] = true;           je[i + 2] = true;           i += 2;           continue;         }       }       if (i + 1 < l) {         string nov;         nov = ulaz[i];         nov += ulaz[i + 1];         if (nov == dva) {           je[i] = true;           je[i + 1] = true;           i += 1;           continue;         }       }       if (ulaz[i] == jed[0]) {         je[i] = true;         continue;       }     }     for (int i = 0; i < l; i++)       if (je[i] == false) {         cout <<  NO  << endl;         return 0;       }     cout <<  YES  << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   const ll P = 1e9 + 7;   ll N, M, K, R, C;   ll Dx, Dy;   ll mult(ll a, ll b) { return (a * b) % P; }   ll exp(ll num_classes) {     if (num_classes == 0) {       return 1;     }     ll temp = exp(num_classes / 2);     return (num_classes % 2) ? mult(K, mult(temp, temp)) : mult(temp, temp);   }   void input() {     ll Ax, Ay, Bx, By;     cin >> N >> M >> K >> R >> C;     cin >> Ax >> Ay >> Bx >> By;     Dx = (Ax > Bx) ? Ax - Bx : Bx - Ax;     Dy = (Ay > By) ? Ay - By : By - Ay;   }   ll count_classes() {     ll overlap = ((R > Dx) ? R - Dx : 0) * ((C > Dy) ? C - Dy : 0);     ll classes = N * M - (2 * R * C - overlap);     if (overlap == 0) {       return classes + R * C;     }     if (Dx == 0 && Dy == 0) {       return classes + R * C;     }     return classes + (R * Dy) + (C * Dx) - Dx * Dy;   }   int main() {     input();     cout << exp(count_classes()) << endl;   }