submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s862692129
p03651
C++
#include <bits/stdc++.h> using namespace std; #define ll long long #define rep(i, n) for (ll i = 0; i < n; ++i) #define P pair<ll, ll> #define Graph vector<vector<ll>> #define fi first #define se second constexpr ll mod = 1000000007; constexpr ll INF = (1ll << 60); constexpr double pi = 3.14159265358979323846; template <typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } int main() { ll N, K; cin >> N >> K; vector<ll> A(N); rep(i, N) cin >> A[i]; bool check = false; sort(A.begin(), A.end()); rep(i, N) { if (A[i] % A[0] != 0 && A[n - 1] >= K) check = true; } if (check) cout << "POSSIBLE\n"; else cout << "IMPOSSIBLE\n"; return 0; }
a.cc: In function 'int main()': a.cc:38:35: error: 'n' was not declared in this scope 38 | if (A[i] % A[0] != 0 && A[n - 1] >= K) check = true; | ^
s131581104
p03651
C++
#include <bits/stdc++.h> #include <cstring> #include <ctype.h> #include<stdlib.h> #define flin freopen("input.txt", "r", stdin); #define flout freopen("output.txt", "w", stdout); #define ll long long #define ull unsigned long long #define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #define nl '\n' #define nll '\0' #define pb push_back #define bdyptb return 0; #define sorted(x) sort(x.begin(), x.end()) #define reversed(x) reverse(x.begin(), x.end()) #define all(x) x.begin(), x.end() #define mset(a, b) memset(a, b, sizeof(a)); #define testcase ll t,tt; cin>>tt; for(t=1;t<=tt;t++) #define pi acos(-1.00) #define mx 1000007 using namespace std; int findGCD(int arr[], int n) { int result = arr[0]; for (int i = 1; i < n; i++) { result = _gcd(arr[i], result); if(result == 1) { return 1; } } return result; } int main() { fastio; int n,k; cin>>n>>k; int a[n]; for(int i=0; i<n; i++) { cin>>a[i]; } int g=findGCD(a,n); if(g%k==0 and k<=*max_element(a,a+n))cout<<"POSSIBLE\n"; else cout<<"IMPOSSIBLE\n"; bdyptb; }
a.cc: In function 'int findGCD(int*, int)': a.cc:30:18: error: '_gcd' was not declared in this scope 30 | result = _gcd(arr[i], result); | ^~~~
s553342626
p03651
C++
#include<bits/stdc++.h> using namespace std; using ll = long long; #define rep(i,n) for(ll i=0;i<n;i++) #define repl(i,l,r) for(ll i=(l);i<(r);i++) #define per(i,n) for(ll i=n-1;i>=0;i--) #define perl(i,r,l) for(ll i=r-1;i>=l;i--) #define fi first #define se second #define pb push_back #define ins insert #define all(x) (x).begin(),(x).end() using vl=vector<ll>; using vvl=vector<vector<ll>>; const ll MOD=1000000007; const ll MOD9=998244353; const int inf=1e9+10; const ll INF=4e18; const ll dy[8]={1,0,-1,0,1,1,-1,-1}; const ll dx[8]={0,-1,0,1,1,-1,1,-1}; using Graph = vector<vector<int>>; const double pi=acos(-1); template<int MOD> struct Fp { long long val; constexpr Fp(long long v = 0) noexcept : val(v % MOD) { if (val < 0) val += MOD; } constexpr int getmod() { return MOD; } constexpr Fp operator - () const noexcept { return val ? MOD - val : 0; } constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; } constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; } constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; } constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; } constexpr Fp& operator += (const Fp& r) noexcept { val += r.val; if (val >= MOD) val -= MOD; return *this; } constexpr Fp& operator -= (const Fp& r) noexcept { val -= r.val; if (val < 0) val += MOD; return *this; } constexpr Fp& operator *= (const Fp& r) noexcept { val = val * r.val % MOD; return *this; } constexpr Fp& operator /= (const Fp& r) noexcept { long long a = r.val, b = MOD, u = 1, v = 0; while (b) { long long t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); } val = val * u % MOD; if (val < 0) val += MOD; return *this; } constexpr bool operator == (const Fp& r) const noexcept { return this->val == r.val; } constexpr bool operator != (const Fp& r) const noexcept { return this->val != r.val; } friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept { return os << x.val; } friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept { if (n == 0) return 1; auto t = modpow(a, n / 2); t = t * t; if (n & 1) t = t * a; return t; } }; using mint = Fp<MOD>; vector<bool> seen,finished; int pos = -1; int ca=0; int f=0; void dfs(const Graph &G, int v, int p) { seen[v] = true; for (auto nv : G[v]) { if (nv == p) continue; if (finished[nv]) continue; if (seen[nv] && !finished[nv]) { pos = nv;f++; return; } dfs(G, nv, v); // サイクル検出したならば真っ直ぐに抜けていく if (pos != -1) { return;}} finished[v] = true; } mint calc(long long N, long long K) { mint res = 1; for (long long n = 0; n < K; ++n) { res *= (N - n); res /= (n + 1); } return res; } int main() { ll n,k; cin>>n>>k; ll a[n]={}; ll f=0; rep(i,n){ cin>>a[i];} sort(a,a+n); if(a[n-1]<k){ cout << "IMPOSSIBLE" << endl;} else{ ll b ; map<ll,ll> c; rep(i,n){ if(k>a[n-1-i]) break; b = __gcd(k,a[n-1-i]) c[b]++; if(c[b]>1) { f++; break;} } rep(i,n){ if(a[i]>=k) break; b = __gcd(k,a[i]); if(c[b]>0) {f++; break;}} if(f==0) cout << "IMPOSSIBLE" << endl; else cout << "POSSIBLE" << endl;}}
a.cc: In function 'int main()': a.cc:123:22: error: expected ';' before 'c' 123 | b = __gcd(k,a[n-1-i]) | ^ | ; 124 | c[b]++; | ~
s815686916
p03651
C++
#include <numeric> #include <iostream> #include <string> #include <vector> #include <algorithm> #include <cmath> #include <set> #include <map> using namespace std; using ll = long long; #define REP(i,n) for(ll i=0;i<(ll)(n);i++) #define REPD(i,n) for(ll i=n-1;i>=0;i--) #define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++) #define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--) #define input(...) __VA_ARGS__; in(__VA_ARGS__) #if __has_include("debugger.cpp") #include "debugger.cpp" #else void print() { std::cout << std::endl; } template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) { print__(head); if (sizeof...(tail) > 0) cout << " "; print(std::forward<Tail>(tail)...); } # endif void in() { } template <class Head, class... Tail> void in(Head&& head, Tail&&... tail) { cin >> head; in(std::forward<Tail>(tail)...); } int main() { ll input(n, k); vector<ll> a(n); REP(i, n) cin >> a[i]; ll p = a[0]; REP(i, n - 1) { p = gcd(p, a[i + 1]); } print(k % p == 0 ? "POSSIBLE" : "IMPOSSIBLE"); }
a.cc: In instantiation of 'void print(Head&&, Tail&& ...) [with Head = const char*; Tail = {}]': a.cc:52:8: required from here 52 | print(k % p == 0 ? "POSSIBLE" : "IMPOSSIBLE"); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:30:10: error: 'print__' was not declared in this scope; did you mean 'printf'? 30 | print__(head); | ~~~~~~~^~~~~~ | printf
s478982654
p03651
C++
#include<bits/stdc++.h> using namespace std; using ll = long long; using Graph = vector<vector<int>>; const ll mod=1000000007; const int dx[4] = { 1, 0, -1, 0 }; const int dy[4] = { 0, 1, 0, -1 }; int main() { ll n,k; cin>>n>>k; ll t[n]={}; ll a=0; ll b=0; for(ll i=0; i<n; i++){ cin>>t[i];} sort(t,t+n); if(t[n-1]<k){ cout<<"IMPOSSIBLE"<<endl;} else{ for(ll i=0; i<n; i++){ if(t[i]>=k){ a=i; break;}} if(t[a]==k){ cout<<"POSSIBLE"<<endl;} else{ for(ll i=1; i*i<=k; i++){ if(k%i==0){ bas++; a=i; while(t[a]<=r&&b<c){ b++; a++; if(a==n)break;} i=a-1; b=0;} cout<<bas<<endl;}
a.cc: In function 'int main()': a.cc:31:1: error: 'bas' was not declared in this scope; did you mean 'abs'? 31 | bas++; | ^~~ | abs a.cc:33:13: error: 'r' was not declared in this scope 33 | while(t[a]<=r&&b<c){ | ^ a.cc:33:18: error: 'c' was not declared in this scope 33 | while(t[a]<=r&&b<c){ | ^ a.cc:39:7: error: 'bas' was not declared in this scope; did you mean 'abs'? 39 | cout<<bas<<endl;} | ^~~ | abs a.cc:39:18: error: expected '}' at end of input 39 | cout<<bas<<endl;} | ^ a.cc:27:5: note: to match this '{' 27 | else{ | ^ a.cc:39:18: error: expected '}' at end of input 39 | cout<<bas<<endl;} | ^ a.cc:19:5: note: to match this '{' 19 | else{ | ^ a.cc:39:18: error: expected '}' at end of input 39 | cout<<bas<<endl;} | ^ a.cc:8:12: note: to match this '{' 8 | int main() { | ^
s384613182
p03651
C++
#include<iostream> using namespace std; int balls[100005]; int findFPB(int a, int b){ if(b == 0) return a; return findFPB(b, a%b); } int main(){ int N, K, maks = 0, fpb; cin >> N >> K; for(int i=1; i<=N; i++){ cin >> balls[i]; if (balls[i] > maks) maks = balls[i]; if (balls[i] == K) udahADA = true; if (i == 1) fpb = balls[i]; if (i >= 2 && fpb != 1){ fpb = findFPB(balls[i], fpb); } } if(K > maks){ cout << "IMPOSSIBLE" << endl; } else if(K % fpb == 0){ cout << "POSSIBLE" << endl; } else{ cout << "IMPOSSIBLE" << endl; } }
a.cc: In function 'int main()': a.cc:19:28: error: 'udahADA' was not declared in this scope 19 | if (balls[i] == K) udahADA = true; | ^~~~~~~
s357528157
p03651
C
#include <bits/stdc++.h> using namespace std; #define rep(i, s, e) for (int i = s; i < e; ++i) #define sort_(a) stable_sort(a.begin(), a.end()) #define rsort(a) stable_sort(a.rbegin(), a.rend()) #define sum(a) accumulate(a.begin(), a.end(), 0LL) #define join(a, d) accumulate(a.begin() + 1, a.end(), a[0], [](string s, string t) {return s + d + t;}) #define all(a) a.begin(), a.end() // #define __lcm(a, b) std::__detail::__lcm(a, b) typedef long long ll; const long mod = 1e9 + 7; ll lcm(ll x, ll y) { return x / __gcd(x, y) * y; } int main(void) { #ifdef DEBUG freopen("input.txt", "r", stdin); #endif ios_base::sync_with_stdio(false); cin.tie(0); long N, K; cin >> N >> K; vector<long> A(N); rep(i, 0, N) cin >> A[i]; long maxa = accumulate(all(A), A[0], [](long x, long y) {return max(x, y);}); if (maxa < K) { cout << "IMPOSSIBLE" << endl; return 0; } long gcd1 = accumulate(all(A), A[0], [](long x, long y) {return __gcd(x, y);}); long gcd2 = __gcd(gcd1, K); if (gcd1 == gcd2) { cout << "POSSIBLE" << endl; } else { cout << "IMPOSSIBLE" << endl; } return 0; }
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory 1 | #include <bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s593990492
p03651
C++
#include <iostream> #include <vector> #include <algorithm> #include <numeric> using namespace std; int main(){ int n, k, a; cin >> n >> k; vector<int>a(n); int g=0, m=1e9+7; for(int i=0; i<n; i++){ cin >> a; g = gcd(g, a); m = max(m, a); } if(m-k>=0 && (m-k)%g==0)cout << "POSSIBLE"; else cout << "IMPOSSIBLE"; return 0; }
a.cc: In function 'int main()': a.cc:10:14: error: conflicting declaration 'std::vector<int> a' 10 | vector<int>a(n); | ^ a.cc:8:13: note: previous declaration as 'int a' 8 | int n, k, a; | ^
s496216998
p03651
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using vi = vector<int>; using vvi = vector<vector<int>>; using vvvi = vector<vector<vector<int>>>; using vl = vector<ll>; using vvl = vector<vector<ll>>; using vvvl = vector<vector<vector<ll>>>; #define FOR(i, m, n) for (int i = (m); i < (n); i++) #define FORR(i, m, n) for (int i = (m); i >= (n); i--) #define REP(i, n) FOR(i, 0, (n)) #define REPR(i, n) FORR(i, (n) - 1, 0) #define REP1(i, n) FOR(i, 1, (n) + 1) #define REPS(c, s) for (char c : s) #define ALL(c) (c).begin(), (c).end() #define SORT(c) sort(ALL(c)) #define REV(c) reverse(ALL(c)) #define sz(v) (int)v.size() #define endl '\n' template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;} template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;} template<class T> inline void prn(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << ' ';} template<class T> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');} template<class T> inline void printvv(vector<vector<T>>& v) {for (auto u : v) printv(u);} template<class T> inline void printlnv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;} const int MOD = 1000000007; const int INF = 1000000001; const ll LINF = 1000000001000000001LL; void solve(); int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(numeric_limits<double>::max_digits10); solve(); return 0; } void solve() { int n, k; int a; cin >> a; int mx = a; int g = a; REP1(i, n - 1) { cin >> a; chmax(mx, a); g = __gcd(g, a) } if (k <= mx and k % g == 0) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
a.cc: In function 'void solve()': a.cc:52:24: error: expected ';' before '}' token 52 | g = __gcd(g, a) | ^ | ; 53 | } | ~
s865650311
p03651
C++
#include <bits/stdc++.h> using namespace std; typedef long long int ll; #define FOR(i,l,r) for(i=l;i<r;i++) #define REP(i,n) FOR(i,0,n) #define ALL(x) x.begin(),x.end() #define P pair<ll,ll> #define F first #define S second signed main(){ ll N,K,i,a;cin>>N>>K;cin>>A; REP(i,N-1){cin>>a;A=__gcd(A,a);} if(K%A)cout<<"POSSIBLE"<<endl; else cout<<"IMPOSSIBLE"<<endl; return 0; }
a.cc: In function 'int main()': a.cc:11:29: error: 'A' was not declared in this scope 11 | ll N,K,i,a;cin>>N>>K;cin>>A; | ^
s879157750
p03651
C++
#include <iostream> using namespace std; typedef long long ll; const int MAXN = 1e9+10; int n; ll A[MAXN]; ll k; ll gcd(ll x, ll y) { if (x < y) { swap(x, y); } if (y == 0) { return x; } return gcd(y, x % y); } void solve() { ll d = A[0]; for (int i=0;i<n;i++) { d = gcd(d, A[i]); } for (int i=0;i<n;i++) { if ((k - A[i]) % d == 0) { cout << "POSSIBLE" << endl; return; } } cout << "IMPOSSIBLE" << endl; } int main() { cin >> n >> k; for (int i=0;i<n;i++) { cin >> A[i]; } solve(); }
/tmp/cchBcmcr.o: in function `solve()': a.cc:(.text+0xc6): relocation truncated to fit: R_X86_64_PC32 against symbol `k' defined in .bss section in /tmp/cchBcmcr.o /tmp/cchBcmcr.o: in function `main': a.cc:(.text+0x186): relocation truncated to fit: R_X86_64_PC32 against symbol `k' defined in .bss section in /tmp/cchBcmcr.o collect2: error: ld returned 1 exit status
s410400806
p03651
C
/****************************************************************************** Online C Compiler. Code, Compile, Run and Debug C program online. Write your code in this editor and press "Run" button to compile and execute it. *******************************************************************************/ #include <stdio.h> int getGcd(int, int); int getGcd(int a, int b){ if(a==0 || a==b){ return b; } if(a>=b){ return getGcd(a%b, b); } return getGcd(b, a); } int main() { int n, k, a, gcd; scanf("%d", &n); scanf("%d", &k); gcd = 0; max_num = 0; for(int i=0;i<n;i++){ scanf("%d", &a); gcd = getGcd(gcd, a); if(max_num<=a){ max_num = a; } } //Can we get the number k by performing subtractions with the n numbers if(k%gcd == 0 & gcd>0 & max_num >= k){ printf("POSSIBLE"); } else{ printf("IMPOSSIBLE"); } return 0; }
main.c: In function 'main': main.c:31:9: error: 'max_num' undeclared (first use in this function) 31 | max_num = 0; | ^~~~~~~ main.c:31:9: note: each undeclared identifier is reported only once for each function it appears in
s232779413
p03651
C++
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int N, K; cin >> N >> K; int mx = 0, g = 0; while (N--) { int x; cin >> x; g = __gcd(g, x); mx = max(mx, x); } if (K % g == 0 && k <= mx) cout << "POSSIBLE\n"; else cout << "IMPOSSIBLE\n"; }
a.cc: In function 'int main()': a.cc:16:21: error: 'k' was not declared in this scope 16 | if (K % g == 0 && k <= mx) cout << "POSSIBLE\n"; | ^
s237033455
p03651
C++
#include<bits/stdc++.h> using namespace std; #define rep(i,n) for(int i = 0;i<n;i++) #define erep(i,n) for(int i = 0;i<=n;i++) #define rep1(i,n) for(int i = 1;i<n;i++) #define erep1(i,n) for(int i = 1;i<=n;i++) typedef long long ll; #define vint vector<int> #define vvint vector<vector<int>> #define vstring vector<string> #define vll vector<ll> #define vbool vector<bool> #define INF 1000000009 ll gcm(ll a,ll b){ if(a < b) swap(a,b); if(b == 0) return a; return gcm(a%b,b); } ll main(){ ll n,k; cin >> n >> k; ll b; cin >> b; ll ag = b; rep(i,n){ ll a; cin >> a; ag = gcm(ag,a); b = max(b,a); } if(k < b && k & ag == 0) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
a.cc:21:1: error: '::main' must return 'int' 21 | ll main(){ | ^~
s809906270
p03651
C++
#include<bits/stdc++.h> #include<unordered_set> #include<unordered_map> #include <iostream> #include <string> #include <cmath> using namespace std; #define ll long long #define rep(i, n) for (ll i = 0; i < (n); i++) #define FOR(i,a,b) for(ll i=(a);i<(b);i++) #define FORR(i,a,b)for(ll i=(a);i<=(b);i++) #define repR(i,n) for(ll i=n;i>=0;i--) #define all(v)(v).begin(),(v).end() #define rall(v)(v).rbegin(),(v).rend() #define F first #define S second #define pb push_back #define pu push #define COUT(x) cout<<(x)<<endl #define PQ priority_queue<ll> #define PQR priority_queue<ll,vector<ll>,greater<ll>> #define YES(n) cout << ((n) ? "YES" : "NO" ) << endl #define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl #define mp make_pair #define maxs(x,y) (x = max(x,y)) #define mins(x,y) (x = min(x,y)) #define sz(x) (int)(x).size() typedef pair<int,int> pii; typedef pair<ll,ll> pll; const ll MOD = 1000000007LL; const ll INF = 1LL << 60; using vll = vector<ll>; using vb = vector<bool>; using vvb = vector<vb>; using vvll = vector<vll>; using vstr = vector<string>; using pll = pair<ll, ll>; using vc = vector<char>; using vvc = vector<vc>; ll dx[4]={0,1,0,-1}; ll dy[4]={1,0,-1,0}; ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;} ll lcm(ll a, ll b) { return a/gcd(a,b)*b;} int main(){ ll n,k; cin>>n>>k; vll a(n); rep(i,n) cin>>a[i]; sort(all(a)); ll l=a[i]; rep(i,n){ l=gcd(a[i],l); } if(l!=1){ if(k%l!=0){ COUT("IMPOSSIBLE"); } else if(k>a[n-1]){ COUT("IMPOSSIBLE"); } COUT("POSSIBLE"); } else{ if(k>a[n-1]){ COUT("IMPOSSIBLE"); } else{ COUT("POSSIBLE"); } } }
a.cc: In function 'int main()': a.cc:50:10: error: 'i' was not declared in this scope 50 | ll l=a[i]; | ^
s665844973
p03651
C++
#include<bits/stdc++.h> using namespace std; using ll = long long; int main(void) { ll n, k; cin >> n >> k; vector<ll> a(n); for(auto &e: a) cin >> e; ll g = 0; for(auto &e: a) g = __gcd(g, e); cout << any_of(a.begin(), a.end(), [&](ll x){return (x-k)%g == 0}) ? "POSSIBLE" : "IMPOSSIBLE" << endl; }
a.cc: In lambda function: a.cc:16:69: error: expected ';' before '}' token 16 | cout << any_of(a.begin(), a.end(), [&](ll x){return (x-k)%g == 0}) ? "POSSIBLE" : "IMPOSSIBLE" << endl; | ^ | ; a.cc: In function 'int main()': a.cc:16:100: error: invalid operands of types 'const char [11]' and '<unresolved overloaded function type>' to binary 'operator<<' 16 | cout << any_of(a.begin(), a.end(), [&](ll x){return (x-k)%g == 0}) ? "POSSIBLE" : "IMPOSSIBLE" << endl; | ~~~~~~~~~~~~~^~~~~~~
s954624155
p03651
C++
#pragma GCC optimize("O3") #include <bits/stdc++.h> #define ll long long #define rep2(i,a,b) for(ll i=a;i<=b;++i) #define rep(i,n) for(ll i=0;i<n;i++) #define rep3(i,a,b) for(ll i=a;i>=b;i--) #define pii pair<int,int> #define pll pair<ll,ll> #define pq priority_queue #define pb push_back #define eb emplace_back #define veci vector<int> #define vecll vector<ll> #define vecpii vector<pii> #define vec2(a,b) vector<vec>(a,vec(b)) #define vec2ll(a,b) vector<vec>(a,vecll(b)) #define vec3(a,b,c) vector<vector<vec>>(a,vec2(b,c)) #define vec3ll(a,b,c) vector<vector<vecll>>(a,vec2ll(b,c)) #define fi first #define se second #define all(c) begin(c),end(c) #define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0); #define lb(c,x) distance(c.begin(),lower_bound(all(c),x)) #define ub(c,x) distance(c.begin(),upper_bound(all(c),x)) using namespace std; int in() {int x;cin>>x;return x;} ll lin() {ll x;cin>>x;return x;} template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;} template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;} template<class T> inline void print(pair<T,T> p){cout<<"("<<p.first<<","<<p.second<<") ";} template<class T> inline void print(vector<pair<T,T>> v){for(auto e:v)print(e); cout<<endl;} template<class T> inline void print(T v){for(auto e:v)cout<<e<<" ";cout<<endl;} template<typename T> istream& operator >> (istream& is, vector<T>& vec){ for(T& x:vec) is >> x; return is; } const ll INF=1e9+7; int main() { ll n,k; cin >> n >> k; ll d=INF; ll M=-1; vector<ll> a(n); rep(i,n) cin >> a[i]; sort(a,begin(),end()); rep(i,n){ M=max(M,a[i]); if(i==0) continue; if(a[i]==a[i-1]) continue; d=min(d,a[i]-a[i-1])); } bool flag=true; rep(i,n){ if(a[i]%d!=0) flag=false; break; } if(k>M) cout << "IMPOSSIBLE" << endl; else if(flag && k%d!=0) cout << "IMPOSSIBLE" << endl; else{ cout << "POSSIBLE" << endl; } return 0; }
a.cc: In function 'int main()': a.cc:51:17: error: no matching function for call to 'begin()' 51 | sort(a,begin(),end()); | ~~~~~^~ In file included from /usr/include/c++/14/bits/algorithmfwd.h:39, from /usr/include/c++/14/bits/stl_algo.h:59, from /usr/include/c++/14/algorithm:61, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:3: /usr/include/c++/14/initializer_list:88:5: note: candidate: 'template<class _Tp> constexpr const _Tp* std::begin(initializer_list<_Tp>)' 88 | begin(initializer_list<_Tp> __ils) noexcept | ^~~~~ /usr/include/c++/14/initializer_list:88:5: note: candidate expects 1 argument, 0 provided In file included from /usr/include/c++/14/string:53, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/range_access.h:52:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.begin()) std::begin(_Container&)' 52 | begin(_Container& __cont) -> decltype(__cont.begin()) | ^~~~~ /usr/include/c++/14/bits/range_access.h:52:5: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/bits/range_access.h:63:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.begin()) std::begin(const _Container&)' 63 | begin(const _Container& __cont) -> decltype(__cont.begin()) | ^~~~~ /usr/include/c++/14/bits/range_access.h:63:5: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/bits/range_access.h:95:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::begin(_Tp (&)[_Nm])' 95 | begin(_Tp (&__arr)[_Nm]) noexcept | ^~~~~ /usr/include/c++/14/bits/range_access.h:95:5: note: candidate expects 1 argument, 0 provided In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166: /usr/include/c++/14/valarray:1227:5: note: candidate: 'template<class _Tp> _Tp* std::begin(valarray<_Tp>&)' 1227 | begin(valarray<_Tp>& __va) noexcept | ^~~~~ /usr/include/c++/14/valarray:1227:5: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/valarray:1238:5: note: candidate: 'template<class _Tp> const _Tp* std::begin(const valarray<_Tp>&)' 1238 | begin(const valarray<_Tp>& __va) noexcept | ^~~~~ /usr/include/c++/14/valarray:1238:5: note: candidate expects 1 argument, 0 provided a.cc:51:23: error: no matching function for call to 'end()' 51 | sort(a,begin(),end()); | ~~~^~ /usr/include/c++/14/initializer_list:99:5: note: candidate: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)' 99 | end(initializer_list<_Tp> __ils) noexcept | ^~~ /usr/include/c++/14/initializer_list:99:5: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/bits/range_access.h:74:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)' 74 | end(_Container& __cont) -> decltype(__cont.end()) | ^~~ /usr/include/c++/14/bits/range_access.h:74:5: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/bits/range_access.h:85:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)' 85 | end(const _Container& __cont) -> decltype(__cont.end()) | ^~~ /usr/include/c++/14/bits/range_access.h:85:5: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/bits/range_access.h:106:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])' 106 | end(_Tp (&__arr)[_Nm]) noexcept | ^~~ /usr/include/c++/14/bits/range_access.h:106:5: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/valarray:1249:5: note: candidate: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)' 1249 | end(valarray<_Tp>& __va) noexcept | ^~~ /usr/include/c++/14/valarray:1249:5: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/valarray:1265:5: note: candidate: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)' 1265 | end(const valarray<_Tp>& __va) noexcept | ^~~ /usr/include/c++/14/valarray:1265:5: note: candidate expects 1 argument, 0 provided a.cc:56:29: error: expected ';' before ')' token 56 | d=min(d,a[i]-a[i-1])); | ^ | ;
s117792872
p03651
C++
#include<bits/stdc++.h> using namespace std; int n,k,a,pyy,h; int main() { cin>>n>>k>>a;h=a; for(int i=2;i<=n;i++) { cin>>pyy; a=__gcd(a,pyy); h=max(ak,h); } if(k%a==0&&k<=h)cout<<"POSSIBLE"; else cout<<"IMPOSSIBLE"; }
a.cc: In function 'int main()': a.cc:11:15: error: 'ak' was not declared in this scope; did you mean 'k'? 11 | h=max(ak,h); | ^~ | k
s372531204
p03651
C++
#include <bits/stdc++.h> #define rep(i, n) for (ll i=0;i<(n); i++) using namespace std; typedef long long ll; typedef pair<ll, ll> pi; int main(){ int n, k; cin >> n >> k; // cout << "a"; vector<ll> a(n); rep(i,n) cin >> a.at(i); int flag = 0; ll tmp = *min_element(a.begin(), a.end()); ll tmp_max = *max_element(a.begin(), a.end()); if (k>tmp_max) { cout << "IMPOSSIBLE" << endl; return 0; } ll tmp = a.at(0); rep(i, n) { tmp = __gcd(tmp, a.at(i)); } if (k%tmp=0) { cout << "POSSIBLE" << endl; return 0; } else { cout << "IMPOSSIBLE" << endl; return 0; } }
a.cc: In function 'int main()': a.cc:29:6: error: redeclaration of 'll tmp' 29 | ll tmp = a.at(0); | ^~~ a.cc:21:6: note: 'll tmp' previously declared here 21 | ll tmp = *min_element(a.begin(), a.end()); | ^~~ a.cc:35:8: error: lvalue required as left operand of assignment 35 | if (k%tmp=0) { | ~^~~~
s651433973
p03651
C++
#include <bits/stdc++.h> #define rep(i, n) for (ll i=0;i<(n); i++) using namespace std; typedef long long ll; typedef pair<ll, ll> pi; int main(){ int n, k; cin >> n >> k; // cout << "a"; vector<ll> a(n); rep(i,n) cin >> a.at(i); int flag = 0; ll tmp = *min_element(a.begin(), a.end()); ll tmp_max = *max_element(a.begin(), a.end()); if (k>tmp_max) { cout << "IMPOSSIBLE" << endl; return 0; } ll tmp = a.at(0); rep(i, n) { tmp = __gcd(tmp, a.at(i)) } if (k%tmp=0) { cout << "POSSIBLE" << endl; return 0; } else { cout << "IMPOSSIBLE" << endl; return 0; } }
a.cc: In function 'int main()': a.cc:29:6: error: redeclaration of 'll tmp' 29 | ll tmp = a.at(0); | ^~~ a.cc:21:6: note: 'll tmp' previously declared here 21 | ll tmp = *min_element(a.begin(), a.end()); | ^~~ a.cc:31:30: error: expected ';' before '}' token 31 | tmp = __gcd(tmp, a.at(i)) | ^ | ; 32 | } | ~ a.cc:35:8: error: lvalue required as left operand of assignment 35 | if (k%tmp=0) { | ~^~~~
s297787710
p03651
C++
#include<bits/stdc++.h> using namespace std; long gcd(long a,long b){ long tmp = a; if(a<b){ a = b; b = tmp; } if(a%b==0)return b; else return gcd(b,a%b); } int main(){ int n; long k; cin >> n >> k; vector<long>a(n); int i; for(i=0;i<n;i++){ cin >> a[i]; } long gcdd = a[0]; long maxx = a[0] for(i=1;i<n;i++){ gcdd = gcd(gcdd,a[i]); if(maxx < a[i])maxx = a[i]; } if(k%gcdd == 0 && k<=maxx)cout<<"POSSIBLE"<<endl; else cout << "IMPOSSIBLE" << endl; }
a.cc: In function 'int main()': a.cc:23:3: error: expected ',' or ';' before 'for' 23 | for(i=1;i<n;i++){ | ^~~ a.cc:23:18: error: expected ';' before ')' token 23 | for(i=1;i<n;i++){ | ^ | ;
s507445173
p03651
C++
#include<bits/stdc++.h> #include<iostream> #include <vector> #include <algorithm> #include <cmath> #include <set> #include <queue> #include <deque> #include <map> #include <stack> #include<bitset> #include<list> #include<cassert> #include<numeric> using namespace std; const long long N = 1e5 + 5; long long mini = 1e9 + 7; long long dp[N]; long long dp2[N]; bool mark[N]; bool check = false; vector<pair<long long, long long>> graph[N]; vector<edge > vec; long long n, m; long long ans; void dfs(long long v) { mark[v] = true; dp[v] = 1; for (long long i = 0; i < graph[v].size(); i++) { long long u = graph[v][i].first; if (!mark[u]) { dfs(u); dp[v] += dp[u]; } } } void dfs2(long long v) { mark[v] = true; for (long long i = 0; i < graph[v].size(); i++) { long long u = graph[v][i].first; long long w = graph[v][i].second; if (!mark[u]) { long long cnt1 = dp[u]; long long cnt2 = n - dp[u]; if (cnt1 == cnt2) { check = true; cnt1 = 2 * cnt1 - 1; } else { cnt1 = 2 * min(cnt1, cnt2); } ans += cnt1 * w; dfs2(u); } } } int main() { cin >> n; for (long long i = 0; i < n - 1; i++) { long long u, v, w; cin >> u >> v >> w; graph[u - 1].push_back({v - 1, w}); graph[v - 1].push_back({u - 1, w}); mini = min(mini, w); } dfs(0); memset(mark, 0, sizeof mark); dfs2(0); if (!check) { ans -= mini; } cout << ans << endl; }
a.cc:26:8: error: 'edge' was not declared in this scope 26 | vector<edge > vec; | ^~~~ a.cc:26:13: error: template argument 1 is invalid 26 | vector<edge > vec; | ^ a.cc:26:13: error: template argument 2 is invalid
s377202508
p03651
C++
def gcm(a,b): a,b = max(a,b),min(a,b) while b != 0: a,b = b,a%b return a n,k = map(int,input().split()) a = list(map(int,input().split())) m = max(a) g = a[0] for i in a[1:]: g = gcm(g,i) if m >= k and (m-k)%g == 0: print('POSSIBLE') else: print('IMPOSSIBLE')
a.cc:13:9: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes 13 | print('POSSIBLE') | ^~~~~~~~~~ a.cc:15:9: warning: multi-character literal with 10 characters exceeds 'int' size of 4 bytes 15 | print('IMPOSSIBLE') | ^~~~~~~~~~~~ a.cc:1:1: error: 'def' does not name a type 1 | def gcm(a,b): | ^~~
s519466259
p03651
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main(){ ll n,k;cin >> n >> k; ll a,b,MAX; if(n==1){ cin >> a; if(k==tmp){cout << "POSSIBLE" << endl;return 0;} else {cout << "IMPOSSIBLE" << endl;return 0;} } cin >> b; ll GCD = gcd(a,b); MAX = max(a,b); for(ll i=0; i<n-2; i++){ cin >> a; MAX = max(a,MAX); GCD = gcd(GCD,a); } if(k<=MAX&&k%GCD==0){cout << "POSSIBLE" << endl;} else{cout << "IMPOSSIBLE" << endl;} }
a.cc: In function 'int main()': a.cc:10:11: error: 'tmp' was not declared in this scope; did you mean 'tm'? 10 | if(k==tmp){cout << "POSSIBLE" << endl;return 0;} | ^~~ | tm
s463072323
p03651
C++
#include <bits/stdc++.h> using namespace std; template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } #define rep(i,n) for(int i=0;i<(int)(n);i++) #define all(vec) vec.begin(),vec.end() typedef long long ll; const int MAX=2e7; const ll MOD=1e9+7; const int INF=1<<30; ll gcd(ll a,ll b){ if(a%b==0) return b; return gcd(b,a%b); } int main(){ int N,K; cin >> N >> K; vector<int> A(N); rep(i,N){ cin >> A[i]; } int maxA=0; int GCD=A[0]; rep(i,N){ if(A[i]>maxA) maxA=A[i]; GCD=gcd(GCD,A[i]); } if(maxA=>K&&(maxA-K)%GCD==0) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
a.cc: In function 'int main()': a.cc:31:11: error: expected primary-expression before '>' token 31 | if(maxA=>K&&(maxA-K)%GCD==0) cout << "POSSIBLE" << endl; | ^
s568622647
p03651
C++
#include <bits/stdc++.h> using namespace std; template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } #define rep(i,n) for(int i=0;i<(int)(n);i++) #define all(vec) vec.begin(),vec.end() typedef long long ll; const int MAX=2e7; const ll MOD=1e9+7; const int INF=1<<30; ll gcd(ll a,ll b){ if(a%b==0) return b; return gcd(b,a%b); } int main(){ int N,K; cin >> N >> K; vector<int> A(N); rep(i,N){ cin >> A[i]; } int maxA=0; int GCD=A[0]; rep(i,N){ if(A[i]>maxA) maxA=A[i]; GCD=gcd(GCD,A[i]); } if(maxA=>K&&(maxA-K)%GCD==0) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
a.cc: In function 'int main()': a.cc:31:11: error: expected primary-expression before '>' token 31 | if(maxA=>K&&(maxA-K)%GCD==0) cout << "POSSIBLE" << endl; | ^
s323860086
p03651
Java
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int K = sc.nextInt(); int[] A = new int[N]; for (int i = 0; i < N; i++) { A[i] = sc.nextInt(); } Arrays.sort(A); if (K > A[N-1]) { System.out.println("IMPOSSIBLE"); return; } if (N == 1) { System.out.println(A[0] == K ? "POSSIBLE" : "IMPOSSIBLE"); return; } int gcd = calcGcd(A[1], A[0]); boolean ans = false; for (int i = 0; i < N; i++) { if (A[i]%gcd != 0 || A[i] == K) { ans = true; break; } } System.out.println(ans ? "POSSIBLE" : "IMPOSSIBLE"); } private static int calcGcd(int a, int b) { if (b == 0) return a; return gcd(b, a%b); } }
Main.java:36: error: cannot find symbol return gcd(b, a%b); ^ symbol: method gcd(int,int) location: class Main 1 error
s020959159
p03651
Java
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int K = sc.nextInt(); int[] A = new int[N]; for (int i = 0; i < N; i++) { A[i] = sc.nextInt(); } Arrays.sort(A); if (K > A[N-1]) { System.out.println("IMPOSSIBLE"); return; } if (N == 1) { System.out.println(A[0] == K ? "POSSIBLE" ? "IMPOSSIBLE"); return; } int gcd = calcGcd(A[1], A[0]); boolean ans = false; for (int i = 0; i < N; i++) { if (A[i]%gcd != 0 || A[i] == K) { ans = true; break; } } System.out.println(ans ? "POSSIBLE" : "IMPOSSIBLE"); } private static int calcGcd(int a, int b) { if (b == 0) return a; return gcd(b, a%b); } }
Main.java:20: error: : expected System.out.println(A[0] == K ? "POSSIBLE" ? "IMPOSSIBLE"); ^ 1 error
s528403086
p03651
Java
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int K = sc.nextInt(); int[] A = new int[N]; for (int i = 0; i < N; i++) { A[i] = sc.nextInt(); } Arrays.sort(A); boolean ans = false; int d = A[0]; for (int i = 0; i < N; i++) { if (A[i] != d*(i+1 || A[i] == K)) { ans = true; break; } } System.out.println(ans ? "POSSIBLE" : "IMPOSSIBLE"); } }
Main.java:18: error: bad operand types for binary operator '||' if (A[i] != d*(i+1 || A[i] == K)) { ^ first type: int second type: boolean 1 error
s611763587
p03651
C
#include<stdio.h> long GCDisGOD(long a,long b){ long p = a; long q = b; long c=0; long hoge = 0; long i = 0; for(i=0;i<10;i++){ c = p%q; if(c == 0){ return q; }else{ hoge = p; p = q; q = c; } //printf("%d %d %d#",p,q,c); } } int main(){ int n = 0; int k = 0; int i = 0; long a[100000] = {}; int success = -1; long gcd = 0; long max = 0; scanf("%ld %ld",&n,&k); for(i=0;i<n;i++){ scanf("%ld",&a[i]); } gcd = a[0]; for(i=1;i<n;i++){ gcd = GCDisGOD(gcd,a[i]); if(a[i] > max){ max = a[i]; } } } if(a[0] == k){ success = 1; } //printf("%ld#",gcd); if((k % gcd == 0 && max < k)){ success = 1; }else{ success = 0; } if(success){ printf("POSSIBLE"); }else{ printf("IMPOSSIBLE"); } return 0; }
main.c:41:3: error: expected identifier or '(' before 'if' 41 | if(a[0] == k){ | ^~ main.c:45:5: error: expected identifier or '(' before 'if' 45 | if((k % gcd == 0 && max < k)){ | ^~ main.c:47:6: error: expected identifier or '(' before 'else' 47 | }else{ | ^~~~ main.c:51:3: error: expected identifier or '(' before 'if' 51 | if(success){ | ^~ main.c:53:4: error: expected identifier or '(' before 'else' 53 | }else{ | ^~~~ main.c:58:3: error: expected identifier or '(' before 'return' 58 | return 0; | ^~~~~~ main.c:59:1: error: expected identifier or '(' before '}' token 59 | } | ^
s331148809
p03651
C
#include<stdio.h> int GCDisGOD(int a,int b){ int p = a; int q = b; int c=0; int hoge = 0; int i = 0; for(i=0;i<20;i++){ c = p%q; if(c == 0){ return q; }else{ hoge = p; p = q; q = c; } //printf("%d %d %d#",p,q,c); } } int main(){ int n = 0; int k = 0; int i = 0; int a[100000] = {}; int success = -1; int gcd = 0; int max = 0; scanf("%d %d",&n,&k); for(i=0;i<k;i++){ scanf("%d",&a[i]); } gcd = a[0]; for(i=1;i<n;i++){ if(a[i] == k){ success = 1; break; }else{ gcd = GCDisGOD(gcd,a[i]); if(a[i] > max){ max = a[i]; } } printf("%d#",gcd); if((k % gcd == 0 || success = 1)&&success != 0&&max < k){ success = 1; }else{ success = 0; } if(success){ printf("POSSIBLE"); }else{ printf("IMPOSSIBLE"); } return 0; }
main.c: In function 'main': main.c:45:33: error: lvalue required as left operand of assignment 45 | if((k % gcd == 0 || success = 1)&&success != 0&&max < k){ | ^ main.c:59:1: error: expected declaration or statement at end of input 59 | } | ^
s783492659
p03651
C++
#include <bits/stdc++.h> #include <cstdlib> // abs() for integer 邨カ蟇セ蛟、豎ゅa繧・▽ #include <cmath> // abs() for float, and fabs() #include <algorithm> #include <vector> #include <string> #define rep(i,n) for(int i = 0; i < (n);i++) #define SORT(a) sort((a).begin(),(a).end()) #define REV(a) reverse((a).begin(),(a).end()) using namespace std; #define INF 2000000000 template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } #define che(a,string) cout<<"//"<<string <<"=="<<(a)<<"//" <<endl; typedef long long ll; int main(){ int n,k ; cin >>n>> k ;//k is target vector<ll> A(n); int judge =0; rep(i,n){ cin>>A[i]; if(A[i]==k) judge = 1; } SORT(A); int coutn = 0; if(judge != 1){ for(int i = n-1 ; i > 0; i--){ count ++; if(count>3)break; for(int j = 0 ; j < i ; j++){ ll a = A[i]%A[j]; if(a!=0&&k/a == 0){ judge = 1; break; } else if(a == 1){ judge = 1; break; } } } } if(judge) cout<<"POSSIBLE"<<endl; else cout<<"IMPOSSIBLE"<<endl; }
a.cc: In function 'int main()': a.cc:31:31: error: no post-increment operator for type 31 | count ++; | ^~ a.cc:32:33: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator>' 32 | if(count>3)break; | ~~~~~^~
s529945564
p03651
C++
#include <bits/stdc++.h> #include <cstdlib> // abs() for integer 邨カ蟇セ蛟、豎ゅa繧・▽ #include <cmath> // abs() for float, and fabs() #include <algorithm> #include <vector> #include <string> #define rep(i,n) for(int i = 0; i < (n);i++) #define SORT(a) sort((a).begin(),(a).end()) #define REV(a) reverse((a).begin(),(a).end()) using namespace std; #define INF 2000000000 template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } #define che(a,string) cout<<"//"<<string <<"=="<<(a)<<"//" <<endl; int main(){ int n,k ; cin >>n>> k ;//k is target vector<ll> A(n); int judge =0; rep(i,n){ cin>>A[i]; if(A[i]==k) judge = 1; } SORT(A); int coutn = 0; if(judge != 1){ for(int i = n-1 ; i > 0; i--){ count ++; if(count>3)break; for(int j = 0 ; j < i ; j++){ ll a = A[i]%A[j]; if(a!=0&&k/a == 0){ judge = 1; break; } else if(a == 1){ judge = 1; break; } } } } if(judge) cout<<"POSSIBLE"<<endl; else cout<<"IMPOSSIBLE"<<endl; }
a.cc: In function 'int main()': a.cc:19:16: error: 'll' was not declared in this scope 19 | vector<ll> A(n); | ^~ a.cc:19:18: error: template argument 1 is invalid 19 | vector<ll> A(n); | ^ a.cc:19:18: error: template argument 2 is invalid a.cc:22:23: error: invalid types 'int[int]' for array subscript 22 | cin>>A[i]; | ^ a.cc:23:21: error: invalid types 'int[int]' for array subscript 23 | if(A[i]==k) judge = 1; | ^ a.cc:8:26: error: request for member 'begin' in 'A', which is of non-class type 'int' 8 | #define SORT(a) sort((a).begin(),(a).end()) | ^~~~~ a.cc:25:9: note: in expansion of macro 'SORT' 25 | SORT(A); | ^~~~ a.cc:8:38: error: request for member 'end' in 'A', which is of non-class type 'int' 8 | #define SORT(a) sort((a).begin(),(a).end()) | ^~~ a.cc:25:9: note: in expansion of macro 'SORT' 25 | SORT(A); | ^~~~ a.cc:29:31: error: no post-increment operator for type 29 | count ++; | ^~ a.cc:30:33: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator>' 30 | if(count>3)break; | ~~~~~^~ a.cc:32:35: error: expected ';' before 'a' 32 | ll a = A[i]%A[j]; | ^~ | ; a.cc:33:36: error: 'a' was not declared in this scope 33 | if(a!=0&&k/a == 0){ | ^
s946527960
p03651
C++
if(judge != 1){ for(int j = 0 ; j < n-1 ; j++){ ll a = A[n-1]%A[j]; if(a!=0&&k/a == 0){ judge = 1; break; } else if(a == 1){ judge = 1; break; } } }
a.cc:1:1: error: expected unqualified-id before 'if' 1 | if(judge != 1){ | ^~
s243956277
p03651
C++
#include<iostream> #include<vector> #include<string> #include<cmath> #include<algorithm> #include <numeric> #include<map> #include<unordered_map> #include <queue> using namespace std; using ll=long long; #define rep(i,n) for(ll i=0;i<n;++i) #define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++) #define ALL(a) (a).begin(),(a).end() int main(){ ll n, k; cin >> n >> k; vector<ll> a(n); rep(i, n)cin >> a[i]; if(n == 1 && n != k){ cout << cout << "IMPOSSIBLE"; return 0; } sort(ALL(a)); ll sum = 0; rep(i, n)sum += a[i]%a.front(); if(a.back() >= k){ if(sum > 0)cout << "POSSIBLE"; else if(k%a.front() == 0)cout << "POSSIBLE"; else cout << "IMPOSSIBLE"; } else cout << "IMPOSSIBLE"; }
a.cc: In function 'int main()': a.cc:24:14: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::ostream' {aka 'std::basic_ostream<char>'}) 24 | cout << cout << "IMPOSSIBLE"; | ~~~~ ^~ ~~~~ | | | | | basic_ostream<[...]> | basic_ostream<[...]> a.cc:24:14: note: candidate: 'operator<<(int, int)' (built-in) 24 | cout << cout << "IMPOSSIBLE"; | ~~~~~^~~~~~~ a.cc:24:14: note: no known conversion for argument 2 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int' In file included from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'} 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]' 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ^~~~~~~~ /usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'std::ios_base& (*)(std::ios_base&)' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 174 | operator<<(long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'long int' 174 | operator<<(long __n) | ~~~~~^~~ /usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 178 | operator<<(unsigned long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'long unsigned int' 178 | operator<<(unsigned long __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 182 | operator<<(bool __n) | ^~~~~~~~ /usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'bool' 182 | operator<<(bool __n) | ~~~~~^~~ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]' 96 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'short int' 97 | operator<<(short __n) | ~~~~~~^~~ /usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 189 | operator<<(unsigned short __n) | ^~~~~~~~ /usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'short unsigned int' 189 | operator<<(unsigned short __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]' 110 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int' 111 | operator<<(int __n) | ~~~~^~~ /usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 200 | operator<<(unsigned int __n) | ^~~~~~~~ /usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'unsigned int' 200 | operator<<(unsigned int __n) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 211 | operator<<(long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'long long int' 211 | operator<<(long long __n) | ~~~~~~~~~~^~~ /usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 215 | operator<<(unsigned long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'long long unsigned int' 215 | operator<<(unsigned long long __n) | ~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 231 | operator<<(double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'double' 231 | operator<<(double __f) | ~~~~~~~^~~ /usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 235 | operator<<(float __f) | ^~~~~~~~ /usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'float' 235 | operator<<(float __f) | ~~~~~~^~~ /usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 243 | operator<<(long double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'long double' 243 | operator<<(long double __f) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 301 | operator<<(const void* __p) | ^~~~~~~~ /usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'const void*' 301 | operator<<(const void* __p) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/os
s697097122
p03651
C++
#include <bits/stdc++.h> #include <math.h> #include <cmath> #define rep(i,n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; int main(){ int n,k; cin >>n>>k; priority_queue<int> b; rep(i,n){ int a; cin >>a; b.push(a); } if(b.top()=k) { printf("POSSIBLE"); return 0; } if(b.top()<k) { printf("IMPOSSIBLE"); return 0; } }
a.cc: In function 'int main()': a.cc:18:13: error: assignment of read-only location 'b.std::priority_queue<int>::top()' 18 | if(b.top()=k) { | ~~~~~~~^~
s804352474
p03651
C++
#include <bits/stdc++.h> #include <math.h> #include <cmath> #define rep(i,n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; int main(){ int n,k; cin >>n>>k; priority_queue<int> b(n); rep(i,n) cin >> b[i]; if(b.top()=k) { printf("POSSIBLE"); return 0; } if(b.top()<k) { printf("IMPOSSIBLE"); return 0; } }
a.cc: In function 'int main()': a.cc:12:26: error: no matching function for call to 'std::priority_queue<int>::priority_queue(int&)' 12 | priority_queue<int> b(n); | ^ In file included from /usr/include/c++/14/queue:66, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:157, from a.cc:1: /usr/include/c++/14/bits/stl_queue.h:691:9: note: candidate: 'template<class _InputIterator, class _Alloc, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(_InputIterator, _InputIterator, const _Compare&, _Sequence&&, const _Alloc&) [with _Alloc = _InputIterator; _Requires = _Alloc; _Tp = int; _Sequence = std::vector<int>; _Compare = std::less<int>]' 691 | priority_queue(_InputIterator __first, _InputIterator __last, | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:691:9: note: candidate expects 5 arguments, 1 provided /usr/include/c++/14/bits/stl_queue.h:679:9: note: candidate: 'template<class _InputIterator, class _Alloc, class, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(_InputIterator, _InputIterator, const _Compare&, const _Sequence&, const _Alloc&) [with _Alloc = _InputIterator; <template-parameter-2-3> = _Alloc; _Requires = <template-parameter-1-3>; _Tp = int; _Sequence = std::vector<int>; _Compare = std::less<int>]' 679 | priority_queue(_InputIterator __first, _InputIterator __last, | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:679:9: note: candidate expects 5 arguments, 1 provided /usr/include/c++/14/bits/stl_queue.h:671:9: note: candidate: 'template<class _InputIterator, class _Alloc, class, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(_InputIterator, _InputIterator, const _Compare&, const _Alloc&) [with _Alloc = _InputIterator; <template-parameter-2-3> = _Alloc; _Requires = <template-parameter-1-3>; _Tp = int; _Sequence = std::vector<int>; _Compare = std::less<int>]' 671 | priority_queue(_InputIterator __first, _InputIterator __last, | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:671:9: note: candidate expects 4 arguments, 1 provided /usr/include/c++/14/bits/stl_queue.h:663:9: note: candidate: 'template<class _InputIterator, class _Alloc, class, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(_InputIterator, _InputIterator, const _Alloc&) [with _Alloc = _InputIterator; <template-parameter-2-3> = _Alloc; _Requires = <template-parameter-1-3>; _Tp = int; _Sequence = std::vector<int>; _Compare = std::less<int>]' 663 | priority_queue(_InputIterator __first, _InputIterator __last, | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:663:9: note: candidate expects 3 arguments, 1 provided /usr/include/c++/14/bits/stl_queue.h:649:9: note: candidate: 'template<class _InputIterator, class> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(_InputIterator, _InputIterator, const _Compare&, _Sequence&&) [with <template-parameter-2-2> = _InputIterator; _Tp = int; _Sequence = std::vector<int>; _Compare = std::less<int>]' 649 | priority_queue(_InputIterator __first, _InputIterator __last, | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:649:9: note: candidate expects 4 arguments, 1 provided /usr/include/c++/14/bits/stl_queue.h:638:9: note: candidate: 'template<class _InputIterator, class> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(_InputIterator, _InputIterator, const _Compare&, const _Sequence&) [with <template-parameter-2-2> = _InputIterator; _Tp = int; _Sequence = std::vector<int>; _Compare = std::less<int>]' 638 | priority_queue(_InputIterator __first, _InputIterator __last, | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:638:9: note: candidate expects 4 arguments, 1 provided /usr/include/c++/14/bits/stl_queue.h:629:9: note: candidate: 'template<class _InputIterator, class> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(_InputIterator, _InputIterator, const _Compare&) [with <template-parameter-2-2> = _InputIterator; _Tp = int; _Sequence = std::vector<int>; _Compare = std::less<int>]' 629 | priority_queue(_InputIterator __first, _InputIterator __last, | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:629:9: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_queue.h:594:9: note: candidate: 'template<class _Alloc, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(std::priority_queue<_Tp, _Sequence, _Compare>&&, const _Alloc&) [with _Requires = _Alloc; _Tp = int; _Sequence = std::vector<int>; _Compare = std::less<int>]' 594 | priority_queue(priority_queue&& __q, const _Alloc& __a) | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:594:9: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_queue.h:590:9: note: candidate: 'template<class _Alloc, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(const std::priority_queue<_Tp, _Sequence, _Compare>&, const _Alloc&) [with _Requires = _Alloc; _Tp = int; _Sequence = std::vector<int>; _Compare = std::less<int>]' 590 | priority_queue(const priority_queue& __q, const _Alloc& __a) | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:590:9: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_queue.h:585:9: note: candidate: 'template<class _Alloc, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(const _Compare&, _Sequence&&, const _Alloc&) [with _Requires = _Alloc; _Tp = int; _Sequence = std::vector<int>; _Compare = std::less<int>]' 585 | priority_queue(const _Compare& __x, _Sequence&& __c, const _Alloc& __a) | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:585:9: note: candidate expects 3 arguments, 1 provided /usr/include/c++/14/bits/stl_queue.h:579:9: note: candidate: 'template<class _Alloc, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(const _Compare&, const _Sequence&, const _Alloc&) [with _Requires = _Alloc; _Tp = int; _Sequence = std::vector<int>; _Compare = std::less<int>]' 579 | priority_queue(const _Compare& __x, const _Sequence& __c, | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:579:9: note: candidate expects 3 arguments, 1 provided /usr/include/c++/14/bits/stl_queue.h:573:9: note: candidate: 'template<class _Alloc, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(const _Compare&, const _Alloc&) [with _Requires = _Alloc; _Tp = int; _Sequence = std::vector<int>; _Compare = std::less<int>]' 573 | priority_queue(const _Compare& __x, const _Alloc& __a) | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:573:9: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_queue.h:569:9: note: candidate: 'template<class _Alloc, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(const _Alloc&) [with _Requires = _Alloc; _Tp = int; _Sequence = std::vector<int>; _Compare = std::less<int>]' 569 | priority_queue(const _Alloc& __a) | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:569:9: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_queue.h: In substitution of 'template<class _Tp, class _Sequence, class _Compare> template<class _Alloc> using std::priority_queue<_Tp, _Sequence, _Compare>::_Uses = typename std::enable_if<std::uses_allocator<_Sequence, _Alloc>::value>::type [with _Alloc = int; _Tp = int; _Sequence = std::vector<int>; _Compare = std::less<int>]': /usr/include/c++/14/bits/stl_queue.h:567:33: required from here 567 | template<typename _Alloc, typename _Requires = _Uses<_Alloc>> | ^~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:513:15: error: no type named 'type' in 'struct std::enable_if<false, void>' 513 | using _Uses = typename | ^~~~~ /usr/include/c++/14/bits/stl_queue.h:554:9: note: candidate: 'template<class _Seq, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue() [with _Requires = _Seq; _Tp = int; _Sequence = std::vector<int>; _Compare = std::less<int>]' 554 | priority_queue() | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:554:9: note: candidate expects 0 arguments, 1 provided /usr/include/c++/14/bits/stl_queue.h:563:7: note: candidate: 'std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(const _Compare&, _Sequence&&) [with _Tp = int; _Sequence = std::vector<int>; _Compare = std::less<int>]' 563 | priority_queue(const _Compare& __x, _Sequence&& __s = _Sequence()) | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:563:38: note: no known conversion for argument 1 from 'int' to 'const std::less<int>&' 563 | priority_queue(const _Compare& __x, _Sequence&& __s = _Sequence()) | ~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_queue.h:558:7: note: candidate: 'std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(const _Compare&, const _Sequence&) [with _Tp = int; _Sequence = std::vector<int>; _Compare = std::less<int>]' 558 | priority_queue(const _Compare& __x, const _Sequence& __s) | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:558:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_queue.h:496:11: note: candidate: 'std::priority_queue<int>::priority_queue(const std::priority_queue<int>&)' 496 | class priority_queue | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:496:11: note: no known conversion for argument 1 from 'int' to 'const std::priority_queue<int>&' /usr/include/c++/14/bits/stl_queue.h:496:11: note: candidate: 'std::priority_queue<int>::priority_queue(std::priority_queue<int>&&)' /usr/include/c++/14/bits/stl_queue.h:496:11: note: no known conversion for argument 1 from 'int' to
s068471909
p03651
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, j, n) for (ll i = j; i < n; i++) #define all(x) (x).begin(),(x).end() #define INF (1000000000) #define MOD (1000000007) #define MAX (100000) #define pii pair<int, int> ///////////////////////////////////////////////////////// class XY{ public: ll x, y; XY() {x = y = 0;} XY(ll u, ll v) {x = u; y = v;} }; template<typename T1, typename T2> void chmin(T1 &a, T2 b) {if(a > b) a = b;} template<typename T1, typename T2> void chmax(T1 &a, T2 b) {if(a < b) a = b;} template<typename T1, typename T2> ll mypow(T1 a, T2 n){ if(n == 0) return 1; if(n == 1) return a; if(n % 2) return a * mypow(a, n - 1); ll tmp = mypow(a, n / 2); return tmp * tmp; } template<typename T> int BS(vector<T> V, int left, int right, T key){ int mid = (left + right) / 2; if(V[mid] <= key) left = mid; else right = mid; if(right - mid == 1) return left; else return BS(V, left, right, key); } ll comb(ll n, ll r){ ll res = 1; rep(i, 0, r){ res *= n - i; res /= i + 1; } return res; } template<typename T> T euclid(T a, T b){ if(b == 0) return a; else return euclid(b, a % b); } ///////////////////////////////////////////////////////// void Main() { int N, K; cin >> N, K; vector<int> A(N); int ma = 0; mi = INF; rep(i, 0, N){ cin >> A[i]; chmax(ma, A[i]); chmin(mi, A[i]); } int GCM = A[0]; rep(i, 1, N) GCM = euclid(GCM, A[i]); string res; if(K % GCM == 0 && ma - mi >= K) res = "POSSIBLE"; else res = "IMPOSSIBLE"; cout << res << endl; } ///////////////////////////////////////////////////////// int main(){ cin.tie(nullptr); ios_base::sync_with_stdio(false); cout << std::fixed << std::setprecision(15); Main(); }
a.cc: In function 'void Main()': a.cc:63:15: error: 'mi' was not declared in this scope; did you mean 'ma'? 63 | int ma = 0; mi = INF; | ^~ | ma
s270188483
p03651
C++
// luogu-judger-enable-o2 #include<bits/stdc++.h> using namespace std; int n,k,e,u,w; int main(){ cin>>n>>k>>e; w=e; for(int i=2;i<=n;i++){ cin>>u; e=__gcd(e,u); w=max(u,w); } if(k%a==0&&k<=w){ cout<<"POSSIBLE"<<endl; } else{ cout<<"IMPOSSIBLE"<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:13:10: error: 'a' was not declared in this scope 13 | if(k%a==0&&k<=w){ | ^
s562607363
p03651
C++
#include<bits/stdc++.h> using namespace std; int main() { int n,k,a,ak,h; cin>>n>>k>>a; h=a; for(int i=2;i<=n;i++) { cin>>ak; a=__gcd(a,ak); h=max(ak,h); } if(k%a==0&&k<=h) { cout<<"POSSIBLE"<<endl; } else { cout<<"IMPOSSIBLE"<<endl; }
a.cc: In function 'int main()': a.cc:21:6: error: expected '}' at end of input 21 | } | ^ a.cc:4:1: note: to match this '{' 4 | { | ^
s373831726
p03651
C++
#include <iostream> using namespace std; long long gcd(long long a, long long b){ if (b == 0) return a; return gcd(b, a % b); } int main(){ int N, K; long long p, n, M; bool b = false; cin >> N >> K; cin >> p; M = p; for (int i = 1; i < N; ++i){ cin >> n; p = gcd(p, n); M = max(M, n); if (n == K) b = ture; } cout << ( b||(K % p == 0 && K <= M) ? "POSSIBLE" : "IMPOSSIBLE") << endl; }
a.cc: In function 'int main()': a.cc:21:25: error: 'ture' was not declared in this scope 21 | if (n == K) b = ture; | ^~~~
s075834867
p03651
C++
#include <bits/stdc++.h> using namespace std; #define all(x) x.begin(), x.end() #define rep(i, n) for (int i = 0; i < n; ++i) #define reps(i, m, n) for (int i = m; i <= n; ++i) using i64 = long long; using pii = pair<i64, i64>; template<class A, class B>inline bool chmax(A &a, const B &b){return b > a ? a = b,1 : 0 template<class A, class B>inline bool chmin(A &a, const B &b){return b < a ? a = b,1 : 0 constexpr int INF = 0x3f3f3f3f; constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL; constexpr int MOD = int(1e9) + 7; signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); i64 n, k; cin >> n >> k; int sumdiff = 0; vector<int> a(n+5); rep(i, n) { cin >> a[i]; if (a[i] == k) { cout << "POSSIBLE" << "\n"; return 0; } sumdiff = abs(sumdiff - a[i]); } for (int i = 0; i < n; ++i) { if (abs(a[i] - sumdiff) == k) { cout << "POSSIBLE" << "\n"; return 0; } } cout << "IMPOSSIBLE" << "\n"; return 0; }
a.cc: In function 'bool chmax(A&, const B&)': a.cc:12:89: error: expected ';' before 'template' 12 | template<class A, class B>inline bool chmax(A &a, const B &b){return b > a ? a = b,1 : 0 | ^ | ; 13 | template<class A, class B>inline bool chmin(A &a, const B &b){return b < a ? a = b,1 : 0 | ~~~~~~~~ a.cc:13:1: error: a template declaration cannot appear at block scope 13 | template<class A, class B>inline bool chmin(A &a, const B &b){return b < a ? a = b,1 : 0 | ^~~~~~~~ a.cc:48:2: error: expected '}' at end of input 48 | } | ^ a.cc:12:62: note: to match this '{' 12 | template<class A, class B>inline bool chmax(A &a, const B &b){return b > a ? a = b,1 : 0 | ^
s989132994
p03651
C++
/* Life Before Death, Strength Before Weakness, Journey Before Destination ------------------------------------------------------------------------ You don't become great by trying to be great. You become great by wanting to do something, and then doing it so hard that you become great in the process. */ //#pragma comment(linker, ack:200000000") #pragma GCC optimize ("Ofast") #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <bits/stdc++.h> using namespace std; #define TRACE #ifdef TRACE #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) template <typename Arg1> void __f(const char* name, Arg1&& arg1){ cerr << name << " : " << arg1 << std::endl; } template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args){ const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); } #else #define trace(...) #endif #define rep(i, n) for(ll i = 0; i < (n); ++i) #define repA(i, a, n) for(ll i = a; i <= (n); ++i) #define repD(i, a, n) for(ll i = a; i >= (n); --i) #define trav(a, x) for(auto& a : x) #define all(x) x.begin(), x.end() #define sz(x) (int)(x).size() #define fill(a) memset(a, 0, sizeof (a)) #define fst first #define snd second //#define mp make_pair #define pb push_back #define PI 3.141592653589793238462643383279502884197169399 /* pi */ #define te ll ti; cin >> ti; while(ti--) solve(); typedef long double ld; typedef long long ll; typedef pair<ll, ll> pii; typedef vector<ll> vi; const int maxN = 200100; void solve(){ ll n, k, g = 0; cin >> n >> k; rep(i, n) cin >> a[i], g = __gcd(g, a[i]); ll m = *max_element(a, a+n); if(k > m) { cout << "IMPOSSIBLE" << endl; return; } cout << (k%m ? "IMPOSSIBLE" : "POSSIBLE") << endl; } int main() { cin.sync_with_stdio(0); cin.tie(0); cin.exceptions(cin.failbit); /* #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif */ //te solve(); return 0; }
a.cc: In function 'void solve()': a.cc:53:26: error: 'a' was not declared in this scope 53 | rep(i, n) cin >> a[i], g = __gcd(g, a[i]); | ^ a.cc:54:29: error: 'a' was not declared in this scope 54 | ll m = *max_element(a, a+n); | ^
s923405573
p03651
C++
#include <cmath> #include <cstdio> using namespace std; int n,k,a,ak,h,i; int max(int a,int b) {return(a>b?a:b);} int main() { scanf("%d %d %d",&n,&k,&a); h=a; for(i=2;i<=n;++i) { scanf("%d",&ak); a=__gcd(a,ak); h=max(ak,h); } if(k%a==0&&k<=h)printf("POSSIBLE\n"); else printf("IMPOSSIBLE\n"); }
a.cc: In function 'int main()': a.cc:18:11: error: '__gcd' was not declared in this scope 18 | a=__gcd(a,ak); | ^~~~~
s795581295
p03651
Java
import java.util.*; public class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); long n = sc.nextLong(); long k = sc.nextLong(); List<Long> a = new ArrayList<>(); for (int i = 0; i < n; i++){ a.add(sc.nextLong()); if(a.get(i)==k){ System.out.println("POSSIBLE"); Sytem.exit(0); } } int i = 0; int j = 0; long diff = 0; while(i < a.size()){ while(j<a.size()){ diff = Math.abs(a.get(i)-a.get(j)); if((diff)==k){ System.out.println("POSSIBLE"); System.exit(0); } if(!a.contains(diff)){ a.add(diff); } j++; } j = 1; i++; } System.out.println("IMPOSSIBLE"); } }
Main.java:15: error: cannot find symbol Sytem.exit(0); ^ symbol: variable Sytem location: class Main 1 error
s837358454
p03651
Java
import java.util.*; public class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); long n = sc.nextLong(); long k = sc.nextLong(); List<Long> a = new ArrayList<>(); for (int i = 0; i < n; i++){ a.add(sc.nextLong()); } int j = 0; long diff = 0; while(i < a.size()){ j = i+1; while(j<a.size()){ diff = Math.abs(a.get(i)-a.get(j)); if((diff)==k){ System.out.println("POSSIBLE"); System.exit(0); } if(!a.contains(diff)){ a.add(diff); } j++; } } System.out.println("IMPOSSIBLE"); } }
Main.java:17: error: cannot find symbol while(i < a.size()){ ^ symbol: variable i location: class Main Main.java:18: error: cannot find symbol j = i+1; ^ symbol: variable i location: class Main Main.java:20: error: cannot find symbol diff = Math.abs(a.get(i)-a.get(j)); ^ symbol: variable i location: class Main 3 errors
s560168519
p03651
Java
import java.util.*; public class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); long n = sc.nextLong(); long k = sc.nextLong(); long[] a = new long[n]; for (int i = 0; i < n; i++){ a[i] = sc.nextLong(); } int j = 0; for(int i = 0; i<n; i++){ j = i+1; while(j<n){ if(Math.abs(a[i]-a[j])==k){ System.out.println("POSSIBLE"); System.exit(0); } j++; } } System.out.println("IMPOSSIBLE"); } }
Main.java:9: error: incompatible types: possible lossy conversion from long to int long[] a = new long[n]; ^ 1 error
s400420552
p03651
C++
#include <iostream> #include <algorithm> #include <vector> #include <math.h> using namespace std; typedef long long int ll; long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; } int main(){ int n,k; cin >> n >> k; vector<int> a(n); int M=0; for(int i=0;i<n;i++){ cin >> a[i]; M=max(a[i],M); } int m=a[0]; for(int i=1;i<n;i++){ m=GCD(m,a[i]); } if(int i=M;i>=0;i-=m){ if(i==k){ cout << "POSSIBLE" << endl; return 0; } } cout << "IMPOSSIBLE" << endl; return 0; }
a.cc: In function 'int main()': a.cc:22:24: error: expected ')' before ';' token 22 | if(int i=M;i>=0;i-=m){ | ~ ^ | ) a.cc:22:25: error: 'i' was not declared in this scope 22 | if(int i=M;i>=0;i-=m){ | ^
s888115806
p03651
C++
#include <iostream> #include <cstdio> #include <string> #include <algorithm> #include <cmath> #include <vector> #define rep(i, n) for(int i = 0; i < n; i++) using namespace std; typedef long long ll; int gcd(int x, int y) { if(y == 0) { return x; } return gcd(y, x%y); } int gcd(int n, int a[]) { int a[n]; int x = a[0]; for(int i = 1; i < n; i++) { x = gcd(x, a[i]); } return x; } int main() { int n, k; int a[n]; rep(i, n) { cin >> a[i]; } sort(a, a+n); if(a[n-1] < k) { cout << "IMPOSSIBLE" << endl; return 0; } else { int g = gcd(n, a); if(k%g == 0) { cout << "POSSIBLE" << endl; return 0; } else { cout << "IMPOSSIBLE" << endl; return 0; } } }
a.cc: In function 'int gcd(int, int*)': a.cc:20:9: error: declaration of 'int a [n]' shadows a parameter 20 | int a[n]; | ^ a.cc:19:20: note: 'int* a' previously declared here 19 | int gcd(int n, int a[]) { | ~~~~^~~
s108371653
p03651
C++
#include <iostream> #include <cstdio> #include <string> #include <algorithm> #include <cmath> #include <vector> #define rep(i, n) for(int i = 0; i < n; i++) using namespace std; typedef long long ll; int gcd(int x, int y) { if(y == 0) { return x; } return gcd(y, x%y); } int gcd(int n, int a[n]) { int x = a[0]; for(int i = 1; i < n; i++) { x = gcd(x, a[i]); } return x; } int main() { int n, k; int a[n]; rep(i, n) { cin >> a[i]; } sort(a, a+n); if(a[n-1] < k) { cout << "IMPOSSIBLE" << endl; return 0; } else { int g = gcd(n, a); if(k%g == 0) { cout << "POSSIBLE" << endl; return 0; } else { cout << "IMPOSSIBLE" << endl; return 0; } } }
a.cc:19:23: error: use of parameter outside function body before ']' token 19 | int gcd(int n, int a[n]) { | ^ a.cc: In function 'int gcd(...)': a.cc:20:13: error: 'a' was not declared in this scope 20 | int x = a[0]; | ^ a.cc:22:24: error: 'n' was not declared in this scope 22 | for(int i = 1; i < n; i++) { | ^
s821169585
p03651
C++
#include <iostream> #include <cstdio> #include <string> #include <algorithm> #include <cmath> #include <vector> #define rep(i, n) for(int i = 0; i < n; i++) using namespace std; typedef long long ll; int gcd(int x, int y) { if(y == 0) { return x; } return gcd(y, x%y); } int gcd(int a[]) { int x = a[0]; for(int i = 1; i < a.size(); i++) { x = gcd(x, a[i]); } return x; } int main() { int n, k; int a[n]; rep(i, n) { cin >> a[i]; } sort(a, a+n); if(a[n-1] < k) { cout << "IMPOSSIBLE" << endl; return 0; } else { int g = gcd(a); if(k%g == 0) { cout << "POSSIBLE" << endl; return 0; } else { cout << "IMPOSSIBLE" << endl; return 0; } } }
a.cc: In function 'int gcd(int*)': a.cc:22:26: error: request for member 'size' in 'a', which is of non-class type 'int*' 22 | for(int i = 1; i < a.size(); i++) { | ^~~~
s658238619
p03651
C++
#include <bits/stdc++.h> using namespace std; unsigned euclidean_gcd(unsigned a, unsigned b) { if(a < b) return euclidean_gcd(b, a); unsigned r; while ((r=a%b)) { a = b; b = r; } return b; } int main() { int N,K; cin >> N >> K; int a[N]; cin >> a[0]; int ma; ma=0; for(int i=1;i<N;i++){ cin >> a[i]; a[i]=euclidean_gcd(a[i-1],a[i]); if(a[i]>ma)ma=a[i]; } if((K%a[N-1]==0 && ma>=K) cout << "POSSIBLE"; else cout << "IMPOSSIBLE"; }
a.cc: In function 'int main()': a.cc:26:28: error: expected ';' before 'cout' 26 | if((K%a[N-1]==0 && ma>=K) cout << "POSSIBLE"; | ^~~~~ | ; a.cc:27:3: error: expected primary-expression before 'else' 27 | else cout << "IMPOSSIBLE"; | ^~~~ a.cc:26:48: error: expected ')' before 'else' 26 | if((K%a[N-1]==0 && ma>=K) cout << "POSSIBLE"; | ~ ^ | ) 27 | else cout << "IMPOSSIBLE"; | ~~~~
s436822045
p03651
C++
#include <bits/stdc++.h> #define REP(i, n) for(ll i = 0; i < (ll)n; i++) #define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++) #define ALL(obj) (obj).begin(), (obj).end() #define INF 1000000000000000 using namespace std; typedef long long ll; typedef double db; typedef string str; typedef pair<ll, ll> p; constexpr int MOD = 1000000007; template <class T> inline bool chmin(T &a, T b) { if(a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if(a < b) { a = b; return true; } return false; } void print(const std::vector<int> &v) { std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; }); std::cout << std::endl; } long long gcd(long long a, long long b) { if(a < b) { swap(b, a); } if(b == 0) { return a; } if(a == 0) { return b; } a = a % b; return gcd(b, a); } int main() { long long N, K; cin >> N >> K; vector<long long> A(N); REP(i, N) { cin >> A[i]; } long long gc = gcd(A[0], A[1]); REP(i, N) { gc = gcd(gc, A[i]); } // KがAiの最大値以下でありかつgcdで割り切れるか long long m = max_element(begin(A), end(A)); // c++11 if(K <= m and K % gc == 0) { cout << "POSSIBLE" << endl; } else { cout << "IMPOSSIBLE" << endl; } }
a.cc: In function 'int main()': a.cc:52:30: error: cannot convert '__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >' to 'long long int' in initialization 52 | long long m = max_element(begin(A), end(A)); // c++11 | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ | | | __gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >
s864126322
p03651
C++
//#pragma GCC optimize ("-O3") #include <bits/stdc++.h> using namespace std; //衝突対策 #define ws wszzzz #define int long long //@formatter:off template<class A, class B, class C>struct T2 {A f;B s;C t;T2() { f = 0, s = 0, t = 0; }T2(A f, B s, C t) : f(f), s(s), t(t) {}bool operator<(const T2 &r) const { return f != r.f ? f < r.f : s != r.s ? s < r.s : t < r.t; /*return f != r.f ? f > r.f : s != r.s ?n s > r.s : t > r.t; 大きい順 */ } bool operator>(const T2 &r) const { return f != r.f ? f > r.f : s != r.s ? s > r.s : t > r.t; /*return f != r.f ? f > r.f : s != r.s ? s > r.s : t > r.t; 小さい順 */ } bool operator==(const T2 &r) const { return f == r.f && s == r.s && t == r.t; } bool operator!=(const T2 &r) const { return f != r.f || s != r.s || t != r.t; }}; template<class A, class B, class C, class D> struct F2 { A a; B b; C c; D d; F2() { a = 0, b = 0, c = 0, d = 0; } F2(A a, B b, C c, D d) : a(a), b(b), c(c), d(d) {} bool operator<(const F2 &r) const { return a != r.a ? a < r.a : b != r.b ? b < r.b : c != r.c ? c < r.c : d < r.d; /* return a != r.a ? a > r.a : b != r.b ? b > r.b : c != r.c ? c > r.c : d > r.d;*/ } bool operator>(const F2 &r) const { return a != r.a ? a > r.a : b != r.b ? b > r.b : c != r.c ? c > r.c : d > r.d;/* return a != r.a ? a < r.a : b != r.b ? b < r.b : c != r.c ? c < r.c : d < r.d;*/ } bool operator==(const F2 &r) const { return a == r.a && b == r.b && c == r.c && d == r.d; } bool operator!=(const F2 &r) const { return a != r.a || b != r.b || c != r.c || d != r.d; } int operator[](int i) { assert(i < 4); return i == 0 ? a : i == 1 ? b : i == 2 ? c : d; }}; typedef T2<int, int, int> T; typedef F2<int, int, int, int> F; T mt(int a, int b, int c) {return T(a, b, c);} //@マクロ省略系 型,構造 #define ll long long #define double long double #define ull unsigned long long using dou = double; using itn = int; using str = string; using bo= bool; #define au auto using P = pair<ll, ll>; using pd =pair<dou, dou>; #define fi first #define se second #define vec vector #define beg begin #define rbeg rbegin #define con continue #define bre break #define brk break #define is == #define elf else if #define maxq 1 #define minq -1 #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) #define MALLOC(type, len) (type*)malloc((len) * sizeof(type)) #define lam(right) [&](int& p){return p right;} //マクロ省略系 コンテナ using vi = vector<int>; #define _overloadvvi(_1, _2, _3, _4, name, ...) name #define vvi0() vec<vi> #define vvi1(a) vec<vi> a #define vvi2(a, b) vec<vi> a(b) #define vvi3(a, b, c) vec<vi> a(b,vi(c)) #define vvi4(a, b, c, d) vec<vi> a(b,vi(c,d)) #define vvi(...) _overloadvvi(__VA_ARGS__,vvi4,vvi3,vvi2 ,vvi1,vvi0)(__VA_ARGS__) using vl = vector<ll>; #define _overloadvvl(_1, _2, _3, _4, name, ...) name #define vvl1(a) vec<vl> a #define vvl2(a, b) vec<vl> a(b) #define vvl3(a, b, c) vec<vl> a(b,vl(c)) #define vvl4(a, b, c, d) vec<vl> a(b,vl(c,d)) #define vvl(...) _overloadvvl(__VA_ARGS__,vvl4,vvl3,vvl2 ,vvl1)(__VA_ARGS__) using vb = vector<bool>; #define _overloadvvb(_1, _2, _3, _4, name, ...) name #define vvb1(a) vec<vb> a #define vvb2(a, b) vec<vb> a(b) #define vvb3(a, b, c) vec<vb> a(b,vb(c)) #define vvb4(a, b, c, d) vec<vb> a(b,vb(c,d)) #define vvb(...) _overloadvvb(__VA_ARGS__,vvb4,vvb3,vvb2 ,vvb1)(__VA_ARGS__) using vs = vector<string>; #define _overloadvvs(_1, _2, _3, _4, name, ...) name #define vvs1(a) vec<vs> a #define vvs2(a, b) vec<vs> a(b) #define vvs3(a, b, c) vec<vs> a(b,vs(c)) #define vvs4(a, b, c, d) vec<vs> a(b,vs(c,d)) #define vvs(...) _overloadvvs(__VA_ARGS__,vvs4,vvs3,vvs2 ,vvs1)(__VA_ARGS__) using vd = vector<double>; #define _overloadvvd(_1, _2, _3, _4, name, ...) name #define vvd1(a) vec<vd> a #define vvd2(a, b) vec<vd> a(b) #define vvd3(a, b, c) vec<vd> a(b,vd(c)) #define vvd4(a, b, c, d) vec<vd> a(b,vd(c,d)) #define vvd(...) _overloadvvd(__VA_ARGS__,vvd4,vvd3,vvd2 ,vvd1)(__VA_ARGS__) using vc=vector<char>; #define _overloadvvc(_1, _2, _3, _4, name, ...) name #define vvc1(a) vec<vc> a #define vvc2(a, b) vec<vc> a(b) #define vvc3(a, b, c) vec<vc> a(b,vc(c)) #define vvc4(a, b, c, d) vec<vc> a(b,vc(c,d)) #define vvc(...) _overloadvvc(__VA_ARGS__,vvc4,vvc3,vvc2 ,vvc1)(__VA_ARGS__) using vp = vector<P>; #define _overloadvvp(_1, _2, _3, _4, name, ...) name #define vvp1(a) vec<vp> a #define vvp2(a, b) vec<vp> a(b) #define vvp3(a, b, c) vec<vp> a(b,vp(c)) #define vvp4(a, b, c, d) vec<vp> a(b,vp(c,d)) #define vvp(...) _overloadvvp(__VA_ARGS__,vvp4,vvp3,vvp2 ,vvp1)(__VA_ARGS__) using vt = vector<T>; #define _overloadvvt(_1, _2, _3, _4, name, ...) name #define vvt1(a) vec<vt> a #define vvt2(a, b) vec<vt> a(b) #define vvt3(a, b, c) vec<vt> a(b,vt(c)) #define vvt4(a, b, c, d) vec<vt> a(b,vt(c,d)) #define vvt(...) _overloadvvt(__VA_ARGS__,vvt4,vvt3,vvt2 ,vvt1)(__VA_ARGS__) #define v3i(a, b, c, d) vector<vector<vi>> a(b, vector<vi>(c, vi(d))) #define v3d(a, b, c, d) vector<vector<vd>> a(b, vector<vd>(c, vd(d))) #define v3m(a, b, c, d) vector<vector<vm>> a(b, vector<vm>(c, vm(d))) #define _vvi vector<vi> #define _vvl vector<vl> #define _vvb vector<vb> #define _vvs vector<vs> #define _vvd vector<vd> #define _vvc vector<vc> #define _vvp vector<vp> template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); } template<typename T, typename... Ts> auto make_v(size_t a, Ts... ts) {return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));} #define vni(name, ...) auto name = make_v<int>(__VA_ARGS__) #define vnb(name, ...) auto name = make_v<bool>(__VA_ARGS__) #define vns(name, ...) auto name = make_v<string>(__VA_ARGS__) #define vnd(name, ...) auto name = make_v<double>(__VA_ARGS__) #define vnc(name, ...) auto name = make_v<char>(__VA_ARGS__) #define vnp(name, ...) auto name = make_v<P>(__VA_ARGS__) #define PQ priority_queue<ll, vector<ll>, greater<ll> > #define tos to_string using mapi = map<int, int>; using mapp = map<P, int>; using mapd = map<dou, int>; using mapc = map<char, int>; using maps = map<str, int>; using seti = set<int>; using setd = set<dou>; using setc = set<char>; using sets = set<str>; using qui = queue<int>; #define bset bitset #define uset unordered_set #define mset multiset #define umap unordered_map #define umapi unordered_map<int,int> #define umapp unordered_map<P,int> #define mmap multimap //マクロ 繰り返し #define _overloadrep(_1, _2, _3, _4, name, ...) name # define rep1(n) for(int rep1i = 0,_lim=n; rep1i < _lim ; rep1i++) # define _rep(i, n) for(int i = 0,_lim=n; i < _lim ; i++) #define repi(i, m, n) for(int i = m,_lim=n; i < _lim ; i++) #define repadd(i, m, n, ad) for(int i = m,_lim=n; i < _lim ; i+= ad) #define rep(...) _overloadrep(__VA_ARGS__,repadd,repi,_rep,rep1)(__VA_ARGS__) #define _rer(i, n) for(int i = n; i >= 0 ; i--) #define reri(i, m, n) for(int i = m,_lim=n; i >= _lim ; i--) #define rerdec(i, m, n, dec) for(int i = m,_lim=n; i >= _lim ; i-=dec) #define rer(...) _overloadrep(__VA_ARGS__,rerdec,reri,_rer,)(__VA_ARGS__) #define reps2(i, j, n) for(int i = 0,_lim=n; i < _lim ; i++)for(int j = 0; j < _lim ; j++) #define reps3(i, j, k, n) for(int i = 0,_lim=n; i < _lim ; i++)for(int j = 0; j < _lim ; j++)for(int k = 0; k < _lim ; k++) #define reps4(i, j, k, l, n) for(int i = 0,_lim=n; i < _lim ; i++)for(int j = 0; j < _lim ; j++)for(int k = 0; k < _lim ; k++)for(int l = 0; l < _lim ; l++) #define _overloadreps(_1, _2, _3, _4, _5, name, ...) name #define reps(...) _overloadreps(__VA_ARGS__,reps4,reps3,reps2,_rep,)(__VA_ARGS__) #define repss(i, j, k, a, b, c) for(int i = 0; i < a ; i++)for(int j = 0; j < b ; j++)for(int k = 0; k < c ; k++) #define fora(a, b) for(auto&& a : b) #define forg(gi, ve) for (int gi = 0,_lim = ve.size(), f, t, c; gi < _lim && (f = ve[gi].f, t = ve[gi].t, c = ve[gi].c, true); gi++) #define fort(gi, ve) for (int gi = 0, f, t, c; gi < ve.size() && (f = ve[gi].f, t = ve[gi].t, c = ve[gi].c, true); gi++)if(t!=p) #define form(st, l, r) for (auto &&it = st.lower_bound(l); it != st.end() && (*it).fi < r; it++) #define forit(st, l, r) for (auto &&it = st.lower_bound(l); it != st.end() && (*it) < r;) //マクロ 定数 #define k3 1010 #define k4 10101 #define k5 101010 #define k6 1010101 #define k7 10101010 const int inf = (int) 1e9 + 100; const ll linf = (ll) 1e18 + 100; const char infc = '{'; const string infs = "{"; const double eps = 1e-9; const double PI = 3.1415926535897932384626433832795029L; ll ma = numeric_limits<ll>::min(); ll mi = numeric_limits<ll>::max(); const int y4[] = {-1, 1, 0, 0}; const int x4[] = {0, 0, -1, 1}; const int y8[] = {0, 1, 0, -1, -1, 1, 1, -1}; const int x8[] = {1, 0, -1, 0, 1, -1, 1, -1}; //マクロ省略形 関数等 #define arsz(a) (sizeof(a)/sizeof(a[0])) #define sz(a) ((int)(a).size()) #define mp make_pair #define pb push_back #define pf push_front #define eb emplace_back #define all(a) (a).begin(),(a).end() #define rall(a) (a).rbegin(),(a).rend() constexpr bool ev(int a) { return !(a & 1); } constexpr bool od(int a) { return (a & 1); } //@拡張系 こう出来るべきというもの //埋め込み 存在を意識せずに機能を増やされているもの namespace std {template<> class hash<std::pair<signed, signed>> {public:size_t operator()(const std::pair<signed, signed> &x) const {return hash<ll>()(((ll) x.first << 32) + x.second);}};template<> class hash<std::pair<ll, ll>> {public:/*大きいllが渡されると、<<32でオーバーフローするがとりあえず問題ないと判断*/size_t operator()(const std::pair<ll, ll> &x) const {return hash<ll>()(((ll) x.first << 32) + x.second);}};} //stream まとめ istream &operator>>(istream &iss, P &a) {iss >> a.first >> a.second;return iss;}template<typename T> istream &operator>>(istream &iss, vector<T> &vec) {for (T &x: vec) iss >> x;return iss;}template<class T, class U> ostream &operator<<(ostream &os, pair<T, U> p) {os << p.fi << " " << p.se << endl;return os;}ostream &operator<<(ostream &os, T p) { os << p.f << " " << p.s << " " << p.t; return os;}ostream &operator<<(ostream &os, F p) { os << p.a << " " << p.b << " " << p.c << " " << p.d; return os;}template<typename T> ostream &operator<<(ostream &os, vector <T> &vec) { for (int i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " "); return os;}template<typename T> ostream &operator<<(ostream &os, vector <vector<T>> &vec) { for (int i = 0; i < vec.size(); i++) { for (int j = 0; j < vec[0].size(); j++) { os << vec[i][j]; } os << endl; } return os;}template<typename T, typename U> ostream &operator<<(ostream &os, map<T, U> &m) { for (auto &&v:m) os << v; return os;} template<typename V, typename H> void resize(vector<V> &vec, const H head) { vec.resize(head); }template<typename V, typename H, typename ... T> void resize(vector<V> &vec, const H &head, const T ... tail) {vec.resize(head);for (auto &v: vec)resize(v, tail...);} template<typename T, typename F> bool all_of2(const vector<T> &v, F f) { return std::all_of(v.begin(), v.end(), f); } template<typename T, typename F> bool any_of2(const vector<T> &v, F f) { return std::any_of(v.begin(), v.end(), f); } template<typename T, typename F> bool none_of2(const vector<T> &v, F f) { return std::none_of(v.begin(), v.end(), f); } template<typename T, typename F> int find_if2(const vector<T> &v, F f) { return std::find_if(v.begin(), v.end(), f)-v.begin(); } template<typename T, typename F> int rfind_if2(const vector<T> &v, F f) {return sz(v) - 1 - (find_if(v.rbegin(), v.rend(), f) - v.rbegin());} template<class T> bool contains(const string &s, const T &v) { return s.find(v) != string::npos; } template<typename T> bool contains(const vector<T> &v, const T &val) { return std::find(v.begin(), v.end(), val) != v.end(); } template<typename T, typename F> bool contains_if2(const vector<T> &v, F f) { return find_if(v.begin(), v.end(), f) != v.end(); } template<typename T, typename F> int count_if2(const T &v, F f) { return f(v); } template<typename T, typename F> int count_if2(const vector<T> &vec, F f) { int ret=0;fora(v,vec)ret+=count_if2(v,f) ;return ret;} template<typename V> int count_od(vector<V> &a) {return count_if2(a,[](int v){return v&1 ;});} template<typename V> int count_ev(vector<V> &a) {return count_if2(a,[](int v){return !(v&1) ;});} #define all_of(a,right) all_of2(a,lam(right)) #define any_of(a,right) any_of2(a,lam(right)) #define none_of(a,right) none_of2(a,lam(right)) #define find_if(a,right) find_if2(a,lam(right)) #define rfind_if(a,right) rfind_if2(a,lam(right)) #define contains_if(a,right) contains_if2(a,lam(right)) template<class T, class U> void replace(vector<T> &a, T key, U v) { replace(a.begin(), a.end(), key, v); } void replace(str &a, char key, str v) { if (v == "")a.erase(remove(all(a), key), a.end()); } void replace(str &a, char key, char v) { replace(all(a), key, v); } //keyと同じかどうか01で置き換える template<class T, class U> void replace(vector<T> &a, U k) { rep(i, sz(a)) a[i] = a[i] == k; } template<class T, class U> void replace(vector<vector<T >> &a, U k) { rep(i, sz(a))rep(j, sz(a[0])) a[i][j] = a[i][j] == k; } template<class T> void replace(T &a) { replace(a, '#'); } void replace(str &a, str key, str v) {stringstream t;int kn = sz(key);std::string::size_type Pos(a.find(key));int l = 0;while (Pos != std::string::npos) {t << a.substr(l, Pos - l);t << v;l = Pos + kn;Pos = a.find(key, Pos + kn);}t << a.substr(l, sz(a) - l);a = t.str();} template<class T> bool includes(vector<T> &a, vector<T> &b) {vi c = a;vi d = b;sort(all(c));sort(all(d));return includes(all(c), all(d));} template<class T> bool is_permutation(vector<T> &a, vector<T> &b) { return is_permutation(all(a), all(b)); } template<class T> bool next_permutation(vector<T> &a) { return next_permutation(all(a)); } void iota(vector<int> &ve, int s, int n) {ve.resize(n);iota(all(ve), s);} vi iota(int s, int len) {vi ve(len);iota(all(ve), s);return ve;} template<class A, class B> auto vtop(vector<A> &a, vector<B> &b) { assert(sz(a) == sz(b)); /*stringを0で初期化できない */ vector<pair<A, B>> res; rep(i, sz(a))res.eb(a[i], b[i]);return res;} template<class A, class B> void ptov(vector<pair<A, B>> &p, vector<A> &a, vector<B> &b) { a.resize(sz(p)), b.resize(sz(p)); rep(i, sz(p))a[i] = p[i].fi, b[i] = p[i].se;} template<class A, class B, class C> auto vtot(vector<A> &a, vector<B> &b, vector<C> &c) { assert(sz(a) == sz(b) && sz(b) == sz(c)); vector<T2<A, B, C>> res; rep(i, sz(a))res.eb(a[i], b[i], c[i]); return res;} template<class A, class B, class C, class D> auto vtof(vector<A> &a, vector<B> &b, vector<C> &c, vector<D> &d) { assert(sz(a) == sz(b) && sz(b) == sz(c) && sz(c) == sz(d)); vector<F2<A, B, C, D>> res; rep(i, sz(a))res.eb(a[i], b[i], c[i], d[i]); return res;} enum pcomparator { fisi, fisd, fdsi, fdsd, sifi, sifd, sdfi, sdfd }; enum tcomparator { fisiti, fisitd, fisdti, fisdtd, fdsiti, fdsitd, fdsdti, fdsdtd, fitisi, fitisd, fitdsi, fitdsd, fdtisi, fdtisd, fdtdsi, fdtdsd, sifiti, sifitd, sifdti, sifdtd, sdfiti, sdfitd, sdfdti, sdfdtd, sitifi, sitifd, sitdfi, sitdfd, sdtifi, sdtifd, sdtdfi, sdfdfd, tifisi, tifisd, tifdsi, tifdsd, tdfisi, tdfisd, tdfdsi, tdfdsd, tisifi, tisifd, tisdfi, tisdfd, tdsifi, tdsifd, tdsdfi, tdsdfd}; template<class A, class B> void sort(vector<pair<A, B>> &a, pcomparator type) { typedef pair<A, B> U; if (type == fisi) sort(all(a), [&](U l, U r) { return l.fi != r.fi ? l.fi < r.fi : l.se < r.se; }); else if (type == fisd) sort(all(a), [&](U l, U r) { return l.fi != r.fi ? l.fi < r.fi : l.se > r.se; }); else if (type == fdsi) sort(all(a), [&](U l, U r) { return l.fi != r.fi ? l.fi > r.fi : l.se < r.se; }); else if (type == fdsd) sort(all(a), [&](U l, U r) { return l.fi != r.fi ? l.fi > r.fi : l.se > r.se; }); else if (type == sifi) sort(all(a), [&](U l, U r) { return l.se != r.se ? l.se < r.se : l.fi < r.fi; }); else if (type == sifd) sort(all(a), [&](U l, U r) { return l.se != r.se ? l.se < r.se : l.fi > r.fi; }); else if (type == sdfi) sort(all(a), [&](U l, U r) { return l.se != r.se ? l.se > r.se : l.fi < r.fi; }); else if (type == sdfd) sort(all(a), [&](U l, U r) { return l.se != r.se ? l.se > r.se : l.fi > r.fi; });};template<class U> void sort(vector<U> &a, pcomparator type) { if (type == fisi) sort(all(a), [&](U l, U r) { return l.f != r.f ? l.f < r.f : l.s < r.s; }); else if (type == fisd) sort(all(a), [&](U l, U r) { return l.f != r.f ? l.f < r.f : l.s > r.s; }); else if (type == fdsi) sort(all(a), [&](U l, U r) { return l.f != r.f ? l.f > r.f : l.s < r.s; }); else if (type == fdsd) sort(all(a), [&](U l, U r) { return l.f != r.f ? l.f > r.f : l.s > r.s; }); else if (type == sifi) sort(all(a), [&](U l, U r) { return l.s != r.s ? l.s < r.s : l.f < r.f; }); else if (type == sifd) sort(all(a), [&](U l, U r) { return l.s != r.s ? l.s < r.s : l.f > r.f; }); else if (type == sdfi) sort(all(a), [&](U l, U r) { return l.s != r.s ? l.s > r.s : l.f < r.f; }); else if (type == sdfd) sort(all(a), [&](U l, U r) { return l.s != r.s ? l.s > r.s : l.f > r.f; });};template<class A, class B, class C, class D> void sort(vector<F2<A, B, C, D> > &a, pcomparator type) { typedef F2<A, B, C, D> U; if (type == fisi) sort(all(a), [&](U l, U r) { return l.a != r.a ? l.a < r.a : l.b < r.b; }); else if (type == fisd) sort(all(a), [&](U l, U r) { return l.a != r.a ? l.a < r.a : l.b > r.b; }); else if (type == fdsi) sort(all(a), [&](U l, U r) { return l.a != r.a ? l.a > r.a : l.b < r.b; }); else if (type == fdsd) sort(all(a), [&](U l, U r) { return l.a != r.a ? l.a > r.a : l.b > r.b; }); else if (type == sifi) sort(all(a), [&](U l, U r) { return l.b != r.b ? l.b < r.b : l.a < r.a; }); else if (type == sifd) sort(all(a), [&](U l, U r) { return l.b != r.b ? l.b < r.b : l.a > r.a; }); else if (type == sdfi) sort(all(a), [&](U l, U r) { return l.b != r.b ? l.b > r.b : l.a < r.a; }); else if (type == sdfd) sort(all(a), [&](U l, U r) { return l.b != r.b ? l.b > r.b : l.a > r.a; });};template<class U> void sort(vector<U> &a, tcomparator type) { if (type == 0) sort(all(a), [&](U l, U r) { return l.f != r.f ? l.f < r.f : l.s != r.s ? l.s < r.s : l.t < r.t; }); else if (type == 1) sort(all(a), [&](U l, U r) { return l.f != r.f ? l.f < r.f : l.s != r.s ? l.s < r.s : l.t > r.t; }); else if (type == 2) sort(all(a), [&](U l, U r) { return l.f != r.f ? l.f < r.f : l.s != r.s ? l.s > r.s : l.t < r.t; }); else if (type == 3) sort(all(a), [&](U l, U r) { return l.f != r.f ? l.f < r.f : l.s != r.s ? l.s > r.s : l.t > r.t; }); else if (type == 4) sort(all(a), [&](U l, U r) { return l.f != r.f ? l.f > r.f : l.s != r.s ? l.s < r.s : l.t < r.t; }); else if (type == 5) sort(all(a), [&](U l, U r) { return l.f != r.f ? l.f > r.f : l.s != r.s ? l.s < r.s : l.t > r.t; }); else if (type == 6) sort(all(a), [&](U l, U r) { return l.f != r.f ? l.f > r.f : l.s != r.s ? l.s > r.s : l.t < r.t; }); else if (type == 7) sort(all(a), [&](U l, U r) { return l.f != r.f ? l.f > r.f : l.s != r.s ? l.s > r.s : l.t > r.t; }); else if (type == 8) sort(all(a), [&](U l, U r) { return l.f != r.f ? l.f < r.f : l.t != r.t ? l.t < r.t : l.s < r.s; }); else if (type == 9) sort(all(a), [&](U l, U r) { return l.f != r.f ? l.f < r.f : l.t != r.t ? l.t < r.t : l.s > r.s; }); else if (type == 10) sort(all(a), [&](U l, U r) { return l.f != r.f ? l.f < r.f : l.t != r.t ? l.t > r.t : l.s < r.s; }); else if (type == 11) sort(all(a), [&](U l, U r) { return l.f != r.f ? l.f < r.f : l.t != r.t ? l.t > r.t : l.s > r.s; }); else if (type == 12) sort(all(a), [&](U l, U r) { return l.f != r.f ? l.f > r.f : l.t != r.t ? l.t < r.t : l.s < r.s; }); else if (type == 13) sort(all(a), [&](U l, U r) { return l.f != r.f ? l.f > r.f : l.t != r.t ? l.t < r.t : l.s > r.s; }); else if (type == 14) sort(all(a), [&](U l, U r) { return l.f != r.f ? l.f > r.f : l.t != r.t ? l.t > r.t : l.s < r.s; }); else if (type == 15) sort(all(a), [&](U l, U r) { return l.f != r.f ? l.f > r.f : l.t != r.t ? l.t > r.t : l.s > r.s; }); else if (type == 16) sort(all(a), [&](U l, U r) { return l.s != r.s ? l.s < r.s : l.f != r.f ? l.f < r.f : l.t < r.t; }); else if (type == 17) sort(all(a), [&](U l, U r) { return l.s != r.s ? l.s < r.s : l.f != r.f ? l.f < r.f : l.t > r.t; }); else if (type == 18) sort(all(a), [&](U l, U r) { return l.s != r.s ? l.s < r.s : l.f != r.f ? l.f > r.f : l.t < r.t; }); else if (type == 19) sort(all(a), [&](U l, U r) { return l.s != r.s ? l.s < r.s : l.f != r.f ? l.f > r.f : l.t > r.t; }); else if (type == 20) sort(all(a), [&](U l, U r) { return l.s != r.s ? l.s > r.s : l.f != r.f ? l.f < r.f : l.t < r.t; }); else if (type == 21) sort(all(a), [&](U l, U r) { return l.s != r.s ? l.s > r.s : l.f != r.f ? l.f < r.f : l.t > r.t; }); else if (type == 22) sort(all(a), [&](U l, U r) { return l.s != r.s ? l.s > r.s : l.f != r.f ? l.f > r.f : l.t < r.t; }); else if (type == 23) sort(all(a), [&](U l, U r) { return l.s != r.s ? l.s > r.s : l.f != r.f ? l.f > r.f : l.t > r.t; }); else if (type == 24) sort(all(a), [&](U l, U r) { return l.s != r.s ? l.s < r.s : l.t != r.t ? l.t < r.t : l.f < r.f; }); else if (type == 25) sort(all(a), [&](U l, U r) { return l.s != r.s ? l.s < r.s : l.t != r.t ? l.t < r.t : l.f > r.f; }); else if (type == 26) sort(all(a), [&](U l, U r) { return l.s != r.s ? l.s < r.s : l.t != r.t ? l.t > r.t : l.f < r.f; }); else if (type == 27) sort(all(a), [&](U l, U r) { return l.s != r.s ? l.s < r.s : l.t != r.t ? l.t > r.t : l.f > r.f; }); else if (type == 28) sort(all(a), [&](U l, U r) { return l.s != r.s ? l.s > r.s : l.t != r.t ? l.t < r.t : l.f < r.f; }); else if (type == 29) sort(all(a), [&](U l, U r) { return l.s != r.s ? l.s > r.s : l.t != r.t ? l.t < r.t : l.f > r.f; }); else if (type == 30) sort(all(a), [&](U l, U r) { return l.s != r.s ? l.s > r.s : l.t != r.t ? l.t > r.t : l.f < r.f; }); else if (type == 31) sort(all(a), [&](U l, U r) { return l.s != r.s ? l.s > r.s : l.t != r.t ? l.t > r.t : l.f > r.f; }); else if (type == 32) sort(all(a), [&](U l, U r) { return l.t != r.t ? l.t < r.t : l.f != r.f ? l.f < r.f : l.s < r.s; }); else if (type == 33) sort(all(a), [&](U l, U r) { return l.t != r.t ? l.t < r.t : l.f != r.f ? l.f < r.f : l.s > r.s; }); else if (type == 34) sort(all(a), [&](U l, U r) { return l.t != r.t ? l.t < r.t : l.f != r.f ? l.f > r.f : l.s < r.s; }); else if (type == 35) sort(all(a), [&](U l, U r) { return l.t != r.t ? l.t < r.t : l.f != r.f ? l.f > r.f : l.s > r.s; }); else if (type == 36) sort(all(a), [&](U l, U r) { return l.t != r.t ? l.t > r.t : l.f != r.f ? l.f < r.f : l.s < r.s; }); else if (type == 37) sort(all(a), [&](U l, U r) { return l.t != r.t ? l.t > r.t : l.f != r.f ? l.f < r.f : l.s > r.s; }); else if (type == 38) sort(all(a), [&](U l, U r) { return l.t != r.t ? l.t > r.t : l.f != r.f ? l.f > r.f : l.s < r.s; }); else if (type == 39) sort(all(a), [&](U l, U r) { return l.t != r.t ? l.t > r.t : l.f != r.f ? l.f > r.f : l.s > r.s; }); else if (type == 40) sort(all(a), [&](U l, U r) { return l.t != r.t ? l.t < r.t : l.s != r.s ? l.s < r.s : l.f < r.f; }); else if (type == 41) sort(all(a), [&](U l, U r) { return l.t != r.t ? l.t < r.t : l.s != r.s ? l.s < r.s : l.f > r.f; }); else if (type == 42) sort(all(a), [&](U l, U r) { return l.t != r.t ? l.t < r.t : l.s != r.s ? l.s > r.s : l.f < r.f; }); else if (type == 43) sort(all(a), [&](U l, U r) { return l.t != r.t ? l.t < r.t : l.s != r.s ? l.s > r.s : l.f > r.f; }); else if (type == 44) sort(all(a), [&](U l, U r) { return l.t != r.t ? l.t > r.t : l.s != r.s ? l.s < r.s : l.f < r.f; }); else if (type == 45) sort(all(a), [&](U l, U r) { return l.t != r.t ? l.t > r.t : l.s != r.s ? l.s < r.s : l.f > r.f; }); else if (type == 46) sort(all(a), [&](U l, U r) { return l.t != r.t ? l.t > r.t : l.s != r.s ? l.s > r.s : l.f < r.f; }); else if (type == 47) sort(all(a), [&](U l, U r) { return l.t != r.t ? l.t > r.t : l.s != r.s ? l.s > r.s : l.f > r.f; });}template<class A, class B, class C, class D> void sort(vector<F2<A, B, C, D>> &a, tcomparator type) { typedef F2<A, B, C, D> U; if (type == 0) sort(all(a), [&](U l, U r) { return l.a != r.a ? l.a < r.a : l.b != r.b ? l.b < r.b : l.c < r.c; }); else if (type == 1) sort(all(a), [&](U l, U r) { return l.a != r.a ? l.a < r.a : l.b != r.b ? l.b < r.b : l.c > r.c; }); else if (type == 2) sort(all(a), [&](U l, U r) { return l.a != r.a ? l.a < r.a : l.b != r.b ? l.b > r.b : l.c < r.c; }); else if (type == 3) sort(all(a), [&](U l, U r) { return l.a != r.a ? l.a < r.a : l.b != r.b ? l.b > r.b : l.c > r.c; }); else if (type == 4) sort(all(a), [&](U l, U r) { return l.a != r.a ? l.a > r.a : l.b != r.b ? l.b < r.b : l.c < r.c; }); else if (type == 5) sort(all(a), [&](U l, U r) { return l.a != r.a ? l.a > r.a : l.b != r.b ? l.b < r.b : l.c > r.c; }); else if (type == 6) sort(all(a), [&](U l, U r) { return l.a != r.a ? l.a > r.a : l.b != r.b ? l.b > r.b : l.c < r.c; }); else if (type == 7) sort(all(a), [&](U l, U r) { return l.a != r.a ? l.a > r.a : l.b != r.b ? l.b > r.b : l.c > r.c; }); else if (type == 8) sort(all(a), [&](U l, U r) { return l.a != r.a ? l.a < r.a : l.c != r.c ? l.c < r.c : l.b < r.b; }); else if (type == 9) sort(all(a), [&](U l, U r) { return l.a != r.a ? l.a < r.a : l.c != r.c ? l.c < r.c : l.b > r.b; }); else if (type == 10) sort(all(a), [&](U l, U r) { return l.a != r.a ? l.a < r.a : l.c != r.c ? l.c > r.c : l.b < r.b; }); else if (type == 11) sort(all(a), [&](U l, U r) { return l.a != r.a ? l.a < r.a : l.c != r.c ? l.c > r.c : l.b > r.b; }); else if (type == 12) sort(all(a), [&](U l, U r) { return l.a != r.a ? l.a > r.a : l.c != r.c ? l.c < r.c : l.b < r.b; }); else if (type == 13) sort(all(a), [&](U l, U r) { return l.a != r.a ? l.a > r.a : l.c != r.c ? l.c < r.c : l.b > r.b; }); else if (type == 14) sort(all(a), [&](U l, U r) { return l.a != r.a ? l.a > r.a : l.c != r.c ? l.c > r.c : l.b < r.b; }); else if (type == 15) sort(all(a), [&](U l, U r) { return l.a != r.a ? l.a > r.a : l.c != r.c ? l.c > r.c : l.b > r.b; }); else if (type == 16) sort(all(a), [&](U l, U r) { return l.b != r.b ? l.b < r.b : l.a != r.a ? l.a < r.a : l.c < r.c; }); else if (type == 17) sort(all(a), [&](U l, U r) { return l.b != r.b ? l.b < r.b : l.a != r.a ? l.a < r.a : l.c > r.c; }); else if (type == 18) sort(all(a), [&](U l, U r) { return l.b != r.b ? l.b < r.b : l.a != r.a ? l.a > r.a : l.c < r.c; }); else if (type == 19) sort(all(a), [&](U l, U r) { return l.b != r.b ? l.b < r.b : l.a != r.a ? l.a > r.a : l.c > r.c; }); else if (type == 20) sort(all(a), [&](U l, U r) { return l.b != r.b ? l.b > r.b : l.a != r.a ? l.a < r.a : l.c < r.c; }); else if (type == 21) sort(all(a), [&](U l, U r) { return l.b != r.b ? l.b > r.b : l.a != r.a ? l.a < r.a : l.c > r.c; }); else if (type == 22) sort(all(a), [&](U l, U r) { return l.b != r.b ? l.b > r.b : l.a != r.a ? l.a > r.a : l.c < r.c; }); else if (type == 23) sort(all(a), [&](U l, U r) { return l.b != r.b ? l.b > r.b : l.a != r.a ? l.a > r.a : l.c > r.c; }); else if (type == 24) sort(all(a), [&](U l, U r) { return l.b != r.b ? l.b < r.b : l.c != r.c ? l.c < r.c : l.a < r.a; }); else if (type == 25) sort(all(a), [&](U l, U r) { return l.b != r.b ? l.b < r.b : l.c != r.c ? l.c < r.c : l.a > r.a; }); else if (type == 26) sort(all(a), [&](U l, U r) { return l.b != r.b ? l.b < r.b : l.c != r.c ? l.c > r.c : l.a < r.a; }); else if (type == 27) sort(all(a), [&](U l, U r) { return l.b != r.b ? l.b < r.b : l.c != r.c ? l.c > r.c : l.a > r.a; }); else if (type == 28) sort(all(a), [&](U l, U r) { return l.b != r.b ? l.b > r.b : l.c != r.c ? l.c < r.c : l.a < r.a; }); else if (type == 29) sort(all(a), [&](U l, U r) { return l.b != r.b ? l.b > r.b : l.c != r.c ? l.c < r.c : l.a > r.a; }); else if (type == 30) sort(all(a), [&](U l, U r) { return l.b != r.b ? l.b > r.b : l.c != r.c ? l.c > r.c : l.a < r.a; }); else if (type == 31) sort(all(a), [&](U l, U r) { return l.b != r.b ? l.b > r.b : l.c != r.c ? l.c > r.c : l.a > r.a; }); else if (type == 32) sort(all(a), [&](U l, U r) { return l.c != r.c ? l.c < r.c : l.a != r.a ? l.a < r.a : l.b < r.b; }); else if (type == 33) sort(all(a), [&](U l, U r) { return l.c != r.c ? l.c < r.c : l.a != r.a ? l.a < r.a : l.b > r.b; }); else if (type == 34) sort(all(a), [&](U l, U r) { return l.c != r.c ? l.c < r.c : l.a != r.a ? l.a > r.a : l.b < r.b; }); else if (type == 35) sort(all(a), [&](U l, U r) { return l.c != r.c ? l.c < r.c : l.a != r.a ? l.a > r.a : l.b > r.b; }); else if (type == 36) sort(all(a), [&](U l, U r) { return l.c != r.c ? l.c > r.c : l.a != r.a ? l.a < r.a : l.b < r.b; }); else if (type == 37) sort(all(a), [&](U l, U r) { return l.c != r.c ? l.c > r.c : l.a != r.a ? l.a < r.a : l.b > r.b; }); else if (type == 38) sort(all(a), [&](U l, U r) { return l.c != r.c ? l.c > r.c : l.a != r.a ? l.a > r.a : l.b < r.b; }); else if (type == 39) sort(all(a), [&](U l, U r) { return l.c != r.c ? l.c > r.c : l.a != r.a ? l.a > r.a : l.b > r.b; }); else if (type == 40) sort(all(a), [&](U l, U r) { return l.c != r.c ? l.c < r.c : l.b != r.b ? l.b < r.b : l.a < r.a; }); else if (type == 41) sort(all(a), [&](U l, U r) { return l.c != r.c ? l.c < r.c : l.b != r.b ? l.b < r.b : l.a > r.a; }); else if (type == 42) sort(all(a), [&](U l, U r) { return l.c != r.c ? l.c < r.c : l.b != r.b ? l.b > r.b : l.a < r.a; }); else if (type == 43) sort(all(a), [&](U l, U r) { return l.c != r.c ? l.c < r.c : l.b != r.b ? l.b > r.b : l.a > r.a; }); else if (type == 44) sort(all(a), [&](U l, U r) { return l.c != r.c ? l.c > r.c : l.b != r.b ? l.b < r.b : l.a < r.a; }); else if (type == 45) sort(all(a), [&](U l, U r) { return l.c != r.c ? l.c > r.c : l.b != r.b ? l.b < r.b : l.a > r.a; }); else if (type == 46) sort(all(a), [&](U l, U r) { return l.c != r.c ? l.c > r.c : l.b != r.b ? l.b > r.b : l.a < r.a; }); else if (type == 47) sort(all(a), [&](U l, U r) { return l.c != r.c ? l.c > r.c : l.b != r.b ? l.b > r.b : l.a > r.a; });} void sort(string &a) { sort(all(a)); } template<class T> void sort(vector<T> &a) { sort(all(a)); } //P l, P rで f(P) の形で渡す template<class U, class F> void sort(vector<U> &a, F f) { sort(all(a), [&](U l, U r) { return f(l) < f(r); }); }; template<class T> void rsort(vector<T> &a) { sort(all(a), greater<T>()); }; template<class U, class F> void rsort(vector<U> &a, F f) { sort(all(a), [&](U l, U r) { return f(l) > f(r); }); }; //F = T<T> //例えばreturn p.fi + p.se; template<class A, class B> void sortp(vector<A> &a, vector<B> &b) { auto c = vtop(a, b); sort(c); rep(i, sz(a)) a[i] = c[i].fi, b[i] = c[i].se;}template<class A, class B, class F> void sortp(vector<A> &a, vector<B> &b, F f) { auto c = vtop(a, b); sort(c, f); rep(i, sz(a)) a[i] = c[i].fi, b[i] = c[i].se;}template<class A, class B> void rsortp(vector<A> &a, vector<B> &b) { auto c = vtop(a, b); rsort(c); rep(i, sz(a))a[i] = c[i].first, b[i] = c[i].second;}template<class A, class B, class F> void rsortp(vector<A> &a, vector<B> &b, F f) { auto c = vtop(a, b); rsort(c, f); rep(i, sz(a))a[i] = c[i].first, b[i] = c[i].second;}template<class A, class B, class C> void sortt(vector<A> &a, vector<B> &b, vector<C> &c) { auto d = vtot(a, b, c); sort(d); rep(i, sz(a)) a[i] = d[i].f, b[i] = d[i].s, c[i] = d[i].t;}template<class A, class B, class C, class F> void sortt(vector<A> &a, vector<B> &b, vector<C> &c, F f) { auto d = vtot(a, b, c); sort(d, f); rep(i, sz(a)) a[i] = d[i].f, b[i] = d[i].s, c[i] = d[i].t;}template<class A, class B, class C> void rsortt(vector<A> &a, vector<B> &b, vector<C> &c) { auto d = vtot(a, b, c); rsort(d); rep(i, sz(a)) a[i] = d[i].f, b[i] = d[i].s, c[i] = d[i].t;}template<class A, class B, class C, class F> void rsortt(vector<A> &a, vector<B> &b, vector<C> &c, F f) { auto d = vtot(a, b, c); rsort(d, f); rep(i, sz(a)) a[i] = d[i].f, b[i] = d[i].s, c[i] = d[i].t;} //sortindex 元のvectorはソートしない template<class T> vi sorti(vector<T> &a) { auto b = a; vi ind = iota(0, sz(a)); sortp(b, ind); return ind;}/*indexの分で型が変わるためpcomparatorが必要*/template<class T> vi sorti(vector<T> &a, pcomparator f) { auto b = a; vi ind = iota(0, sz(a)); sortp(b, ind, f); return ind;}template<class T, class F> vi sorti(vector<T> &a, F f) { vi ind = iota(0, sz(a)); sort(all(ind), [&](int x, int y) { return f(a[x]) < f(a[y]); }); return ind;}template<class T> vi rsorti(vector<T> &a) { auto b = a; vi ind = iota(0, sz(a)); rsortp(b, ind); return ind;}template<class T, class F> vi rsorti(vector<T> &a, F f) { vi ind = iota(0, sz(a)); sort(all(ind), [&](int x, int y) { return f(a[x]) > f(a[y]); }); return ind;}template<class A, class B, class F> vi sortpi(vector<A> &a, vector<B> &b, F f) { auto c = vtop(a, b); vi ind = iota(0, sz(a)); sort(all(ind), [&](int x, int y) { return f(c[x]) < f(c[y]); }); return ind;}template<class A, class B> vi sortpi(vector<A> &a, vector<B> &b, pcomparator f) { vi ind = iota(0, sz(a)); auto c = a; auto d = b; sortt(c, d, ind, f); return ind;}template<class A, class B> vi sortpi(vector<A> &a, vector<B> &b) { return sortpi(a, b, fisi); };template<class A, class B, class F> vi rsortpi(vector<A> &a, vector<B> &b, F f) { auto c = vtop(a, b); vi ind = iota(0, sz(a)); sort(all(ind), [&](int x, int y) { return f(c[x]) > f(c[y]); }); return ind;}template<class A, class B> vi rsortpi(vector<A> &a, vector<B> &b) { return sortpi(a, b, fdsd); };template<class A, class B, class C, class F> vi sortti(vector<A> &a, vector<B> &b, vector<C> &c, F f) { auto d = vtot(a, b, c); vi ind = iota(0, sz(a)); sort(all(ind), [&](int x, int y) { return f(d[x]) < f(d[y]); }); return ind;}template<class A, class B, class C> vi sortti(vector<A> &a, vector<B> &b, vector<C> &c, pcomparator f) { vi ind = iota(0, sz(a)); auto d = vtof(a, b, c, ind); sort(d, f); rep(i, sz(a))ind[i] = d[i].d; return ind;}template<class A, class B, class C> vi sortti(vector<A> &a, vector<B> &b, vector<C> &c) { vi ind = iota(0, sz(a)); sort(all(ind), [&](int x, int y) { if (a[x] == a[y]) { if (b[x] == b[y])return c[x] < c[y]; else return b[x] < b[y]; } else { return a[x] < a[y]; } }); return ind;}template<class A, class B, class C, class F> vi rsortti(vector<A> &a, vector<B> &b, vector<C> &c, F f) { auto d = vtot(a, b, c); vi ind = iota(0, sz(a)); sort(all(ind), [&](int x, int y) { return f(d[x]) > f(d[y]); }); return ind;}template<class A, class B, class C> vi rsortti(vector<A> &a, vector<B> &b, vector<C> &c) { vi ind = iota(0, sz(a)); sort(all(ind), [&](int x, int y) { if (a[x] == a[y]) { if (b[x] == b[y])return c[x] > c[y]; else return b[x] > b[y]; } else { return a[x] > a[y]; } }); return ind;} template<class T> void sort2(vector<vector<T >> &a) { for (int i = 0, n = a.size(); i < n; i++)sort(a[i]); } template<class T> void rsort2(vector<vector<T >> &a) { for (int i = 0, n = a.size(); i < n; i++)rsort(a[i]); } template<typename A, size_t N, typename T> void fill(A (&a)[N], const T &v) { rep(i, N)a[i] = v; }template<typename A, size_t N, size_t O, typename T> void fill(A (&a)[N][O], const T &v) { rep(i, N)rep(j, O)a[i][j] = v; }template<typename A, size_t N, size_t O, size_t P, typename T> void fill(A (&a)[N][O][P], const T &v) { rep(i, N)rep(j, O)rep(k, P)a[i][j][k] = v; }template<typename A, size_t N, size_t O, size_t P, size_t Q, typename T> void fill(A (&a)[N][O][P][Q], const T &v) { rep(i, N)rep(j, O)rep(k, P)rep(l, Q)a[i][j][k][l] = v; }template<typename A, size_t N, size_t O, size_t P, size_t Q, size_t R, typename T> void fill(A (&a)[N][O][P][Q][R], const T &v) { rep(i, N)rep(j, O)rep(k, P)rep(l, Q)rep(m, R)a[i][j][k][l][m] = v; }template<typename A, size_t N, size_t O, size_t P, size_t Q, size_t R, size_t S, typename T> void fill(A (&a)[N][O][P][Q][R][S], const T &v) { rep(i, N)rep(j, O)rep(k, P)rep(l, Q)rep(m, R)rep(n, S)a[i][j][k][l][m][n] = v; } template<typename V, typename T>void fill(V &xx, const T vall) { xx = vall;}template<typename V, typename T>void fill(vector<V> &vecc, const T vall) { for (auto &&vx : vecc)fill(vx, vall);} template<class T,class U>void fill(vector<T> &a,U val,vi& ind) {fora(v,ind)a[v]=val;} template<typename A, size_t N> A sum(A (&a)[N]) { A res = 0; rep(i, N)res += a[i]; return res;}template<typename A, size_t N, size_t O> A sum(A (&a)[N][O]) { A res = 0; rep(i, N)rep(j, O)res += a[i][j]; return res;}template<typename A, size_t N, size_t O, size_t P> A sum(A (&a)[N][O][P]) { A res = 0; rep(i, N)rep(j, O)rep(k, P)res += a[i][j][k]; return res;}template<typename A, size_t N, size_t O, size_t P, size_t Q> A sum(A (&a)[N][O][P][Q]) { A res = 0; rep(i, N)rep(j, O)rep(k, P)rep(l, Q)res += a[i][j][k][l]; return res;}template<typename A, size_t N, size_t O, size_t P, size_t Q, size_t R> A sum(A (&a)[N][O][P][Q][R]) { A res = 0; rep(i, N)rep(j, O)rep(k, P)rep(l, Q)rep(m, R)res += a[i][j][k][l][m]; return res;}template<typename A, size_t N, size_t O, size_t P, size_t Q, size_t R, size_t S> A sum(A (&a)[N][O][P][Q][R][S]) { A res = 0; rep(i, N)rep(j, O)rep(k, P)rep(l, Q)rep(m, R)rep(n, S)res += a[i][j][k][l][m][n]; return res;} //@汎用便利関数 入力 int in() {int ret;cin >> ret;return ret;} string sin() {string ret;cin >> ret;return ret;} template<class T> void in(T &head) { cin >> head; }template<class T, class... U> void in(T &head, U &... tail) {cin >> head;in(tail...);} #define _overloaddin(_1, _2, _3, _4, name, ...) name #define din1(a) int a;cin>>a #define din2(a, b) int a,b;cin>>a>> b #define din3(a, b, c) int a,b,c;cin>>a>>b>>c #define din4(a, b, c, d) int a,b,c,d;cin>>a>>b>>c>>d #define din(...) _overloaddin(__VA_ARGS__,din4,din3,din2 ,din1)(__VA_ARGS__) #define _overloaddind(_1, _2, _3, _4, name, ...) name #define din1d(a) din1(a);a-- #define din2d(a, b) din2(a,b);a--,b-- #define din3d(a, b, c) din3(a,b,c);a--,b--,c-- #define din4d(a, b, c, d) din4(a,b,c,d);a--,b--,c--,d-- #define dind(...) _overloaddind(__VA_ARGS__,din4d,din3d,din2d ,din1d)(__VA_ARGS__) #define _overloadout(_1, _2, _3, _4, name, ...) name #define out1(a) cout<<a<<endl #define out2(a, b) cout<<a<<" "<< b<<endl #define out3(a, b, c) cout<<a<<" "<<b<<" "<<c<<endl #define out4(a, b, c, d) cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl #define out(...) _overloadout((__VA_ARGS__),out4,out3,out2,out1)((__VA_ARGS__)) template<class T> void outl(vector<T> &a) { fora(v, a)cout << v << endl; } template<class T> void na(vector<T> &a, int n) {a.resize(n);rep(i, n)cin >> a[i];} #define dna(a, n) vi a(n); rep(_i,n) cin >> a[_i]; template<class T> void nao(vector<T> &a, int n) { a.resize(n + 1); a[0] = 0; rep(i, n)cin >> a[i + 1];} template<class T> void nad(vector<T> &a, int n) { a.resize(n); rep(i, n)cin >> a[i], a[i]--;} template<class T, class U> void na2(vector<T> &a, vector<U> &b, int n) { a.resize(n); b.resize(n); rep(i, n)cin >> a[i] >> b[i];} #define dna2(a, b, n) vi a(n),b(n);rep(_i, n)cin >> a[_i] >> b[_i]; template<class T, class U> void nao2(vector<T> &a, vector<U> &b, int n) { a.resize(n + 1); b.resize(n + 1); a[0] = b[0] = 0; rep(i, n)cin >> a[i + 1] >> b[i + 1];} template<class T, class U> void na2d(vector<T> &a, vector<U> &b, int n) { a.resize(n); b.resize(n); rep(i, n)cin >> a[i] >> b[i], a[i]--, b[i]--;} template<class T, class U, class V> void na3(vector<T> &a, vector<U> &b, vector<V> &c, int n) { a.resize(n); b.resize(n); c.resize(n); rep(i, n)cin >> a[i] >> b[i] >> c[i];} #define dna3(a, b, c, n) vi a(n),b(n),c(n); rep(_i, n)cin >> a[_i] >> b[_i] >> c[_i]; template<class T, class U, class V> void na3d(vector<T> &a, vector<U> &b, vector<V> &c, int n) { a.resize(n); b.resize(n); c.resize(n); rep(i, n)cin >> a[i] >> b[i] >> c[i], a[i]--, b[i]--, c[i]--;} #define dna3d(a, b, c, n) vi a(n),b(n),c(n); rep(_i, n){cin >> a[_i] >> b[_i] >> c[_i];a[_i]--,b[_i]--,c[_i]--;} #define nt(a, h, w) resize(a,h,w);rep(_hi,h)rep(_wi,w) cin >> a[_hi][_wi]; #define ntd(a, h, w) rs(a,h,w);rep(_hi,h)rep(_wi,w) cin >> a[_hi][_wi], a[_hi][_wi]--; #define ntp(a, h, w) resize(a,h+2,w+2);fill(a,'#');rep(_hi,1,h+1)rep(_wi,1,w+1) cin >> a[_hi][_wi]; //デバッグ #define sp << " " << #define debugName(VariableName) # VariableName #define _deb1(x) debugName(x)<<" = "<<x #define _deb2(x, ...) _deb1(x) <<", "<< _deb1(__VA_ARGS__) #define _deb3(x, ...) _deb1(x) <<", "<< _deb2(__VA_ARGS__) #define _deb4(x, ...) _deb1(x) <<", "<< _deb3(__VA_ARGS__) #define _deb5(x, ...) _deb1(x) <<", "<< _deb4(__VA_ARGS__) #define _deb6(x, ...) _deb1(x) <<", "<< _deb5(__VA_ARGS__) #define _deb7(x, ...) _deb1(x) <<", "<< _deb6(__VA_ARGS__) #define _deb8(x, ...) _deb1(x) <<", "<< _deb7(__VA_ARGS__) #define _deb9(x, ...) _deb1(x) <<", "<< _deb8(__VA_ARGS__) #define _deb10(x, ...) _deb1(x) <<", "<< _deb9(__VA_ARGS__) #define _overloadebug(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, name, ...) name #ifdef _DEBUG #define deb(...) cerr<< _overloadebug(__VA_ARGS__,_deb10,_deb9,_deb8,_deb7,_deb6,_deb5,_deb4,_deb3,_deb2,_deb1)(__VA_ARGS__) <<endl #else #define deb(...) ; #endif #define debugline(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n' //よく使うクラス、構造体 class UnionFind { public: vi par, rank, sizes; int n, trees; UnionFind(int n) : n(n), trees(n) { par.resize(n), rank.resize(n), sizes.resize(n); rep(i, n)par[i] = i, sizes[i] = 1; } int root(int x) { if (par[x] == x)return x; else return par[x] = root(par[x]); } int find(int x) { return root(x); } void unite(int x, int y) { x = root(x); y = root(y); if (x == y)return; if (rank[x] < rank[y])swap(x, y); trees--; par[y] = x; sizes[x] += sizes[y]; if (rank[x] == rank[y])rank[x]++; } bool same(int x, int y) { return root(x) == root(y); } int size(int x) { return sizes[root(x)]; } //順不同 umapなので vec<vi> sets() { vec<vi> res(trees); umap<int, vi> map; rep(i, n) map[root(i)].push_back(i); int i = 0; for (auto &&p:map) { int r = p.fi; res[i].push_back(r); for (auto &&v:p.se) { if (r == v)continue; res[i].push_back(v); } i++; } return res; } }; using bint =__int128; using u32 = unsigned int; using u64 = unsigned long long; using u128 = __uint128_t; std::ostream &operator<<(std::ostream &dest, __int128_t value) { std::ostream::sentry s(dest); if (s) { __uint128_t tmp = value < 0 ? -value : value; char buffer[128]; char *d = std::end(buffer); do { --d; *d = "0123456789"[tmp % 10]; tmp /= 10; } while (tmp != 0); if (value < 0) { --d; *d = '-'; } int len = std::end(buffer) - d; if (dest.rdbuf()->sputn(d, len) != len) { dest.setstate(std::ios_base::badbit); } } return dest;} //__int128 toi128(string &s) { __int128 ret = 0; for (int i = 0; i < s.length(); i++) if ('0' <= s[i] && s[i] <= '9') ret = 10 * ret + s[i] - '0'; return ret;} //エラー void ole() { #ifdef _DEBUG debugline("ole");exit(0); #endif string a = "a";rep(i, 30)a += a;rep(i, 1 << 17)cout << a << endl;cout << "OLE 出力長制限超過" << endl;exit(0); } void re() { assert(0 == 1);exit(0); } void tle() { while (inf)cout << inf << endl; } //便利関数 //テスト用 char ranc() {return (char) ('a' + rand() % 26);} int rand(int min, int max) { assert(min <= max); if (min >= 0 && max >= 0) { return rand() % (max + 1 - min) + min; } else if (max < 0) { return -rand(-max, -min); } else { if (rand() % 2) { return rand(0, max); } else { return -rand(0, -min); } }} vi ranv(int n, int min, int max) { vi v(n); rep(i, n)v[i] = rand(min, max); return v;} str ransu(int n) { str s; rep(i, n)s += (char) rand('A', 'Z'); return s;} str ransl(int n) { str s; rep(i, n)s += (char) rand('a', 'z'); return s;} //単調増加 vi ranvinc(int n, int min, int max) { vi v(n); bool bad = 1; while (bad) { bad = 0; v.resize(n); rep(i, n) { if (i && min > max - v[i - 1]) { bad = 1; break; } if (i)v[i] = v[i - 1] + rand(min, max - v[i - 1]); else v[i] = rand(min, max); } } return v;} //便利 汎用 void ranvlr(int n, int min, int max, vi &l, vi &r) { l.resize(n); r.resize(n); rep(i, n) { l[i] = rand(min, max); r[i] = l[i] + rand(0, max - l[i]); }} vp run_length(vi &a) { vp ret; ret.eb(a[0], 1); rep(i, 1, sz(a)) { if (ret.back().fi == a[i]) { ret.back().se++; } else { ret.eb(a[i], 1); } } return ret;} vector<pair<char, int>> run_length(string &a) { vector<pair<char, int>> ret; ret.eb(a[0], 1); rep(i, 1, sz(a)) { if (ret.back().fi == a[i]) { ret.back().se++; } else { ret.eb(a[i], 1); } } return ret;} template<class F> int mgr(int ok, int ng, F f) {if (ok < ng)while (ng - ok > 1) { int mid = (ok + ng) / 2; if (f(mid))ok = mid; else ng = mid; } else while (ok - ng > 1) { int mid = (ok + ng) / 2; if (f(mid))ok = mid; else ng = mid; }return ok;} //strを整数として比較 string smax(str &a, str b) { if (sz(a) < sz(b)) { return b; } else if (sz(a) > sz(b)) { return a; } else { rep(i, sz(a)) { if (a[i] < b[i]) { return b; } else if (a[i] > b[i])return a; } } return a;} //strを整数として比較 string smin(str &a, str b) { if (sz(a) < sz(b)) { return a; } else if (sz(a) > sz(b)) { return b; } else { rep(i, sz(a)) { if (a[i] < b[i]) { return a; } else if (a[i] > b[i])return b; } } return a;} template<typename V, typename T> int find(vector<V> &a,const T key) {rep(i, sz(a))if (a[i] == key)return i;return -1;} template<typename V, typename T> P find(vector<vector<V >> &a,const T key) {rep(i, sz(a))rep(j, sz(a[0]))if (a[i][j] == key)return mp(i, j);return mp(-1, -1);} template<typename V, typename U> T find(vector<vector<vector<V >>> &a,const U key) {rep(i, sz(a))rep(j, sz(a[0]))rep(k, sz(a[0][0]))if (a[i][j][k] == key)return mt(i, j, k);return mt(-1, -1, -1);} template<typename V, typename T> int count2(V &a, const T k) { return a == k; } template<typename V, typename T> int count2(vector<V> &a, const T k) {int ret = 0;fora(v, a)ret +=count(v, k);return ret;} template<typename V, typename T> int count(vector<V> &a, const T k) {int ret = 0;fora(v, a)ret +=count2(v, k);return ret;} int count(str a, str k) {int ret = 0, len = k.length();auto pos = a.find(k);while (pos != string::npos)pos = a.find(k, pos + len), ret++;return ret;} #define couif count_if //algorythm inline ll rev(ll a) {ll res = 0;while (a) {res *= 10;res += a % 10;a /= 10;}return res;} template<class T> void rev(vector<T> &a) {reverse(all(a));} template<class T> vector<T> revv(vector<T> &a) {vector<T> b = a;reverse(all(b));return b;} void inline rev(string &a) {reverse(all(a));} constexpr int p10[] = {1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000, 10000000000ll, 100000000000ll, 1000000000000ll, 10000000000000ll, 100000000000000ll, 1000000000000000ll, 10000000000000000ll, 100000000000000000ll, 1000000000000000000ll}; int get(int a, int keta) { return (a / (int) pow(10, keta)) % 10; } int keta(ll v) { if (v < p10[9]) { if (v < p10[4]) { if (v < p10[2]) { if (v < p10[1]) return 1; else return 2; } else { if (v < p10[3]) return 3; else return 4; }} else { if (v < p10[7]) { if (v < p10[5]) return 5; else if (v < p10[6])return 6; else return 7; } else { if (v < p10[8])return 8; else return 9; }}} else { if (v < p10[13]) { if (v < p10[11]) { if (v < p10[10]) return 10; else return 11; } else { if (v < p10[12]) return 12; else return 13; }} else { if (v < p10[15]) { if (v < p10[14]) return 14; else if (v < p10[15])return 15; else return 16; } else { if (v < p10[17])return 17; else return 18; }}}} int dsum(int v) {int ret = 0;for (; v; v /= 10)ret += v % 10;return ret;} struct sint { int v; sint(int v) : v(v) {} operator int() { return v; } //下からi番目 int operator[](int i) { return (v / p10[i]) % 10; } int back(int i) { return operator[](i); } //上からi番目 int top(int i) { int len = keta(v); return operator[](len - 1 - i); } //先頭からi番目にセット int settop(int i, int k) { int len = keta(v); return set(len - 1 - i, k); } int set(int i, int k) { if (i < 0)return settop(abs(i) - 1, k); return v += p10[i] * (k - (v / p10[i]) % 10); } int add(int i, int k = 1) { return v += p10[i] * k; } int addtop(int i, int k = 1) { return v += p10[keta(v) - i - 1] * k; } int dec(int i, int k = 1) { return v -= p10[i] * k; } int dectop(int i, int k = 1) { return v -= p10[keta(v) - i - 1] * k; } #define op(t, o)template<class T>inline t operator o(T r){return v o r;} op(int, +=);op(int, -=);op(int, *=);op(int, /=);op(int, %=); op(int, +);op(int, -);op(int, *);op(int, /);op(int, %); op(bool, ==);op(bool, !=);op(bool, <);op(bool, <=);op(bool, >);op(bool, >=); #undef op template<class T> inline int operator<<=(T r) { return v *= p10[r]; } template<class T> inline int operator<<(T r) { return v * p10[r]; } template<class T> inline int operator>>=(T r) { return v /= p10[r]; } template<class T> inline int operator>>(T r) { return v / p10[r]; } }; int mask10(int v) { return p10[v] - 1; } //変換系 template<class T> auto keys(T a) {vector<decltype((a.begin())->fi)> res;for (auto &&k :a)res.pb(k.fi);return res;} template<class T> auto values(T a) {vector<decltype((a.begin())->se)> res;for (auto &&k :a)res.pb(k.se);return res;} template<class T, class U> inline bool chma(T &a, const U &b) { if (a < b) { a = b; return true; } return false;} template<class U> inline bool chma(const U &b) { return chma(ma, b); } template<class T, class U> inline bool chmi(T &a, const U &b) { if (b < a) { a = b; return true; } return false;} template<class U> inline bool chmi(const U &b) { return chmi(mi, b); } template<class T> inline T min(T a, signed b) { return a < b ? a : b; } template<class T> inline T max(T a, signed b) { return a < b ? b : a; } template<class T> inline T min(T a, T b, T c) { return a >= b ? b >= c ? c : b : a >= c ? c : a; } template<class T> inline T max(T a, T b, T c) { return a <= b ? b <= c ? c : b : a <= c ? c : a; } template<class T> inline T min(vector<T> a) { return *min_element(all(a)); } template<class T> inline T mini(vector<T> a) { return min_element(all(a)) - a.begin(); } template<class T> inline T min(vector<T> a, int n) { return *min_element(a.begin(), a.begin() + min(n, sz(a))); } template<class T> inline T min(vector<T> a, int s, int n) { return *min_element(a.begin() + s, a.begin() + min(n, sz(a))); } template<class T> inline T max(vector<T> a) { return *max_element(all(a)); } template<class T> inline T maxi(vector<T> a) { return max_element(all(a)) - a.begin(); } template<class T> inline T max(vector<T> a, int n) { return *max_element(a.begin(), a.begin() + min(n, sz(a))); } template<class T> inline T max(vector<T> a, int s, int n) { return *max_element(a.begin() + s, a.begin() + min(n, sz(a))); } template<typename A, size_t N> inline A max(A (&a)[N]) { A res = a[0]; rep(i, N)res = max(res, a[i]); return res;}template<typename A, size_t N, size_t O> inline A max(A (&a)[N][O]) { A res = max(a[0]); rep(i, N)res = max(res, max(a[i])); return res;}template<typename A, size_t N, size_t O, size_t P> inline A max(A (&a)[N][O][P]) { A res = max(a[0]); rep(i, N)res = max(res, max(a[i])); return res;}template<typename A, size_t N, size_t O, size_t P, size_t Q> inline A max(A (&a)[N][O][P][Q], const T &v) { A res = max(a[0]); rep(i, N)res = max(res, max(a[i])); return res;}template<typename A, size_t N, size_t O, size_t P, size_t Q, size_t R> inline A max(A (&a)[N][O][P][Q][R]) { A res = max(a[0]); rep(i, N)res = max(res, max(a[i])); return res;}template<typename A, size_t N, size_t O, size_t P, size_t Q, size_t R, size_t S> inline A max(A (&a)[N][O][P][Q][R][S]) { A res = max(a[0]); rep(i, N)res = max(res, max(a[i])); return res;}template<typename A, size_t N> inline A min(A (&a)[N]) { A res = a[0]; rep(i, N)res = min(res, a[i]); return res;}template<typename A, size_t N, size_t O> inline A min(A (&a)[N][O]) { A res = min(a[0]); rep(i, N)res = min(res, max(a[i])); return res;}template<typename A, size_t N, size_t O, size_t P> inline A min(A (&a)[N][O][P]) { A res = min(a[0]); rep(i, N)res = min(res, min(a[i])); return res;}template<typename A, size_t N, size_t O, size_t P, size_t Q> inline A min(A (&a)[N][O][P][Q], const T &v) { A res = min(a[0]); rep(i, N)res = min(res, min(a[i])); return res;}template<typename A, size_t N, size_t O, size_t P, size_t Q, size_t R> inline A min(A (&a)[N][O][P][Q][R]) { A res = min(a[0]); rep(i, N)res = min(res, min(a[i])); return res;}template<typename A, size_t N, size_t O, size_t P, size_t Q, size_t R, size_t S> inline A min(A (&a)[N][O][P][Q][R][S]) { A res = min(a[0]); rep(i, N)res = min(res, min(a[i])); return res;} template<class T> T sum(vector<T> &v) {T ret = 0;rep(i, sz(v))ret += v[i];return ret;} template<class T> T sum(vector<vector<T> > &v) {T ret = 0;rep(i, sz(v))ret += sum(v[i]);return ret;} template<class T> T sum(vector<vector<vector<T> > > &v) {T ret = 0;rep(i, sz(v))ret += sum(v[i]);return ret;} template<class T> T sum(vector<vector<vector<vector<T> > > > &v) {T ret = 0;rep(i, sz(v))ret += sum(v[i]);return ret;} template<class T> T sum(vector<vector<vector<vector<vector<T> > > > > &v) {T ret = 0;rep(i, sz(v))ret += sum(v[i]);return ret;} template<class T> auto sum(priority_queue<T, vector<T>, greater<T> > &r) {auto q = r;T ret = 0;while (sz(q)) {ret += q.top();q.pop();}return ret;} template<class T> auto sum(priority_queue<T> &r) { auto q = r; T ret = 0; while (sz(q)) { ret += q.top(); q.pop(); } return ret;} template<class T, class U, class... V> inline auto sum(vector<T> &v, U head, V... tail) { auto ret = sum(v[0], tail...); rep(i, 1, min(sz(v), head))ret += sum(v[i], tail...); return ret;} void clear(PQ &q) { q=PQ(); } template<class T> void clear(queue<T> &q) { while (q.size())q.pop(); } template<class T> T *negarr(int size) { T *body = (T *) malloc((size * 2 + 1) * sizeof(T)); return body + size;} template<class T> T *negarr2(int h, int w) { double **dummy1 = new double *[2 * h + 1]; double *dummy2 = new double[(2 * h + 1) * (2 * w + 1)]; dummy1[0] = dummy2 + w; for (int i = 1; i <= 2 * h + 1; i++) { dummy1[i] = dummy1[i - 1] + 2 * w + 1; } double **a = dummy1 + h; return a;} //imoは0-indexed //ruiは1-indexed template<class T> vector<T> imo(vector<T> &v) { vector<T> ret = v; rep(i, sz(ret) - 1)ret[i + 1] += ret[i]; return ret;} //kと同じものの数 template<class T, class U> vi imocou(vector<T> &a, U k) { vector<T> ret = a; rep(i, sz(ret) - 1)ret[i + 1] = ret[i] + (a[i] == k); return ret;} template<class T> vector<T> imox(vector<T> &v) { vector<T> ret = v; rep(i, sz(ret) - 1)ret[i + 1] ^= ret[i]; return ret;} //漸化的に最小を持つ template<class T> vector<T> imi(vector<T> &v) { vector<T> ret = v; rep(i, sz(ret) - 1)chmi(ret[i + 1], ret[i]); return ret;} template<class T> struct ruiC { const vector<T> rui; ruiC(vector<T> &ru) : rui(ru) {} inline T operator()(int l, int r) { assert(l <= r); return rui[r] - rui[l]; } inline T operator[](int i) { return rui[i]; }}; template<class T> struct rruic { const T *rrui; rruic(T *ru) : rrui(ru) {} inline T operator()(int l, int r) { assert(l >= r); return rrui[r] - rrui[l]; } inline T operator[](int i) { return rrui[i]; }}; template<class T> vector<T> ruiv(vector<T> &a) { vector<T> ret(a.size() + 1); rep(i, a.size())ret[i + 1] = ret[i] + a[i]; return ret;} template<class T> ruiC<T> ruic(vector<T> &a) { vector<T> ret = ruiv(a); return ruiC<T>(ret);} //kと同じものの数 template<class T, class U> vi ruiv(T &a, U k) { vi ret(a.size() + 1); rep(i, a.size())ret[i + 1] = ret[i] + (a[i] == k); return ret;} template<class T, class U> ruiC<int> ruic(T &a, U k) { vi ret = ruiv(a, k); return ruiC<int>(ret);} //xor template<class T> vector<T> ruix(vector<T> &a) { vector<T> ret(a.size() + 1); rep(i, a.size())ret[i + 1] = ret[i] ^ a[i]; return ret;} template<class T> vector<T> ruim(vector<T> &a) { vector<T> res(a.size() + 1, 1); rep(i, a.size())res[i + 1] = res[i] * a[i]; return res;} //漸化的に最小を1indexで持つ template<class T> vector<T> ruimi(vector<T> &a) { int n = sz(a); vector<T> ret(n + 1); rep(i, 1, n) { ret[i] = a[i - 1]; chmi(ret[i + 1], ret[i]); } return ret;} //template<class T> T *rrui(vector<T> &a) { //右から左にかけての半開区間 (-1 n-1] template<class T> rruic<T> rrui(vector<T> &a) { int len = a.size(); T *body = (T *) malloc((len + 1) * sizeof(T)); T *res = body + 1; rer(i, len - 1)res[i - 1] = res[i] + a[i]; return rruic<T>(res);} //掛け算 template<class T> T *rruim(vector<T> &a) { int len = a.size(); T *body = (T *) malloc((len + 1) * sizeof(T)); T *res = body + 1; res[len - 1] = 1; rer(i, len - 1)res[i - 1] = res[i] * a[i]; return res;} template<class T, class U> void inc(T &a, U v = 1) { a += v; } template<class T, class U> void inc(vector<T> &a, U v = 1) { for (auto &u:a)inc(u, v); } template<class T, class U> void dec(T &a, U v = 1) { a -= v; } template<class T, class U> void dec(vector<T> &a, U v = 1) { for (auto &u :a)dec(u, v); } template<class T> void dec(vector<T> &a) { for (auto &u :a)dec(u, 1); } template<class T, class U> void minu(T &a, U v = 1) { a -= v; } template<class T, class U> void minu(vector<T> &a, U v = 1) { for (auto &u:a)dec(u, v); } template<class T> void minu(vector<T> &a) { for (auto &u :a)dec(u, 1); } template<class U> void minu(string &a, U v = 1) { for (auto &u :a)dec(u, v); } void minu(string &a) { for (auto &u :a)dec(u, 1); } bool inside(int h, int w, int H, int W) { return h >= 0 && w >= 0 && h < H && w < W; } bool inside(int l, int v, int r) { return l <= v && v < r; } template<class T>bool inside(vector<T>& a,int i,int j=0){return inside(0,i,sz(a)) &&inside(0,j,sz(a));} #define ins inside ll u(ll a) { return a < 0 ? 0 : a; } template<class T> vector<T> u(const vector<T> &a) {vector<T> ret = a;fora(v, ret)v = u(v);return ret;} #define MIN(a) numeric_limits<a>::min() #define MAX(a) numeric_limits<a>::max() ll goldd(ll left, ll right, function<ll(ll)> calc) { double GRATIO = 1.6180339887498948482045868343656; ll lm = left + (ll) ((right - left) / (GRATIO + 1.0)); ll rm = lm + (ll) ((right - lm) / (GRATIO + 1.0)); ll fl = calc(lm); ll fr = calc(rm); while (right - left > 10) { if (fl < fr) { right = rm; rm = lm; fr = fl; lm = left + (ll) ((right - left) / (GRATIO + 1.0)); fl = calc(lm); } else { left = lm; lm = rm; fl = fr; rm = lm + (ll) ((right - lm) / (GRATIO + 1.0)); fr = calc(rm); } } ll minScore = MAX(ll); ll resIndex = left; for (ll i = left; i < right + 1; i++) { ll score = calc(i); if (minScore > score) { minScore = score; resIndex = i; } } return resIndex;} ll goldt(ll left, ll right, function<ll(ll)> calc) { double GRATIO = 1.6180339887498948482045868343656; ll lm = left + (ll) ((right - left) / (GRATIO + 1.0)); ll rm = lm + (ll) ((right - lm) / (GRATIO + 1.0)); ll fl = calc(lm); ll fr = calc(rm); while (right - left > 10) { if (fl > fr) { right = rm; rm = lm; fr = fl; lm = left + (ll) ((right - left) / (GRATIO + 1.0)); fl = calc(lm); } else { left = lm; lm = rm; fl = fr; rm = lm + (ll) ((right - lm) / (GRATIO + 1.0)); fr = calc(rm); } } if (left > right) { ll l = left; left = right; right = l; } ll maxScore = MIN(ll); ll resIndex = left; for (ll i = left; i < right + 1; i++) { ll score = calc(i); if (maxScore < score) { maxScore = score; resIndex = i; } } return resIndex;} template<class T> T min(vector<vector<T >> &a) {T res = MAX(T);rep(i, a.size())chmi(res, *min_element(all(a[i])));return res;} template<class T> T max(vector<vector<T >> &a) {T res = MIN(T);rep(i, a.size())chma(res, *max_element(all(a[i])));return res;} constexpr bool bget(ll m, int keta) {return (m >> keta) & 1;} int bget(ll m, int keta, int sinsuu) {m /= (ll) pow(sinsuu, keta);return m % sinsuu;} ll bit(int n) { return (1LL << (n)); } ll bit(int n, int sinsuu) { return (ll) pow(sinsuu, n); } int mask(int n) { return (1ll << n) - 1; } #define bcou __builtin_popcountll //最下位ビット int lbit(int n) {return n & -n;} //最上位ビット int hbit(int n) {n |= (n >> 1);n |= (n >> 2);n |= (n >> 4);n |= (n >> 8);n |= (n >> 16);n |= (n >> 32);return n - (n >> 1);} int hbitk(int n) {int k = 0;rer(i, 5) {int a = k + (1ll << i);int b = 1ll << a;if (b <= n)k += 1ll << i;}return k;} //初期化は0を渡す ll nextComb(ll &mask, int n, int r) { if (!mask)return mask = (1LL << r) - 1; ll x = mask & -mask; /*最下位の1*/ ll y = mask + x; /*連続した下の1を繰り上がらせる*/ ll res = ((mask & ~y) / x >> 1) | y; if (bget(res, n))return mask = 0; else return mask = res;} //n桁以下でビットがr個立っているもののvectorを返す vl bitCombList(int n, int r) {vl res;int m = 0;while (nextComb(m, n, r)) {res.pb(m);}return res;} char itoal(int i) { return 'a' + i;} char itoaL(int i) { return 'A' + i;} int altoi(char c) { if ('A' <= c && c <= 'Z')return c - 'A'; return c - 'a';} int ctoi(char c) { return c - '0'; } char itoc(int i) { return i + '0'; } int vtoi(vi &v) { int res = 0; if (sz(v) > 18) { debugline("vtoi"); deb(sz(v)); ole(); } rep(i, sz(v)) { res *= 10; res += v[i]; } return res;} vi itov(int i) { vi res; while (i) { res.pb(i % 10); i /= 10; } rev(res); return res;} vi stov(string &a) { int n = sz(a); vi ret(n); rep(i, n) { ret[i] = a[i] - '0'; } return ret;} //基準を満たさないものは0になる vi stov(string &a,char one) { int n=sz(a); vi ret (n); rep(i,n)ret[i]=a[i]==one; return ret;} vector<vector<int>> ctoi(vector<vector<char>> s, char c) { int n = sz(s), m = sz(s[0]); vector<vector<int>> res(n, vector<int>(m)); rep(i, n)rep(j, m)res[i][j] = s[i][j] == c; return res;} #define unique(v) v.erase( unique(v.begin(), v.end()), v.end() ); //[i] := i番として圧縮されたものを返す vi compress(vi &a) { vi b; int len = a.size(); for (int i = 0; i < len; ++i) { b.push_back(a[i]); } sort(b); unique(b); for (int i = 0; i < len; ++i) { a[i] = lower_bound(all(b), a[i]) - b.begin(); } int blen = sz(b); vi ret(blen); rep(i, blen) { ret[i] = b[i]; } return ret;} vi compress(vi &a, umap<int, int> &map) { vi b; int len = a.size(); for (int i = 0; i < len; ++i) { b.push_back(a[i]); } sort(b); unique(b); for (int i = 0; i < len; ++i) { int v = a[i]; a[i] = lower_bound(all(b), a[i]) - b.begin(); map[v] = a[i]; } int blen = sz(b); vi ret(blen); rep(i, blen) { ret[i] = b[i]; } return ret;} vi compress(vi &a, vi &r) { vi b; int len = a.size(); fora(v, a)b.pb(v); fora(v, r)b.pb(v); sort(b); unique(b); for (int i = 0; i < len; ++i) a[i] = lower_bound(all(b), a[i]) - b.begin(); for (int i = 0; i < sz(r); ++i) r[i] = lower_bound(all(b), r[i]) - b.begin(); int blen = sz(b); vi ret(blen); rep(i, blen) { ret[i] = b[i]; } return ret;} vi compress(vi &a, vi &r, vi &s) { vi b; int len = a.size(); fora(v, a)b.pb(v); fora(v, r)b.pb(v); fora(v, s)b.pb(v); sort(b); unique(b); for (int i = 0; i < len; ++i) a[i] = lower_bound(all(b), a[i]) - b.begin(); for (int i = 0; i < sz(r); ++i) r[i] = lower_bound(all(b), r[i]) - b.begin(); for (int i = 0; i < sz(s); ++i) r[i] = lower_bound(all(b), s[i]) - b.begin(); int blen = sz(b); vi ret(blen); rep(i, blen) { ret[i] = b[i]; } return ret;} vi compress(_vvi &a) { vi b; fora(vv, a)fora(v, vv)b.pb(v); sort(b); unique(b); fora(vv, a)fora(v, vv)v = lower_bound(all(b), v) - b.begin(); int blen = sz(b); vi ret(blen); rep(i, blen) { ret[i] = b[i]; } return ret;} vi compress(vector<vector<vi >> &a) { vi b; fora(vvv, a)fora(vv, vvv)fora(v, vv)b.pb(v); sort(b); unique(b); fora(vvv, a)fora(vv, vvv)fora(v, vv)v = lower_bound(all(b), v) - b.begin(); int blen = sz(b); vi ret(blen); rep(i, blen) { ret[i] = b[i]; } return ret;} void compress(int a[], int len) { vi b; for (int i = 0; i < len; ++i) { b.push_back(a[i]); } sort(b); unique(b); for (int i = 0; i < len; ++i) { a[i] = lower_bound(all(b), a[i]) - b.begin(); }} //要素が見つからなかったときに困る #define binarySearch(a, v) (binary_search(all(a),v)) #define lowerIndex(a, v) (lower_bound(all(a),v)-a.begin()) #define lowerBound(a, v) (*lower_bound(all(a),v)) #define upperIndex(a, v) (upper_bound(all(a),v)-a.begin()) #define upperBound(a, v) (*upper_bound(all(a),v)) template<class T> void fin(T s) { cout << s << endl, exit(0); } //便利 数学 math int mod(int a, int m) { return (a % m + m) % m; } int pow(int a) { return a * a; }; ll fact(int v) { return v <= 1 ? 1 : v * fact(v - 1); } ll comi(int n, int r) { assert(n < 100); static vvi(pas, 100, 100); if (pas[0][0])return pas[n][r]; pas[0][0] = 1; rep(i, 1, 100) { pas[i][0] = 1; rep(j, 1, i + 1)pas[i][j] = pas[i - 1][j - 1] + pas[i - 1][j]; } return pas[n][r];} double comd(int n, int r) { static vd fac; if (sz(fac) < n + 1) { if (sz(fac) == 0)fac.pb(1); rep(i, sz(fac) - 1, n) { fac.pb(fac.back() * (i + 1)); } } if (n < r || n <= 0)return 0; return fac[n] / fac[n - r] / fac[r];} int gcd(int a, int b) { while (b) a %= b, swap(a, b); return abs(a);} int gcd(vi b) { ll res = b[0]; rep(i, 1, sz(b))res = gcd(b[i], res); return res;} ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } ll lcm(vi a) { int res = a[0]; rep(i, 1, sz(a))res = lcm(a[i], res); return res;} ll ceil(ll a, ll b) { if (b == 0) { debugline("ceil"); deb(a, b); ole(); return -1; } else if (a < 0) { return 0; } else {return (a + b - 1) / b;}} //v * v >= aとなる最小のvを返す ll sqrt(ll a) {if (a < 0) {debugline("sqrt");deb(a);ole();}ll res = (ll) std::sqrt(a);while (res * res < a)res++;return res;} double log(double e, double x) { return log(x) / log(e); } ll sig(ll t) { return (1 + t) * t / 2; } ll sig(ll s, ll t) { return (s + t) * (t - s + 1) / 2; } //幾何 Pをcomplexとして扱う template<class T, class U> bool eq(T a, U b) { return fabs(a - b) < eps; } dou atan2(pd a) { return atan2(a.se, a.fi); } dou angle(pd f, pd t) { return atan2(t.se - f.se, t.fi - f.fi); } dou distance(pd a, pd b) { return hypot(a.fi - b.fi, a.se - b.se); } //bを中心とするabcのtheta aからcにかけて時計回り dou angle(pd a, pd b, pd c) { dou ax = a.fi - b.fi; dou ay = a.se - b.se; dou cx = c.fi - b.fi; dou cy = c.se - b.se; double ret = atan2(cy, cx) - atan2(ay, ax); if (ret < 0) ret += 2 * PI; return ret;} dou dot(pd a, pd b) { return a.fi * b.fi + a.se + b.se; } dou cro(pd a, pd b) { return a.fi * b.se - a.se + b.fi; } //機能拡張 template<class T, class U> void operator+=(queue<T> &a, U v) { a.push(v); }template<class T, class U> void operator+=(deque<T> &a, U v) { a.push_back(v); }template<class T, class U> priority_queue<T, vector<T>, greater<T> > &operator+=(priority_queue<T, vector<T>, greater<T> > &a, vector <U> &v) { fora(d, v)a.push(d); return a;}template<class T, class U> priority_queue<T, vector<T>, greater<T> > &operator+=(priority_queue<T, vector<T>, greater<T> > &a, U v) { a.push(v); return a;}template<class T, class U> priority_queue<T> &operator+=(priority_queue<T> &a, U v) { a.push(v); return a;}template<class T> set<T> &operator+=(set<T> &a, vector<T> v) {fora(d,v)a.insert(d);return a;}template<class T, class U> set<T> &operator+=(set<T> &a, U v) { a.insert(v); return a;}template<class T, class U> set<T, greater<T>> &operator+=(set<T, greater<T>> &a, U v) { a.insert(v); return a;}template<class T, class U> vector<T> &operator+=(vector<T> &a, U v) { a.pb(v); return a;} template<class T, class U> vector<T> operator+(const vector <T> &a, U v) {vector<T> ret = a;ret += v;return ret;} template<class T, class U> vector<T> operator+(U v, const vector <T> &a) {vector<T> ret = a;ret.insert(ret.begin(), v);return ret;} template<class T> vector<T> operator+(vector<T> a, vector <T> b) {vector<T> ret;ret = a;fora(v, b)ret += v;return ret;} template<class T> vector<T> &operator+=(vector<T> &a, vector <T> &b) {fora(v, b)a += v;return a;} template<class T> vector<T> &operator-=(vector<T> &a, vector <T> &b) {if (sz(a) != sz(b)) {debugline("vector<T> operator-=");deb(a);deb(b);exit(0);}rep(i, sz(a))a[i] -= b[i];return a;} template<class T> vector<T> operator-(vector<T> &a, vector <T> &b) {if (sz(a) != sz(b)) {debugline("vector<T> operator-");deb(a);deb(b);ole();}vector<T> res(sz(a));rep(i, sz(a))res[i] = a[i] - b[i];return res;} template<typename T> void erase(vector<T> &v, unsigned int i) {v.erase(v.begin()+ i);} template<typename T> void erase(vector<T> &v, unsigned int s,unsigned int e) {v.erase(v.begin()+ s, v.begin()+ e);} template<class T, class U> void erase(map<T, U> &m, int okl, int ngr) {m.erase(m.lower_bound(okl), m.lower_bound(ngr));} template<class T> void erase(set<T> &m, int okl, int ngr) {m.erase(m.lower_bound(okl), m.lower_bound(ngr));} template<typename T> void erasen(vector<T> &v, unsigned int s,unsigned int n) {v.erase(v.begin()+ s, v.begin()+ s + n);} template<typename T, typename U> void insert(vector<T> &v, unsigned int i,U t) {v.insert(v.begin()+ i, t);} template<typename T, typename U> void push_front(vector<T> &v, U t) {v.insert(v.begin(), t);} template<typename T, typename U> void insert(vector<T> &v, unsigned int i,vector<T> list) {for (auto &&va:list)v.insert(v.begin()+ i++, va);} template<typename T> void insert(set<T> &v, vector<T> list) {for (auto &&va :list)v.insert(va);} vector<string> split(const string a, const char deli) { string b = a + deli; int l = 0, r = 0, n = b.size(); vector<string> res; rep(i, n) { if (b[i] == deli) { r = i; if (l < r)res.push_back(b.substr(l, r - l)); l = i + 1; } } return res;} vector<string> split(const string a, const string deli) { vector<string> res; int kn = sz(deli); std::string::size_type Pos(a.find(deli)); int l = 0; while (Pos != std::string::npos) { if (Pos - l)res.pb(a.substr(l, Pos - l)); l = Pos + kn; Pos = a.find(deli, Pos + kn); } if (sz(a) - l)res.pb(a.substr(l, sz(a) - l)); return res;} void yn(bool a) { if (a)cout << "yes" << endl; else cout << "no" << endl;} void Yn(bool a) { if (a)cout << "Yes" << endl; else cout << "No" << endl;} void YN(bool a) { if (a)cout << "YES" << endl; else cout << "NO" << endl;} void fyn(bool a) { if (a)cout << "yes" << endl; else cout << "no" << endl; exit(0);} void fYn(bool a) { if (a)cout << "Yes" << endl; else cout << "No" << endl; exit(0);} void fYN(bool a) { if (a)cout << "YES" << endl; else cout << "NO" << endl; exit(0);} void Possible(bool a) { if (a)cout << "Possible" << endl; else cout << "Impossible" << endl; exit(0);} void POSSIBLE(bool a) { if (a)cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; exit(0);} //@起動時 struct initon { initon() { cin.tie(0); ios::sync_with_stdio(false); cout.setf(ios::fixed); cout.precision(16); srand((unsigned) clock() + (unsigned) time(NULL)); }; } __initon; //@formatter:on //gra mint pr int n, m, k, d, H, W, x, y, z, q; int cou; vi t, a, b, c; //vvi (s, 0, 0); vvc (ba, 0, 0); vp p; str s; template<class T> struct pq { priority_queue<T, vector<T>, greater<T> > q;//小さい順 T su = 0; void clear() { q = priority_queue<T, vector<T>, greater<T> >(); su = 0; } void operator+=(T v) { su += v; q.push(v); } T sum() { return su; } T top() { return q.top(); } void pop() { su -= q.top(); q.pop(); } T poll() { T ret = q.top(); su -= ret; q.pop(); return ret; } int size() { return q.size(); } }; #define pqi pq<int> void solve() { rep(i,10)a+=3 ; cout<<(all_of(a,==3))<<endl; rep(i,10)b+=i; cout<<(any_of(b,==9))<<endl; b.pop_back(); cout<<(any_of(b,==9))<<endl; cout<<(none_of(b,==9))<<endl; b.pb(9); cout<<(none_of(b,==9))<<endl; cout<<count_if(b,<=3)<<endl; cout<<contains_if(b,9)<<endl; b.pop_back(); cout<<contains_if(b,9)<<endl; } int my(int n, vi &a) { return 0; } int sister(int n, vi &a) { int ret = 0; return ret; } signed main() { solve(); #define arg n,a #ifdef _DEBUG bool bad = 0; for (int i = 0, ok = 1; i < k5 && ok; i++) { int n = rand(1, 8); vi a = ranv(n, 1, 10); int myres = my(arg); int res = sister(arg); ok = myres == res; if (!ok) { out(arg); cerr << "正解 : " << res << endl; cerr << "自分 : " << myres << endl; bad = 1; break; } } if (!bad) { // cout << "完璧 : solveを書き直そう" << endl; // cout << " : そして、solve()を呼び出すのだ" << endl; // cout << " : cin>>n; na(a,n);も忘れるな" << endl; } #endif return 0; };
a.cc: In function 'void solve()': a.cc:752:22: error: expected primary-expression before '<=' token 752 | cout<<count_if(b,<=3)<<endl; | ^~ a.cc: In lambda function: a.cc:753:25: error: expected ';' before numeric constant 753 | cout<<contains_if(b,9)<<endl; | ^ a.cc:43:41: note: in definition of macro 'lam' 43 | #define lam(right) [&](int& p){return p right;} | ^~~~~ a.cc:753:11: note: in expansion of macro 'contains_if' 753 | cout<<contains_if(b,9)<<endl; | ^~~~~~~~~~~ a.cc: In lambda function: a.cc:755:25: error: expected ';' before numeric constant 755 | cout<<contains_if(b,9)<<endl; | ^ a.cc:43:41: note: in definition of macro 'lam' 43 | #define lam(right) [&](int& p){return p right;} | ^~~~~ a.cc:755:11: note: in expansion of macro 'contains_if' 755 | cout<<contains_if(b,9)<<endl; | ^~~~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:71, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:2: /usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Iter_pred<_Predicate>::operator()(_Iterator) [with _Iterator = __gnu_cxx::__normal_iterator<const long long int*, std::vector<long long int> >; _Predicate = solve()::<lambda(long long int&)>]': /usr/include/c++/14/bits/stl_algobase.h:2107:14: required from '_RandomAccessIterator std::__find_if(_RandomAccessIterator, _RandomAccessIterator, _Predicate, random_access_iterator_tag) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<const long long int*, vector<long long int> >; _Predicate = __gnu_cxx::__ops::_Iter_pred<solve()::<lambda(long long int&)> >]' 2107 | if (__pred(__first)) | ~~~~~~^~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:2152:23: required from '_Iterator std::__find_if(_Iterator, _Iterator, _Predicate) [with _Iterator = __gnu_cxx::__normal_iterator<const long long int*, vector<long long int> >; _Predicate = __gnu_cxx::__ops::_Iter_pred<solve()::<lambda(long long int&)> >]' 2152 | return __find_if(__first, __last, __pred, | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ 2153 | std::__iterator_category(__first)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:3876:28: required from '_IIter std::find_if(_IIter, _IIter, _Predicate) [with _IIter = __gnu_cxx::__normal_iterator<const long long int*, vector<long long int> >; _Predicate = solve()::<lambda(long long int&)>]' 3876 | return std::__find_if(__first, __last, | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ 3877 | __gnu_cxx::__ops::__pred_iter(__pred)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:228:93: required from 'bool contains_if2(const std::vector<_Tp>&, F) [with T = long long int; F = solve()::<lambda(long long int&)>]' 228 | template<typename T, typename F> bool contains_if2(const vector<T> &v, F f) { return find_if(v.begin(), v.end(), f) != v.end(); } | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~ a.cc:753:11: required from here 238 | #define contains_if(a,right) contains_if2(a,lam(right)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~ /usr/include/c++/14/bits/predefined_ops.h:318:30: error: no match for call to '(solve()::<lambda(long long int&)>) (const long long int&)' 318 | { return bool(_M_pred(*__it)); } | ~~~~~~~^~~~~~~ a.cc:43:20: note: candidate: 'solve()::<lambda(long long int&)>' (near match) 43 | #define lam(right) [&](int& p){return p right;} | ^ a.cc:238:45: note: in expansion of macro 'lam' 238 | #define contains_if(a,right) contains_if2(a,lam(right)) | ^~~ a.cc:753:11: note: in expansion of macro 'contains_if' 753 | cout<<contains_if(b,9)<<endl; | ^~~~~~~~~~~ a.cc:43:20: note: conversion of argument 1 would be ill-formed: 43 | #define lam(right) [&](int& p){return p right;} | ^ a.cc:238:45: note: in expansion of macro 'lam' 238 | #define contains_if(a,right) contains_if2(a,lam(right)) | ^~~ a.cc:753:11: note: in expansion of macro 'contains_if' 753 | cout<<contains_if(b,9)<<endl; | ^~~~~~~~~~~ a.cc:43:20: error: binding reference of type 'long long int&' to 'const long long int' discards qualifiers 43 | #define lam(right) [&](int& p){return p right;} | ^ a.cc:238:45: note: in expansion of macro 'lam' 238 | #define contains_if(a,right) contains_if2(a,lam(right)) | ^~~ a.cc:753:11: note: in expansion of macro 'contains_if' 753 | cout<<contains_if(b,9)<<endl; | ^~~~~~~~~~~ /usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Iter_pred<_Predicate>::operator()(_Iterator) [with _Iterator = __gnu_cxx::__normal_iterator<const long long int*, std::vector<long long int> >; _Predicate = solve()::<lambda(long long int&)>]': /usr/include/c++/14/bits/stl_algobase.h:2107:14: required from '_RandomAccessIterator std::__find_if(_RandomAccessIterator, _RandomAccessIterator, _Predicate, random_access_iterator_tag) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<const long long int*, vector<long long int> >; _Predicate = __gnu_cxx::__ops::_Iter_pred<solve()::<lambda(long long int&)> >]' 2107 | if (__pred(__first)) | ~~~~~~^~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:2152:23: required from '_Iterator std::__find_if(_Iterator, _Iterator, _Predicate) [with _Iterator = __gnu_cxx::__normal_iterator<const long long int*, vector<long long int> >; _Predicate = __gnu_cxx::__ops::_Iter_pred<solve()::<lambda(long long int&)> >]' 2152 | return __find_if(__first, __last, __pred, | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ 2153 | std::__iterator_category(__first)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:3876:28: required from '_IIter std::find_if(_IIter, _IIter, _Predicate) [with _IIter = __gnu_cxx::__normal_iterator<const long long int*, vector<long long int> >; _Predicate = solve()::<lambda(long long int&)>]' 3876 | return std::__find_if(__first, __last, | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ 3877 | __gnu_cxx::__ops::__pred_iter(__pred)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:228:93: required from 'bool contains_if2(const std::vector<_Tp>&, F) [with T = long long int; F = solve()::<lambda(long long int&)>]' 228 | template<typename T, typename F> bool contains_if2(const vector<T> &v, F f) { return find_if(v.begin(), v.end(), f) != v.end(); } | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~ a.cc:755:11: required from here 238 | #define contains_if(a,right) contains_if2(a,lam(right)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~ /usr/include/c++/14/bits/predefined_ops.h:318:30: error: no match for call to '(solve()::<lambda(long long int&)>) (const long long int&)' 318 | { return bool(_M_pred(*__it)); } | ~~~~~~~^~~~~~~ a.cc:43:20: note: candidate: 'solve()::<lambda(long long int&)>' (near match) 43 | #define lam(right) [&](int& p){return p right;} | ^ a.cc:238:45: note: in expansion of macro 'lam' 238 | #define contains_if(a,right) contains_if2(a,lam(right)) | ^~~ a.cc:755:11: note: in expansion of macro 'contains_if' 755 | cout<<contains_if(b,9)<<endl; | ^~~~~~~~~~~ a.cc:43:20: note: conversion of argument 1 would be ill-formed: 43 | #define lam(right) [&](int& p){return p right;} | ^ a.cc:238:45: note: in expansion of macro 'lam' 238 | #define contains_if(a,right) contains_if2(a,lam(right)) | ^~~ a.cc:755:11: note: in expansion of macro 'contains_if' 755 | cout<<contains_if(b,9)<<endl; | ^~~~~~~~~~~ a.cc:43:20: error: binding reference of type 'long long int&' to 'const long long int' discards qualifiers 43 | #define lam(right) [&](int& p){return p right;} | ^ a.cc:238:45: note: in expansion of macro 'lam' 238 | #define contains_if(a,right) contains_if2(a,lam(right)) | ^~~ a.cc:755:11: note: in expansion of macro 'contains_if' 755 | cout<<contains_if(b,9)<<endl; | ^~~~~~~~~~~ /usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Iter_negate<_Predicate>::operator()(_Iterator) [with _Iterator = __gnu_cxx::__normal_iterator<const long long int*, std::vector<long long int> >; _Predicate = solve()::<lambda(long long int&)>]': /usr/include/c++/14/bits/stl_algobase.h:2107:14: required from '_RandomAccessIterator std::__find_if(_RandomAccessIterator, _RandomAccessIterator, _Predicate, random_access_iterator_tag) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<const long long int*, vector<long long int> >; _Predicate = __gnu_cxx::__ops::_Iter_negate<solve()::<lambda(long long int&)> >]' 2107 | if (__pred(__first)) | ~~~~~~^~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:112:28: required from '_InputIterator std::__find_if_not(_InputIterator, _InputIterator, _Predicate) [with _InputIterator = __gnu_cxx::__normal_iterator<const long long int*, vector<long long int> >; _Predicate = __gnu_cxx::__ops::_Ite
s663394790
p03651
C++
// author: Saman Mahdanian #include<bits/stdc++.h> const int N = 1e5 + 10; using namespace std; struct person { int a, b, c; void read() { cin >> a >> b >> c; } }; long long n, X, Y, Z, a[N], b[N], c[N], lsum[3], rsum[3]; set <pair <long long, int> > leftHand[3], rightHand[3]; person p[N]; int main() { cin >> X >> Y >> Z; n = X + Y + Z; for (int i = 0; i < n; i++) p[i].read(); sort (p, p + n, [] (person i, person j) { return i.b - i.c > j.b - j.c; }); for (int i = 0; i < n; i++) a[i] = p[i].a, b[i] = p[i].b, c[i] = p[i].c; long long curVal = 0; for (int i = 0; i < Y; i++) { leftHand[0].insert({b[i] - a[i], i}); curVal += b[i]; } for (int i = Y; i < n; i++) { rightHand[0].insert({c[i] - a[i], i}); curVal += c[i]; } for (int i = 0; i < X; i++) { auto h = *rightHand[0].begin(); rightHand[0].erase(h); rightHand[1].insert(h); curVal += a[h.second] - c[h.second]; } long long ans = curVal; for (int e = Y; e < Y + X; e++) { bool flag = false; for (auto i: {0, 1}) if (rightHand[i].find({c[e] - a[e], e}) != rightHand[i].end()) { rightHand[i].erase({c[e] - a[e], e}); curVal -= (i == 0)? c[e] : a[e]; flag = true; } assert(flag); leftHand[1].insert({b[e] - a[e], e}); curVal += a[e]; if (*leftHand[1].rbegin() > *leftHand[0].begin()) { auto v = *leftHand[1].rbegin(); auto u = *leftHand[0].begin(); lsum[1] += a[u.second] - a[v.second]; lsum[0] += b[v.second] - b[u.second]; leftHand[1].insert(u); leftHand[0].insert(v); } ans = max(ans, curVal()); } cout << ans << endl; } // SamMHD :: May24-2019 :: Another Soale Jazzzzab...
a.cc: In function 'int main()': a.cc:72:38: error: 'curVal' cannot be used as a function 72 | ans = max(ans, curVal()); | ~~~~~~^~
s140367392
p03651
C++
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define ALL(V) (V).begin(), (V).end() #define ALLR(V) (V).rbegin(), (V).rend() #define DEBUGGING template <typename T> using V = vector<T>; template <typename T> using VV = V<V<T>>; template <typename T, typename U> using P = pair<T, U>; using ll = int64_t; using PLL = P<ll, ll>; template <typename T> const T& var_min(const T &t) { return t; } template <typename T> const T& var_max(const T &t) { return t; } template <typename Head, typename... Tail> const Head& var_min(const Head &head, const Tail&... tail) { return min(head, var_min(tail...)); } template <typename Head, typename... Tail> const Head& var_max(const Head &head, const Tail&... tail) { return max(head, var_max(tail...)); } template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); } template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); } namespace __init { struct InitIO { InitIO() { cin.tie(0); ios_base::sync_with_stdio(false); cout << fixed << setprecision(30); } } init_io; } #ifdef DEBUGGING #include "../debug.cpp" #else #define DEBUG(...) 0 #endif template <typename T> T make_v(T init) { return init; } template <typename T, typename... Tail> auto make_v(T init, size_t s, Tail... tail) { #define rec make_v(init, tail...) return V<decltype(rec)>(s, rec); #undef rec } ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } bool solve() { ll N, K; cin >> N >> K; V<ll> A(N); for(ll &e : A) cin >> e; sort(ALL(A)); auto ite = unique(ALL(A)); A.erase(ite, A.end()); if(A.size() == 1) return A[0] == K; ll G = A[0]; for(ll e : A) G = gcd(G, e); return *max_element(ALL(A)) >= K && K % G == 0; } int main() { cout << (solve() ? "POSSIBLE" : "IMPOSSIBLE") << endl; return 0; }
a.cc:34:10: fatal error: ../debug.cpp: No such file or directory 34 | #include "../debug.cpp" | ^~~~~~~~~~~~~~ compilation terminated.
s322394458
p03651
C++
def gcd(a, b): if b == 0: return a return gcd(b, a % b) N, K = map(int, input().split()) a = list(map(int, input().split())) g = a[0] for aa in a: g = gcd(g, aa) d = (max(a) - K) if d >= 0: if d % g == 0: print('POSSIBLE') else: print('IMPOSSIBLE') else: print('IMPOSSIBLE')
a.cc:16:15: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes 16 | print('POSSIBLE') | ^~~~~~~~~~ a.cc:18:15: warning: multi-character literal with 10 characters exceeds 'int' size of 4 bytes 18 | print('IMPOSSIBLE') | ^~~~~~~~~~~~ a.cc:20:11: warning: multi-character literal with 10 characters exceeds 'int' size of 4 bytes 20 | print('IMPOSSIBLE') | ^~~~~~~~~~~~ a.cc:1:1: error: 'def' does not name a type 1 | def gcd(a, b): | ^~~
s694481050
p03651
C++
#include<bits/stdc++.h> using namespace std; typedef long long ll; int N; int main(){ ll k; cin >> N >> k; vector<ll> a(N); ll max=0; ll min=1000000000; for(int i=0;i!=N;i++){ cin >> a[i]; if(max<a[i]){ max=a[i]; } if(min>a[i]){ min=a[i]; } } if(a[i]<k){ cout << "IMPOSSIBLE" << endl; return 0; } sort(a.first(),a.end()); ll tmp=1000000000; for(int i=0;i!=N-1;i++){ int tmp2=a[i+1]-a[i]; if(tmp2<tmp){ tmp=tmp2; } } if((max-min-k)<tmp){ cout << "IMPOSSIBLE" << endl; } else{ cout << "POSSIBLE" << endl; } }
a.cc: In function 'int main()': a.cc:21:8: error: 'i' was not declared in this scope 21 | if(a[i]<k){ | ^ a.cc:25:10: error: 'class std::vector<long long int>' has no member named 'first' 25 | sort(a.first(),a.end()); | ^~~~~
s183407473
p03651
C++
#include<bits/stdc++.h> using namespace std; typedef long long ll; int N; int main(){ ll k; cin >> N >> k; vector<ll> a[N]; ll max=0; ll min=1000000000; for(int i=0;i!=N;i++){ cin >> a[i]; if(max<a[i]){ max=a[i]; } if(min>a[i]){ min=a[i]; } } if(a[i]<k){ cout << "IMPOSSIBLE" << endl; return 0; } sort(a.first(),a.end()); ll tmp=1000000000; for(int i=0;i!=N-1;i++){ int tmp2=a[i+1]-a[i]; if(tmp2<tmp){ tmp=tmp2; } } if((max-min-k)<tmp){ cout << "IMPOSSIBLE" << endl; } else{ cout << "POSSIBLE" << endl; } }
a.cc: In function 'int main()': a.cc:13:9: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::vector<long long int>') 13 | cin >> a[i]; | ~~~ ^~ ~~~~ | | | | | std::vector<long long int> | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127, from a.cc:1: /usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:24: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'bool&' 170 | operator>>(bool& __n) | ~~~~~~^~~ /usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:25: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'short int&' 174 | operator>>(short& __n); | ~~~~~~~^~~ /usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:34: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'short unsigned int&' 177 | operator>>(unsigned short& __n) | ~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:23: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'int&' 181 | operator>>(int& __n); | ~~~~~^~~ /usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:32: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'unsigned int&' 184 | operator>>(unsigned int& __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:24: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'long int&' 188 | operator>>(long& __n) | ~~~~~~^~~ /usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:33: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'long unsigned int&' 192 | operator>>(unsigned long& __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:29: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'long long int&' 199 | operator>>(long long& __n) | ~~~~~~~~~~~^~~ /usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:38: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'long long unsigned int&' 203 | operator>>(unsigned long long& __n) | ~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 219 | operator>>(float& __f) | ^~~~~~~~ /usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'float&' 219 | operator>>(float& __f) | ~~~~~~~^~~ /usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 223 | operator>>(double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'double&' 223 | operator>>(double& __f) | ~~~~~~~~^~~ /usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 227 | operator>>(long double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'long double&' 227 | operator>>(long double& __f) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:25: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'void*&' 328 | operator>>(void*& __p) | ~~~~~~~^~~ /usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]' 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:126:32: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:133:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 133 | operator>>(ios_base& (*__pf)(ios_base&)) | ^~~~~~~~ /usr/include/c++/14/istream:133:30: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'std::ios_base& (*)(std::ios_base&)' 133 | operator>>(ios_base& (*__pf)(ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:352:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; __streambuf_type = std::basic_streambuf<char>]' 352 | operator>>(__streambuf_type* __sb); | ^~~~~~~~ /usr/include/c++/14/istream:352:36: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'std::basic_istream<char>::__streambuf_type*' {aka 'std::basic_streambuf<char
s229995656
p03651
C++
int gcd(int a, int b){ if(!b) return a; return gcd(b, a%b); } int main (){ int N, K; cin >> N >> K; vector<int> world(N); int mx = 0; for(int &a:world){ cin >> a; mx = max(mx, a); } if(mx < K){ cout << "IMPOSSIBLE" << endl; return 0; } int hello = world[0]; for(int i=1; i<N; i++){ hello = gcd(hello, world[i]); } for(int i=0; i<N; i++){ if(abs(world[i]-K)%hello==0){ cout << "POSSIBLE" << endl; return 0; } } cout << "IMPOSSIBLE" << endl; return 0; }
a.cc: In function 'int main()': a.cc:6:15: error: 'cin' was not declared in this scope 6 | int N, K; cin >> N >> K; | ^~~ a.cc:7:5: error: 'vector' was not declared in this scope 7 | vector<int> world(N); | ^~~~~~ a.cc:7:12: error: expected primary-expression before 'int' 7 | vector<int> world(N); | ^~~ a.cc:9:16: error: 'world' was not declared in this scope 9 | for(int &a:world){ | ^~~~~ a.cc:11:14: error: 'max' was not declared in this scope; did you mean 'mx'? 11 | mx = max(mx, a); | ^~~ | mx a.cc:14:9: error: 'cout' was not declared in this scope 14 | cout << "IMPOSSIBLE" << endl; | ^~~~ a.cc:14:33: error: 'endl' was not declared in this scope 14 | cout << "IMPOSSIBLE" << endl; | ^~~~ a.cc:17:17: error: 'world' was not declared in this scope 17 | int hello = world[0]; | ^~~~~ a.cc:22:12: error: 'abs' was not declared in this scope 22 | if(abs(world[i]-K)%hello==0){ | ^~~ a.cc:23:13: error: 'cout' was not declared in this scope 23 | cout << "POSSIBLE" << endl; | ^~~~ a.cc:23:35: error: 'endl' was not declared in this scope 23 | cout << "POSSIBLE" << endl; | ^~~~ a.cc:27:5: error: 'cout' was not declared in this scope 27 | cout << "IMPOSSIBLE" << endl; | ^~~~ a.cc:27:29: error: 'endl' was not declared in this scope 27 | cout << "IMPOSSIBLE" << endl; | ^~~~
s673684636
p03651
C++
#include<bits/stdc++.h> #define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i) #define all(x) (x).begin(),(x).end() typedef long long ll; using namespace std; #define sz(x) ((int)(x).size()) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) #define MEMSET(v, h) memset((v), h, sizeof(v)) template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } #define pb push_back #define mp make_pair #define y0 y3487465 #define y1 y8687969 #define j0 j1347829 #define j1 j234892 ll gcd(ll a,ll b){return b?gcd(b,a%b):a;} const ll INF = 1LL<<58; int main(){ ll N,K; vector<ll> A; A.resize(N); bool flag = false; for(ll i = 0; i < A.size(); ++i) cin >> A[i]; sort(A, A + N, greater<int>()); ll g = A[0]; if(A[0] < K){ cout << "IMPOSSIBLE" << endl; return 0; } for(ll i = 1; i < A.size(); ++i){ g = gcd(g, A[i]); } if(K % g == 0) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
a.cc: In function 'int main()': a.cc:27:19: error: no match for 'operator+' (operand types are 'std::vector<long long int>' and 'll' {aka 'long long int'}) 27 | sort(A, A + N, greater<int>()); | ~ ^ ~ | | | | | ll {aka long long int} | std::vector<long long int> In file included from /usr/include/c++/14/bits/stl_algobase.h:67, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_iterator.h:627:5: note: candidate: 'template<class _Iterator> constexpr std::reverse_iterator<_Iterator> std::operator+(typename reverse_iterator<_Iterator>::difference_type, const reverse_iterator<_Iterator>&)' 627 | operator+(typename reverse_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:627:5: note: template argument deduction/substitution failed: a.cc:27:21: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'll' {aka 'long long int'} 27 | sort(A, A + N, greater<int>()); | ^ /usr/include/c++/14/bits/stl_iterator.h:1798:5: note: candidate: 'template<class _Iterator> constexpr std::move_iterator<_IteratorL> std::operator+(typename move_iterator<_IteratorL>::difference_type, const move_iterator<_IteratorL>&)' 1798 | operator+(typename move_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1798:5: note: template argument deduction/substitution failed: a.cc:27:21: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'll' {aka 'long long int'} 27 | sort(A, A + N, greater<int>()); | ^ In file included from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/basic_string.h:3598:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3598 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3598:5: note: template argument deduction/substitution failed: a.cc:27:21: note: 'std::vector<long long int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 27 | sort(A, A + N, greater<int>()); | ^ /usr/include/c++/14/bits/basic_string.h:3616:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3616 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3616:5: note: template argument deduction/substitution failed: a.cc:27:21: note: mismatched types 'const _CharT*' and 'std::vector<long long int>' 27 | sort(A, A + N, greater<int>()); | ^ /usr/include/c++/14/bits/basic_string.h:3635:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3635 | operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3635:5: note: template argument deduction/substitution failed: a.cc:27:21: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'll' {aka 'long long int'} 27 | sort(A, A + N, greater<int>()); | ^ /usr/include/c++/14/bits/basic_string.h:3652:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3652 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3652:5: note: template argument deduction/substitution failed: a.cc:27:21: note: 'std::vector<long long int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 27 | sort(A, A + N, greater<int>()); | ^ /usr/include/c++/14/bits/basic_string.h:3670:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT)' 3670 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3670:5: note: template argument deduction/substitution failed: a.cc:27:21: note: 'std::vector<long long int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 27 | sort(A, A + N, greater<int>()); | ^ /usr/include/c++/14/bits/basic_string.h:3682:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3682 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3682:5: note: template argument deduction/substitution failed: a.cc:27:21: note: 'std::vector<long long int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 27 | sort(A, A + N, greater<int>()); | ^ /usr/include/c++/14/bits/basic_string.h:3689:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3689 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3689:5: note: template argument deduction/substitution failed: a.cc:27:21: note: 'std::vector<long long int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 27 | sort(A, A + N, greater<int>()); | ^ /usr/include/c++/14/bits/basic_string.h:3696:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3696 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3696:5: note: template argument deduction/substitution failed: a.cc:27:21: note: 'std::vector<long long int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 27 | sort(A, A + N, greater<int>()); | ^ /usr/include/c++/14/bits/basic_string.h:3719:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3719 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3719:5: note: template argument deduction/substitution failed: a.cc:27:21: note: mismatched types 'const _CharT*' and 'std::vector<long long int>' 27 | sort(A, A + N, greater<int>()); | ^ /usr/include/c++/14/bits/basic_string.h:3726:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3726 | operator+(_CharT __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3726:5: note: template argument deduction/substitution failed: a.cc:27:21: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'll' {aka 'long long int'} 27 | sort(A, A + N, greater<int>()); | ^ /usr/include/c++/14/bits/basic_string.h:3733:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const _CharT*)' 3733 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3733:5: note: template argument deduction/substitution failed: a.cc:27:21: note: 'std::vector<long long int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 27 | sort(A, A + N, greater<int>()); | ^ /usr/include/c++/14/bits/basic_string.h:3740:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, _CharT)' 3740 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3740:5: note: template argument deduction/substitution failed: a.cc:27:21: note: 'std::vector<long long int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 27 | sort(A, A + N, greater<int>()); | ^ In file included from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/complex:340:5: note: candidate: 'template<class _Tp> std::compl
s443647555
p03651
C++
//#include <bits/stdc++.h> #include <iostream> #include <complex> #include <sstream> #include <string> #include <algorithm> #include <deque> #include <list> #include <map> #include <numeric> #include <queue> #include <vector> #include <set> #include <limits> #include <cstdio> #include <cctype> #include <cmath> #include <cstring> #include <cstdlib> #include <ctime> #include <climits> #include <iomanip> #define REP(i, n) for(int i = 0; i < (int)(n); i++) #define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i) #define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i) #define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++) #define SORT(v, n) sort(v, v+n) #define REVERSE(v) reverse((v).begin(), (v).end()) using namespace std; using ll = long long; const ll MOD=1000000007LL; typedef pair<int, int> P; ll ADD(ll x, ll y) { return (x+y) % MOD; } ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; } ll MUL(ll x, ll y) { return x*y % MOD; } ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; } ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); } template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;} template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;} ll n,k; ll a[100010]; ll gcd(ll a, ll b) { int t; while ( b != 0 ) { t = a%b; a = b; b = t; } return a; } ll coprime(ll a, ll b) { return (gcd(a, b) == 1); } int main(void){ ios_base::sync_with_stdio(false); cin.tie(0); cin >> n >> k; REP(i,n) cin >> a[i]; sort(a, a+n, greater<ll>()); ll res = 0LL; REF(i,n){ res = gcd(res, a[i]); } if(k%res==0 && k <= a[n0]) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; return 0; }
a.cc: In function 'int main()': a.cc:69:7: error: 'i' was not declared in this scope 69 | REF(i,n){ | ^ a.cc:69:3: error: 'REF' was not declared in this scope; did you mean 'ROF'? 69 | REF(i,n){ | ^~~ | ROF a.cc:72:25: error: 'n0' was not declared in this scope; did you mean 'y0'? 72 | if(k%res==0 && k <= a[n0]) cout << "POSSIBLE" << endl; | ^~ | y0
s900465103
p03651
C++
#include <iostream> #include <vector> #include <algorithm> using namespace std; typedef long long ll; ll gcd(ll a, ll b) { if (b == 0) { return a; } else { return gcd(b, a%b); } } int main() { int n, k; cin >> n >> k; vector<ll> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a.rbegin(), a.rend()); ll g = gcd(a[0], a[1]); for (int i = 0; i < n; i++) { g = gcd(g, a[i]); } if (k % g == 0 || k <= a[0]) { cout << "POSSIBLE" << endl; } else { cout << "IMPOSSIBLE" << endl; } return 0; }
a.cc:29:16: error: extended character   is not valid in an identifier 29 | if (k % g == 0 || k <= a[0]) { | ^ a.cc: In function 'int main()': a.cc:29:16: error: unable to find numeric literal operator 'operator""\U00003000' 29 | if (k % g == 0 || k <= a[0]) { | ^~~
s297031895
p03651
C++
#include <bits/stdc++.h> using namespace std; #define REP(i,n) for(int i=0;i<(n);i++) #define COUNT(i,n) for(int i=1;i<=(n);i++) // repeat for accumulational summention #define Acu(i,n,m) for(int i=(n);i<=(m);i++) #define DownREP(i,n) for(int i=(n);i>0;i--) #define ll long long int dx[4] = { 1, 0, -1, 0 }; int dy[4] = { 0, 1, 0, -1 }; int MAX=1e9; int MOD=1e9+7; int main(){ ll N,K;cin>>N>>K; vector<ll> A(N);REP(i,N)cin>>A[i]; ll G,MAX; REP(i,N){ G=__gcd(G,A[i]); MAX=max(MAX,a[i]); } if(K<=MAX&&K%G==0){ cout<<"POSSIBLE"<<endl; }else{ cout<<"IMPOSSIBLE"<<endl; } }
a.cc: In function 'int main()': a.cc:20:17: error: 'a' was not declared in this scope 20 | MAX=max(MAX,a[i]); | ^
s059624126
p03651
C++
#include<bits/stdc++.h> using namespace std; using ll = long long; #define MM = 1000000000; #define mod = MM + 7; #define INF (ll)1e18 #define pi acos(-1.0) #define MAX 100005 #define NIL -1 ll gcd(ll s, ll t){ if(t == 0) return s; return gcd(t, t % s); } int main(){ ll n, k; cin >> n >> k; int a[n], int mx = 0; for(ll i = 0; i < n; i++){ cin >> a[i]; mx = max(mx, a[i]); } ll g = a[0]; for(ll i = 1; i < n; i++){ g = gcd(g, a[i]); } if(mx >= k && k%g == 0) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
a.cc: In function 'int main()': a.cc:18:15: error: expected unqualified-id before 'int' 18 | int a[n], int mx = 0; | ^~~ a.cc:21:9: error: 'mx' was not declared in this scope 21 | mx = max(mx, a[i]); | ^~ a.cc:27:8: error: 'mx' was not declared in this scope 27 | if(mx >= k && k%g == 0) cout << "POSSIBLE" << endl; | ^~
s492659253
p03651
C++
#include<iostream> #include<vector> #include<algorithm> #include<string> using namespace std; using ll = long long; #define MM = 1000000000; #define mod = MM + 7; #define INF (ll)1e18 #define pi acos(-1.0) #define MAX 100005 #define NIL -1 int gcd(ll s, ll t){ if(b == 0) return s; return gcd(b, b % a); } int main(){ ll n, k; cin >> n >> k; ll a[n]; ll mx = 0; vector<ll> v; string ans; for(ll i = 0; i < n; i++){ cin >> a[i]; mx = max(mx, a[i]); } ll g = a[0]; for(ll i = 1; i < n; i++){ g = gcd(g, a[i]); } if(mx >= k && k%g == 0) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
a.cc: In function 'int gcd(ll, ll)': a.cc:14:8: error: 'b' was not declared in this scope 14 | if(b == 0) return s; | ^ a.cc:15:16: error: 'b' was not declared in this scope 15 | return gcd(b, b % a); | ^ a.cc:15:23: error: 'a' was not declared in this scope 15 | return gcd(b, b % a); | ^
s550106820
p03651
C++
#include<iostream> #include<vector> #include<algorithm> #include<string> using namespace std; using ll = long long; #define MM = 1000000000; #define mod = MM + 7; #define INF (ll)1e18 #define pi acos(-1.0) #define MAX 100005 #define NIL -1 int main(){ ll n, k; cin >> n >> k; ll a; vector<ll> v; string ans; for(ll i = 0; i < n; i++){ cin >> a; if(a == k) ans = "POSSIBLE" v.push_back(a); } sort(v.begin(), v.end()); bool flag = true; for(ll i = 1; i < n; i++){ if(v[i] % v[0] != 0) flag = false; } if(!flag) ans = "POSSIBLE"; else ans = "IMPOSSIBLE"; cout << ans << endl; }
a.cc: In function 'int main()': a.cc:20:36: error: expected ';' before 'v' 20 | if(a == k) ans = "POSSIBLE" | ^ | ; 21 | v.push_back(a); | ~
s924750870
p03651
C
#include <cstdio> #include <algorithm> using namespace std; int n, k, r, a, maxa; int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); } int main(void) { scanf("%d%d%d", &n, &k, &r); maxa = r; for (int i = 1; i < n; i++) { scanf("%d", &a); r = gcd(r, a); maxa = max(maxa, a); } if (!(k % r) && k <= maxa) printf("POSSIBLE"); else printf("IMPOSSIBLE"); }
main.c:1:10: fatal error: cstdio: No such file or directory 1 | #include <cstdio> | ^~~~~~~~ compilation terminated.
s331947371
p03651
C++
#include<bits/stdc++.h> using namespace std; int main() { int } /* ---------- STL Libraries ---------- */ // IO library #include <cstdio> #include <fstream> #include <iomanip> #include <ios> #include <iostream> // algorithm library #include <algorithm> #include <cmath> #include <numeric> #include <random> // container library #include <array> #include <bitset> #include <deque> #include <map> #include <queue> #include <set> #include <string> #include <tuple> #include <vector> /* ---------- Namespace ---------- */ using namespace std; /* ---------- Type Abbreviation ---------- */ template <typename T> using PQ = priority_queue<T>; template <typename T> using GPQ = priority_queue<T, vector<T>, greater<T>>; using ll = long long; #define fst first #define snd second #define mp make_pair #define mt make_tuple #define FOR(i, a, b) for (ll i = (a); i < (b); i++) #define REP(i, n) FOR(i, 0, n) /* ---------- conversion ---------- */ #define INT(c) static_cast<int>(c) #define CHAR(n) static_cast<char>(n) #define LL(n) static_cast<ll>(n) #define DOUBLE(n) static_cast<double>(n) /* ---------- container ---------- */ #define ALL(v) (v).begin(), (v).end() #define SIZE(v) (LL((v).size())) #define FIND(v, k) (v).find(k) != (v).end() #define VFIND(v, k) find(ALL(v), k) != (v).end() #define gsort(b, e) sort(b, e, greater<decltype(*b)>()) /* ----------- debug ---------- */ template <class T> ostream& operator<<(ostream& os, vector<T> v) { os << "["; for (auto vv : v) os << vv << ","; return os << "]"; } template <class T> ostream& operator<<(ostream& os, set<T> v) { os << "["; for (auto vv : v) os << vv << ","; return os << "]"; } template <class L, class R> ostream& operator<<(ostream& os, pair<L, R> p) { return os << "(" << p.fst << "," << p.snd << ")"; } /* ---------- Constants ---------- */ // const ll MOD = 1e9 + 7; // const int INF = 1 << 25; // const ll INF = 1LL << 50; // const double PI = acos(-1); // const double EPS = 1e-10; // mt19937 mert(LL(time(0))); /* ---------- Short Functions ---------- */ template <typename T> T sq(T a) { return a * a; } template <typename T> T gcd(T a, T b) { if (a > b) return gcd(b, a); return a == 0 ? b : gcd(b % a, a); } template <typename T, typename U> T mypow(T b, U n) { if (n == 0) return 1; if (n == 1) return b /* % MOD */; if (n % 2 == 0) { return mypow(b * b /* % MOD */, n / 2); } else { return mypow(b, n - 1) * b /* % MOD */; } } ll pcnt(ll b) { return __builtin_popcountll(b); } // const ll dx[4] = {0, -1, 1, 0}; // const ll dy[4] = {-1, 0, 0, 1}; // const ll dx[8] = {-1, 0, 1, -1, 1, -1, 0, 1}; // const ll dy[8] = {-1, -1, -1, 0, 0, 1, 1, 1}; /* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */ int main() { cin.tie(0); ios::sync_with_stdio(false); ll N, K; cin >> N >> K; ll A[N]; REP(i, N) { cin >> A[i]; } ll B[N]; REP(i, N) { B[i] = A[i] % 2; } bool flg; REP(i, N - 1) { if (B[i] != B[i + 1]) flg = false; } if (!flg) { cout << "POSSIBLE" << endl; return 0; } else { if (B[0] == K % 2) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; } return 0; }
a.cc: In function 'int main()': a.cc:5:1: error: expected unqualified-id before '}' token 5 | } | ^ a.cc: At global scope: a.cc:142:5: error: redefinition of 'int main()' 142 | int main() { | ^~~~ a.cc:3:5: note: 'int main()' previously defined here 3 | int main() { | ^~~~
s092753401
p03651
C++
#include<bits/stdc++.h> #define ll long long using namespace std; const int inf = 1e9 + 7; const int mnx = 5e2 + 9; int a[mnx][mnx]; bool del[mnx]; int ptr[mnx]; int cnt[mnx]; int n, m; bool check(int lim){ for(int i = 1; i <= n; i++){ ptr[i] = 1; } for(int i = 1; i <= m; i++){ del[i] = 0; } while(true){ for(int i = 1; i <= m; i++){ cnt[i] = 0; } for(int i = 1; i <= n; i++){ cnt[a[i][ptr[i]]]++; } bool found = 0; for(int i = 1; i <= m; i++){ if (cnt[i] > lim) { del[i] = 1; found = 1; } } if(!found){ break; } for(int i = 1; i <= n; i++){ while(ptr[i] <= m && del[a[i][ptr[i]]]) { ptr[i]++; } if (ptr[i] > m) { return 0; } } } return 1; } int main(){ cin >> n >> m; for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { cin >> a[i][j]); } } int l = 1, r = n, ans = 0; while(l <= r){ int mid = (l + r) >> 1; if(check(mid)){ r = mid - 1; ans = mid; } else{ l = mid + 1; } } cout << ans << '\n'; return 0; }
a.cc: In function 'int main()': a.cc:56:23: error: expected ';' before ')' token 56 | cin >> a[i][j]); | ^ | ;
s080064619
p03651
C++
#include <bits/stdc++.h> #define vec(v) vector<int>(v) #define be(v) (v).begin(), (v).end() #define pb(q) push_back(q) #define mapci(mp) map<char*,int>(mp) #define mapcc(mp) map<char*,char*>(mp) typedef long long ll; using namespace std; int gcd(int x, int y) { while(x != 0){ y %= x; if(y == 0) return x; x %= y; } return y; } int main() { cin.tie(0); ios::sync_with_stdio(false); int n,k; cin>>n>>k; ll a[n]; for(int i=0;i<n;i++){ cin>>a[i]; } int g=a[0],ma=a[0]; for(int i=1;i<n;i++){ gcd(g,a[i]); ma=max(ma,a[i]); } if(n==1){ if(a[0]==k){ cout <<"POSSIBLE"<<endl; } else{ cout <<"IMPOSSIBLE"<<endl; } } else{ if(k%g==0&&k<=ma){ cout <<"POSSIBLE"<<endl; } else{ cout <<"IMPOSSIBLE"<<endl; } } return 0; }
a.cc: In function 'int main()': a.cc:32:15: error: no matching function for call to 'max(int&, ll&)' 32 | ma=max(ma,a[i]); | ~~~^~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:32:15: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'}) 32 | ma=max(ma,a[i]); | ~~~^~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:32:15: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 32 | ma=max(ma,a[i]); | ~~~^~~~~~~~~
s379374473
p03651
C++
#include<iostream> #include<climits> #include<vector> #include<list> #include<functional> #include<algorithm> #include<string> #include<cmath> #include<complex> #include<set> #include<map> #include<stack> #include<queue> #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define REP(i,n) for(int i=0;i<(n);i++) using namespace std; typedef long long ll; typedef pair<int, int> P; class question { public: int N, K; vector<int> A; int gcd_vec(vector<int> a, int l, int r) { if (l + 1 == r) return a[l]; int m = (l + r) / 2; return gcd(gcd_vec(a, l, m), gcd_vec(a, m, r)); } int gcd(int x, int y) { return y == 0 ? x : gcd(y, x%y); } void ans() { cin >> N >> K; A.resize(N); int mx = 0; REP(i, N) { cin >> A[i]; mx = max(mx, A[i]); } int g = A[0]; FOR(i, 1, N) g = gcd(g, A[i]); string res = "IMPOSSIBLE\n"; if (K <= mx && K%g == 0) res = "POSSIBLE\n"; cout << res; } };
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s952011584
p03651
C++
#include <algorithm> #include <iostream> #include <cstring> #include <climits> #include <cstdio> #include <vector> #include <cmath> #include <queue> #include <stack> #include <map> #include <set> #define R register #define LL long long #define U unsigned #define FOR(i,a,b) for(R int i = a;i <= b;++i) #define RFOR(i,a,b) for(R int i = a;i >= b;--i) #define CLR(i,a) memset(i,a,sizeof(i)) #define BR printf("--------------------\n") #define DEBUG(x) std::cerr << #x << '=' << x << std::endl int N,K; int g; int main(){ scanf("%d%d",&N,&K); FOR(i,1,N){ int x;scanf("%d",&x); if(i == 1) g = x; else g = __gcd(g,x); } if(K%g) puts("IMPOSSIBLE"); else puts("POSSIBLE"); return 0; }
a.cc: In function 'int main()': a.cc:27:9: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 27 | FOR(i,1,N){ | ^ a.cc:16:30: note: in definition of macro 'FOR' 16 | #define FOR(i,a,b) for(R int i = a;i <= b;++i) | ^ a.cc:30:18: error: '__gcd' was not declared in this scope; did you mean 'std::__gcd'? 30 | else g = __gcd(g,x); | ^~~~~ | std::__gcd In file included from /usr/include/c++/14/algorithm:61, from a.cc:1: /usr/include/c++/14/bits/stl_algo.h:1137:5: note: 'std::__gcd' declared here 1137 | __gcd(_EuclideanRingElement __m, _EuclideanRingElement __n) | ^~~~~
s364183318
p03651
C++
#include "bits/stdc++.h" #define rep(i,a,n) for(int i = a;i < n;i++) typedef unsigned long long ull; typedef long long ll; using namespace std; ull gcd(ull a,ull b){ if(!b) return a; return gcd(b,a%b); } int main(){ ull n,k,memo = 0,memo2 = 0; cin >> n >> k; int a[n]; rep(i,0,n){ cin >> a[i]; if(!i) memo2 = a[i]; else memo2 = max(memo2,a[i]); } if(memo2 < k){ cout << "IMPOSSIBLE" << endl; return 0; } memo = a[0]; rep(i,1,n){ memo = gcd(memo,a[i]); } if(memo-1){ cout << "IMPOSSIBLE" << endl; } else{ cout << "POSSIBLE" << endl; } return 0; }
a.cc: In function 'int main()': a.cc:21:33: error: no matching function for call to 'max(ull&, int&)' 21 | else memo2 = max(memo2,a[i]); | ~~~^~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:21:33: note: deduced conflicting types for parameter 'const _Tp' ('long long unsigned int' and 'int') 21 | else memo2 = max(memo2,a[i]); | ~~~^~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:21:33: note: mismatched types 'std::initializer_list<_Tp>' and 'long long unsigned int' 21 | else memo2 = max(memo2,a[i]); | ~~~^~~~~~~~~~~~
s523884563
p03651
C++
#include <bits/stdc++.h> #define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++) #define rrep(i,a,b) for(long long int i=(a);i<(b);i++) typedef long long ll; using namespace std; long long int n,cnt=0,ans=0,a[100005],sum=0,pos,k; int main(void){ cin>>n>>k; ll ma=0; rep(i,n){ cin>>a[i]; ma=max(ma,a[i]); } if(ma<k)Cout("IMPOSSIBLE"); else{ pos=a[0]; rrep(i,1,n){ pos=__gcd(pos,a[i]); } if(k%pos==0)cout<<"POSSIBLE"<<endl; else cout<<"IMPOSSIBLE"<<endl; } }
a.cc: In function 'int main()': a.cc:14:15: error: 'Cout' was not declared in this scope 14 | if(ma<k)Cout("IMPOSSIBLE"); | ^~~~
s738433644
p03651
C++
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b){ if(b==0) return a; return gcd(b, a%b); } int main(){ long long int a,b,k[100005],most=0,mon; cin>>a>>b; for(int i=0;i<a;++i){ cin>>k[i]; most=max(most,k[i]); if(i==0) mon=k[i]; mon=gcd(mon,k[i]); } if(most<b){ cout<<"IMPOSSIBLE"<<endl; return 0; } if(b%mon==0) cout<<"POSSIBLEL<<endl; cout<<"IMPOSSIBLE"<<endl; }
a.cc:23:22: warning: missing terminating " character 23 | if(b%mon==0) cout<<"POSSIBLEL<<endl; | ^ a.cc:23:22: error: missing terminating " character 23 | if(b%mon==0) cout<<"POSSIBLEL<<endl; | ^~~~~~~~~~~~~~~~~ a.cc: In function 'int main()': a.cc:23:20: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::ostream' {aka 'std::basic_ostream<char>'}) 23 | if(b%mon==0) cout<<"POSSIBLEL<<endl; | ~~~~^~ | | | basic_ostream<[...]> 24 | cout<<"IMPOSSIBLE"<<endl; | ~~~~ | | | basic_ostream<[...]> a.cc:23:20: note: candidate: 'operator<<(int, int)' (built-in) 23 | if(b%mon==0) cout<<"POSSIBLEL<<endl; | ~~~~^~~~~~~~~~~~~~~~~~~ 24 | cout<<"IMPOSSIBLE"<<endl; | ~~~~ a.cc:23:20: note: no known conversion for argument 2 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int' In file included from /usr/include/c++/14/istream:41, from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127, from a.cc:1: /usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'} 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]' 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ^~~~~~~~ /usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'std::ios_base& (*)(std::ios_base&)' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 174 | operator<<(long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'long int' 174 | operator<<(long __n) | ~~~~~^~~ /usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 178 | operator<<(unsigned long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'long unsigned int' 178 | operator<<(unsigned long __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 182 | operator<<(bool __n) | ^~~~~~~~ /usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'bool' 182 | operator<<(bool __n) | ~~~~~^~~ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]' 96 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'short int' 97 | operator<<(short __n) | ~~~~~~^~~ /usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 189 | operator<<(unsigned short __n) | ^~~~~~~~ /usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'short unsigned int' 189 | operator<<(unsigned short __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]' 110 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int' 111 | operator<<(int __n) | ~~~~^~~ /usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 200 | operator<<(unsigned int __n) | ^~~~~~~~ /usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'unsigned int' 200 | operator<<(unsigned int __n) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 211 | operator<<(long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'long long int' 211 | operator<<(long long __n) | ~~~~~~~~~~^~~ /usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 215 | operator<<(unsigned long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'long long unsigned int' 215 | operator<<(unsigned long long __n) | ~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 231 | operator<<(double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'double' 231 | operator<<(double __f) | ~~~~~~~^~~ /usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 235 | operator<<(float __f) | ^~~~~~~~ /usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'float' 235 | operator<<(float __f) | ~~~~~~^~~ /usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 243 | operator<<(long double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'long doubl
s214048384
p03651
C++
#include <iostream> #include <vector> #include <math.h> #include <cmath> #include <algorithm> #include <numeric> #include <string> #include <cstring> #include <regex> #include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int,int>; using pl4 = pair<ll,ll>; using vi = vector<int>; using vvi = vector<vi>; using vs = vector<string>; using vvs = vector<vs>; using vll = vector<ll>; using vvll = vector<vll>; using vpii = vector<pii>; using vvpii = vector<vpii>; using vpl4 = vector<pl4>; using vvpl4 = vector<vpl4>; #define fi first #define se second #define mp make_pair #define pb push_back #define pob pop_back() #define sz size() #define be begin() #define en end() #define asn assign #define emp empty() #define ft front() #define bk back() #define clr clear() #define ins insert #define ers erase #define res resize #define FOR(i,a,b) for(int i=(a);i<=(b);i++) #define rFOR(i,a,b) for(int i=(b);i>=(a);i--) #define REP(i,a) for(int i=0;i<(a);i++) #define REP1(i,a) for(int i=1;i<=(a);i++) #define rREP(i,a) for(int i=(a-1);i>=0;i--) #define rREP1(i,a) for(int i=(a);i>0;i--) #define SORT(a) sort((a).be,(a).en) #define rSORT(a) sort((a).rbegin(),(a).rend()) #define UNIQUE(a) (a).erase(unique((a).be,(a).en),(a).en) #define PREVP(a) prev_permutation((a).be,(a).en) #define NEXTP(a) next_permutation((a).be,(a).en) #define BINS(a,b) binary_search((a).be,(a).en,(b)) #define LOWB(a,b) (lower_bound((a).be,(a).en,(b))-(a).be) #define UPB(a,b) (upper_bound((a).be,(a).en,(b))-(a).be) #define CNT(a,b) count((a).be,(a).en,b) #define SUM(a) accumulate((a).be,(a).en,0) #define REV(a) reverse((a).be,(a).en) #define REGS(a,b) regex_search((a),regex(b)) #define REGM(a,b) regex_match((a),regex(b)) #define yn(a) cout <<((a)?"yes":"no")<<endl; #define Yn(a) cout <<((a)?"Yes":"No")<<endl; #define YN(a) cout <<((a)?"YES":"NO")<<endl; #define say(a) cout <<(a); #define sal(a) cout <<(a)<<endl; #define sak cout <<endl; #define dbg(a) cout <<(#a)<<": "<<(a)<<endl; #define a2l(a) ((ll)(a-97)) #define A2l(a) ((ll)(a-65)) #define l2a(a) ((char)(a+97)) #define l2A(a) ((char)(a+65)) #define DigN2(a) ((llabs(a)==0)?(1):((ll)(log2(double(llabs(a))))+1)) #define DigN10(a) ((llabs(a)==0)?(1):((ll)(log10(double(llabs(a))))+1)) #define Dig2(a,b) (((a)>>(b))&1) #define Dig10(a,b) (ll)(((a)/((ll)(pow(10.0,(double)(b)))))%10) #define Pow2(a) (1<<(a)) #define llin(a) ll (a);cin >>(a); #define stin(a) string (a);cin >>(a); #define rdn(a,b) ((a)/(b)) #define rou(a,b) ((((double(a)/double(b))-((a)/(b)))<0.5)?((a)/(b)):(((a)/(b))+1)) #define rup(a,b) ((((a)%(b))==0)?((a)/(b)):(((a)/(b))+1)) #define min(a,b) ((a<b)?(a):(b)) #define max(a,b) ((a>b)?(a):(b)) #define int ll const ll MOD = 1e9+7; const string alp = "abcdefghijklmnopqrstuvwxyz"; const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);} ll lcm(ll a, ll b){return a/gcd(a,b)*b;} ll sgn(ll n){ if(n==0) return 0; else return n/abs(n); } ll salv(vll v){ say("{"); FOR(i,0,v.sz-1){ say(v[i]); if(i!=v.sz-1) say(","); } sal("}") } ll DigS10(ll n){ ll m=0; FOR(i,0,DigN10(n)-1){ m+=(ll)((llabs(n)%(ll)(pow(10.0,(double)(i+1))))/(ll)(pow(10.0,(double)i))); } return m; } ll isP(ll n){ if(n<=1) return 0; FOR(i,2,(ll)sqrt(n)){ if(n%i==0) return 0; } return 1; } vll FactM(1,1); vll FactMI(1,1); ll PowM(ll a,ll b){ ll ans=1,x=(a%MOD); FOR(i,0,DigN2(b)-1){ if(Dig2(b,i)==1) ans=(ans*x)%MOD; if(i!=(DigN2(b)-1)) x=(x*x)%MOD; } return ans; } void CFactM(ll n){ FOR(i,FactM.sz,n){ FactM.pb((FactM[i-1]*(i%MOD))%MOD); } return; } void CFactMI(ll n){ CFactM(n); if(FactMI.sz<(n+1)) FactMI.res(n+1,-1); if(FactMI[n]==-1) FactMI[n]=PowM(FactM[n],MOD-2); rFOR(i,1,n-1){ if(FactMI[i]!=-1) break; FactMI[i]=((FactMI[i+1]*((i+1)%MOD))%MOD); } return; } ll CombM(ll n,ll k){ if((n<0)||(k<0)) return 0; if(n<k) return 0; if(n+1>FactMI.sz) CFactMI(n); return ((((FactMI[k]*FactMI[n-k])%MOD)*FactM[n])%MOD); } signed main() { ll n,k,a[100010],mx=0,g; cin >> n >> k; REP(i,n){ cin >> a[i]; if(a[i]==k){ cout << "POSSIBLE"; return 0; } if(mx<a[i])mx=a[i]; } if(mx<k){ cout << "IMPOSSIBLE"; } else { g=abs(a[0]-a[1]); REP1(i,n-1){ g=gcd(abs(a[i+1]-a[i]),g); } if(g==1){ cout << "POSSIBLE"; } else { if(1!=gcd(g,abs(a[i+1]-a[i]))){ cout << "POSSIBLE"; return 0; } cout << "IMPOSSIBLE"; } } return 0; }
a.cc: In function 'll salv(vll)': a.cc:109:1: warning: no return statement in function returning non-void [-Wreturn-type] 109 | } | ^ a.cc: In function 'int main()': a.cc:185:25: error: 'i' was not declared in this scope 185 | if(1!=gcd(g,abs(a[i+1]-a[i]))){ | ^
s281234840
p03651
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; const double PI = 4*atan(1); const int INF = 0x3f3f3f3f; const ll LINF = 0x3f3f3f3f3f3f3f3f; const double EPS = 1e-6; const string YES = "Possible"; const string NO = "Impossible"; #define pb push_back #define mp make_pair const int MAX_N = 1e5+12; int A[MAX_N]; int N, K; int gcd(int a, int b) { if(b==0) return a; return gcd(b%a, b); } void solve() { int g = A[0]; for(int i=1;i<N;++i) g=gcd(g, A[i]); if(g<=K && K%g==0) return "POSSIBLE"; return "IMPOSSIBLE"; } int main() { cin >> N >> K; for(int i=0;i<N;++i) cin >> A[i]; solve(); return 0; }
a.cc: In function 'void solve()': a.cc:27:35: error: return-statement with a value, in function returning 'void' [-fpermissive] 27 | if(g<=K && K%g==0) return "POSSIBLE"; | ^~~~~~~~~~ a.cc:28:16: error: return-statement with a value, in function returning 'void' [-fpermissive] 28 | return "IMPOSSIBLE"; | ^~~~~~~~~~~~
s766540771
p03651
C++
#include<bits/stdc++.h> #define ll long long #define pb push_back using namespace std; const int mnx = 2e6 + 9; const int mod = 1e9 + 7; int n, k; int a[mnx]; ll gcd(ll a, ll b){ if(b % 2 == 0){ return 1; } return gcd(b, a % b); } int main(){ scanf("%d%d", &n, &k); int g, m; scanf("%d", &g); m = g; for(int i=1; i<n; i++){ scanf("%d", &a); g = gcd(g, a); m = max(m, a); } if(k <= m && k % g == 0){ printf("POSSIBLE\n"); } else{ printf("INPOSSIBLE\n"); } return 0; }
a.cc: In function 'int main()': a.cc:29:12: error: no matching function for call to 'gcd(int&, int [2000009])' 29 | g = gcd(g, a); | ~~~^~~~~~ a.cc:12:4: note: candidate: 'long long int gcd(long long int, long long int)' (near match) 12 | ll gcd(ll a, ll b){ | ^~~ a.cc:12:4: note: conversion of argument 2 would be ill-formed: a.cc:29:16: error: invalid conversion from 'int*' to 'long long int' [-fpermissive] 29 | g = gcd(g, a); | ^ | | | int* In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:58, from a.cc:1: /usr/include/c++/14/numeric:173:5: note: candidate: 'template<class _Mn, class _Nn> constexpr std::common_type_t<_Mn, _Nn> std::gcd(_Mn, _Nn)' 173 | gcd(_Mn __m, _Nn __n) noexcept | ^~~ /usr/include/c++/14/numeric:173:5: note: template argument deduction/substitution failed: In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/type_traits: In substitution of 'template<class ... _Tp> using std::common_type_t = typename std::common_type::type [with _Tp = {int, int*}]': /usr/include/c++/14/numeric:173:5: required by substitution of 'template<class _Mn, class _Nn> constexpr std::common_type_t<_Mn, _Nn> std::gcd(_Mn, _Nn) [with _Mn = int; _Nn = int*]' a.cc:29:12: required from here 29 | g = gcd(g, a); | ~~~^~~~~~ /usr/include/c++/14/type_traits:2719:11: error: no type named 'type' in 'struct std::common_type<int, int*>' 2719 | using common_type_t = typename common_type<_Tp...>::type; | ^~~~~~~~~~~~~ a.cc:30:12: error: no matching function for call to 'max(int&, int [2000009])' 30 | m = max(m, a); | ~~~^~~~~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:30:12: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'int [2000009]') 30 | m = max(m, a); | ~~~^~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:30:12: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 30 | m = max(m, a); | ~~~^~~~~~
s395153560
p03651
C++
#include <bits/stdc++.h> using namespace std; #define int long long #define INF (1<<29) #define MOD 1000000007 #define rep(i,n) for(int i=0;i<(n);i++) int gcd(int a,int b){ if(b==0)return a; return gcd(b,a%b); } int lcm(int a,int b){ return a/gcd(a,b)*b; } bool prime(int p){ for(int i=2;i<=sqrt(p);i++){ if(!p%i)return false; } return true; } int modpow(int a,int b){ if(b==0)return 1; if(b==1)return a%MOD; if(b%2)return modpow(a,b-1)*a%MOD; else return modpow(a,b/2)*modpow(a,b/2)%MOD; } int comb(int a,int b){ if(b==0||a==b)return 1; if(b==1)return a%MOD; return (comb(a-1,b-1)+comb(a-1,b))%MOD; } int n,k,a[100000]; signed main(){ cin>>n>>k; rep(i,n)cin>>a[i]; sort(a,a+n); int g=a[0]; for(int i=1;i<n;i++)g=gcd(a[i],g); if(k<=a[n-i]&&k%g==0)cout<<"IM"; cout<<"POSSIBLE"<<endl; return 0; }
a.cc: In function 'int main()': a.cc:38:15: error: 'i' was not declared in this scope 38 | if(k<=a[n-i]&&k%g==0)cout<<"IM"; | ^
s104148039
p03651
C++
#include <bits/stdc++.h> #define int long long using namespace std; main () { int n, k; cin >> n >> k; int gcd = 0; int mn = 0; for (int i = 1;i <= n;i ++) { int x; cin >> x; gcd = __gcd (gcd, x); mn = max (mn, x); } if (k % gcd == 0 && k <= mx) cout << "POSSIBLE"; else cout << "IMPOSSIBLE"; return 0; }
a.cc:7:2: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 7 | main () { | ^~~~ a.cc: In function 'int main()': a.cc:18:34: error: 'mx' was not declared in this scope; did you mean 'mn'? 18 | if (k % gcd == 0 && k <= mx) cout << "POSSIBLE"; | ^~ | mn
s669371727
p03651
C++
#include <iostream> #include <vector> #include <set> #include <function> using namespace std; int gcd(int a, int b) { if (a < b) swap(a, b); while (b != 0) { a = a%b; swap(a, b); } return a; } int main() { int N, K; cin >> N >> K; vector<int> A(N),v; for (int i = 0; i < N; ++i) cin >> A[i]; set<int> st; for (int i = 0; i < N; ++i) { //最初にあれば終わり if (A[i] == K) { cout << "POSSIBLE" << endl; return 0; } //差分列挙 if (A[i] > K) v.push_back(A[i] - K); //ユニークだけを列挙 st.insert(A[i]); } //最大値がKより小さい場合 if (v.size() == 0) { cout << "IMPOSSIBLE" << endl; return 0; } int mini = 0, mini2 = *min_element(A.begin(),A.end()); //最小値が更新される限りループ while (mini2 != mini) { mini = mini2; //割り切れればPOSSIBLE for (int i = 0; i < v.size(); ++i) { if (v[i] % mini == 0) { cout << "POSSIBLE" << endl; return 0; } } vector<int> u; //gcdを作っていく for (auto itr = st.begin(); itr != st.end(); ++itr) { int g = gcd(mini, *itr); u.push_back(g); } for (int i = 0; i < u.size(); ++i) st.insert(u[i]); mini2 = *min_element(u.begin(), u.end()); } cout << "IMPOSSIBLE" << endl; return 0; }
a.cc:4:10: fatal error: function: No such file or directory 4 | #include <function> | ^~~~~~~~~~ compilation terminated.
s621521940
p03651
C++
#include <iostream> #include <vector> #include <set> using namespace std; int gcd(int a, int b) { if (a < b) swap(a, b); while (b != 0) { a = a%b; swap(a, b); } return a; } int main() { ll N, K; cin >> N >> K; vector<int> A(N),v; for (int i = 0; i < N; ++i) cin >> A[i]; set<int> st; for (int i = 0; i < N; ++i) { //最初にあれば終わり if (A[i] == K) { cout << "POSSIBLE" << endl; return 0; } //差分列挙 if (A[i] > K) v.push_back(A[i] - K); //ユニークだけを列挙 st.insert(A[i]); } //最大値がKより小さい場合 if (v.size() == 0) { cout << "IMPOSSIBLE" << endl; return 0; } int mini = 0, mini2 = *min_element(A.begin(),A.end()); //最小値が更新される限りループ while (mini2 != mini) { mini = mini2; //割り切れればPOSSIBLE for (int i = 0; i < v.size(); ++i) { if (v[i] % mini == 0) { cout << "POSSIBLE" << endl; return 0; } } vector<int> u; //gcdを作っていく for (auto itr = st.begin(); itr != st.end(); ++itr) { int g = gcd(mini, *itr); u.push_back(g); } for (int i = 0; i < u.size(); ++i) st.insert(u[i]); mini2 = *min_element(ALL(u)); } cout << "IMPOSSIBLE" << endl; return 0; }
a.cc: In function 'int main()': a.cc:17:9: error: 'll' was not declared in this scope 17 | ll N, K; cin >> N >> K; | ^~ a.cc:17:25: error: 'N' was not declared in this scope 17 | ll N, K; cin >> N >> K; | ^ a.cc:17:30: error: 'K' was not declared in this scope 17 | ll N, K; cin >> N >> K; | ^ a.cc:43:32: error: 'min_element' was not declared in this scope 43 | int mini = 0, mini2 = *min_element(A.begin(),A.end()); | ^~~~~~~~~~~ a.cc:64:38: error: 'ALL' was not declared in this scope 64 | mini2 = *min_element(ALL(u)); | ^~~
s273415663
p03651
C++
#include <iostream> #include <vector> #include <set> using namespace std; int gcd(ll a, ll b) { if (a < b) swap(a, b); while (b != 0) { a = a%b; swap(a, b); } return a; } int main() { ll N, K; cin >> N >> K; vector<int> A(N),v; for (int i = 0; i < N; ++i) cin >> A[i]; set<int> st; for (int i = 0; i < N; ++i) { //最初にあれば終わり if (A[i] == K) { cout << "POSSIBLE" << endl; return 0; } //差分列挙 if (A[i] > K) v.push_back(A[i] - K); //ユニークだけを列挙 st.insert(A[i]); } //最大値がKより小さい場合 if (v.size() == 0) { cout << "IMPOSSIBLE" << endl; return 0; } int mini = 0, mini2 = *min_element(A.begin(),A.end()); //最小値が更新される限りループ while (mini2 != mini) { mini = mini2; //割り切れればPOSSIBLE for (int i = 0; i < v.size(); ++i) { if (v[i] % mini == 0) { cout << "POSSIBLE" << endl; return 0; } } vector<int> u; //gcdを作っていく for (auto itr = st.begin(); itr != st.end(); ++itr) { int g = gcd(mini, *itr); u.push_back(g); } for (int i = 0; i < u.size(); ++i) st.insert(u[i]); mini2 = *min_element(ALL(u)); } cout << "IMPOSSIBLE" << endl; return 0; }
a.cc:7:9: error: 'll' was not declared in this scope 7 | int gcd(ll a, ll b) { | ^~ a.cc:7:15: error: 'll' was not declared in this scope 7 | int gcd(ll a, ll b) { | ^~ a.cc:7:19: error: expression list treated as compound expression in initializer [-fpermissive] 7 | int gcd(ll a, ll b) { | ^ a.cc: In function 'int main()': a.cc:17:9: error: 'll' was not declared in this scope 17 | ll N, K; cin >> N >> K; | ^~ a.cc:17:25: error: 'N' was not declared in this scope 17 | ll N, K; cin >> N >> K; | ^ a.cc:17:30: error: 'K' was not declared in this scope 17 | ll N, K; cin >> N >> K; | ^ a.cc:43:32: error: 'min_element' was not declared in this scope 43 | int mini = 0, mini2 = *min_element(A.begin(),A.end()); | ^~~~~~~~~~~ a.cc:60:36: error: 'gcd' cannot be used as a function 60 | int g = gcd(mini, *itr); | ~~~^~~~~~~~~~~~ a.cc:64:38: error: 'ALL' was not declared in this scope 64 | mini2 = *min_element(ALL(u)); | ^~~
s165105246
p03651
C++
#include <iostream> #include <vector> #include <set> using namespace std; ll gcd(ll a, ll b) { if (a < b) swap(a, b); while (b != 0) { a = a%b; swap(a, b); } return a; } int main() { ll N, K; cin >> N >> K; vector<int> A(N),v; REP(i, N) cin >> A[i]; set<int> st; for (int i = 0; i < N; ++i) { //最初にあれば終わり if (A[i] == K) { cout << "POSSIBLE" << endl; return 0; } //差分列挙 if (A[i] > K) v.push_back(A[i] - K); //ユニークだけを列挙 st.insert(A[i]); } //最大値がKより小さい場合 if (v.size() == 0) { cout << "IMPOSSIBLE" << endl; return 0; } int mini = 0, mini2 = *min_element(ALL(A)); //最小値が更新される限りループ while (mini2 != mini) { mini = mini2; //割り切れればPOSSIBLE for (int i = 0; i < v.size(); ++i) { if (v[i] % mini == 0) { cout << "POSSIBLE" << endl; return 0; } } vector<int> u; //gcdを作っていく for (auto itr = st.begin(); itr != st.end(); ++itr) { int g = gcd(mini, *itr); u.push_back(g); } for (int i = 0; i < u.size(); ++i) st.insert(u[i]); mini2 = *min_element(ALL(u)); } cout << "IMPOSSIBLE" << endl; return 0; }
a.cc:7:1: error: 'll' does not name a type 7 | ll gcd(ll a, ll b) { | ^~ a.cc: In function 'int main()': a.cc:17:9: error: 'll' was not declared in this scope 17 | ll N, K; cin >> N >> K; | ^~ a.cc:17:25: error: 'N' was not declared in this scope 17 | ll N, K; cin >> N >> K; | ^ a.cc:17:30: error: 'K' was not declared in this scope 17 | ll N, K; cin >> N >> K; | ^ a.cc:18:33: error: 'i' was not declared in this scope 18 | vector<int> A(N),v; REP(i, N) cin >> A[i]; | ^ a.cc:18:29: error: 'REP' was not declared in this scope 18 | vector<int> A(N),v; REP(i, N) cin >> A[i]; | ^~~ a.cc:42:44: error: 'ALL' was not declared in this scope 42 | int mini = 0, mini2 = *min_element(ALL(A)); | ^~~ a.cc:42:32: error: 'min_element' was not declared in this scope 42 | int mini = 0, mini2 = *min_element(ALL(A)); | ^~~~~~~~~~~ a.cc:59:33: error: 'gcd' was not declared in this scope 59 | int g = gcd(mini, *itr); | ^~~
s027031118
p03651
C++
4 11 11 3 7 15
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 4 11 | ^
s736927092
p03651
C++
#include <bits/stdc++.h> using namespace std; #define forx(i, a, b) for (int i = (a); i < (b); i++) #define rep(i, n) for (int i = 0; i < (n); i++) typedef long long ll; int main() { int n,k; cin>>n>>k; vector<int> a(n); rep(i, n) cin >> a[i]; sort(a.begin(), a.end()); reverse(a.begin(), a.end()); int max = a[0]; int g=a[0]; rep(i,n)g=_gcd(g,a[i]); if(max>=k&&(max-k)%g==0) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; return 0; }
a.cc: In function 'int main()': a.cc:19:15: error: '_gcd' was not declared in this scope 19 | rep(i,n)g=_gcd(g,a[i]); | ^~~~
s525982143
p03651
C++
#include <iostream> #include <string> using namespace std; long long gcd(long long a, long long b) { long long r; while ( (r = a % b) != 0) { a = b; b = r; } return b; } int main() { long long N, K; cin >> N >> K; long long A[N]; for (int i = 0; i < N; ++i) cin >> A[i]; if (N==1) { if (K== A[0]) cout << "POSSIBLE" << endl; else cout <<"IMPOSSIBLE" << endl; } else { long long m = *max_element(A, A+N); long long d= gcd(A[0], A[1]); for (int i = 0; i < N; ++i) { d = gcd(d, A[i]); } if ( K <= m && K % d == 0) cout << "POSSIBLE" << endl; else cout <<"IMPOSSIBLE" << endl; } }
a.cc: In function 'int main()': a.cc:30:27: error: 'max_element' was not declared in this scope 30 | long long m = *max_element(A, A+N); | ^~~~~~~~~~~
s838988887
p03651
C++
#include <bits/stdc++.h> using namespace std; #define REP(i,a,b) for(int i=a;i<(int)b;i++) #define rep(i,n) REP(i,0,n) #define all(c) (c).begin(), (c).end() #define zero(a) memset(a, 0, sizeof a) #define minus(a) memset(a, -1, sizeof a) #define watch(a) { cout << #a << " = " << a << endl; } template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); } template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); } template<class T> void operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) cin >> e; } typedef long long ll; int const inf = 1<<29; #define OK { cout << "POSSIBLE\n"; exit(0); } #define NG { cout << "IMPOSSIBLE\n"; exit(0); } int main() { if (time() % 2) OK; else NG; }
a.cc: In function 'int main()': a.cc:22:11: error: too few arguments to function 'time_t time(time_t*)' 22 | if (time() % 2) OK; | ~~~~^~ In file included from /usr/include/pthread.h:23, from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35, from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157, from /usr/include/c++/14/ext/atomicity.h:35, from /usr/include/c++/14/bits/ios_base.h:39, from /usr/include/c++/14/streambuf:43, from /usr/include/c++/14/bits/streambuf_iterator.h:35, from /usr/include/c++/14/iterator:66, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54, from a.cc:1: /usr/include/time.h:76:15: note: declared here 76 | extern time_t time (time_t *__timer) __THROW; | ^~~~ a.cc:23:3: error: 'else' without a previous 'if' 23 | else NG; | ^~~~
s521658534
p03651
C++
#include <bits/stdc++.h> using namespace std; int n, k, a[114514]; int gcd(int n, int m){ return (m==0) ? n : gcd(m, n%m);} int main(void){ cin >> n >> k; int maxi = 0; for(int i=0;i<n;i++){ cin >> a[i]; maxi = max(maxi, a[i]); } bool ans; if (n==1){ ans = (a[0] == k); }else{ int g = gcd(a[0], a[1]); for(int i=2;i<n;i++) g = gcd(g, a[i]); ans = (maxi >= k) && ((maxi - k) % g == 0); } cout << ans ? "POSSIBLE" : "IMPOSSIBLE" << endl; return 0; }
a.cc: In function 'int main()': a.cc:22:43: error: invalid operands of types 'const char [11]' and '<unresolved overloaded function type>' to binary 'operator<<' 22 | cout << ans ? "POSSIBLE" : "IMPOSSIBLE" << endl; | ~~~~~~~~~~~~~^~~~~~~
s010613068
p03651
C++
#include <iostream> #include <string> #include <vector> #define INC(i, a, b) for(int i = a; i < b; ++i) #define DEC(i, a, b) for(int i = a; i > b; --i) #define REP(i, n) INC(i, 0, n) typedef unsigned int uint; typedef unsigned long ul; typedef long long ll; typedef unsigned long long ull; using namespace std; void TFprint(bool b, std::string T, std::string F){ if(b){ std::cout << T << std::endl; }else{ std::cout << F << std::endl; } } uint gcd(uint a, uint b){ if(a < b){ return gcd(b, a); } uint r = a % b; while(r > 0){ a = b; b = r; r = a % b; } return b; } int main(){ int n; uint k; cin >> n; cin >> k; vector<uint> a; bool ans = false; REP(i, n){ int temp; cin >> temp; a.push_back(temp); } sort(a.begin(), a.end(), greater<uint>()); REP(i, n){ INC(j, i + 1, n){ if(k <= a[i] && k % gcd(a[i], a[j]) == 0){ ans = true; break; } } if(ans) break; } TFprint(ans, "POSSIBLE", "IMPOSSIBLE"); return 0; }
a.cc: In function 'int main()': a.cc:48:5: error: 'sort' was not declared in this scope; did you mean 'short'? 48 | sort(a.begin(), a.end(), greater<uint>()); | ^~~~ | short
s875854544
p03651
Java
import java.util.Scanner; public class a018 { public static void main(String[] args) { final Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long k = sc.nextLong(); int max = 0; int g = 0; for (int i = 0; i < n; i++) { int x = sc.nextInt(); g = gcd(g, x); max = Math.max(max, x); } System.out.println(k%g==0 && max >= k ? "POSSIBLE" : "IMPOSSIBLE"); } static int gcd(int a, int b) { return b>0 ? gcd(b, a%b) : a; } }
Main.java:2: error: class a018 is public, should be declared in a file named a018.java public class a018 { ^ 1 error
s099171992
p03651
C++
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> #define p(s) cout<<(s)<<endl #define REP(i,n,N) for(int i=n;i<N;i++) #define RREP(i,n,N) for(int i=N-1;i>=n;i--) #define CK(n,a,b) ((a)<=(n)&&(n)<(b)) #define F first #define S second typedef long long ll; using namespace std; const ll mod = 1e9+7; int N, K; int A[100010]; int main(){ cin>>N>>K; int mx=0; REP(i,0,N){ cin>>A[i]; mx=max(mx,A[i]); } int g=A[0]; REP(i,1,N){ g = __algo_gcd(g,A[i]); } if(K%g==0&&K<=mx){ p("POSSIBLE"); }else{ p("IMPOSSIBLE"); } return 0; }
a.cc: In function 'int main()': a.cc:35:13: error: '__algo_gcd' was not declared in this scope 35 | g = __algo_gcd(g,A[i]); | ^~~~~~~~~~
s989824471
p03651
C++
#include<iostream> #include<string> using namespace std; int gcd(int a, int b) { int c; if (a < b) { a+=b; b=a-b; a-=b; } while (b != 0) { c = a % b; a = b; b = c; } return a; } int main(){ int N, K; int A[1000000008]; cin >> N >> K; int G = 0; for(int i=0; i<N; i++){ int temp; cin >> temp; maxim = max(maxim, temp); G = gcd(temp, G) } string ans; if(maxim >= K && K % G == 0){ans = "POSSIBLE"}; else{ans = "IMPOSSIBLE"}: cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:31:17: error: 'maxim' was not declared in this scope 31 | maxim = max(maxim, temp); | ^~~~~ a.cc:32:33: error: expected ';' before '}' token 32 | G = gcd(temp, G) | ^ | ; 33 | } | ~ a.cc:35:12: error: 'maxim' was not declared in this scope 35 | if(maxim >= K && K % G == 0){ans = "POSSIBLE"}; | ^~~~~ a.cc:35:54: error: expected ';' before '}' token 35 | if(maxim >= K && K % G == 0){ans = "POSSIBLE"}; | ^ | ; a.cc:36:9: error: 'else' without a previous 'if' 36 | else{ans = "IMPOSSIBLE"}: | ^~~~ a.cc:36:32: error: expected ';' before '}' token 36 | else{ans = "IMPOSSIBLE"}: | ^ | ; a.cc:36:33: error: expected primary-expression before ':' token 36 | else{ans = "IMPOSSIBLE"}: | ^
s680550105
p03651
C++
// G++ MACro.cpp -std=c++14 #include <bits/stdc++.h> typedef long long ll; const int INF = 1e9; const int MOD = 1e9+7; const ll LINF = 1e18; using namespace std; #define dump(x) cout << #x << " = " << (x) << endl; #define YES(n) cout << ((n) ? "YES" : "NO" ) << endl #define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl #define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE" ) << endl #define Possible(n) cout << ((n) ? "Possible" : "Impossible" ) << endl #define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) for(int i=0;i<(n);++i) #define REPR(i,n) for(int i=n;i>=0;i--) #define FOREACH(x,a) for(auto& (x) : (a) ) #define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j]) #define SCOUT(x) cout<<(x)<<" " #define ENDL cout<<endl #define VECCIN(x) for(auto&youso_: (x) )cin>>youso_ #define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i] #define VECCOUT(x) for(auto&youso_: (x) )cout<<youso_<<" ";cout<<endl #define ALL(obj) (obj).begin(),(obj).end() #define EXIST(n,x) (find(ALL(n),x)!=n.end()) #define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end()) #define COUT(x) cout<<(x)<<endl void CINT(){} template <class Head,class... Tail> void CINT(Head&& head,Tail&&... tail){ cin>>head; CINT(move(tail)...); } #define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__) #define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__) //#include <boost/multiprecision/cpp_int.hpp> //using namespace boost::multiprecision; // cpp_int #define P pair<int,int> #define V vector<int> #define M map<int,int> #define S set<int> #define L list<int> #define pb(a) push_back(a) #define mp make_pair int gcd(int m,int n){ if(0==n)return m; return gcd(n,m%n); } int main(){ CIN(n,k);V a(n);VECCIN(a); if(n==1){POSSIBLE(k==a[0]);return 0;} if(k>max_element(ALL(a))){POSSIBLE(false);return 0;} int gc=gcd(a[0],a[1]); FOR(i,2,n){ gc=gcd(gc,a[i]); } POSSIBLE(k%gc==0); return 0; }
a.cc: In function 'int main()': a.cc:66:7: error: no match for 'operator>' (operand types are 'int' and '__gnu_cxx::__normal_iterator<int*, std::vector<int> >') 66 | if(k>max_element(ALL(a))){POSSIBLE(false);return 0;} | ~^~~~~~~~~~~~~~~~~~~~ | | | | int __gnu_cxx::__normal_iterator<int*, std::vector<int> > In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:2: /usr/include/c++/14/bits/regex.h:1176:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1176 | operator>(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1176:5: note: template argument deduction/substitution failed: a.cc:66:26: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 66 | if(k>max_element(ALL(a))){POSSIBLE(false);return 0;} | ^ /usr/include/c++/14/bits/regex.h:1236:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator>(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)' 1236 | operator>(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1236:5: note: template argument deduction/substitution failed: a.cc:66:26: note: mismatched types 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' and 'int' 66 | if(k>max_element(ALL(a))){POSSIBLE(false);return 0;} | ^ /usr/include/c++/14/bits/regex.h:1329:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator>(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)' 1329 | operator>(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1329:5: note: template argument deduction/substitution failed: a.cc:66:26: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 66 | if(k>max_element(ALL(a))){POSSIBLE(false);return 0;} | ^ /usr/include/c++/14/bits/regex.h:1403:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1403 | operator>(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1403:5: note: template argument deduction/substitution failed: a.cc:66:26: note: '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 66 | if(k>max_element(ALL(a))){POSSIBLE(false);return 0;} | ^ /usr/include/c++/14/bits/regex.h:1497:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1497 | operator>(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1497:5: note: template argument deduction/substitution failed: a.cc:66:26: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 66 | if(k>max_element(ALL(a))){POSSIBLE(false);return 0;} | ^ /usr/include/c++/14/bits/regex.h:1573:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1573 | operator>(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1573:5: note: template argument deduction/substitution failed: a.cc:66:26: note: '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 66 | if(k>max_element(ALL(a))){POSSIBLE(false);return 0;} | ^ /usr/include/c++/14/bits/regex.h:1673:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1673 | operator>(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1673:5: note: template argument deduction/substitution failed: a.cc:66:26: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 66 | if(k>max_element(ALL(a))){POSSIBLE(false);return 0;} | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/bits/stl_pair.h:1058:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1058 | operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1058:5: note: template argument deduction/substitution failed: a.cc:66:26: note: mismatched types 'const std::pair<_T1, _T2>' and 'int' 66 | if(k>max_element(ALL(a))){POSSIBLE(false);return 0;} | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:462:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 462 | operator>(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:462:5: note: template argument deduction/substitution failed: a.cc:66:26: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int' 66 | if(k>max_element(ALL(a))){POSSIBLE(false);return 0;} | ^ /usr/include/c++/14/bits/stl_iterator.h:507:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 507 | operator>(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:507:5: note: template argument deduction/substitution failed: a.cc:66:26: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int' 66 | if(k>max_element(ALL(a))){POSSIBLE(false);return 0;} | ^ /usr/include/c++/14/bits/stl_iterator.h:1714:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1714 | operator>(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1714:5: note: template argument deduction/substitution failed: a.cc:66:26: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int' 66 | if(k>max_element(ALL(a))){POSSIBLE(false);return 0;} | ^ /usr/include/c++/14/bits/stl_iterator.h:1774:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1774 | operator>(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1774:5: note: template argument deduction/substitution failed: a.cc:66:26: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int' 66 | if(k>max_element(ALL(a))){POSSIBLE(false);return 0;} | ^ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/string_view:695:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 695 | operator> (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:695:5: note: template argument deduction/substitution failed: a.cc:66:26: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int' 66 | if(k>max_element(ALL(a))){POSSIBLE(false);return 0;} | ^ /usr/include/c++/14/string_view:702:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 702 | operator> (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:702:5: note: template argument deduction/substitution failed: a.cc:66:26: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int' 66 | if(k>max_element(ALL(a))){POSSIBLE(false);return 0;} | ^ /usr/include/c++/14/string_view:710:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 710 | operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:710:5: note: template argument deduction/substitution failed: a.cc:66:26: note: '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::basic_string_view<_CharT, _Traits>' 66 | if(k>max_element(ALL(a))){POSSIBLE(false);return 0;} | ^ /usr/include/c++/14/bits/basic_string.h:3915:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3915 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/
s075691182
p03651
C++
// G++ MACro.cpp -std=c++14 #include <bits/stdc++.h> typedef long long ll; const int INF = 1e9; const int MOD = 1e9+7; const ll LINF = 1e18; using namespace std; #define dump(x) cout << #x << " = " << (x) << endl; #define YES(n) cout << ((n) ? "YES" : "NO" ) << endl #define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl #define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE" ) << endl #define Possible(n) cout << ((n) ? "Possible" : "Impossible" ) << endl #define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) for(int i=0;i<(n);++i) #define REPR(i,n) for(int i=n;i>=0;i--) #define FOREACH(x,a) for(auto& (x) : (a) ) #define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j]) #define SCOUT(x) cout<<(x)<<" " #define ENDL cout<<endl #define VECCIN(x) for(auto&youso_: (x) )cin>>youso_ #define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i] #define VECCOUT(x) for(auto&youso_: (x) )cout<<youso_<<" ";cout<<endl #define ALL(obj) (obj).begin(),(obj).end() #define EXIST(n,x) (find(ALL(n),x)!=n.end()) #define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end()) #define COUT(x) cout<<(x)<<endl void CINT(){} template <class Head,class... Tail> void CINT(Head&& head,Tail&&... tail){ cin>>head; CINT(move(tail)...); } #define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__) #define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__) //#include <boost/multiprecision/cpp_int.hpp> //using namespace boost::multiprecision; // cpp_int #define P pair<int,int> #define V vector<int> #define M map<int,int> #define S set<int> #define L list<int> #define pb(a) push_back(a) #define mp make_pair int gcd(int m,int n){ if(0==n)return m; return gcd(n,m%n); } int main(){ CIN(n,k);V a(n);VECCIN(a); if(n==1){POSSIBLE(k==a[0]);return 0;} if(k>=3 7 9 3 4*max_element(ALL(a))){POSSIBLE(false);return 0;} int gc=gcd(a[0],a[1]); FOR(i,2,n){ gc=gcd(gc,a[i]); } POSSIBLE(k%gc==0); return 0; }
a.cc: In function 'int main()': a.cc:66:10: error: expected ')' before numeric constant 66 | if(k>=3 7 | ~ ^~ | )
s078981243
p03651
C++
#include <bits/stdc++.h> using namespace std; #define ll long long int #define rep(i,n) for( int i = 0; i < n; i++ ) #define dump(x) cerr << #x << " = " << (x) << endl; #define INF 2000000000 #define mod 1000000007 #define INF2 1000000000000000000 int gcd(int a, int b) { //dump(a); dump(b); if (b > a) return gcd(b, a); else if (b == 0) return a; else return gcd(b, a % b); } int main(void) { cin.tie(0); ios::sync_with_stdio(false); int N, K; cin >> N >> K; int A[N]; rep(i, N) cin >> A[i]; sort(A, A+N); int G = A[0]; rep(i, N) G = gcd(G, A[i]); //dump(G); if(K >= A[0] && K =< A[N-1] && K % G == 0) { cout << "POSSIBLE" << endl; } else { cout << "IMPOSSIBLE" << endl; } return 0; }
a.cc: In function 'int main()': a.cc:29:24: error: expected primary-expression before '<' token 29 | if(K >= A[0] && K =< A[N-1] && K % G == 0) { | ^
s314727485
p03651
C++
int N,K; int A[100000]; cin>>N>>K; int G,M; cin>>G; M=G; FOR(i,1,N){ int C; cin>>C; G=GCD(max(G,C),min(G,C)); M=max(M,C); } if(K>M||K%G!=0){ cout<<"IMPOSSIBLE"<<endl; }else{ cout<<"POSSIBLE"<<endl; }
a.cc:4:3: error: 'cin' does not name a type 4 | cin>>N>>K; | ^~~ a.cc:6:3: error: 'cin' does not name a type 6 | cin>>G; | ^~~ a.cc:7:3: error: 'M' does not name a type 7 | M=G; | ^ a.cc:8:6: error: expected constructor, destructor, or type conversion before '(' token 8 | FOR(i,1,N){ | ^ a.cc:14:3: error: expected unqualified-id before 'if' 14 | if(K>M||K%G!=0){ | ^~ a.cc:16:4: error: expected unqualified-id before 'else' 16 | }else{ | ^~~~
s133187406
p03651
C++
#include <iostream> #include <algorithm> #include <string> #include <queue> #include <vector> #include <set> #include <bitset> #include <cmath> #define FOR(i,a,b) for(int i=a;i<b;i++) #define ROF(i,a,b) for(int i=b-1;i>=a;i--) #define FI first #define SE second #define MA(i,j) make_pair(i,j) #define PA pair<int,int> #define PB push_back #define PQ priority_queue<int> #define PGQ priority_queue<int,vector<int>,greater<int> > #define VE vector<int> #define VP vector<PA> #define YES(i) cout<<(i?"YES":"NO")<<endl #define Yes(i) cout<<(i?"Yes":"No")<<endl #define MOD 1000000007 #define INF 1000000007 #define PI 3.141592653589793238462643383279 using namespace std; // int main(){ int N,K; int A[100000]; cin>>N>>K; int G,M=-1; int P,C; cin>>P; G=P; FOR(i,1,N){ cin>>C; G=gcd(G,C); M=max(M,C); } if(K>M||K%G!=0){ cout<<"IMPOSSIBLE"<<endl; }else{ cout<<"POSSIBLE"<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:37:7: error: 'gcd' was not declared in this scope 37 | G=gcd(G,C); | ^~~
s046129588
p03651
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringTokenizer; public class harshg_11740370_2{ static class FastReader{ BufferedReader br; StringTokenizer st; public FastReader(){ br = new BufferedReader(new InputStreamReader(System.in)); } String next(){ while (st == null || !st.hasMoreElements()){ try{ st = new StringTokenizer(br.readLine()); } catch (IOException e){ e.printStackTrace(); } } return st.nextToken(); } int nextInt(){ return Integer.parseInt(next()); } long nextLong(){ return Long.parseLong(next()); } double nextDouble(){ return Double.parseDouble(next()); } String nextLine(){ String str = ""; try { str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } return str; } } public static void main(String[] args){ FastReader s=new FastReader(); int t=1; outer: while(t--!=0){ int n=s.nextInt(); int k=s.nextInt(); int arr[]=new int[n]; int nice=0; // System.out.println(gcd(2,4)); arr[0]=s.nextInt(); int max=arr[0]; for(int i=1;i<n;i++){ arr[i]=s.nextInt(); if(arr[i]>max) max=arr[i]; } if(k>max||k<1){ System.out.println("IMPOSSIBLE"); continue; } if(n==1){ if(k%arr[0]==0){ System.out.println("POSSIBLE"); continue; } else{ System.out.println("IMPOSSIBLE"); continue; } } int l=arr[0]; for(int i=0;i<n-1;i++){ nice=l<arr[i+1]?gcd(l,arr[i+1]):gcd(arr[i+1],l); l=nice; if(nice==1){ System.out.println("POSSIBLE"); continue outer; } } // System.out.println(nice); // System.out.println(max); if(k%nice==0){ System.out.println("POSSIBLE"); } else{ System.out.println("IMPOSSIBLE"); } } } static int gcd(int a,int b){ if(b%a==0){ return a; } else{ return gcd(b%a,a); } } }
Main.java:6: error: class harshg_11740370_2 is public, should be declared in a file named harshg_11740370_2.java public class harshg_11740370_2{ ^ 1 error