#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
using namespace std;
using ll = long long;
const ll INF = INT_MAX;
#define DBG cout << "# yay!" << endl;
// #define DBG
// todo: stop doing this
#define int long long
#define uchar unsigned char
#define FOR(i, a, b) for(int i = a ; i <= b ; i++)
#define ROF(i, a, b) for(int i = a ; i >= b ; i--)
#define FORK(i, a, b, k) for(int i = a ; i <= b ; i += k)
#define ROFK(i, a, b, k) for(int i = a ; i >= b ; i -= k)
#define vi vector<int>
#define pb push_back
#define ins insert
#define mpi map<int, int>
#define ALL(d) d.begin(), d.end()
#define F first
#define S second
using pr = pair<int, int>;
int binpown(int a, int b, int m) {
int res = 1;
while(b > 0) {
if(b&1) res = (res*a) % m;
a = (a*a) % m;
b >>= 1;
}
return res % m;
}
// int invp(int v, int m) {
// return binpowm(v, MOD-2, MOD);
// }
// int ask(int a, int b) {
// int k;
// cout << "? " << a << " " << b << endl << flush;
// cin >> k;
// return k;
// }
int _lcm(int a, int b) {
return a * b / __gcd(a, b);
}
int chmin(uchar a, uchar b) {
if(a > b) return b;
else return a;
}
int ask(int a, int b) {
a++;
b++;
int k;
cout << "? " << a << " " << b << endl;
cin >> k;
return k;
}
int dis(int a, int b, int c, int d) {
return (a-b)*(a-b) + (c-d)*(c-d);
}
int inv(int a, int m) {
return a <= 1 ? a : m - (long long)(m/a) * inv(m % a, m) % m;
}
// check for 3 comps
struct DSU {
vector<int> par, sz;
DSU(int n) {
par.resize(n+1);
sz.resize(n+1, 1);
// ecnt.resize(n+1, 0);
FOR(i, 0, n) par[i] = i;
}
int pfind(int v) {
if(v == par[v]) return v;
else return par[v] = pfind(par[v]);
}
void sunion(int a, int b) {
a = pfind(a);
b = pfind(b);
if(a == b) return;
if(sz[a] > sz[b]) swap(a, b);
par[a] = b;
sz[b] += sz[a];
// ecnt[b] += ecnt[a] + 1;
// return 1;
}
};
const ll MOD = 1e9 + 7;
void solve() {
int n, cs, cf;
cout << binpown(2, n-2, MOD);
}
signed main() {
// ios::sync_with_stdio(false);
// cin.tie(nullptr);
freopen("kangaroo.in", "r", stdin);
freopen("kangaroo.out", "w", stdout);
int t = 1;
// int t; cin >> t;
while(t--) solve();
}
Compilation message (stderr)
kangaroo.cpp: In function 'int main()':
kangaroo.cpp:111:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
111 | freopen("kangaroo.in", "r", stdin);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
kangaroo.cpp:112:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
112 | freopen("kangaroo.out", "w", stdout);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |