malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const long long int mod = 1000000000 + 7;   long long int n, k, summ, tr, a[1000000], minn, maxx;   string s, s1;   map<int, int> been;   int compare(const void* a, const void* b) {     return ((*(long long int*)a) - (*(long long int*)b));   };   int gcd(int a, int b) {     while (b != 0) {       int t = b;       b = a % b;       a = t;     }     return a;   }   int NOK(int n1, int n2) { return n1 * n2 / gcd(n1, n2); }   int main() {     cin >> n;     for (int i = 0; i < n; i++) {       been.clear();       maxx =  a  - 1;       minn =  z  + 1;       cin >> s;       for (int j = 0; j < s.length(); j++) {         if (been[s[j]] == 1) {           minn = -1000;           break;         }         been[s[j]] = 1;         minn = min(minn, (long long int)s[j]);         maxx = max(maxx, (long long int)s[j]);       }       if (maxx - minn + 1 != s.length()) {         cout <<  No  << endl;       } else {         cout <<  Yes  << endl;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     long long t;     cin >> t;     while (t--) {       int a;       set<int> pr;       cin >> a;       int ar[a];       for (int i = 0; i < a; i++) {         cin >> ar[i];         pr.insert(ar[i]);       }       cout << pr.size() << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   const int maxl = 100000;   map<int, int> SG, num;   int n, x, tmp, ans = 0, prime[maxl], tot = 0;   bool notprime[maxl + 1];   inline void init() {     notprime[1] = 1;     for (int i = 2; i <= maxl; i++) {       if (!notprime[i]) prime[++tot] = i;       for (int j = 1; j <= tot && i * prime[j] <= maxl; j++) {         notprime[i * prime[j]] = 1;         if (i % prime[j] == 0) break;       }     }   }   inline int solve(int x) {     if (x == 0) return 0;     if (SG.count(x)) return SG[x];     map<int, int> vis;     int p = x, t = 0;     while (p) {       p /= 2;       t++;     }     for (int i = 1; i <= t; i++)       vis[solve((x >> i) | (x & ((1 << (i - 1)) - 1)))] = 1;     for (int i = 0;; i++)       if (!vis[i]) return SG[x] = i;   }   int main() {     init();     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       scanf( %d , &x);       for (int pos = 1; prime[pos] * prime[pos] <= x; pos++) {         tmp = 0;         while (x % prime[pos] == 0) {           x /= prime[pos];           tmp++;         }         if (tmp != 0) num[prime[pos]] = num[prime[pos]] | (1 << (tmp - 1));       }       if (x != 1) num[x] |= 1;     }     for (map<int, int>::iterator it = num.begin(); it != num.end(); it++)       ans = ans ^ solve(it->second);     if (ans == 0)       puts( Arpa );     else       puts( Mojtaba );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long pi = 1, sum = 0, n, k, a[200100], pos[200100];   const long long inf = (long long)1e19;   int main() {     scanf( %I64d %I64d , &n, &k);     for (int i = 1; i <= n; i++) {       scanf( %I64d , &a[i]);       pos[i] = (a[i - 1] != 1 ? i - 1 : pos[i - 1]);     }     long long ans = 0;     for (long long i = 1; i <= n; i++) {       pi = sum = a[i];       ans += (k == 1);       for (long long now = pos[i], pre = i;; pre = now, now = pos[now]) {         long long mid = pi - sum * (long long)k;         if (mid > 0 && mid % k == 0 && mid / k < pre - now) ans++;         if (!now || inf / a[now] < pi) break;         pi *= (long long)a[now];         sum += a[now] + pre - now - 1;         ans += (pi == sum * (long long)k);       }     }     printf( %I64d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAX = 100005;   int n;   unordered_map<int, int> bit[MAX];   unordered_map<int, int> idx;   int inf = 1000000001;   void update(int pos, int t, int val) {     for (; t < inf; t += (t & -t)) {       bit[pos][t] += val;     }   }   int get(int pos, int t) {     int ans = 0;     for (; t > 0; t -= (t & -t)) ans += bit[pos][t];     return ans;   }   int main() {     int type, t, x;     scanf( %d , &n);     for (int i = 0; i < n; i++) {       scanf( %d %d %d , &type, &t, &x);       if (!idx.count(x)) idx[x] = i;       int cur = idx[x];       if (type == 1) {         update(idx[x], t, 1);       }       if (type == 2) {         update(idx[x], t, -1);       }       if (type == 3) {         int ans = get(idx[x], t);         printf( %d n , ans);       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 100005;   vector<int> graph[MAXN];   int values[MAXN];   long long dp[MAXN];   int leftValue[MAXN];   priority_queue<pair<long long, int>, vector<pair<long long, int> >,                  greater<pair<long long, int> > >       pq;   void dfs(int u, int prev) {     for (int v : graph[u]) {       if (v == prev || values[v] == 0) {         continue;       }       values[v]--;       dfs(v, u);     }     while (!pq.empty()) {       pq.pop();     }     for (int v : graph[u]) {       if (v == prev) {         continue;       }       pq.push({dp[v], v});     }     int currentLeft = values[u];     while (!pq.empty()) {       if (pq.size() <= values[u]) {         dp[u] += pq.top().first + 1;         values[pq.top().second] = leftValue[pq.top().second];         currentLeft--;       }       pq.pop();     }     for (int v : graph[u]) {       if (v == prev || values[v] == 0) {         continue;       }       int pick = min(currentLeft, values[v]);       currentLeft -= pick;       values[v] -= pick;       dp[u] += 2 * pick;     }     dp[u]++;     leftValue[u] = currentLeft;   }   int main() {     cin.sync_with_stdio(false);     cin.tie(0);     int n;     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> values[i];     }     for (int i = 1; i < n; i++) {       int in, out;       cin >> in >> out;       graph[in].push_back(out);       graph[out].push_back(in);     }     int root;     cin >> root;     dfs(root, -1);     cout << dp[root] - 1 << endl;     cin.get();     cin.get();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long logn = 63;   const long long inf = 1e18;   void upd(long long& a, const long long& b) { a = min(a, b); }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     int n;     cin >> n;     vector<long long> a(n), b(n);     for (int i = 0; i < n; i++) cin >> a[i];     long long mx = *max_element(a.begin(), a.end());     for (int i = 0; i < n; i++) b[i] = mx - a[i];     vector<vector<long long> > dp(logn, vector<long long>(n + 1, inf));     dp[0][0] = 0;     vector<int> s;     for (int i = 0; i < n; i++) s.push_back(i);     for (long long bit = 0; bit + 1 < logn; bit++) {       if (bit) {         vector<int> nws;         for (int i : s)           if (!(b[i] & (1ll << (bit - 1)))) nws.push_back(i);         for (int i : s)           if (b[i] & (1ll << (bit - 1))) nws.push_back(i);         s = nws;       }       vector<long long> pf0(n + 1, 0), pf1(n + 1, 0);       for (int i = 0; i < n; i++) {         pf0[i + 1] = pf0[i], pf1[i + 1] = pf1[i];         if (b[s[i]] & (1ll << bit))           pf1[i + 1]++;         else           pf0[i + 1]++;       }       for (int sf = 0; sf <= n; sf++) {         int b0ones = pf1[n - sf] + (pf0[n] - pf0[n - sf]);         int b0carry = pf1[n] - pf1[n - sf];         upd(dp[bit + 1][b0carry], dp[bit][sf] + b0ones);         int b1ones = pf0[n - sf] + (pf1[n] - pf1[n - sf]);         int b1carry = n - pf0[n - sf];         upd(dp[bit + 1][b1carry], dp[bit][sf] + b1ones);       }     }     cout << dp[logn - 1][0] <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int limit = 453;   int n, m, q, i, x, y, col;   vector<pair<int, int> > edges[100011];   pair<int, int> Q[100011];   vector<int> cols[100011];   int sz[100011];   int id_big[100011], cnt_big;   int dad[100011];   vector<int> who[100011];   int big[limit + 11][100011];   bool us[100011];   vector<int> appear[100011];   int groups;   int Find(int x) {     if (dad[x] == x) return x;     dad[x] = Find(dad[x]);     return dad[x];   }   bool Merge(int x, int y) {     x = Find(x);     y = Find(y);     if (x == y) return false;     dad[x] = y;     return true;   }   void pre() {     int i;     for (i = 1; i <= n; i++) {       dad[i] = i;       sort(cols[i].begin(), cols[i].end());       cols[i].resize(unique(cols[i].begin(), cols[i].end()) - cols[i].begin());       sz[i] = cols[i].size();       if (sz[i] >= limit) id_big[i] = ++cnt_big;     }   }   void solve_color(int id) {     for (auto e : edges[id]) Merge(e.first, e.second);     for (auto e : edges[id]) {       if (!us[e.first]) who[Find(e.first)].push_back(e.first);       if (!us[e.second]) who[Find(e.second)].push_back(e.second);       us[e.first] = us[e.second] = true;     }     for (auto e : edges[id]) {       int node = e.first;       if (who[e.second].size() > 0) node = e.second;       if (who[node].size() > 0) {         groups++;         for (auto n1 : who[node]) {           appear[n1].push_back(groups);           if (sz[n1] < limit) continue;           for (auto n2 : who[node]) big[id_big[n1]][n2]++;         }         who[node].clear();       }     }     for (auto e : edges[id])       dad[e.first] = e.first, dad[e.second] = e.second,       us[e.first] = us[e.second] = false;   }   int main() {     scanf( %d%d , &n, &m);     for (i = 1; i <= m; i++) {       scanf( %d%d%d , &x, &y, &col);       edges[col].push_back(make_pair(x, y));       cols[x].push_back(col);       cols[y].push_back(col);     }     pre();     scanf( %d , &q);     for (i = 1; i <= q; i++) {       scanf( %d%d , &x, &y);       Q[i] = make_pair(x, y);     }     for (i = 1; i <= m; i++) {       if (edges[i].empty()) continue;       solve_color(i);     }     for (i = 1; i <= q; i++) {       if (sz[Q[i].first] > sz[Q[i].second]) swap(Q[i].first, Q[i].second);       if (sz[Q[i].second] < limit) {         int c0 = 0;         int c1 = 0;         int n1 = Q[i].first;         int n2 = Q[i].second;         int ans = 0;         while (c0 < appear[n1].size() && c1 < appear[n2].size()) {           if (appear[n1][c0] == appear[n2][c1]) {             ans++;             c0++;             c1++;             continue;           }           if (appear[n1][c0] < appear[n2][c1])             c0++;           else             c1++;         }         printf( %d n , ans);         continue;       }       printf( %d n , big[id_big[Q[i].second]][Q[i].first]);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, d, m, i, a, b;     cin >> n >> d >> m;     for (i = 0; i < m; i++) {       cin >> a >> b;       if ((a - b + d) * (a - b - d) <= 0 &&           (a + b - d) * (a + b + d - 2 * n) <= 0)         cout <<  YES  << endl;       else         cout <<  NO  << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long s;     scanf( %I64d , &s);     long long d = s;     int n = 0;     while (s > 0) {       d /= 10;       d *= 10;       int a = s - d;       if (a == 4 || a == 7) {         n++;       }       s /= 10;       d = s;     }     if (n == 0) {       printf( NO );       return 0;     }     d = n;     while (n > 0) {       d /= 10;       d *= 10;       int a = n - d;       if (a != 4 && a != 7) {         printf( NO );         return 0;       }       n /= 10;       d = n;     }     printf( YES );   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long int n, a, b, k;     cin >> n >> a >> b >> k;     long long int skips_left = k;     long long int win = 0;     long long int h[n];     long long int skips_req[n];     for (long long int m = 0; m < n; m++) {       skips_req[m] = 0;     }     for (long long int j = 0; j < n; j++) {       cin >> h[j];       long long int rem = (h[j] % (a + b));       if ((0 < rem) && (rem <= a)) {         skips_req[j] = 0;       } else if ((a < rem) && (rem < (a + b))) {         long long int skips;         if ((rem - a) % a == 0) {           skips_req[j] = (rem - a) / a;         } else {           skips = (rem - a) / a + 1;           skips_req[j] = skips;         }       } else if (rem == 0) {         long long int skips;         if ((b) % a == 0) {           skips_req[j] = b / a;         } else {           skips = (b / a) + 1;           skips_req[j] = skips;         }       }     }     sort(skips_req, skips_req + n);     long long int d;     d = 0;     while ((skips_left > 0) && (d < n)) {       skips_left = skips_left - skips_req[d];       if (skips_left >= 0) {         win++;       }       d++;     }     cout << win << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MaxN = 400007;   const int mod = (int)1e9 + 7;   int a, b, k, t, N;   int ans, f[MaxN], s[MaxN];   int main() {     int i, j;     scanf( %d%d%d%d , &a, &b, &k, &t);     f[2 * k * t + 1] = 1;     N = 4 * k * t + 1;     for (i = 1; i <= t + t; i++) {       for (j = 1; j <= N; j++) {         s[j] = (s[j - 1] + f[j]) % mod;       }       for (j = 1; j <= N; j++) {         f[j] = (s[min(N - 1, j + k)] - s[max(1, j - k - 1)]) % mod;         if (f[j] < 0) f[j] += mod;       }     }     ans = 0;     for (i = 2 * k * t + b - a + 2; i <= N; i++) ans = (ans + f[i]) % mod;     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   bool DEB = 0;   void __start__() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);   }   mt19937_64 rnd(time(0));   using ll = long long;   using vi = vector<int>;   using ld = long double;   using pii = pair<int, int>;   void test_case() {     ll n, k, two, five, c = 1;     cin >> n >> k;     two = k;     five = k;     while (n % 2 == 0 && two) n /= 2, two--;     while (n % 5 == 0 && five) n /= 5, five--;     cout << n << string(k,  0 );   }   signed main() {     __start__();     int Q = 1;     while (Q--) test_case();   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     vector<int> c(n);     for (int i = 0; i < n; ++i) {       scanf( %d , &c[i]);     }     vector<int> ans(n + 1, 0);     for (int i = 0; i < n; ++i) {       vector<int> mx(n + 1, 0);       int p = 0;       for (int k = i; k < n; ++k) {         mx[c[k]] += 1;         if (mx[c[k]] > mx[p]) {           p = c[k];         } else if (mx[c[k]] == mx[p]) {           p = min(p, c[k]);         }         ans[p] += 1;       }     }     for (int i = 1; i <= n; ++i) {       printf( %d  , ans[i]);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string s;     cin >> s;     long long res = 1;     long long mdl = 1000000000 + 7;     long long s1 = s.size();     vector<long long> fibo(s1 + 1);     fibo[0] = 1;     fibo[1] = 1;     for (long long i = 0; i < s1; i++) {       if (s[i] ==  m  || s[i] ==  w ) {         cout <<  0 ;         return 0;       }     }     for (long long j = 1; j < s1; j++) {       long long z = 1;       while ((j < s1) && ((s[j] == s[j - 1] && s[j] ==  u ) ||                           (s[j] == s[j - 1] && s[j] ==  n ))) {         z++;         j++;       }       long long i = 2;       while (i <= z) {         fibo[i] = (fibo[i - 1] + fibo[i - 2]) % mdl;         i++;       }       res = (res * fibo[z]) % mdl;     }     cout << res;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   char a[5005], b[5005];   int la, lb;   int memo[5005][5005];   int dp(int x, int y) {     if (x == la || y == lb)       return 0;     else if (memo[x][y] != -1) {       return memo[x][y];     } else {       int ans1 = dp(x, y + 1) % 1000000007;       int ans2 = 0;       if (a[x] == b[y]) {         ans2 = (dp(x + 1, y + 1) + 1) % 1000000007;       }       int ret = (ans1 + ans2) % 1000000007;       return memo[x][y] = ret;     }   }   int main() {     scanf( %s %s , a, b);     memset(memo, -1, sizeof(memo));     int i;     la = strlen(a);     lb = strlen(b);     int ans = 0;     for (i = 0; i < la; i++) {       ans = (ans + dp(i, 0)) % 1000000007;     }     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int a, b, n, s = 0, q = 0;     cin >> a >> b >> n;     for (int i = 1;; i++) {       if (n != 0) {         if (i % 2 == 1) {           if (a >= n) {             for (int j = n; j >= 1; j--) {               if (a % j == 0 && n % j == 0) {                 n = n - j;                 break;               }             }           } else {             for (int j = a; j >= 1; j--) {               if (a % j == 0 && n % j == 0) {                 n = n - j;                 break;               }             }           }         } else {           if (n >= b) {             for (int j = b; j >= 1; j--) {               if (b % j == 0 && n % j == 0) {                 n = n - j;                 break;               }             }           } else {             for (int j = n; j >= 1; j--) {               if (b % j == 0 && n % j == 0) {                 n = n - j;                 break;               }             }           }         }       }       if (n == 0) {         cout << (i + 1) % 2;         break;       }     }   }
#include <bits/stdc++.h>   using namespace std;   const int MOD = 1e9 + 7;   const int INF = 0x3f3f3f3f;   const int MAXN = 2005;   int n, m;   char maze[MAXN][MAXN];   void Dfs(int x, int y) {     if (x >= n - 1 || y >= m - 1 || x < 0 || y < 0) return;     int xx, yy, s = 0;     for (int i = 0; i < 2; ++i)       for (int j = 0; j < 2; ++j)         if (maze[x + i][y + j] ==  * ) {           s++;           xx = x + i;           yy = y + j;         }     if (s == 1) {       maze[xx][yy] =  . ;       for (int i = -1; i < 1; ++i)         for (int j = -1; j < 1; ++j) Dfs(xx + i, yy + j);     }   }   int main(int argc, char const *argv[]) {     scanf( %d %d , &n, &m);     for (int i = 0; i < n; ++i) scanf( %s , maze[i]);     for (int i = 0; i < n - 1; ++i)       for (int j = 0; j < m - 1; ++j) Dfs(i, j);     for (int i = 0; i < n; ++i) printf( %s n , maze[i]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<int> adj[200005];   int visited[200005];   int dfs(int u) {     visited[u] = 1;     int iscycle = ((adj[u].size() == 2) ? (1) : (0));     for (int i = 0; i < adj[u].size(); ++i) {       if (visited[adj[u][i]] == 0 and dfs(adj[u][i]) == 0) iscycle = 0;     }     return iscycle;   }   int main() {     int n, m;     scanf( %d%d , &n, &m);     for (int i = 0; i < m; ++i) {       int u, v;       scanf( %d%d , &u, &v);       adj[u].push_back(v);       adj[v].push_back(u);     }     for (int i = 0; i <= n; ++i) visited[i] = 0;     int ans = 0;     for (int i = 1; i <= n; ++i)       if (visited[i] == 0) ans += dfs(i);     printf( %d n , ans);   }
#include <bits/stdc++.h>   using namespace std;   long long MOD = 1e9 + 7;   long long MOD1 = 1e9 + 123;   long long MOD2 = 1e9 + 321;   vector<int> fun(string &s) {     int i;     vector<int> v;     for (i = 0; i + 1 < s.length(); i++)       if (s[i] != s[i + 1]) v.push_back(i + 1);     if (s[s.length() - 1] ==  1 ) v.push_back(s.length());     return v;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     ;     long long t, a, n, q, k, i, l, m, c, u, f, j, p, r, x, y, s, b, d;     cin >> t;     while (t--) {       cin >> n;       string S, P;       cin >> S >> P;       vector<int> v1, v2;       v1 = fun(S);       v2 = fun(P);       reverse(v2.begin(), v2.end());       cout << v1.size() + v2.size() <<    ;       for (auto h : v1) cout << h <<    ;       for (auto h : v2) cout << h <<    ;       cout <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void solve() {}   int main() {     long long a, b, c, d;     cin >> a >> b >> c >> d;     long long ans = 0;     long long l = max(c, a + b);     long long r = c + d + 1;     for (long long i = l; i < r; i++) {       long long che = min(i - c, d - c + 1);       long long e1 = max(0LL, i - 2 * b);       long long e2 = max(0LL, i - a - c);       long long e3 = max(0LL, i - b - c - 1);       long long e4 = (i - a - b + 1);       ans += (che * (e4 - e1 - e2 + e3));     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int a[1000006];   int n, k;   int max_a;   int has[20000007];   bool judge(int num) {     if (num == 1) return true;     int cnt = 0;     for (int i = 0; i < num * 2; i++) {       has[i] = i / num;     }     for (int i = num * 2; i <= max_a; i++) {       has[i] = has[i / 2] + has[i - i / 2];     }     for (int i = 0; i < n; i++) {       cnt += has[a[i]];       if (cnt >= k) {         return true;       }     }     return false;   }   int main() {     while (scanf( %d%d , &n, &k) != EOF) {       for (int i = 0; i < n; i++) {         scanf( %d , &a[i]);       }       long long sum = 0;       max_a = 0;       for (int i = 0; i < n; i++) {         sum += a[i];         if (a[i] > max_a) {           max_a = a[i];         }       }       if (sum < k) {         printf( -1 n );       } else {         int l = 1, r = max_a + 1;         while (l < r - 1) {           int m = (l + r) / 2;           if (judge(m)) {             l = m;           } else {             r = m;           }         }         while (judge(l)) {           l++;         }         cout << l - 1 << endl;       }     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t--) {       long long int n;       cin >> n;       vector<long long int> arr;       long long int num;       for (int i = 0; i < n; i++) {         cin >> num;         arr.push_back(num);       }       sort(arr.begin(), arr.end());       long long int sum = 0;       for (int i = 0; i < n - 1; i++) {         if (arr[i] != arr[i + 1]) {           sum++;         }       }       cout << sum + 1 << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   const inline int __GET_INT() {     int ret;     scanf( %d , &ret);     return ret;   }   int main() {     long long A = __GET_INT(), B = __GET_INT(), n = __GET_INT();     for (int i = 0; i < n; ++i) {       long long l = __GET_INT(), t = __GET_INT(), m = __GET_INT();       long long first = B * (l - 1) + A;       if (first > t) {         puts( -1 );       } else {         int r = -1;         long long low = 1, high = 1000000, mid;         while (low <= high) {           mid = (low + high) >> 1;           long long val = ((mid * (mid - 1)) / 2) * B + mid * first;           long long second = B * (l + mid - 2) + A;           if (second > t || val > (t * m)) {             high = mid - 1;           } else {             low = mid + 1;             r = l + mid - 1;           }         }         printf( %d n , r);       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int a[1005], b[1005];   char c[1005][1005];   int main() {     int n, m;     cin >> n >> m;     int cnt = 0;     for (int i = 1; i <= n; i++) {       for (int j = 1; j <= m; j++) {         cin >> c[i][j];         if (c[i][j] ==  * ) {           a[i]++;           b[j]++;           cnt++;         }       }     }     for (int i = 1; i <= n; i++) {       for (int j = 1; j <= m; j++) {         if (c[i][j] ==  * ) {           if (a[i] + b[j] - 1 == cnt) return cout <<  YES n  << i <<     << j, 0;         } else {           if (a[i] + b[j] == cnt) return cout <<  YES n  << i <<     << j, 0;         }       }     }     cout <<  NO ;   }
#include <bits/stdc++.h>   using namespace std;   long long n, A, B, C = 1;   const long long E = 1e9 + 7;   int main() {     cin >> n;     if (n <= 1) {       cout << 0 << endl;       return 0;     }     for (long long i = 2; i < n; i++) {       A = B;       B = C;       C = 2 * B + 3 * A;       C %= E;     }     long long ans = (3 * C) % E;     cout << ans << endl;     return 0;   }