submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s003621873
p03807
Java
package test; import java.util.Scanner; public class main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); sc.nextLine(); int[] a = new int[n]; int oddOfSum = 0; for (int i=0;i<n;i++){ a[i] = sc.nextInt(); if (a[i]%2==1){ oddOfSum++; } } if (oddOfSum%2==1){ System.out.println("NO"); } else{ System.out.println("YES"); } } }
Main.java:5: error: class main is public, should be declared in a file named main.java public class main { ^ 1 error
s142134937
p03807
C++
import java.util.Scanner; /** * Created by wenjian on 2017/2/4. */ public class Main{ public static void main(String[] args) { Scanner reader = new Scanner(System.in); int n = reader.nextInt(); int[] a = new int[n]; for (int i=0; i<a.length; ++i) a[i] = reader.nextInt(); int sum = 0; for (int i=0; i<a.length; ++i) { if (a[i] % 2 == 1) ++sum; } if (sum % 2 == 0) System.out.println("YES"); else System.out.println("NO"); } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.Scanner; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:6:1: error: expected unqualified-id before 'public' 6 | public class Main{ | ^~~~~~
s619674216
p03807
Java
public class Main { public static void main(String[] args) { try (Scanner in = new Scanner(System.in)) { solve(in); } } private static void solve(Scanner in) { int N = in.nextInt(); final int[] A = new int[N];// 2 <= N for (int i = 0; i < N; i++) { A[i] = in.nextInt() % 2; } String ans = "YES"; int count = 0; for (int a : A) { count += a; } if (count % 2 == 1) { ans = "NO"; } System.out.println(ans); } }
Main.java:8: error: cannot find symbol private static void solve(Scanner in) { ^ symbol: class Scanner location: class Main Main.java:3: error: cannot find symbol try (Scanner in = new Scanner(System.in)) { ^ symbol: class Scanner location: class Main Main.java:3: error: cannot find symbol try (Scanner in = new Scanner(System.in)) { ^ symbol: class Scanner location: class Main 3 errors
s763380418
p03807
C++
#include<iostream> using namespace std; int main(){ int n; int count=0; int temp; cin >> n; for(i=0;i<n;i++){ cin >> temp; if(temp%2==1){ count++;} } if(count%2==1) cout << "NO"; else cout <<"YES"; return 0; }
a.cc: In function 'int main()': a.cc:8:7: error: 'i' was not declared in this scope 8 | for(i=0;i<n;i++){ | ^
s354658962
p03807
C++
#include <iostream> #include <time.h> #include <vector> #include <stdio.h> #include <memory.h> #include <string> #include <map> #include <algorithm> #include <bitset> #include <queue> #include <set> #include <time.h> #include <assert.h> #include <sstream> //#include <unordered_map> #include <bitset> #include <utility> #include <iomanip> #include <climits> #include <cstdio> #include <cstdlib> #include <ctime> #include <cmath> #include <math.h> #include <string.h> #include <string> #include <complex> #include <valarray> #if !ONLINE_JUDGE #include "inc.h" #endif using namespace std; typedef long long ll; int main() { #if !ONLINE_JUDGE freopen("a.txt", "r", stdin); //freopen("b.txt", "w", stdout); decTime; #endif int n; scanf("%d",&n); int cnt=0; for(int i=0;i<n;++i){ int x; scanf("%d",&x); cnt+=x&1; } puts((cnt&1)?"NO":"YES"); #if !ONLINE_JUDGE printTime; #endif return 0; }
a.cc:30:10: fatal error: inc.h: No such file or directory 30 | #include "inc.h" | ^~~~~~~ compilation terminated.
s520698822
p03807
C++
#include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <vector> #include <string> #include <algorithm> #include <stack> #include <queue> #include <set> #include <map> using namespace std; typedef __int64 LL; typedef vector<int> ivec; typedef vector<string> svec; int n; int a[100010]; int ans=0; int main(){ cin>>n; for(int i=0;i<n;i++){ cin>>a[i]; if(a[i]%2==1)ans++; } puts(ans%2==0 ? "YES" : "NO"); return 0; }
a.cc:13:9: error: '__int64' does not name a type; did you mean '__int64_t'? 13 | typedef __int64 LL; | ^~~~~~~ | __int64_t
s353427337
p03807
C++
#include <bits/stdc++.h> #define x first #define y second using namespace std; typedef long long ll; typedef long double ld; typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int,int> ii; typedef pair<ll,ll> pll; const int mod=1000000000+7; int addm(int& a,int b) {return (a+=b)<mod?a:a-=mod;} template<class T,class U> bool smin(T& a,U b) {return a>b?(a=b,1):0;} template<class T,class U> bool smax(T& a,U b) {return a<b?(a=b,1):0;} int a[100000]; int ct[2]; int main() { ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; for (int i=0;i<n;i++) { cin >> a[i]; ct[a[i]%2]++; } if (n==1 || ct[1]%2==0) cout << "YES\n"; else cout << "NO\n" }
a.cc: In function 'int main()': a.cc:36:28: error: expected ';' before '}' token 36 | else cout << "NO\n" | ^ | ; 37 | } | ~
s363372188
p03807
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; int c = 0; for (int i = 0; i < N; ++ i) { int x; cin >> x; if (x % 2) ++ c; } cout << (c % 2 == 0 ? "YES" : "NO") << endl; } #include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; int c = 0; for (int i = 0; i < N; ++ i) { int x; cin >> x; if (x % 2) ++ c; } cout << (c % 2 == 0 ? "YES" : "NO") << endl; }
a.cc:16:5: error: redefinition of 'int main()' 16 | int main() { | ^~~~ a.cc:3:5: note: 'int main()' previously defined here 3 | int main() { | ^~~~
s079699405
p03807
C++
n = input() a = sum(map(int, raw_input().split())) & 1 print 'YES' if a == 1 else 'NO'
a.cc:3:7: warning: multi-character character constant [-Wmultichar] 3 | print 'YES' if a == 1 else 'NO' | ^~~~~ a.cc:3:28: warning: multi-character character constant [-Wmultichar] 3 | print 'YES' if a == 1 else 'NO' | ^~~~ a.cc:1:1: error: 'n' does not name a type 1 | n = input() | ^
s734057491
p03807
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; int c = 0; for (int i = 0; i < N; ++ i) { int x; cin >> x; if (x % 2) ++ c; } cout << (c % 2 == 0 ? "YES" : "NO") << endl; } #include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; int c = 0; for (int i = 0; i < N; ++ i) { int x; cin >> x; if (x % 2) ++ c; } cout << (c % 2 == 0 ? "YES" : "NO") << endl; }
a.cc:16:5: error: redefinition of 'int main()' 16 | int main() { | ^~~~ a.cc:3:5: note: 'int main()' previously defined here 3 | int main() { | ^~~~
s174527267
p03808
C++
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; vector<long long> a(n); long long sum=0; for ( int i=0; i<n; i++ ) { cin >> a[i]; sum+=a[i]; } long long m=(long long)n*(n+1)/2; if ( m%n ){ cout << "NO" << '\n'; return 0; } m = sum/m; a.push_back(a[0]); // (k-d)/n = x sum = 0; for ( int i=0; i<n; i++ ) { // cout << a[i+1] << ' ' << a[i] << '\n'; long long d=(a[i+1] - a[i]); if ( m<d || (m-d)%n ){ cout << "NO" << '\n'; return 0; } } else cout << "YES" << '\n'; return 0; }
a.cc: In function 'int main()': a.cc:30:5: error: 'else' without a previous 'if' 30 | else cout << "YES" << '\n'; | ^~~~
s272083855
p03808
C++
#include<bits/stdc++.h> using namespace std; #pragma region Macros #define ll long long #define ld long double #define FOR(i,l,r) for(ll i=(l);i<(r);++i) #define REP(i,n) FOR(i,0,n) #define REPS(i,n) FOR(i,1,n+1) #define RFOR(i,l,r) for(ll i=(l);i>=(r);--i) #define RREP(i,n) RFOR(i,n-1,0) #define RREPS(i,n) RFOR(i,n,1) #define pb push_back #define eb emplace_back #define SZ(x) ((ll)(x).size()) #define all(x) (x).begin(),(x).end() #define rall(x) (x).rbegin(),(x).rend() template<class T = ll> using V = vector<T>; template<class T = ll> using VV = V<V<T>>; using P = pair<ll, ll>; #define VEC(type, name, size)\ V<type> name(size);\ IN(name) #define VVEC(type, name, h, w)\ VV<type> name(h, V<type>(w));\ IN(name) #define INT(...)\ int __VA_ARGS__;\ IN(__VA_ARGS__) #define LL(...)\ ll __VA_ARGS__;\ IN(__VA_ARGS__) #define STR(...)\ string __VA_ARGS__;\ IN(__VA_ARGS__) #define CHAR(...)\ char __VA_ARGS__;\ IN(__VA_ARGS__) #define DOUBLE(...)\ DOUBLE __VA_ARGS__;\ IN(__VA_ARGS__) #define LD(...)\ LD __VA_ARGS__;\ IN(__VA_ARGS__) template <class T> void scan(T a) { cin >> a; } void scan(int &a) { cin >> a; } void scan(long long &a) { cin >> a; } void scan(char &a) { cin >> a; } void scan(double &a) { cin >> a; } void scan(long double &a) { cin >> a; } void scan(char a[]) { scanf("%s", a); } void scan(string &a) { cin >> a; } template <class T> void scan(V<T> &); template <class T, class L> void scan(pair<T, L> &); template <class T> void scan(V<T> &a) { for(auto &i : a) scan(i); } template <class T, class L> void scan(pair<T, L> &p){ scan(p.first); scan(p.second); } template <class T> void scan(T &a) { cin >> a; } void IN() {} template <class Head, class... Tail> void IN(Head &head, Tail &... tail) { scan(head); IN(tail...); } template <class T> inline void print(T x){ cout << x << '\n';} struct inputoutputfaster{ inputoutputfaster(){ ios::sync_with_stdio(false);\ cin.tie(nullptr); cout << fixed << setprecision(15); } }inputoutputfaster_; template <class T> V<T> press(V<T> &x){ V<T> res = x; sort(all(res)); res.erase(unique(all(res)), res.end()); REP(i, SZ(x)){ x[i] = lower_bound(all(res), x[i]) - res.begin(); } return res; } 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; } inline void Yes(bool b = true) {cout << (b ? "Yes" : "No") << '\n';} inline void YES(bool b = true) {cout << (b ? "YES" : "NO") << '\n';} inline void err(bool b = true) {if(b) {cout << -1 << '\n'; exit(0);}} template<class T> inline void fin(bool b = true, T e = 0) {if(b) {cout << e << '\n'; exit(0);}} template<class T> T divup(T x, T y) {return (x+(y-1))/y;} template <typename T> T pow(T a, long long n, T e = 1) {T ret = e; while (n) {if (n & 1) ret *= a; a *= a; n >>= 1; } return ret; } const ll INF = 1e18; #pragma endregion ll s; int main(){ LL(n); VEC(ll, a, n); REP(i, n) s += a[i]; fin(s % ((n + 1) * n / 2), "NO"); s /= ((n + 1) * n / 2); a.pb(a[0]); REP(i, n) fin((s + a[i] - a[i + 1]) % n or ((s + a[i] - a[i + 1]) / n < 0, "NO"); print("YES"); }
a.cc: In function 'int main()': a.cc:95:85: error: expected ')' before ';' token 95 | REP(i, n) fin((s + a[i] - a[i + 1]) % n or ((s + a[i] - a[i + 1]) / n < 0, "NO"); | ~ ^ | )
s746016715
p03808
C++
#include <iostream> #define ll long long using namespace std; int main(){ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); int check=0; ll n, sum = 0, k=0; int stones[100005], diff[100005]; cin >> n; for(int i=1; i<=n; i++){ cin >> stones[i]; sum+=stones[i]; } for(int i=1; i<=n; i++){ if(i==n){ diff[n]=(stones[1]-stones[n]); } else{ diff[i]=(stones[i+1]-stones[i]); } } if(sum%(n*(n+1)/2)!=0){ cout << "NO" << endl; } else{ k=sum/(n*(n+1)/2); for(int i=1; i<=n; i++){ ll x = (diff[i]+(k*(n-1))); if(x>=0 && x%n==0 && (k-x>==0) && (k-x%n==0)){ check++; } } if(check==n){ cout << "YES" << endl; } else{ cout << "NO" << endl; } } return 0; }
a.cc: In function 'int main()': a.cc:30:40: error: expected primary-expression before '=' token 30 | if(x>=0 && x%n==0 && (k-x>==0) && (k-x%n==0)){ | ^
s293688881
p03808
C++
/** ____ ____ ____ ____ ____ ||a |||t |||o |||d |||o || ||__|||__|||__|||__|||__|| |/__\|/__\|/__\|/__\|/__\| **/ #include <bits/stdc++.h> using namespace std; typedef long long ll; const int N_MAX = 100002; int n; int a[N_MAX]; ll sum; ll k; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n; for(int i = 1; i <= n; i++) cin >> a[i]; for(int i = 1; i <= n; i++) sum += a[i]; k = sum / (1LL * n * (n + 1) / 2); for(int i = 1; i <= n; i++) { int j = i - 1; if(j == 0) j = n; int diff = a[i] - a[j]; if((k - diff) % n != 0) { cout << "NO\n"; return 0; } } cout << "YES\n"; return 0; } /** ____ ____ ____ ____ ____ ||a |||t |||o |||d |||o || ||__|||__|||__|||__|||__|| |/__\|/__\|/__\|/__\|/__\| **/ #include <bits/stdc++.h> using namespace std; typedef long long ll; const int N_MAX = 100002; int n; int a[N_MAX]; ll sum; ll k; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n; for(int i = 1; i <= n; i++) cin >> a[i]; for(int i = 1; i <= n; i++) sum += a[i]; k = sum / (1LL * n * (n + 1) / 2); for(int i = 1; i <= n; i++) { int j = i - 1; if(j == 0) j = n; int diff = a[i] - a[j]; if((k - diff) % n != 0) { cout << "NO\n"; return 0; } } cout << "YES\n"; return 0; }
a.cc:65:11: error: redefinition of 'const int N_MAX' 65 | const int N_MAX = 100002; | ^~~~~ a.cc:15:11: note: 'const int N_MAX' previously defined here 15 | const int N_MAX = 100002; | ^~~~~ a.cc:67:5: error: redefinition of 'int n' 67 | int n; | ^ a.cc:17:5: note: 'int n' previously declared here 17 | int n; | ^ a.cc:69:5: error: redefinition of 'int a [100002]' 69 | int a[N_MAX]; | ^ a.cc:19:5: note: 'int a [100002]' previously declared here 19 | int a[N_MAX]; | ^ a.cc:71:4: error: redefinition of 'll sum' 71 | ll sum; | ^~~ a.cc:21:4: note: 'll sum' previously declared here 21 | ll sum; | ^~~ a.cc:73:4: error: redefinition of 'll k' 73 | ll k; | ^ a.cc:23:4: note: 'll k' previously declared here 23 | ll k; | ^ a.cc:75:5: error: redefinition of 'int main()' 75 | int main() | ^~~~ a.cc:25:5: note: 'int main()' previously defined here 25 | int main() | ^~~~
s404787040
p03808
C++
#include <bits/stdc++.h> using namespace std; #define FOR(i,o,n) for(long long i = o;i<n;i++) #define oneforall ios::sync_with_stdio(false);cin.tie(0); #define all(v) (v).begin(),(v).end() #define ini(...) int __VA_ARGS__; in(__VA_ARGS__) #define inl(...) long long __VA_ARGS__; in(__VA_ARGS__) #define ins(...) string __VA_ARGS__; in(__VA_ARGS__) #define int long long const long long inf=1e18; void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);} void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);} typedef vector<int> vi; typedef vector<long long> vl; typedef long long ll; typedef vector<pair<long, long > > vpll; typedef vector<pair<int, int > > vpii; #define FORR(x,arr) for(auto& x:arr) #define ZERO(a) memset(a,0,sizeof(a)) //3111111111111111111111111111111 void solve(){ ini(n); int morty[n]; int tmp = 0; FOR(i,0,n){ in(morty[i]); tmp+=morty[i]; } if(tmp%((n*(n+1))/2))return out("NO"); tmp = tmp/((n*(n+1))/2); FOR(i,0,n){ int tmp1 = morty[(i+1)%n]-morty[i]; tmp1*=-1;tmp1+=tmp; if(tmp1<0 or tmp1%n)return out("NO"); } out("YES); } int32_t main() { oneforall oneforall oneforall oneforall oneforall oneforall oneforall oneforall oneforall oneforall oneforall oneforall oneforall oneforall solve(); return 0; }
a.cc:47:21: warning: missing terminating " character 47 | out("YES); | ^ a.cc:47:21: error: missing terminating " character 47 | out("YES); | ^~~~~~ a.cc: In function 'void solve()': a.cc:51:9: error: expected primary-expression before '}' token 51 | } | ^
s909038135
p03808
C++
#include <bits/stdc++.h> using namespace std; #define FOR(i,o,n) for(long long i = o;i<n;i++) #define oneforall ios::sync_with_stdio(false);cin.tie(0); #define all(v) (v).begin(),(v).end() #define ini(...) int __VA_ARGS__; in(__VA_ARGS__) #define inl(...) long long __VA_ARGS__; in(__VA_ARGS__) #define ins(...) string __VA_ARGS__; in(__VA_ARGS__) #define int long long const long long inf=1e18; void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);} void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);} typedef vector<int> vi; typedef vector<long long> vl; typedef long long ll; typedef vector<pair<long, long > > vpll; typedef vector<pair<int, int > > vpii; #define FORR(x,arr) for(auto& x:arr) #define ZERO(a) memset(a,0,sizeof(a)) //3111111111111111111111111111111 void solve(){ ini(n); int morty[n]; int tmp = 0; FOR(i,0,n){ in(morty[i]); tmp+=morty[i]; } if(tmp%((n*(n+1))/2))return out("No"); tmp = tmp%((n*(n+1))/2); FOR(i,0,n){ int tmp1 = morty[(i+1)%n]-morty[i]; tmp1*=-1;tmp1+=tmp; if(tmp1<0 or tmp1%n)retrun out("No"); } out("Yes"); } int32_t main() { oneforall oneforall oneforall oneforall oneforall oneforall oneforall oneforall oneforall oneforall oneforall oneforall oneforall oneforall solve(); return 0; }
a.cc: In function 'void solve()': a.cc:45:45: error: 'retrun' was not declared in this scope 45 | if(tmp1<0 or tmp1%n)retrun out("No"); | ^~~~~~
s395255862
p03808
C++
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(ll i=0; i<n; i++) #define eb(t) emplace_back(t) typedef long long ll; typedef long long unsigned int llu; ll INF = 1000000009; ll MOD = 1000000007; ll a[100010]; ll d[100010]; void solve(){ ll n; cin >> n; ll sum=0; rep(i,n){ cin >> a[i]; sum+=a[i]; } a[n]=a[0]; ll tmp = n*(n+1)/2; ll k = sum/(tmp); rep(i,n){ d[i]=a[i+1]-a[i]-k; } bool b = true; rep(i,n){ if(abs(d[i])%n!=0) b=false; } cout << b?"YES":"NO" << endl; } int main(){ cin.tie(0); ios::sync_with_stdio(false); solve(); return 0; }
a.cc: In function 'void solve()': a.cc:34:26: error: invalid operands of types 'const char [3]' and '<unresolved overloaded function type>' to binary 'operator<<' 34 | cout << b?"YES":"NO" << endl; | ~~~~~^~~~~~~
s594082801
p03808
C++
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<math.h> #include<algorithm> #include<queue> #include<set> #include<map> #include<iostream> using namespace std; #define ll long long #define REP(a,b,c) for(int a=b;a<=c;a++) #define re register #define file(a) freopen(a".in","r",stdin);freopen(a".out","w",stdout) typedef pair<int,int> pii; #define mp make_pair #define int ll inline int gi() { int f=1,sum=0;char ch=getchar(); while(ch>'9' || ch<'0'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0' && ch<='9'){sum=(sum<<3)+(sum<<1)+ch-'0';ch=getchar();} return f*sum; } const int N=200010; int n,a[N]; ll sum,x[N]; int nxt(int id){return id%n+1;} int main() { n=gi();ll get=1ll*n*(n+1)/2; for(int i=1;i<=n;i++)a[i]=gi(),sum+=a[i]; if(sum%get)return puts("NO"),0; ll t=sum/get,s=0; for(int i=1;i<=n;i++) { ll del=a[i]-a[nxt(i)]+t; if(del%n)return puts("NO"),0; x[i]=del/n; } for(int i=1;i<=n;i++)s+=x[i]; puts(s==t?"YES":"NO"); return 0; }
cc1plus: error: '::main' must return 'int'
s702620504
p03808
C++
#include <bits/stdc++.h> typedef long long int ll; using namespace std; int main() { ll N; cin >> N; vector<ll> A(N), D(N); ll t = 0; for (int i = 0; i < N; i++) { cin >> A.at(i); t += A.at(i); } ll u = N * (N+1) / 2; if (t % u != 0) { return cout << "NO" << '\n', 0; ll m = t / u; for (int i = 0; i < N-1; i++) D.at(i) = A.at(i + 1) - A.at(i); D.at(N-1) = A.at(0) - A.at(N-1); for (int i = 0; i < N; i++) { ll y = m - D.at(i); if (y < 0 || y % N != 0) return cout << "NO" << '\n', 0; } cout << "YES" << '\n'; return 0; }
a.cc: In function 'int main()': a.cc:34:2: error: expected '}' at end of input 34 | } | ^ a.cc:5:12: note: to match this '{' 5 | int main() { | ^
s392342640
p03808
C++
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i = 0; i < (n); i++) #define ALL(v) (v).begin(),(v).end() using ll = long long; using P = pair<int, int>; const int INF = 1e9; const long long LINF = 1e18; const long long MOD = 1e9 + 7; signed main(){ ll n; cin >> n; ll sum = 0; ll a[n]; rep(i,n){ cin >> a[i]; sum += a[i]; } if(sum % (n * (n + 1) / 2) != 0){ cout << "NO" << endl; return 0; } ll d[n]; ll k = sum / (n * (n + 1) / 2); for(int i = 0; i < n; i++){ d[i] = a[(i + 1) % n] - a[i] - k; } sum = 0; for(int i = 0; i < n; i++){ if(d[i] % n != 0 || d[i] > 0){ cout << "NO" << endl; return 0; } sum -= d[i] } cout << (sum / n == k ? "YES" : "NO") << endl; return 0; }
a.cc: In function 'int main()': a.cc:35:20: error: expected ';' before '}' token 35 | sum -= d[i] | ^ | ; 36 | } | ~
s260003173
p03808
C++
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i = 0; i < (n); i++) #define ALL(v) (v).begin(),(v).end() using ll = long long; using P = pair<int, int>; const int INF = 1e9; const long long LINF = 1e18; const long long MOD = 1e9 + 7; signed main(){ ll n; cin >> n; ll sum = 0; ll a[n]; rep(i,n){ cin >> a[i]; sum += a[i]; } if(sum % (n * (n + 1) / 2) != 0){ cout << "NO" << endl; return 0; } ll k = sum / (n * (n + 1) / 2); rep(i,n){ ll t = a[(i + 1) % n] - a[i]; if((t + n * (ll)INF) % n != k || t < k * (1 - n) || k < t){ cout << "NO" << endl; return 0; } } cout << "YES" << endl; return 0;
a.cc: In function 'int main()': a.cc:33:14: error: expected '}' at end of input 33 | return 0; | ^ a.cc:11:14: note: to match this '{' 11 | signed main(){ | ^
s881707600
p03808
C++
#include <bits/stdc++.h> #define ALL(A) (A).begin(), (A).end() #define ll long long #define rep(i, n) for (int i = 0; i < (n); i++) const ll mod = 1e9 + 7; const ll INF = -1 * ((1LL << 63) + 1); const int inf = -1 * ((1 << 31) + 1); using namespace std; int main(void){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); ll N; cin >> N; vector<ll> A(N),D(N); ll sum = 0; rep(i,N){ cin >> A[i]; sum += A[i]; } ll b = (N+1)*N/2; if(sum % b != 0 ){ cout << "NO" << endl; return 0; } ll k = sum / b; rep(i,N){ D[i] = A[(i+1)%N] - A[i] - k; } ll cnt = 0; rep(i,N){ if(D[i]% N!=0){ cout << "NO" << endl; return 0; }else cnt += -D[i])/N; } if(cnt==k)cout << "YES" << endl; else cout << "NO" << endl; }
a.cc: In function 'int main()': a.cc:38:27: error: expected ';' before ')' token 38 | }else cnt += -D[i])/N; | ^ | ;
s728048736
p03808
C
#pragma GCC optimize ("O3") #pragma GCC target ("avx") //#include<bits/stdc++.h> #include<cstdio> #include<algorithm> using namespace std; typedef long long ll; #define rep(i, n) for(int i = 0; i < (n); i++) #define rep1(i, n) for(int i = 1; i <= (n); i++) #define co(x) cout << (x) << "\n" #define cosp(x) cout << (x) << " " #define ce(x) cerr << (x) << "\n" #define cesp(x) cerr << (x) << " " #define pb push_back #define mp make_pair #define chmin(x, y) x = min(x, y) #define chmax(x, y) x = max(x, y) #define Would #define you #define please const int cm = 1 << 17; char cn[cm], * ci = cn + cm, ct; inline char getcha() { if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; } return *ci++; } inline int getint() { int A = 0; if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0'; else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0'; return A; } int main() { //cin.tie(0); //ios::sync_with_stdio(false); int N = getint(); if (N == 1) { printf("YES\n"); return 0; } int A[100000]; int saisho = getint(); ll goukei = saisho; int mae = saisho; rep(i, N - 1) { int tugi = getint(); A[i] = tugi - mae; goukei += tugi; mae = tugi; } A[N - 1] = saisho - mae; ll n = ll(N) * (N + 1) / 2; if (goukei % n) { printf("NO\n"); return 0; } int k = goukei / n; rep(i, N) { int tmp = A[i] - k; if (tmp > 0) { printf("NO\n"); return 0; } int watta = tmp / N; if (watta * N != tmp) { printf("NO\n"); return 0; } } printf("YES\n"); Would you please return 0; }
main.c:4:9: fatal error: cstdio: No such file or directory 4 | #include<cstdio> | ^~~~~~~~ compilation terminated.
s213597156
p03808
C++
#include<bits/stdc++.h> using namespace std; #define RI register int int read() { int q=0;char ch=' '; while(ch<'0'||ch>'9') ch=getchar(); while(ch>='0'&&ch<='9') q=q*10+ch-'0',ch=getchar(); return q; } typedef long long LL; const int N=100005; LL sum,nowadd,nows,a[N],orz[N],m;int n; int work() { int js=0; for(RI i=0;i<n;++i) { int b=a[i]-a[(i-1+n)%n]; if((m-b)%n||m-b<0) return 0; orz[i]=(m-b)/n,js+=orz[i]; } if(js!=m) return 0; for(RI i=0;i<n;++i) { nows+=orz[i],nowadd+=nows; if(a[i]<nowadd) return 0; a[i]-=nowadd; } for(RI i=0;i<n;++i) { nows-=orz[i],nowadd-=1LL*n*orz[i],nowadd+=nows; if(a[i]!=nowadd) return 0; } return 1; } int main() n=read(); for(RI i=0;i<n;++i) a[i]=read(),sum+=a[i]; if(sum%(1LL*(n+1)*n/2)) {puts("NO");return 0;} m=sum/(1LL*(n+1)*n/2); if(work()) puts("YES"); else puts("NO"); return 0; }
a.cc: In function 'int work()': a.cc:15:12: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 15 | for(RI i=0;i<n;++i) { | ^ a.cc:21:12: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 21 | for(RI i=0;i<n;++i) { | ^ a.cc:26:12: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 26 | for(RI i=0;i<n;++i) { | ^ a.cc: At global scope: a.cc:33:5: error: expected initializer before 'n' 33 | n=read(); | ^ a.cc:34:5: error: expected unqualified-id before 'for' 34 | for(RI i=0;i<n;++i) a[i]=read(),sum+=a[i]; | ^~~ a.cc:34:16: error: 'i' does not name a type 34 | for(RI i=0;i<n;++i) a[i]=read(),sum+=a[i]; | ^ a.cc:34:20: error: expected unqualified-id before '++' token 34 | for(RI i=0;i<n;++i) a[i]=read(),sum+=a[i]; | ^~ a.cc:35:5: error: expected unqualified-id before 'if' 35 | if(sum%(1LL*(n+1)*n/2)) {puts("NO");return 0;} | ^~ a.cc:36:5: error: 'm' does not name a type; did you mean 'tm'? 36 | m=sum/(1LL*(n+1)*n/2); | ^ | tm a.cc:37:5: error: expected unqualified-id before 'if' 37 | if(work()) puts("YES"); | ^~ a.cc:38:5: error: expected unqualified-id before 'else' 38 | else puts("NO"); | ^~~~ a.cc:39:5: error: expected unqualified-id before 'return' 39 | return 0; | ^~~~~~ a.cc:40:1: error: expected declaration before '}' token 40 | } | ^
s119670564
p03808
C++
#include<bits/stdc++.h> using namespace std; #define RI register int int read() { int q=0;char ch=' '; while(ch<'0'||ch>'9') ch=getchar(); while(ch>='0'&&ch<='9') q=q*10+ch-'0',ch=getchar(); return q; } typedef long long LL; const int N=100005; LL sum,nowadd,nows,a[N],orz[N],m;int n; int work() { int js=0; for(RI i=0;i<n;++i) { int b=a[i]-a[(i-1+n)%n]; if((m-b)%n||m-b<0) return 0; orz[i]=(m-b)/n,js+=orz[i]; } if(js!=m) return 0; for(RI i=0;i<n;++i) { nows+=orz[i],nowadd+=nows; if(a[i]<nowadd) return 0; a[i]-=nowadd; } for(RI i=0;i<n;++i) { nows-=orz[i],nowadd-=1LL*n*orz[i],nowadd+=nows; if(a[i]!=nowadd) return 0; } return 1; } int main() // n=read(); for(RI i=0;i<n;++i) a[i]=read(),sum+=a[i]; if(sum%(1LL*(n+1)*n/2)) {puts("NO");return 0;} m=sum/(1LL*(n+1)*n/2); if(work()) puts("YES"); else puts("NO"); return 0; }
a.cc: In function 'int work()': a.cc:15:12: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 15 | for(RI i=0;i<n;++i) { | ^ a.cc:21:12: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 21 | for(RI i=0;i<n;++i) { | ^ a.cc:26:12: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 26 | for(RI i=0;i<n;++i) { | ^ a.cc: At global scope: a.cc:34:5: error: expected initializer before 'n' 34 | n=read(); | ^ a.cc:35:5: error: expected unqualified-id before 'for' 35 | for(RI i=0;i<n;++i) a[i]=read(),sum+=a[i]; | ^~~ a.cc:35:16: error: 'i' does not name a type 35 | for(RI i=0;i<n;++i) a[i]=read(),sum+=a[i]; | ^ a.cc:35:20: error: expected unqualified-id before '++' token 35 | for(RI i=0;i<n;++i) a[i]=read(),sum+=a[i]; | ^~ a.cc:36:5: error: expected unqualified-id before 'if' 36 | if(sum%(1LL*(n+1)*n/2)) {puts("NO");return 0;} | ^~ a.cc:37:5: error: 'm' does not name a type; did you mean 'tm'? 37 | m=sum/(1LL*(n+1)*n/2); | ^ | tm a.cc:38:5: error: expected unqualified-id before 'if' 38 | if(work()) puts("YES"); | ^~ a.cc:39:5: error: expected unqualified-id before 'else' 39 | else puts("NO"); | ^~~~ a.cc:40:5: error: expected unqualified-id before 'return' 40 | return 0; | ^~~~~~ a.cc:41:1: error: expected declaration before '}' token 41 | } | ^
s856250094
p03808
C++
#include <stdio.h> #include <string> #include <cstring> #include <stdlib.h> #include <math.h> #include <algorithm> #include <vector> #include <set> #include <map> #include <queue> #include <stack> #include <list> #include <iterator> #include <assert.h> #include <time.h> #pragma warning(disable:4996) typedef long long ll; #define MIN(a, b) ((a)>(b)? (b): (a)) #define MAX(a, b) ((a)<(b)? (b): (a)) #define LINF 9223300000000000000 #define INF 2140000000 const long long MOD = 1000000007; //const long long MOD = 998244353; using namespace std; int main(int argc, char* argv[]) { int n; scanf("%d", &n); vector<ll> a(n); long i; ll max=-LINF; for(i=0; i<n; i++) { scanf("%lld", &a[i]); if(i>0) { max=MAX(max,a[i]-a[i-1]); } } for(i=0; i<n; i++) { a[i]-=(i+1)*max; } ll cnt0=max; ll cnt1=0; ll cnt2=0; for(i=1; i<n; i++) { ll tmp=a[i-1]-a[i]; assert(tmp>=0); if(tmp%n) { printf("NO\n"); return 0; } cnt1+=(tmp/n); cnt2+=(n-i)*(tmp/n); } if(cnt1>cnt0) { printf("NO\n"); return 0; } ll tmp=a[0]-cnt2; ll mm=(ll)n*(n+1)/2; if(tmp>=0 && tmp%m==0) { printf("YES\n"); } else { printf("NO\n"); } return 0; }
a.cc: In function 'int main(int, char**)': a.cc:63:22: error: 'm' was not declared in this scope; did you mean 'mm'? 63 | if(tmp>=0 && tmp%m==0) { | ^ | mm
s813710388
p03808
C++
#include <bits/stdc++.h> #define SORT(x) sort((x).begin(), (x).end()) #define ALL(x) (x).begin(), (x).end() #define rep(i, n) for (ll i = 0; i < n; i++) #define reps(i, m, n) for (ll i = m; i < n; i++) #define repr(i, m, n) for (ll i = m; i >= n; i--) #define de(x) cout << #x << "=" << x << endl; template <class T> bool maxi(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool mini(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; } #define INF2 1000000000000000037 #define INF 1000000007 #define MOD 1000000007 #define PI (acos(-1)) using namespace std; using ll = long long; using ld = long double; using P = pair<ll,ll>; //--GLOBAL--------------------------------- //--MAIN----------------------------------- void Main() { ll N, sum=0, itido=0; cin>>N; vector<ll> A(N); rep(i,N) cin>>A[i],sum+=A[i],itido+=(i+1); if(sum%itido!=0) cout<< "NO"<<"\n", return; rep(i,N) if((sum/itido-A[(i+1)%N]-A[i])%N!=0 or sum/itido-A[(i+1)%N]-A[i]<0) cout<< "NO"<<"\n", return; cout<< "YES" <<"\n"; } //--START---------------------------------- int main() { cin.tie(nullptr); ios_base::sync_with_stdio(false); cout << fixed << setprecision(15); Main(); } //-----------------------------------------
a.cc: In function 'void Main()': a.cc:37:41: error: expected primary-expression before 'return' 37 | if(sum%itido!=0) cout<< "NO"<<"\n", return; | ^~~~~~ a.cc:38:101: error: expected primary-expression before 'return' 38 | rep(i,N) if((sum/itido-A[(i+1)%N]-A[i])%N!=0 or sum/itido-A[(i+1)%N]-A[i]<0) cout<< "NO"<<"\n", return; | ^~~~~~
s324016361
p03808
C
#pragma GCC optimize("Ofast") #include<cstdio> #include<cstdlib> #include<string> #include<algorithm> #include<iostream> #include<queue> #include<vector> #include <bitset> #include <cmath> #include <limits> #include <iostream> #include <map> using namespace std; #define INF 1LL<<62 #define MAX 100000 #define MOD 1000000007 typedef long long ll; typedef pair<int,int> P; typedef pair<pair<int,int>,int> p; #define bit(n,k) ((n>>k)&1) /*nのk bit目*/ #define rad_to_deg(rad) (((rad)/2/M_PI)*360) struct edge{ll to,cost,val;}; template<class T,class U>bool chmin(T&a,const U&b){if(a<=b)return false;a=b;return true;} template<class T,class U>bool chmax(T&a,const U&b){if(a>=b)return false;a=b;return true;} //__builtin_popcount(S); //C.erase(unique(C.begin(),C.end()),C.end()); //#define int ll signed main(){ int N; cin>>N; ll A[110000],sum=0; for(int i=0;i<N;i++){ cin>>A[i]; sum+=A[i]; } ll x=(ll)(N+1)*N/2; if(sum%x!=0){ cout<<"NO"<<endl; return 0; } ll a=sum/x; ll count=0; bool flag=true; for(int i=0;i<N;i++){ ll t=A[(i+1)%N]-A[i]; t-=a; if(t>0 || (-1*t)%N!=0){ flag=false; }else count+=(-1*t)/N; } if(flag && count==a) cout<<"YES"<<endl; else cout<<"NO"<<endl; }
main.c:2:9: fatal error: cstdio: No such file or directory 2 | #include<cstdio> | ^~~~~~~~ compilation terminated.
s502630092
p03808
C++
/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
s373403385
p03808
C++
#include "bits/stdc++.h" #define rep(i,n) for(int i=0;i<n;i++) using namespace std; using ll = long long; int main() { ll N; cin >> N; vector<ll> A(N + 1) ll Asum = 0; rep(i, N) { cin >> A[i]; Asum += A[i]; } A[N] = A[0]; if (Asum % (N * (N + 1) / 2) != 0) { cout << "NO" << endl; return 0; } ll n = Asum / (N * (N + 1) / 2); ll s = 0; rep(i, N) { ll d = A[i + 1] - A[i]; // d = n - x - (N - 1) * x // = n - N * x // x = (n - d) / N; if ((n - d) % N != 0) { cout << "NO" << endl; return 0; } s += (n - d) / N; } if (s == n) { cout << "YES" << endl; } else { cout << "NO" << endl; } }
a.cc: In function 'int main()': a.cc:11:5: error: expected ',' or ';' before 'll' 11 | ll Asum = 0; | ^~ a.cc:14:9: error: 'Asum' was not declared in this scope 14 | Asum += A[i]; | ^~~~ a.cc:17:9: error: 'Asum' was not declared in this scope 17 | if (Asum % (N * (N + 1) / 2) != 0) { | ^~~~ a.cc:21:12: error: 'Asum' was not declared in this scope 21 | ll n = Asum / (N * (N + 1) / 2); | ^~~~
s940825243
p03808
C++
#include <bits/stdc++.h> using namespace std; int main() { int n; long long a[100005], sum=0, d, diff, x; bool flag = 1; scanf("%d", &n); if(n%2 == 0) d = n/2LL * (n+1LL); else d = (n+1LL)/2LL * n; for(int i=0; i<n; i++) { scanf("%lld", &a[i]); sum += a[i]; } if(sum%d == 0) printf("YES\n"); else { x = sum/d; for(int i=0; i<n; i++) { diff = a[(i+1)%n] - a[i]; if(diff > x || (x-diff)%n > 0) { flag = 0; break; } } if(!flag) printf("NO\n"); else printf("YES\n"); } return 0;
a.cc: In function 'int main()': a.cc:27:18: error: expected '}' at end of input 27 | return 0; | ^ a.cc:3:12: note: to match this '{' 3 | int main() { | ^
s412165914
p03808
C++
#include<bits/stdc++.h> #define rep(i,a,b) for(int i=a;i<b;i++) #define rrep(i,a,b) for(int i=a;i>=b;i--) #define fore(i,a) for(auto &i:a) #define all(x) (x).begin(),(x).end() //#pragma GCC optimize ("-O3") using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); } typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60; 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; } //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ void _main() { int N; cin >> N; vector<ll> A(N); ll sum = 0; rep(i, 0, N) { cin >> A[i]; sum += A[i]; } const bool ok = [&]() { const ll s = N * (N + 1) / 2; if (sum % s != 0) { return false; } const ll operationNum = sum / s; vector<ll> diff(N); rep(i, 0, N) { diff[i] = A[i] - A[(i - 1 + N) % N]; } vector<ll> oneNum(N); rep(i, 0, N) { if (operationNum - diff[i]) < 0) { return false; } if ((operationNum - diff[i]) % N != 0) { return false; } return true; } ll oneNumSum = 0; rep(i, 0, N) { oneNumSum += oneNum[i]; } return oneNumSum == operationNum; }(); cout << (ok ? "YES" : "NO") << endl; }
a.cc: In lambda function: a.cc:45:41: error: expected primary-expression before '<' token 45 | if (operationNum - diff[i]) < 0) | ^
s263319105
p03808
C++
#include <iostream> #include <string> #include <utility> #include <stack> #include <vector> #include <queue> #include <algorithm> #include <map> #include <climits> #include <set> #include <cmath> using namespace std; long long A[100000]; long long diff_A[100000]; long long x[100000]; long long y[100000]; int main(){ int N; cin >> N; for(int i = 0; i < N; i++){ cin >> A[i]; } for(int i = 0; i < N; i++){ diff_A[i] = A[(i + 1) % N] - A[i]; } long long sum_A = accumulate(A, A + N, (long long) 0); long long sum_N = N * (N + 1) / 2; if(sum_A % sum_N != 0){ cout << "NO" << endl; return 0; } long long op_num = sum_A / sum_N; for(int i = 0; i < N; i++){ if(op_num - diff_A[i] < 0 || (op_num - diff_A[i]) % N != 0){ cout << "NO" << endl; return 0; } y[i] = (op_num - diff_A[i]) / N; x[i] = op_num - y[i]; } cout << "YES" << endl; return 0; }
a.cc: In function 'int main()': a.cc:30:23: error: 'accumulate' was not declared in this scope 30 | long long sum_A = accumulate(A, A + N, (long long) 0); | ^~~~~~~~~~
s307315795
p03808
C++
//#pragma once #include <stdio.h> #include <string> #include <iostream> #include <queue> #include <algorithm> #include <sstream> #include <vector> #include <math.h> #include <set> #include <map> #include <numeric> #include<bitset> #include <iomanip> using namespace std; #define modd 1000000007 typedef pair<long long, long long> pl; #define ll long long /* class UnionFind { public: vector <ll> par; vector <ll> siz; vector <ll> gr; // Constructor UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) ,gr(sz_){ for (ll i = 0; i < sz_; ++i) par[i] = i; } void init(ll sz_) { par.resize(sz_); siz.assign(sz_, 1LL); // resize だとなぜか初期化されなかった for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身 } // Member Function // Find ll root(ll x) { // 根の検索 while (par[x] != x) { x = par[x] = par[par[x]]; // x の親の親を x の親とする } return x; } // Union(Unite, Merge) bool merge(ll x, ll y) { x = root(x); y = root(y); if (x == y) return false; // merge technique(データ構造をマージするテク.小を大にくっつける) if (siz[x] < siz[y]) swap(x, y); siz[x] += siz[y]; par[y] = x; return true; } bool issame(ll x, ll y) { // 連結判定 return root(x) == root(y); } ll size(ll x) { // 素集合のサイズ return siz[root(x)]; } };*/ long long N, M, K, a, b, c, d, e, H, W, L; ll A[200005] = {}; ll B[200005] = {}; ll C[200005] = {}; bool f, ff; string S[200000]; set <long long>sll; pl bufpl; vector <long long>vl[3]; vector <pl>vpl; vector <string> vs; set<ll> llset; /*struct ST { long long Kati; int bangou; bool operator<(const ST& another) const { return Kati < another.Kati;//比較 }; }; vector <ST> vst; ST st[200005]; ST bufst; bitset<5000> bits;*/ long long modinv(long long aa, long long mm) { long long bb = mm, uu = 1, vv = 0; while (bb) { long long tt = aa / bb; aa -= tt * bb; swap(aa, bb); uu -= tt * vv; swap(uu, vv); } uu %= mm; if (uu < 0) uu += mm; return uu; } ll minn, maxx; double ansa; int main() { cin >> N; a = 0; b = 20000000000; for (int i = 0; i < N; i++) { cin >> A[i]; a += A[i]; if (i >= 1) { B[i] = A[i] - A[i - 1]; } b = min(b, A[i]); } c = N * (N + 1) / 2; if (a % c != 0) { cout << "NO" << endl; } else if(b>=a/c){ cout << "YES" << endl; } else { cout << "NO" << endl; } else if (b >= a / c) { } return 0; }
a.cc: In function 'int main()': a.cc:161:9: error: 'else' without a previous 'if' 161 | else if (b >= a / c) { | ^~~~
s095387259
p03808
C++
#include <bits/stdc++.h> int main() { cout<<"NO"<<endl; return 0; }
a.cc: In function 'int main()': a.cc:5:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 5 | cout<<"NO"<<endl; | ^~~~ | std::cout In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146, from a.cc:1: /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:5:21: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 5 | cout<<"NO"<<endl; | ^~~~ | std::endl 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: /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~
s800014838
p03808
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; int min=1000000001; int minum=0; int A[N]; for(int i=0;i<N;i++){ cin >> A[i]; } while(true){ for(int i=0;i<N;i++){ if(A[i]>min){ min=A[i]; minum=i; } } if(min==0){ cout << "YES" << endl; break; } if(min<=0){ cout << "NO" << endl; break; } for(int i=0;i<minum;i++){ A[i]-=N-minum+i+1; } for(int i=minum;i<N;i++){ A[i]-=i-minum+1; } }
a.cc: In function 'int main()': a.cc:34:2: error: expected '}' at end of input 34 | } | ^ a.cc:4:12: note: to match this '{' 4 | int main() { | ^
s601151158
p03808
C++
#include <bits/stdc++.h> using namespace std; using ll=long long; int main(){ ll N; cin>>N; vector<ll> A(N); ll S=0; for(int i=0;i<N;i++){ cin>>A[i]; S+=A[i]; } if(S%(N*(N+1)/2)){ cout<<"NO"<<endl; return 0; } S/=(N*(N+1)/2); ll cnt=0; for(int i=0;i<N;i++){ //t回のうちk回、iを選んだとする。 ll a,b; if(i==N-1) a=A[i],b=A[0]; else a=A[i],b=A[i+1]; ll c=t-(b-a); if(c%N){ cout<<"NO"<<endl; return 0; } cnt+=c%N; } if(cnt==N) cout<<"YES"<<endl; else cout<<"NO"<<endl; }
a.cc: In function 'int main()': a.cc:27:10: error: 't' was not declared in this scope 27 | ll c=t-(b-a); | ^
s595228740
p03808
C++
/* _ _ _ _ _ _ _ _ _ _ _ / /\ / /\ / /\ / /\ / /\ /\ \ /\_\/\_\ _ /\ \ /\ \ _ /\ \ / / \ / / \ / / \ / / / / / / \ \ \ / / / / //\_\ \ \ \ / \ \ /\_\ / \ \ / / /\ \__ / / /\ \ / / /\ \__ / /_/ / / / /\ \_\ /\ \/ \ \/ / / /\ \_\ / /\ \ \_/ / // /\ \_\ / / /\ \___\ / / /\ \ \ / / /\ \___\ / /\ \__/ / / / /\/_/ / \____\__/ / / /\/_/ / / /\ \___/ // / /\/_/ \ \ \ \/___// / / \ \ \ \ \ \ \/___// /\ \___\/ / / / / / /\/________/ / / / / / / \/____// / / ______ \ \ \ / / /___/ /\ \ \ \ \ / / /\/___/ / / / / / / /\/_// / / / / / / / / / / // / / /\_____\ _ \ \ \ / / /_____/ /\ \ _ \ \ \ / / / / / / / / / / / / / / / / / / / / / / / // / / \/____ / /_/\__/ / / / /_________/\ \ \ /_/\__/ / / / / / / / /___/ / /__ / / / / / /___/ / /__ / / / / / // / /_____/ / / \ \/___/ / / / /_ __\ \_\\ \/___/ / / / / / / //\__\/_/___\\/_/ / / //\__\/_/___\/ / / / / // / /______\/ / \_____\/ \_\___\ /____/_/ \_____\/ \/_/ \/_/ \/_________/ \/_/ \/_________/\/_/ \/_/ \/___________/ */ #include<bits/stdc++.h> using namespace std; #define ALL(obj) (obj).begin(), (obj).end() #define REP(i, n) for(int i = 0;i < (n);++i) #define endl '\n' #define pb emplace_back #define mkp make_pair #define p_q priority_queue #define INF 1000000000 #define PI 3.1415926 #define coutdb cout << fixed << setprecision(10) const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1}; const int dx_8[]={1,1,0,-1,-1,-1,0,1}, dy_8[]={0,-1,-1,-1,0,1,1,1}; const long long MOD = 1e9+7; // typedef long long ll; #define int long long template <typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;} template <typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;} template <typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;} template <typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);} signed main(void){ cin.tie(0); ios::sync_with_stdio(false); int N, a[100000]; cin >> N; int diff[100000], sum = 0; REP(i, N){ cin >> a[i]; sum += a[i]; } if(sum % ((N*(N+1))/2) != 0){ cout << "NO" << endl; return 0; } int times = sum / ((N*(N+1))/2); int cnt = 0; REP(i, N){ if(i == N-1) diff[i] = a[0]-a[i]; else diff[i] = a[i+1] - a[i]; if((times-diff[i] % N != 0){ cout << "NO" << endl; return 0; } cnt += (times-diff[i]) / N; } if(cnt != times) cout << "NO" << endl; else cout << "YES" << endl; return 0; }
a.cc: In function 'int main()': a.cc:59:32: error: expected ';' before '{' token 59 | if((times-diff[i] % N != 0){ | ^ | ; a.cc:63:31: error: expected ')' before ';' token 63 | cnt += (times-diff[i]) / N; | ^ | ) a.cc:59:7: note: to match this '(' 59 | if((times-diff[i] % N != 0){ | ^
s153990611
p03808
C++
#include <iostream> #include <algorithm> #include <string> #include <vector> #include <cmath> #include <set> #include <map> #include <queue> using namespace std; #define rep(i,n) for(int i = 0;i<n;i++) const long long MOD = 1000000007LL; int main(){ int n; cin >> n; long long a[n]; long long sum = 0; rep(i,n){ cin >> a[i]; sum+=a[i]; } long long t; bool fl = true; if(sum%(n*(n+1)/2)!=0){ cout << "NO" << endl; } else{ t = sum/(n*(n+1)/2); rep(i,n){ if(((a[(i+1)%n] - a[i])-t)%n != 0 || (a[(i+1)%n] - a[i])-t) >= 0){ fl = false; break; } } if(fl){ cout << "YES" << endl; } else{ cout << "No" << endl; } } }
a.cc: In function 'int main()': a.cc:29:73: error: expected primary-expression before '>=' token 29 | if(((a[(i+1)%n] - a[i])-t)%n != 0 || (a[(i+1)%n] - a[i])-t) >= 0){ | ^~
s048641915
p03808
C++
#include <stdio.h> #include <iostream> #include <vector> #define ll long long #define rep(i,n) for(ll i=0;i<n;i++) #define vecll vector<ll> using namespace std; int in() {int x;scanf("%d",&x);return x;} ll lin() {ll x;scanf("%lld",&x);return x;} string strin(){string s;cin>>s;return s;} bool func(ll n){ ll sum=0,cnt=0; vecll a(n),b(n); rep(i,n) sum+=a[i]=lin(); if(sum*2%(n*(n+1))!=0)return false; ll num=sum*2/n/(n+1); rep(i,n){ b[i]=a[(i+1)%n]-a[i]-num; if(b[i]%n!=0)return false; cnt-=b[i]/n; } if(cnt!=num)return false; return true; } int main(){ string ans=func((lin())?"YES":"NO"; cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:26:39: error: expected ')' before ';' token 26 | string ans=func((lin())?"YES":"NO"; | ~ ^ | )
s178339052
p03808
C++
#include <iostream> #include <vector> using namespace std; bool solve(long long N, const vector<long long> &a) { long long S = 0; for (int i = 0; i < N; ++i) S += a[i]; if (S % (N * (N+1)/2) != 0) return false; long long num = S / (N * (N+1)/2); for (int i = 0; i < N; ++i) { b[i] = a[i] - a[(i-1+N)%N]; b[i] -= num; if (b[i] % N != 0 || b[i] > 0) return false; } return true; } int main() { long long N; cin >> N; vector<long long> a(N); for (int i = 0; i < N; ++i) cin >> a[i]; if (solve(N, a)) cout << "YES" << endl; else cout << "NO" << endl; }
a.cc: In function 'bool solve(long long int, const std::vector<long long int>&)': a.cc:11:9: error: 'b' was not declared in this scope 11 | b[i] = a[i] - a[(i-1+N)%N]; | ^
s654134647
p03808
C++
#include <bits/stdc++.h> using namespace std; int main(){ long long n; cin >> n; long long a[100010]; long long so = 0; for(int i = 0;i < n;i++){ cin >> a[i]; so += a[i]; } long long wa = 0; for(int i = 0;i < n;i++){ wa += a[(i+1)%n] - a[i]; } if(wa == 0 && so % (n*(n+1)/2) == 0){ cout << "YES" << endl; }else{ cout << "NO" << endl; } return 0;
a.cc: In function 'int main()': a.cc:25:14: error: expected '}' at end of input 25 | return 0; | ^ a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s099605317
p03808
C++
#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <utility> #include <string> #include <algorithm> #include <map> #include <vector> #include <climits> #include <numeric> #include<stdio.h> #include <queue> #include <iomanip> #include <float.h> #include <set> #include<functional> #include <stack> #include <time.h> #include <climits> #include <bitset> using namespace std; int gcd(int a, int b) { if (a < b) gcd(b, a); int r; while ((r = a%b)) { a = b; b = r; } return b; } long long lcm(long long a, long long b) { return a / gcd(a, b) * b; } long long modpow(long long a, long long n, long long mod) { long long res = 1; while (n > 0) { if (n & 1) res = res * a % mod; a = a * a % mod; n >>= 1; } return res; } long long modinv(long long a, long long mod) { long long 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); } u %= mod; if (u < 0) u += mod; return u; } namespace NTT { const int MOD = 998244353; // to be set appropriately const long long PR = 3; // to be set appropriately void trans(vector<long long> &v, bool inv = false) { int n = (int)v.size(); for (int i = 0, j = 1; j < n - 1; j++) { for (int k = n >> 1; k >(i ^= k); k >>= 1); if (i > j) swap(v[i], v[j]); } for (int t = 2; t <= n; t <<= 1) { long long bw = modpow(PR, (MOD - 1) / t, MOD); if (inv) bw = modinv(bw, MOD); for (int i = 0; i < n; i += t) { long long w = 1; for (int j = 0; j < t / 2; ++j) { int j1 = i + j, j2 = i + j + t / 2; long long c1 = v[j1], c2 = v[j2] * w % MOD; v[j1] = c1 + c2; v[j2] = c1 - c2 + MOD; while (v[j1] >= MOD) v[j1] -= MOD; while (v[j2] >= MOD) v[j2] -= MOD; w = w * bw % MOD; } } } if (inv) { long long inv_n = modinv(n, MOD); for (int i = 0; i < n; ++i) v[i] = v[i] * inv_n % MOD; } } // C is A*B vector<long long> mult(vector<long long> A, vector<long long> B) { int size_a = 1; while (size_a < A.size()) size_a <<= 1; int size_b = 1; while (size_b < B.size()) size_b <<= 1; int size_fft = max(size_a, size_b) << 1; vector<long long> cA(size_fft, 0), cB(size_fft, 0), cC(size_fft, 0); for (int i = 0; i < A.size(); ++i) cA[i] = A[i]; for (int i = 0; i < B.size(); ++i) cB[i] = B[i]; trans(cA); trans(cB); for (int i = 0; i < size_fft; ++i) cC[i] = cA[i] * cB[i] % MOD; trans(cC, true); vector<long long> res((int)A.size() + (int)B.size() - 1); for (int i = 0; i < res.size(); ++i) res[i] = cC[i]; return res; } }; signed main() { cin.tie(0); ios::sync_with_stdio(false); long long n; cin >> n; long long sum = 0; long long a[100004]; for (int i = 0; i < n; i++) { cin >> a[i]; sum += a[i]; } string ans = "YES"; long long cnt = sum / ((n + 1)*n / 2); long long tmp = 0; long long num[100005]; if (sum % ((n + 1)*n / 2) != 0) { ans = "NO"; goto owari; } if (((n*1000000+cnt - a[0] + a[n - 1]) % n) != 0) { ans = "NO"; goto owari; } num[0] = ((n * 1000000 + cnt - a[0] + a[n - 1]) / n) - 1000000; tmp += ((n*1000000+cnt - a[0] + a[n - 1]) / n)-1000000; for (int i = 1; i < n; i++) { if (((n*1000000+cnt - a[i] + a[i - 1]) % n) != 0) { ans = "NO"; goto owari; } num[i] = ((n * 1000000 + cnt - a[i] + a[i - 1]) / n) - 1000000; tmp += ((n*1000000+cnt - a[i] + a[i - 1]) / n)-1000000; } if (tmp != cnt) { ans = "NO"; goto owari; } long long ima = num[0]; for (int i = 1; i < n; i++) { ima += num[i]*(n-i+1); } if (ima != a[0]) { ans = "NO"; goto owari; } for (int i = 1; i < n; i++) { ima = ima + tmp - num[i]*n; if (ima != a[i]) { ans = "NO"; goto owari; } } owari: cout << ans; }
a.cc: In function 'int main()': a.cc:148:1: error: jump to label 'owari' 148 | owari: | ^~~~~ a.cc:135:34: note: from here 135 | ans = "NO"; goto owari; | ^~~~~ a.cc:137:19: note: crosses initialization of 'long long int ima' 137 | long long ima = num[0]; | ^~~ a.cc:148:1: error: jump to label 'owari' 148 | owari: | ^~~~~ a.cc:130:42: note: from here 130 | ans = "NO"; goto owari; } | ^~~~~ a.cc:137:19: note: crosses initialization of 'long long int ima' 137 | long long ima = num[0]; | ^~~ a.cc:148:1: error: jump to label 'owari' 148 | owari: | ^~~~~ a.cc:125:34: note: from here 125 | ans = "NO"; goto owari; } | ^~~~~ a.cc:137:19: note: crosses initialization of 'long long int ima' 137 | long long ima = num[0]; | ^~~ a.cc:148:1: error: jump to label 'owari' 148 | owari: | ^~~~~ a.cc:123:34: note: from here 123 | ans = "NO"; goto owari; } | ^~~~~ a.cc:137:19: note: crosses initialization of 'long long int ima' 137 | long long ima = num[0]; | ^~~
s066189250
p03808
C++
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<ll, ll> pll; #define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i)) #define REP(i, n) FOR(i, n, 0) #define OF64 std::setprecision(10) const ll MOD = 1000000007; const ll INF = (ll)1e15; ll A[100005]; ll B[100005]; ll C[100005]; int main() { ll N; cin >> N; REP(i, N) { cin >> A[i]; } ll max = 0; ll sum = 0 REP(i, N) { B[i] = A[i] - A[(N + i - 1) % N]; sum += B[i]; max = std::max(max, B[i]); } //! A[i]はmax回の操作で似たものを作れる REP(i, N) { ll k = (B[i] + (N - 1) * max) / N; C[i] = max - k; } //! C[i]にはA[i]が何回1から始まったかが入っている //! C[0]をとりあえず求める FOR(i, N, 1) { if (C[i] > 0) { C[0] += (N + 1 - i) * C[i]; } } FOR(i, N, 1) { C[i] = C[i - 1] + (max - C[i]) - (N - 1) * C[i]; } string ans = "YES"; REP(i, N) { if (abs(A[i] - C[i]) % (N * (N + 1) / 2) != 0) { ans = "NO"; break; } } if (sum != 0) { ans = "NO"; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:7:22: error: expected ',' or ';' before 'for' 7 | #define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i)) | ^~~ a.cc:8:19: note: in expansion of macro 'FOR' 8 | #define REP(i, n) FOR(i, n, 0) | ^~~ a.cc:27:16: note: in expansion of macro 'REP' 27 | ll sum = 0 REP(i, N) | ^~~ a.cc:27:20: error: 'i' was not declared in this scope 27 | ll sum = 0 REP(i, N) | ^ a.cc:7:41: note: in definition of macro 'FOR' 7 | #define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i)) | ^ a.cc:27:16: note: in expansion of macro 'REP' 27 | ll sum = 0 REP(i, N) | ^~~
s502706361
p03808
C++
#include<bits/stdc++.h> #define INF 1e9 #define llINF 1e18 #define MOD 1000000007 #define pb push_back #define mp make_pair #define F first #define S second #define ll long long #define ALL(a) (a).begin(),(a).end() #define Yes(hoge) cout<<((hoge)?"Yes":"No")<<endl; #define YES(hoge) cout<<((hoge)?"YES":"NO")<<endl; using namespace std; struct Grid{int x,y,t;}; struct Edge{int to,cost;}; struct Graph{vector<vector<Edge>>E;int V; const ll Inf = llINF;const int MAX_V=1010;vector<ll>d; Graph(int n):E(n){d.resize(MAX_V);E.resize(n);V=n;} void init(){for(int i=0;i<MAX_V;i++)d[i]=Inf;} void add_edge(int from,int to,int cost){E[from-1].pb({to-1,cost});} }; int main(){ cin.tie(0); ios::sync_with_stdio(false); ll n;cin>>n; vector<ll>A(n); ll sum=0; for(int i=0;i<n;i++){ cin>>A[i]; sum+=A[i]; } if(sum%(n*(n+1)/2)==0){ ll cnt=0; bool flag=true; ll num=sum/(n*(n+1)/2) for(int i=0;i<n;i++){ ll d=A[(i+1)%n]-A[i]+num; if(d%n)flag=false; else{ cnt+=d/n; } } if(cnt!=num)flag=false; YES(flag); }else{ cout<<"NO"<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:38:5: error: expected ',' or ';' before 'for' 38 | for(int i=0;i<n;i++){ | ^~~ a.cc:38:17: error: 'i' was not declared in this scope 38 | for(int i=0;i<n;i++){ | ^
s627882098
p03808
C++
#include<bits/stdc++.h> using namespace std; #define int long long #define double long double #define pb push_back #define pob pop_back #define mp make_pair #define fi first #define se second #define endl '\n' #define Ptest(x) return cout << x << endl, 0; typedef vector <int> vi; typedef pair <int, int> ii; typedef vector <vi > vvi; typedef vector <ii > vii; const int N = 1e5 + 5, mod = 1e9 + 7, inf = 1e18 + 7; int n, m, sum; signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; m = (n * (n + 1)) / 2; for (int i = 0; i < n; i++){ cin >> a[i]; sum += a[i]; } if (sum % m){ Ptest("NO"); } k = sum / m; for (int i = 0; i < n; i++){ d = a[(i + 1) % n] - a[i]; if (k < d || (k - d) % n){ Ptest("NO"); } p += (k - d) / n; } if (k != p){ Ptest("NO"); } cout << "YES"; } /* ----------------------------------+ INPUT: | ============================== | ============================== | ----------------------------------+ OUTPUT: | ============================== | ============================== | ----------------------------------+ */
a.cc: In function 'int main()': a.cc:29:16: error: 'a' was not declared in this scope 29 | cin >> a[i]; | ^ a.cc:35:5: error: 'k' was not declared in this scope 35 | k = sum / m; | ^ a.cc:37:9: error: 'd' was not declared in this scope 37 | d = a[(i + 1) % n] - a[i]; | ^ a.cc:37:13: error: 'a' was not declared in this scope 37 | d = a[(i + 1) % n] - a[i]; | ^ a.cc:41:9: error: 'p' was not declared in this scope 41 | p += (k - d) / n; | ^ a.cc:43:14: error: 'p' was not declared in this scope 43 | if (k != p){ | ^
s284241739
p03808
C
#include <stdio.h> #include <math.h> #include <string.h> #include <stdlib.h> #define llong long long #define fr(i,l,r) for(i=(l);i<(r);i++) #define min(p,q) ((p)<(q)?(p):(q)) #define max(p,q) ((p)>(q)?(p):(q)) int main(void) { //変数の宣言 long long int n; long long int a[100010]; long long int sum; //よく使う変数 int i,j,k,l; int flag=0; int ans=0; int count=0; long long int temp,temp1,temp2; int max,min; int len; //データの読み込み scanf("%lld",&n); for(i=0;i<n;i++){ scanf("%lld",&a[i]); } a[n]=a[0]; // printf("nは%dです\n", n); // printf("データの読み込み終了\n"); //実際の処理 if(n==1){ printf("YES\n"); return 0; } sum=0; for(i=0;i<n;i++){ sum=sum+a[i]; } if(sum%(n*(n+1)/2)!=0){ printf("NO\n"); return 0; }else{ temp=(sum/(n*(n+1)/2)); } temp2=temp; for(i=0;i<n;i++){ if((temp+a[i]-a[i+1])%n!=0&&(temp+a[i]-a[i+1])n<0){ printf("NO\n"); return 0; }else{ temp2=temp2-(temp+a[i]-a[i+1])/n; } } // printf("計算部分終了\n"); //出力 if(temp2==0){ printf("YES\n"); }else{ printf("NO\n"); } // printf("結果の出力終了\n"); return 0; }
main.c: In function 'main': main.c:58:63: error: expected ')' before 'n' 58 | if((temp+a[i]-a[i+1])%n!=0&&(temp+a[i]-a[i+1])n<0){ | ~ ^ | )
s445818909
p03808
C++
#include <iostream> #include <vector> #include <numeric> using namespace std; typedef long long ll; bool solve(const int n, const vector<int> & in){ ll sum = accumulate(in.begin(), in.end(), 0LL); if (sum % ((static_cast<long long>(n) * static_cast<long long>(n+1))/2) != 0){ return false; } ll k = sum / ((static_cast<long long>(n) * static_cast<long long>(n+1))/2); ll ops = 0; for(int i = 0;i < n;i++){ ll tmp = in[(i+1)%n] - in[i] - k; if (tmp <= 0 && - tmp % n == 0){ ops += -tmp / n; }else return false; } return true } int main(){ int n; cin >> n; vector<int> in(n); for(int i = 0;i < n;i++){ cin >> in[i]; } if (solve(n, in)){ cout <<"YES" << endl; } else { cout <<"NO" << endl; } return 0; }
a.cc: In function 'bool solve(int, const std::vector<int>&)': a.cc:24:14: error: expected ';' before '}' token 24 | return true | ^ | ; 25 | } | ~
s636616473
p03808
C++
// Why am I so dumb? :c #include<bits/stdc++.h> #define pb push_back #define mp make_pair #define all(x) (x).begin(), (x).end() #define fi first #define se second using namespace std; typedef long long ll; const int MAXN = (int)1e5 + 5; int arr[MAXN]; int n; void solve() { scanf("%d", &n); ll subt = n * (n + 1ll) / 2; for (int i = 1; i <= n; ++i) { scanf("%d", &arr[i]); arr[i] %= subt; } int d = (int)1e9; for (int i = 1; i <= n; ++i) { d = min(d, arr[i] / (n + 1) - 5); } d = max(d, 0); for (int i = 1; i <= n; ++i) { arr[i] -= d * (n + 1); } ll sum = 0, subt = n * (n + 1ll) / 2; for (int i = 1; i <= n; ++i) { sum += arr[i]; } if (sum % subt) { printf("NO\n"); return; } sum /= subt; for (ll i = 1; i <= sum; ++i) { int ptr = min_element(arr + 1, arr + n + 1) - arr; if (arr[ptr] < sum - i + 1) { printf("NO\n"); return; } if (*max_element(arr + 1, arr + n + 1) > n * (sum - i + 1)) { printf("NO\n"); return; } for (int j = 1; j <= n; ++j) { arr[ptr] -= j; if (arr[ptr] < 0) { printf("NO\n"); return; } if (++ptr > n) { ptr -= n; } } } printf("YES\n"); } int main() { int tt = 1; while (tt--) { solve(); } return 0; }
a.cc: In function 'void solve()': a.cc:43:17: error: redeclaration of 'll subt' 43 | ll sum = 0, subt = n * (n + 1ll) / 2; | ^~~~ a.cc:24:8: note: 'll subt' previously declared here 24 | ll subt = n * (n + 1ll) / 2; | ^~~~
s454956830
p03808
C++
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int MAX_N = 1e5; int N; ll a[MAX_N+5]; int main(){ cin >> N; for(int i=0;i<N;i++) cin >> a[i]; bool flg = true; if(N==1 && a[0] != 1) flg = false; ll sum = 0, p = N * (N+1) / 2, sy = 0, m; for(int i=0;i<N;i++) sum += a[i]; if (sum%p) flg = false; m = sum / p; for(int i=1;i<=N;i++){ ll d = a[i%N] - a[i-1]; if((m-d)%N || m < d || || m<(m-d)/N) flg = false; sy += (m-d) / N; } if(flg && sy==m) cout << "YES" << endl; else cout << "NO" << endl; return 0; }
a.cc: In function 'int main()': a.cc:25:32: error: expected primary-expression before '||' token 25 | if((m-d)%N || m < d || || m<(m-d)/N) flg = false; | ^~
s604525324
p03808
C++
#include <bits/stdc++.h> using namespace std; #define int long long signed main() { int n; cin >> n; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } long sum = accumulate(a, a + n, 0); long div = n * (n + 1) / 2; if (sum % div != 0) { cout << "NO\n"; return 0; } long k = sum / div; long b[n]; for (int i = 0; i < n; i++) { if (i != n - 1) b[i] = a[i + 1] - a[i]; else b[i] = a[0] - a[i]; } for (int i = 0; i < n; i++) { if ((b[i] - k) % -n == 0) { cnt += (b[i] - k) / -n; } else { cout << "NO\n"; return 0; } } if (cnt == k) cout << "YES\n"; else cout << "NO\n"; return 0; }
a.cc: In function 'int main()': a.cc:26:25: error: 'cnt' was not declared in this scope; did you mean 'int'? 26 | cnt += (b[i] - k) / -n; | ^~~ | int a.cc:32:13: error: 'cnt' was not declared in this scope; did you mean 'int'? 32 | if (cnt == k) cout << "YES\n"; | ^~~ | int
s913705575
p03808
C++
#include <bits/stdc++.h> using namespace std; int a[n]; int n,sousa; bool check2(){ int ma = 0, mi = 1e9; for(int i = 0; i < n; i++){ ma = max(ma, a[i]); mi = min(mi, a[i]); } if(ma > sousa * n || mi < sousa)return false; else return true; } int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } long sum = accumulate(a, a + n, 0); long div = n * (n + 1) / 2; sousa=sum/div; if(!check2())cout<<"NO\n"; else{ long sum = accumulate(a, a + n, 0); long div = n * (n + 1) / 2; if (sum % div != 0) { cout << "NO\n"; return 0; } long k = sum / div; int b[n]; for (int i = 0; i < n; i++) { if (i != n - 1) b[i] = a[i + 1] - a[i]; else b[i] = a[0] - a[i]; } int cnt = 0; for (int i = 0; i < n; i++) { if ((b[i] - k) % -n == 0) { cnt += (b[i] - k) / -n; } } if (cnt == k) cout << "YES\n"; else cout << "NO\n"; } return 0; }
a.cc:4:7: error: 'n' was not declared in this scope; did you mean 'yn'? 4 | int a[n]; | ^ | yn a.cc: In function 'bool check2()': a.cc:9:22: error: 'a' was not declared in this scope 9 | ma = max(ma, a[i]); | ^ a.cc: In function 'int main()': a.cc:19:24: error: 'a' was not declared in this scope 19 | cin >> a[i]; | ^ a.cc:21:25: error: 'a' was not declared in this scope 21 | long sum = accumulate(a, a + n, 0); | ^
s083695979
p03808
C++
#include <bits/stdc++.h> using namespace std; int a[n]; int n; bool check2(){ int ma = 0, mi = 1e9; for(int i = 0; i < n; i++){ ma = max(ma, a[i]); mi = min(mi, a[i]); } if(ma > sousa * n || mi < sousa)return false; else return true; } int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } if(!check2())cout<<"NO\n"; else{ long sum = accumulate(a, a + n, 0); long div = n * (n + 1) / 2; if (sum % div != 0) { cout << "NO\n"; return 0; } long k = sum / div; int b[n]; for (int i = 0; i < n; i++) { if (i != n - 1) b[i] = a[i + 1] - a[i]; else b[i] = a[0] - a[i]; } int cnt = 0; for (int i = 0; i < n; i++) { if ((b[i] - k) % -n == 0) { cnt += (b[i] - k) / -n; } } if (cnt == k) cout << "YES\n"; else cout << "NO\n"; } return 0; }
a.cc:4:7: error: 'n' was not declared in this scope; did you mean 'yn'? 4 | int a[n]; | ^ | yn a.cc: In function 'bool check2()': a.cc:9:22: error: 'a' was not declared in this scope 9 | ma = max(ma, a[i]); | ^ a.cc:12:13: error: 'sousa' was not declared in this scope 12 | if(ma > sousa * n || mi < sousa)return false; | ^~~~~ a.cc: In function 'int main()': a.cc:19:24: error: 'a' was not declared in this scope 19 | cin >> a[i]; | ^ a.cc:23:31: error: 'a' was not declared in this scope 23 | long sum = accumulate(a, a + n, 0); | ^ a.cc: In function 'bool check2()': a.cc:14:1: warning: control reaches end of non-void function [-Wreturn-type] 14 | } | ^
s961992957
p03808
C++
#include <bits/stdc++.h> using namespace std; int a[n]; int n; bool check2(){ ll ma = 0, mi = 1e18; for(int i = 0; i < n; i++){ ma = max(ma, a[i]); mi = min(mi, a[i]); } if(ma > sousa * n || mi < sousa)return false; else return true; } int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } if(!check2())cout<<"NO\n"; else{ long sum = accumulate(a, a + n, 0); long div = n * (n + 1) / 2; if (sum % div != 0) { cout << "NO\n"; return 0; } long k = sum / div; int b[n]; for (int i = 0; i < n; i++) { if (i != n - 1) b[i] = a[i + 1] - a[i]; else b[i] = a[0] - a[i]; } int cnt = 0; for (int i = 0; i < n; i++) { if ((b[i] - k) % -n == 0) { cnt += (b[i] - k) / -n; } } if (cnt == k) cout << "YES\n"; else cout << "NO\n"; } return 0; }
a.cc:4:7: error: 'n' was not declared in this scope; did you mean 'yn'? 4 | int a[n]; | ^ | yn a.cc: In function 'bool check2()': a.cc:7:5: error: 'll' was not declared in this scope 7 | ll ma = 0, mi = 1e18; | ^~ a.cc:9:9: error: 'ma' was not declared in this scope; did you mean 'fma'? 9 | ma = max(ma, a[i]); | ^~ | fma a.cc:9:22: error: 'a' was not declared in this scope 9 | ma = max(ma, a[i]); | ^ a.cc:10:9: error: 'mi' was not declared in this scope; did you mean 'i'? 10 | mi = min(mi, a[i]); | ^~ | i a.cc:12:8: error: 'ma' was not declared in this scope; did you mean 'fma'? 12 | if(ma > sousa * n || mi < sousa)return false; | ^~ | fma a.cc:12:13: error: 'sousa' was not declared in this scope 12 | if(ma > sousa * n || mi < sousa)return false; | ^~~~~ a.cc:12:26: error: 'mi' was not declared in this scope 12 | if(ma > sousa * n || mi < sousa)return false; | ^~ a.cc: In function 'int main()': a.cc:19:24: error: 'a' was not declared in this scope 19 | cin >> a[i]; | ^ a.cc:23:31: error: 'a' was not declared in this scope 23 | long sum = accumulate(a, a + n, 0); | ^ a.cc: In function 'bool check2()': a.cc:14:1: warning: control reaches end of non-void function [-Wreturn-type] 14 | } | ^
s181533915
p03808
C++
#include <bits/stdc++.h> typedef long long ll; using namespace std; //-------------------------↓↓↓↓↓↓------------------------ ll n, a[100002], sousa; bool check1(){ ll sum = 0, summ = 0; for(int i = 0; i < n; i++){ sum += a[i]; summ += (i + 1); } sousa = sum / summ; if(sum % summ == 0)return true; else return false; } bool check2(){ ll ma = 0, mi = 1e18; for(int i = 0; i < n; i++){ ma = max(ma, a[i]); mi = min(mi, a[i]); } if(ma > sousa * n || mi < sousa)return false; else return true; } bool check3(){ ll pos, sum = 0, now, tmp; bool ok = true; for(int i = 0; i < n; i++){ pos = abs(a[i + 1] - a[i]); tmp = pos; sum += pos / (n - 1); now = pos / (n - 1); if(pos % (n - 1) != 0)sum++,now++; pos -= pos * now; if (tmp == sousa)return true; if(abs(pos) != sousa - now)ok = false; } if(sum != sousa)return false; else return ok; } int main(void){ cin.tie(0); ios::sync_with_stdio(false); cin >> n; for(int i = 0; i < n; i++){ cin >> a[i]; } if(n == 1)Cout("YES"); else{ if(!check1() || !check2()){ cout << "NO\n"; } else{ if(!check3())cout << "NO\n"; else cout << "YES\n"; } } return 0; }
a.cc: In function 'int main()': a.cc:60:18: error: 'Cout' was not declared in this scope 60 | if(n == 1)Cout("YES"); | ^~~~
s240313487
p03808
C++
#include <bits/stdc++.h> #define FOR(i, a, b) for(int i=(int)(a); i!=(int)(b); i++) #define RFOR(i, a, b) for(int i=(int)(a); i!=(int)(b); i--) #define REP(i, n) FOR(i, 0, n) using namespace std; using ll = long long; int main(){ lln; cin >> n; ll a[n], sum = 0; REP(i, n){ cin >> a[i]; sum += a[i]; } if(2*sum % (n*(n+1)) != 0){ cout << "NO" << endl; return 0; } ll k = 2*sum / (n*(n+1)), d, dd = 0; REP(i, n){ d = a[(i+1)%n] - a[i] - k; if(d > 0 || d%n){ cout << "NO" << endl; return 0; } dd += d; } if(dd + n*k == 0) cout << "YES" << endl; else cout << "NO" << endl; return 0; }
a.cc: In function 'int main()': a.cc:9:3: error: 'lln' was not declared in this scope; did you mean 'll'? 9 | lln; cin >> n; | ^~~ | ll a.cc:9:15: error: 'n' was not declared in this scope; did you mean 'yn'? 9 | lln; cin >> n; | ^ | yn a.cc:12:12: error: 'a' was not declared in this scope 12 | cin >> a[i]; | ^ a.cc:23:5: error: 'd' was not declared in this scope 23 | d = a[(i+1)%n] - a[i] - k; | ^ a.cc:23:9: error: 'a' was not declared in this scope 23 | d = a[(i+1)%n] - a[i] - k; | ^ a.cc:28:5: error: 'dd' was not declared in this scope 28 | dd += d; | ^~ a.cc:31:6: error: 'dd' was not declared in this scope 31 | if(dd + n*k == 0) | ^~
s591588412
p03808
C++
#include <iostream> using namespace std; int main(){ int n; cin >> n; int a[n+1]; for (int i=0; i<n; i++){ cin >> a[i]; } a[n]=a[0]; int d[n]; for (int i=0, i<n; i++){ d[i]=a[i+1]-a[i]; } int k=n*(n+1)/2; for (int i=0; i<n; i++){ if (d[i]>k || (k-d[i])%n!=0){ cout << "NO" << endl; exit(0); } } cout << "YES" << endl; }
a.cc: In function 'int main()': a.cc:12:20: error: expected ';' before '<' token 12 | for (int i=0, i<n; i++){ | ^ | ; a.cc:12:20: error: expected primary-expression before '<' token
s514702808
p03808
C++
#include <iostream> using namespace std; int main(){ int n; cin >> n; int a[n+1] for (int i=0; i<n; i++){ cin >> a[i]; } a[n]=a[0]; int d[n]; for (int i=0, i<n; i++){ d[i]=a[i+1]-a[i]; } int k=n*(n+1)/2; for (int i=0; i<n; i++){ if (d[i]>k || (k-d[i])%n!=0){ cout << "NO" << endl; exit(0); } } cout << "YES" << endl; }
a.cc: In function 'int main()': a.cc:7:5: error: expected initializer before 'for' 7 | for (int i=0; i<n; i++){ | ^~~ a.cc:7:19: error: 'i' was not declared in this scope 7 | for (int i=0; i<n; i++){ | ^ a.cc:10:5: error: 'a' was not declared in this scope 10 | a[n]=a[0]; | ^ a.cc:12:20: error: expected ';' before '<' token 12 | for (int i=0, i<n; i++){ | ^ | ; a.cc:12:20: error: expected primary-expression before '<' token
s431722576
p03808
C++
#include <bits/stdc++.h> #define FOR(i, begin, end) for(int i=(begin);i<(end);i++) #define REP(i, n) FOR(i,0,n) #define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--) #define IREP(i, n) IFOR(i,0,n) #define SORT(a) sort(a.begin(), a.end()) #define REVERSE(a) reverse(a.begin(), a.end()) #define int long long #define INF 1000000000000000 using namespace std; typedef vector<int> vec; typedef vector<vec> mat; typedef pair<int, int> Pii; template<typename T> void readvec(vector<T> &a); void readindex(vector<int> &a); signed main(){ int N; cin >> N; vec A(N); readvec(A); if(N == 1){ cout << "YES"; return 0; } int s = 0; REP(i, N) s += A[i]; int t = N * (N + 1) / 2; if(s % t != 0){ cout << "NO"; return 0; } s /= t; int s2 = 0; REP(i, N){ int dif = A[i] - A[(i + N - 1) % N]; if((s - dif) % N != 0 || s < diff){ cout << "NO"; return 0; } s2 += (s - dif) / N; } if(s2 == s){ cout << "YES"; }else{ cout << "NO"; } return 0; } template<typename T> void readvec(vector<T> &a){ REP(i, a.size()){ cin >> a[i]; } } void readindex(vector<int> &a){ REP(i, a.size()){ cin >> a[i]; a[i]--; } }
a.cc: In function 'int main()': a.cc:45:38: error: 'diff' was not declared in this scope; did you mean 'dif'? 45 | if((s - dif) % N != 0 || s < diff){ | ^~~~ | dif
s222955109
p03808
C++
#include "bits/stdc++.h" #define ll long long #define rep2(i,a,b) for(int i=a;i<=b;++i) #define rep(i,n) for(int i=0;i<n;i++) #define pii pair<int,int> #define ti3 tuple<int,int,int> #define pq priority_queue<int> #define pqg priority_queue<int,vector<int>,greater<int>> ll int MOD=998244353; #define N 3000000 using namespace std; string alphabet("abcdefghijklmnopqrstuvwxyz"); main(){ cout<<"NO; return 0; }
a.cc:16:11: warning: missing terminating " character 16 | cout<<"NO; | ^ a.cc:16:11: error: missing terminating " character 16 | cout<<"NO; | ^~~~ a.cc:15:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 15 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:17:5: error: expected primary-expression before 'return' 17 | return 0; | ^~~~~~
s686634106
p03808
C++
#include <bits/stdc++.h> #define FI first #define SE second #define VE vector<int> #define PB push_back #define PA pair<int,int> #define MA make_pair #define LLI long long int #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 YES(i) cout<<(i?"YES":"NO")<<endl #define Yes(i) cout<<(i?"Yes":"No")<<endl #define POS(i) cout<<(i?"POSSIBLE":"IMPOSSIBLE")<<endl #define Pos(i) cout<<(i?"Possible":"Impossible")<<endl #define co(i) cout<<i<<endl using namespace std; // const int INF=1e9+7; const int MOD=1e9+7; // int main(){ int n; cin>>n; int a[100000] LLI sum=0; FOR(i,0,n){ cin>>a[i]; sum+=a[i]; } bool flag=true; if(sum%(n*(n+1)/2)==0){ sum/=(n*(n+1)/2); }else{ flag=false; } FOR(i,0,n){ if((a[(i+1)%n]-a[i]-sum)%n!=0) flag=false; } YES(flag); }
a.cc: In function 'int main()': a.cc:8:13: error: expected initializer before 'long' 8 | #define LLI long long int | ^~~~ a.cc:24:5: note: in expansion of macro 'LLI' 24 | LLI sum=0; | ^~~ a.cc:26:14: error: 'a' was not declared in this scope 26 | cin>>a[i]; | ^ a.cc:27:9: error: 'sum' was not declared in this scope 27 | sum+=a[i]; | ^~~ a.cc:30:8: error: 'sum' was not declared in this scope 30 | if(sum%(n*(n+1)/2)==0){ | ^~~ a.cc:36:13: error: 'a' was not declared in this scope 36 | if((a[(i+1)%n]-a[i]-sum)%n!=0) flag=false; | ^ a.cc:36:29: error: 'sum' was not declared in this scope 36 | if((a[(i+1)%n]-a[i]-sum)%n!=0) flag=false; | ^~~
s904393454
p03808
C++
#include<iostream> #include<cstdio> #include<cmath> #include<cstring> #include<string> #include<stack> #include<queue> #include<vector> #include<algorithm> #include<iomanip> #include<utility> typedef long long int ll; #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define REP(i,n) for(int i=0;i<signed(n);i++) #define EREP(i,n) for(int i=1;i<=signed(n);i++) #define ALL(a) (a).begin(),(a).end() using std::cout; using std::vector; using std::endl; using std::cin; using std::string; //#define EVEL 1 #ifdef EVEL #define DEB(X) cout << #X << ":" <<X<<" " ; #define TF(f) f ? cout<<"true " : cout<<"false "; #define END cout<<"\n"; #else #define DEB(X) {} #define TF(f) {} #define END {} #endif constexpr int MOD = 1000000007; constexpr ll INF = 50000000000000000; typedef std::pair<int,int> P; constexpr ll SIZE= 100010; ll N,A[100010],B[SIZE]; ll ans=0,sum=0,wa=0; int main() { std::ios_base::sync_with_stdio(false); cin>>N; REP(i,N){ cin>>A[i]; sum+=A[i]; wa+=i+1; } REP(i,N){ B[i]=A[(i+1)%N]-A[i]; } bool f=true,g=true; if(sum%wa!=0)g=false; REP(i,N){ B[i]-=sum/wa; } int cnt=0; REP(i,N){ if(B[(i+1)%N]-B[i]==-N)cnt++; else if(B[(i+1)%N]-B[i]!=0&&B[(i+1)%N]-B[i]=!N)f=false; } if(cnt!=sum/wa)f=false; cout<<(f&&g?"YES":"NO")<<endl; return 0; }
a.cc: In function 'int main()': a.cc:58:35: error: lvalue required as left operand of assignment 58 | else if(B[(i+1)%N]-B[i]!=0&&B[(i+1)%N]-B[i]=!N)f=false; | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
s769708828
p03808
C++
#include<bits/stdc++.h> #include<iostream> #include<string> #include<vector> #include<map> using namespace std; #define pb push_back #define mp make_pair #define fi first #define se second typedef long long ll; typedef long double ld; typedef unsigned long long ull; typedef vector<int> vi; struct pp{ll x,y;}; const int base = 1000*1000*1000; const int days[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; const int inf = (int)1e9; const int mod = 1e9+7; ll gcd (ll a, ll b) { while (b) { a %= b; swap (a, b); } return a; } /* void quickSort(int left, int right) { int i = left, j = right; pp tmp; int pivot = a[(left + right) / 2].x; while (i <= j) { while (a[i].x < pivot) i++; while (a[j].x > pivot) j--; if (i <= j) { swap(a[i],a[j]); i++,j--; } }; if (left < j) quickSort(left, j); if (i < right) quickSort(i, right); }*/ ll binpow (ll a, ll n) { ll res = 1; while (n) { if (n & 1) res *= a,res %= mod; a *= a,a %= mod; n >>= 1; } return res; } const int MaxN = 1e5 + 17; ll a[111111],n,sum; int main(){ cin>>n; for(ll i=0;i<n;i++){ cin>>a[i]; sum+=a[i]; } if(sum%(n*(n+1)/2)){ cout<<"NO"; return 0; }) ll x=sum/(n*(n+1)/2),cnt=0; for(ll i=0;i<n;i++)if(a[i]<x){ cout<<"NO"; return 0; } for(ll i=1;i<=n;i++){ ll b=a[i%n]-a[i-1]; if(abs(b+(n-1)*x)%n||b+(n-1)*x<0){ cout<<"NO"; return 0; } else cnt+=x-(b+(n-1)*x)/n; } cout<<"YES"; return 0; }
a.cc: In function 'int main()': a.cc:72:6: error: expected primary-expression before ')' token 72 | }) | ^ a.cc:74:32: error: 'x' was not declared in this scope 74 | for(ll i=0;i<n;i++)if(a[i]<x){ | ^ a.cc:80:24: error: 'x' was not declared in this scope 80 | if(abs(b+(n-1)*x)%n||b+(n-1)*x<0){ | ^ a.cc:84:14: error: 'cnt' was not declared in this scope; did you mean 'int'? 84 | else cnt+=x-(b+(n-1)*x)/n; | ^~~ | int
s506882401
p03808
C++
#include <bits/stdc++.h> using namespace std; ll n, sum a[10001]; int main () { cin >> n; for (int i = 1; i <= n; i ++) cin >> a[i], sum += a[i]; if (sum % (n * (n + 1) / 2) != 0) cout << "NO", exit (0); sum /= (n * (n + 1) / 2); a[n + 1] = a[1]; for (int i = 1; i <= n; i ++) { if (a[i + 1] - a[i] - sum > 0 || (a[i + 1] - a[i] - sum) % n != 0) cout << "NO", exit (0); } cout << "YES"; }
a.cc:5:1: error: 'll' does not name a type 5 | ll n, sum a[10001]; | ^~ a.cc: In function 'int main()': a.cc:8:16: error: 'n' was not declared in this scope; did you mean 'yn'? 8 | cin >> n; | ^ | yn a.cc:9:46: error: 'a' was not declared in this scope 9 | for (int i = 1; i <= n; i ++) cin >> a[i], sum += a[i]; | ^ a.cc:9:52: error: 'sum' was not declared in this scope 9 | for (int i = 1; i <= n; i ++) cin >> a[i], sum += a[i]; | ^~~ a.cc:10:13: error: 'sum' was not declared in this scope 10 | if (sum % (n * (n + 1) / 2) != 0) cout << "NO", exit (0); | ^~~ a.cc:11:9: error: 'sum' was not declared in this scope 11 | sum /= (n * (n + 1) / 2); | ^~~ a.cc:12:9: error: 'a' was not declared in this scope 12 | a[n + 1] = a[1]; | ^
s648787863
p03808
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; int main() { int n; cin >> n; ll sum = 0; vector<ll> a(n),d(n); for(int i = 0; i < n; i++){ cin >> a[i]; sum += a[i]; } ll k; if(sum % ((ll)n*(n+1)/2)==0){ k = sum / ((ll)n*(n+1)/2); }else{ cout << "NO" << endl; return 0; } for(int i = 0; i < n; i++){ d[i] = max(a[i] - a[(i+1)%n] + k,0); } ll q = 0; for(int i = 0; i < n; i++){ if(d[i]%(ll)n != 0){ cout << "NO" << endl; return 0; }else{ q += d[i]/(ll)n; } } if(k==q){ cout << "YES" << endl; }else{ cout << "NO" << endl; } return 0; }
a.cc: In function 'int main()': a.cc:26:19: error: no matching function for call to 'max(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type, int)' 26 | d[i] = max(a[i] - a[(i+1)%n] + k,0); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~ 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:26:19: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 26 | d[i] = max(a[i] - a[(i+1)%n] + k,0); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~ /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:26:19: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 26 | d[i] = max(a[i] - a[(i+1)%n] + k,0); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~
s078169890
p03808
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; int main() { ll n; cin >> n; ll sum = 0; vector<ll> a(n),d(n); for(int i = 0; i < n; i++){ cin >> a[i]; sum += (ll)a[i]; } ll k; if((sum % (n*(n+1)/2))==0){ k = sum / (n*(n+1)/2)); }else{ cout << "NO" << endl; return 0; } for(int i = 0; i < n; i++){ d[i] = a[i] - a[(i+1)%n] + k; } ll q = 0; for(int i = 0; i < n; i++){ if(d[i]%n != 0){ cout << "NO" << endl; return 0; }else{ q += d[i]/n; } } if(k==q){ cout << "YES" << endl; }else{ cout << "NO" << endl; } return 0; }
a.cc: In function 'int main()': a.cc:18:30: error: expected ';' before ')' token 18 | k = sum / (n*(n+1)/2)); | ^ | ;
s193375452
p03808
C++
#include<bits/stdc++.h> #define N 100050 #define INF 0x3fff #define ll long long using namespace std; ll n,a[N+5],sum=0; int main() { int maxx = 0,t; scanf("%lld",&n); for(int i=1; i<=n; i++) { scanf("%lld",&a[i]); if(a[i]>maxx) { maxx = a[i]; t = i; } sum+=a[i]; } int flag=1,t,m; if(sum%(n*(n+1)/2)==0) { int k=sum/(n*(n+1)/2); while(k--) { int p=1; maxx = 0; for(int i=t+1; i<=t+n; i++) { int k=i; if(k>n) k-=n; a[k]=a[k]-p; if(a[k]<0){ printf("NO\n"); return 0; } if(a[k]>maxx){maxx = a[k],m = k;} p++; } t = m; } } for(int i=1; i<=n; i++) { if(a[i]!=0) { flag=0; break; } } if(flag==1) printf("YES\n"); else printf("NO\n"); return 0; }
a.cc: In function 'int main()': a.cc:20:16: error: redeclaration of 'int t' 20 | int flag=1,t,m; | ^ a.cc:9:18: note: 'int t' previously declared here 9 | int maxx = 0,t; | ^
s283759135
p03808
C++
#include<iostream> #include<algorithm> #define LL long long int N; int A[100010]; LL sum; int main() { std::cin >> N; for (int i = 1; i <= N; i++) { scanf_s("%d",&A[i]); sum += A[i]; if (i == 0)A[0] = A[N]; } LL D = ((N + 1)*N) / 2; if (sum%D) { printf("%s\n", "NO"); return 0; } int ave = sum / D; for (int i = 1; i < N; i++) { int tmp = A[i] - A[i + 1] + ave; if (tmp < 0 || tmp % N) { printf("%s\n", "NO"); return 0; } } printf("%s\n", "YES"); return 0; }
a.cc: In function 'int main()': a.cc:11:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 11 | scanf_s("%d",&A[i]); | ^~~~~~~ | scanf
s658733421
p03808
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; #define REP(i,a) for(int i=0;i<(a);i++) #define MOD 1000000007 int main(){ int N; cin>>N; ll a[N]; ll sum=0; for(int i=0;i<N;i++){ cin>>a[i]; sum+=a[i]; } ll x=N*(N+1)/2,k=sum/x; bool flag=(sum%x==0); for(int i=0;i<N;i++){ ll d=a[(i+1)%N]-a[i]-k; cout<<d<<endl; flag&&=(d<=0&&d%N==0); } cout<<(flag?"YES":"NO")<<endl; return 0; }
a.cc: In function 'int main()': a.cc:22:11: error: expected primary-expression before '=' token 22 | flag&&=(d<=0&&d%N==0); | ^
s944115038
p03808
C++
#include <bits/stdc++.h> using namespace std; long long a[400001]; long long d[400001]; int main () { long long n, k = 0, c, ok = 0; cin >> n; for (int i = 1;i <= n;i ++) { cin >> a[i]; k += a[i]; } if (k % (n * (n + 1) / 2)) { cout << "NO"; return 0; } for (int i = 1;i < n;i ++) { d[i] = a[i + 1] - a[i] - (k / (n * (n + 1) / 2)); } d[n] = a[1] - a[n] - (k / (n * (n + 1) / 2)); for (int i = 1;i <= n;i ++) { if (d[i] % (n)) { ok += (abs (d[i]) / n) cout << "NO"; return 0; } } if (ok != k) cout << "NO"; else cout << "YES"; return 0; }
a.cc: In function 'int main()': a.cc:25:47: error: expected ';' before 'cout' 25 | ok += (abs (d[i]) / n) | ^ | ; 26 | cout << "NO"; | ~~~~
s494945365
p03808
C++
#include <iostream> #include <cmath> #include <ctime> #include <cstdlib> using namespace std; int main() { int n,i,j long long tt=0; long long sum=0,a[100001],dis; cin >> n; for (i=1;i<=n;i++) { cin >> a[i]; sum += a[i]; tt += i; } if ( sum%tt!=0) { cout << "NO"; return 0; } sum = sum / tt; long long fr=0; for (i=1;i<n;i++) { dis = a[i+1] - a[i]; if ((sum-dis)%n!=0) { cout << "NO"; return 0; } fr+= (sum-dis)/n; } dis = a[1] - a[n]; if ((sum-dis)%n!=0) { cout << "NO"; return 0; } fr+= (sum-dis)/n; if (fr==sum) cout << "YES"; else cout << "NO"; }
a.cc: In function 'int main()': a.cc:10:5: error: expected initializer before 'long' 10 | long long tt=0; | ^~~~ a.cc:17:9: error: 'tt' was not declared in this scope; did you mean 'tm'? 17 | tt += i; | ^~ | tm a.cc:20:14: error: 'tt' was not declared in this scope; did you mean 'tm'? 20 | if ( sum%tt!=0) | ^~ | tm a.cc:26:17: error: 'tt' was not declared in this scope; did you mean 'tm'? 26 | sum = sum / tt; | ^~ | tm
s317156204
p03808
C++
#include <iostream> #include <cmath> #include <ctime> #include <cstdlib> using namespace std; int main() { int n,i,j; long long tt = 0; long long sum=0,a[100001],dis; cin >> n; for (i=1;i<=n;i++) { cin >> a[i]; sum += a[i]; tt += i; } sum = sum / tt; long long fr; for (i=1;i<n;i++) { dis = a[i+1] - a[i]; if ((sum-dis)%n!=0) { cout << "NO"; return 0; } fr+= (sum-dis)/n; } dis = a[1] - a[n]; if ((sum-dis)%n!=0) { cout << "NO"; return 0; } fr+= (sum-dis)/n; if (fr==sum) cout << "YES"; else cout << "NO";
a.cc: In function 'int main()': a.cc:47:23: error: expected '}' at end of input 47 | else cout << "NO"; | ^ a.cc:8:1: note: to match this '{' 8 | { | ^
s087645914
p03808
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define REP(i,n) FOR(i,0,n) #define FOR(i,a,b) for(ll i=a;i<b;i++) #define PB push_back #define LB lower_bound #define UB upper_bound #define PQ priority_queue #define UM unordered_map #define ALL(a) (a).begin(),(a).end() typedef vector<ll> vi; typedef vector<vector<ll>> vvi; const ll INF = (1ll << 60); typedef pair<ll,ll> pii; struct Edge {ll s,t,d;}; typedef vector<vector<Edge>> Graph; ll min(vi a){ ll mi=INF; for(ll i:a) mi=min(mi,i); return mi; } ll sum(vi a){ ll ret=0; for(ll i:a) ret+=i; return ret; } int main(){ ll N; cin>>N; vi A(N); REP(i,N) cin>>A[i]; if(sm%(N*(N-1)/2)) {cout<<"NO"<<endl; return 0;} vi B(N); REP(i,N) B[i]=A[i]-A[(i+1)%N]; ll mi=min(B); ll sm=sum(A); if(sm/(N*(N-1)/2)+mi>=0) cout<<"YES"<<endl; else cout<<"NO"<<endl; }
a.cc: In function 'int main()': a.cc:35:6: error: 'sm' was not declared in this scope; did you mean 'tm'? 35 | if(sm%(N*(N-1)/2)) {cout<<"NO"<<endl; return 0;} | ^~ | tm
s794276082
p03808
C++
// Example program #include <bits/stdc++.h> using namespace std; const int MAXN = 2e5 + 1; typedef long long int ll; ll a[MAXN]; int main() { ll n; ll x = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; x += a[i]; } if (x % ((n * (n + 1)) / 2) == 0) { ll u = 0; for (int i = 0; i < n; i++) if (a[i] > u) u = a[i]; for (int i = 2; i < n; i++) { if (a[i] == u && a[i - 1] != u && a[i - 2] == u) { cout << "NO"; return ; } } sort(a, a + n); for (int i = 0; i < n; i++) { if (a[i] < (x / ((n * (n + 1)) / 2)) + i) { cout << "NO"; return 0; } } if (a[n - 1] > ((x / ((n * (n + 1)) / 2)) * n)) { cout << "NO"; return 0; } for (int i = 1; i < n; i++) { if (a[i] > a[i - 1] + n) { cout << "NO"; return 0; } } cout << "YES"; } else cout << "NO"; }
a.cc: In function 'int main()': a.cc:33:17: error: return-statement with no value, in function returning 'int' [-fpermissive] 33 | return ; | ^~~~~~
s663925676
p03808
C++
#include <bits/stdc++.h> using namespace std; using ll=long long; void NO(){cout<<"NO"<<endl;exit(0);} int main(){ ll n;cin>>n;ll x[100001];ll s=0;for(int i=0;i<n;++i)cin>>x[i],s+=x[i]; ll n2=n*(n+1)/2;ll k=s/n2;if(n2*k!=s)NO(); ll j=0;for(int i=0;i+1<N;++i){ll d=x[i+1]-x[i];if((d-k)%n!=0)NO();j+=k+(d-k)/n;} if(j!=n)NO();cout<<"YES"<<endl; return 0;}
a.cc: In function 'int main()': a.cc:8:24: error: 'N' was not declared in this scope 8 | ll j=0;for(int i=0;i+1<N;++i){ll d=x[i+1]-x[i];if((d-k)%n!=0)NO();j+=k+(d-k)/n;} | ^
s224011584
p03808
C++
#include "bits/stdc++.h" using namespace std; #define DEBUG(x) cout<<#x<<": "<<x<<endl; #define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl typedef long long ll; #define vi vector<int> #define vl vector<ll> #define vii vector< vector<int> > #define vll vector< vector<ll> > #define vs vector<string> #define pii pair<int,int> #define pis pair<int,string> #define psi pair<string,int> const int inf = 1000000001; const ll INF = 1e16; #define MOD 1000000007 #define mod 1000000009 #define pi 3.14159265358979323846 #define Sp(p) cout<<setprecision(15)<<fixed<<p<<endl; int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 }; int main(){ ll n, i, j; cin>>n; vl a(n); ll sum=0; for(i=0;i<n;i++){ cin>>a[i]; sum+=a[i]; } if(sum % (n*(n+1)/2) != 0){ cout<<"NO"<<endl; return 0; } ll m = sum/(n*(n+1)/2); vl num(n); for(i=1;i<n;i++){ ll sa = a[i]-a[i-1]; if((m-sa)%n!=0){ cout<<"NO"<<endl; return 0; } num[i-1] = (m-sa)/n; } ll sa = a[0]-a[n-1]; if((m-sa)%n!=0){ cout<<"NO"<<endl; return 0; } num[n-1] = (m-sa)/n; ll ans=0; for(i=0;i<n;i++){ ans += num[i]; } if(ans == m){ cout<<"YES"<<endl; }else{ cout<<"NO"<<endl; } return 0;
a.cc: In function 'int main()': a.cc:64:12: error: expected '}' at end of input 64 | return 0; | ^ a.cc:24:11: note: to match this '{' 24 | int main(){ | ^
s370122063
p03808
C++
#include <iostream> using namespace std; typedef long long int lint; const int NMAX = 100000 + 5; int N; lint A[NMAX]; lint APrim[NMAX]; lint mars[2 * NMAX]; int main() { //ios_base :: sync_with_stdio(false); //cin.tie(0); cin >> N; for (int i = 1; i <= N; ++ i) cin >> A[i]; lint S = 0; for (int i = 1; i <= N; ++ i) S += A[i]; lint onePass = N * (N + 1LL) / 2; if (S % onePass != 0) { cout << "NO\n"; return 0; } lint passes = S / onePass; APrim[0] = A[N]; for (int i = 1; i <= N; ++ i) APrim[i] = A[i]; lint sumAPrim = 0; for (int i = N; i; -- i) { APrim[i] -= APrim[i - 1]; APrim[i] -= passes; APrim[i] *= (-1); if (APrim[i] % N != 0) { cout << "NO\n"; return 0; } APrim[i] /= N; sumAPrim += APrim[i]; } if (sumAPrim != passes) cout << "NO\n"; else { cout << "YES\"; return 0; //Build waves generators for (int i = 1; i <= N; ++ i) { mars[i] += APrim[i]; mars[i + N] -= APrim[i]; } for (int i = 1; i <= 2 * N; ++ i) mars[i] += mars[i - 1]; //Propagate one -N for every wave, so that it suddenly stops for (int i = 1; i <= N; ++ i) mars[i + N] -= APrim[i] * N; for (int i = 1; i <= 2 * N; ++ i) mars[i] += mars[i - 1]; //Build circularity for (int i = 1; i <= N; ++ i) mars[i] += mars[i + N]; //Final check for (int i = 1; i <= N; ++ i) if (mars[i] != A[i]) { cout << "NO\n"; return 0; } } cout << "YES\n"; return 0; }
a.cc:55:17: warning: missing terminating " character 55 | cout << "YES\"; | ^ a.cc:55:17: error: missing terminating " character 55 | cout << "YES\"; | ^~~~~~~ a.cc: In function 'int main()': a.cc:56:9: error: expected primary-expression before 'return' 56 | return 0; | ^~~~~~
s985387625
p03808
C++
#include <iostream> //#include <sstream> #include <string> #include <algorithm> #include <cstdio> #include <cstring> #include <map> #include <set> #include <queue> #include <vector> #include <cmath> //#include <functional> //#define LL long long using namespace std; const int maxn = 100005; int a[maxn]; long long b[maxn]; int main() { // printf("ok"); #ifdef LOCAL // freopen("/Users/ecooodt/Desktop/c++ and acm/DI2_lesson/2/2.txt","r",stdin); #endif // printf("%d",-5%5) memset(a,0,sizeof(a)); int n,m; scanf("%d",&n); for(int i = 0; i < n; i++) { scanf("%d",&a[i]); } for(int i = 1; i < n; i++) { b[i-1] = a[i-1] - a[i]; } b[n-1] = a[n-1] - a[0]; long long int sum = 0; for(int i = 0; i < n; i++) { sum += a[i]; } int t = n*(1+n)/2; if(sum % t) { printf("NO\n"); return 0; } else { sum /= t; } for(int i = 0 ; i < n ; i++) { b[i] += sum; // printf("%d\n",b[i]); if(b[i] != 0 && (b[i] % n != 0|| b[i] < 0) { printf("NO\n"); return 0; } } printf("YES\n"); return 0; }
a.cc: In function 'int main()': a.cc:61:51: error: expected ')' before '{' token 61 | if(b[i] != 0 && (b[i] % n != 0|| b[i] < 0) | ~ ^ | ) 62 | { | ~ a.cc:66:5: error: expected primary-expression before '}' token 66 | } | ^
s896579330
p03808
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; bool solve(vector<ll> A) { } int main() { // メインプログラムここから ll n; cin >> n; vector<ll> A(n); REP(i, n) { cin >> A[i]; } ll n = A.size(); // ΣA[i] を求める ll sum = 0; REP(i, n) { sum += A[i]; } // 1回の操作で取り除く個数 ll K = n * (n+1) / 2; // 後で1つでも条件を満たさなかったらfalseにする bool ans = true; // 必要条件 if (sum % K == 0) { // 合計操作回数 ll T = sum / K; REP(i, n) { // 隣との差を埋められるか ll d = T + A[i] - A[(i+1)%n]; if (d < 0 || d % n != 0) { ans = false; } } } else { ans = false; } // 出力 if (ans) cout << "YES" << endl; else cout << "NO" << endl; }
a.cc: In function 'bool solve(std::vector<long long int>)': a.cc:8:1: warning: no return statement in function returning non-void [-Wreturn-type] 8 | } | ^ a.cc: In function 'int main()': a.cc:14:9: error: 'i' was not declared in this scope 14 | REP(i, n) { | ^ a.cc:14:5: error: 'REP' was not declared in this scope 14 | REP(i, n) { | ^~~ a.cc:17:8: error: redeclaration of 'll n' 17 | ll n = A.size(); | ^ a.cc:12:8: note: 'll n' previously declared here 12 | ll n; cin >> n; | ^
s530193364
p03808
C
#include <stdio.h> int a[100001]; int b[100001]; int n; long long int sum; int main(int argc, const char * argv[]) { scanf("%d",&n); for (int i = 0; i < n; i++){ scanf("%d",&a[i]); sum += a[i]; } if ((2*sum/n/(n+1) != 2.0*sum/n/(n+1))){ printf("NO\n"); return 0; } int t = int(2*sum/n/(n+1)); for (int i = 0; i < n - 1; i ++) b[i] = a[i + 1] - a[i] - t; b[n - 1] = a[0] - a[n - 1] - t; for (int i = 0; i < n; i ++) if (b[i]%n != 0){ printf("NO\n"); return 0; } printf("YES\n"); return 0; }
main.c: In function 'main': main.c:16:13: error: expected expression before 'int' 16 | int t = int(2*sum/n/(n+1)); | ^~~
s086703796
p03808
C++
#include<cstdio> #include<iostream> int s[100005]; int dis[100005]; int main(){ int n; while(scanf("%d",&n)==1) { int sum=0; for(int i=0;i<n;i++) { scanf("%d",&s[i]); sum+=s[i]; } if(((2*sum)%(n*(n+1)))!=0) { printf("NO\n"); continue; } sum/=(n*(n+1))/2; dis[1]=a[1]-a[n]; for(i=2;i<=n;i++) dis[i]=a[i]-a[i-1]; int cnt=0; for(i=1;i<=n;i++) { if((sum-dis[i]<0)||(sum-dis[i])%n) { printf("NO\n"); return 0; } else cnt+=(sum-dis[i])/n; } if(cnt!=sum)printf("NO\n"); else printf("YES\n"); } return 0; }
a.cc: In function 'int main()': a.cc:21:24: error: 'a' was not declared in this scope 21 | dis[1]=a[1]-a[n]; | ^ a.cc:22:21: error: 'i' was not declared in this scope 22 | for(i=2;i<=n;i++) | ^ a.cc:25:21: error: 'i' was not declared in this scope 25 | for(i=1;i<=n;i++) | ^
s764151075
p03808
C++
b
a.cc:1:1: error: 'b' does not name a type 1 | b | ^
s404080363
p03808
C++
#include<bits/stdc++.h> using namespace std; ll a[200000]; ll d[200000]; #define ll long long int main() { ll n; ll sum=0; cin>>n; for(int i=0;i<n;i++) { cin>>a[i]; sum+=a[i]; } for(int i=0;i<n-1;i++) { d[i]=a[i+1]-a[i]; } d[n-1]=a[0]-a[n-1]; if(sum%(n*(n+1)/2)==0) { ll k=sum/(n*(n+1)/2); for(int i=0;i<n;i++) { if((k-(d[i]))%n) { cout<<"NO"<<endl; return 0; } } cout<<"YES"<<endl; } else { cout<<"NO"<<endl; } }
a.cc:3:1: error: 'll' does not name a type 3 | ll a[200000]; | ^~ a.cc:3:1: note: the macro 'll' had not yet been defined a.cc:5:10: note: it was later defined here 5 | #define ll long long | ^~ a.cc:4:1: error: 'll' does not name a type 4 | ll d[200000]; | ^~ a.cc:4:1: note: the macro 'll' had not yet been defined a.cc:5:10: note: it was later defined here 5 | #define ll long long | ^~ a.cc: In function 'int main()': a.cc:13:14: error: 'a' was not declared in this scope 13 | cin>>a[i]; | ^ a.cc:18:9: error: 'd' was not declared in this scope 18 | d[i]=a[i+1]-a[i]; | ^ a.cc:18:14: error: 'a' was not declared in this scope 18 | d[i]=a[i+1]-a[i]; | ^ a.cc:20:5: error: 'd' was not declared in this scope 20 | d[n-1]=a[0]-a[n-1]; | ^ a.cc:20:12: error: 'a' was not declared in this scope 20 | d[n-1]=a[0]-a[n-1]; | ^
s716375311
p03808
C++
#include<bits/stdc++.h> using namespace std; int main(void){ int n; cin >> n; vector<int> a(n); for(int i=0;i<n;i++){ cin >> a[n]; } bool ok = true; int hoge = ((a[1]-a[0])%n + n)%n; for(int i=0;i+1<n;i++){ if ((a[i+1]-a[i])%n + n)%n != hoge) ok = false; } cout << (ok ? "YES" : "NO") << endl; return 0; }
a.cc: In function 'int main()': a.cc:15:25: error: expected primary-expression before '%' token 15 | if ((a[i+1]-a[i])%n + n)%n != hoge) ok = false; | ^
s624098872
p03808
C++
#include <cstdio> #include <vector> using namespace std; typedef long long ll; #define FOR(i,a,b) for(int i=(a);i<(int)(b);++i) #define rep(i,n) FOR(i,0,n) int main(){ ll n; scanf("%lld", &n); vector<ll> a(n+2); ll tot = 0; rep(i,n) { scanf("%lld", &a[i]); tot += a[i]; } ll sum = n * (n+1) / 2LL; if(tot % sum != 0) { puts("NO"); return 0; } vector<ll> d(n+2); ll cnt = 0; bool f = true; rep(i,n){ d[i] = (a[(i+1) % n] - a[i]); d[i] -= tot / sum; if(d[i] > 0) f = false, break; if(d[i] % n == 0) cnt += -d[i] / n; } if(cnt != tot / sum) f = false; puts(f ? "YES" : "NO"); return 0; }
a.cc: In function 'int main()': a.cc:30:33: error: expected primary-expression before 'break' 30 | if(d[i] > 0) f = false, break; | ^~~~~
s928160864
p03808
C++
#include <iostream> #include <vector> #include <cstdint> using namespace std; int main() { int_least32_t n; cin >> n; int_fast64_t sum{ 0 }; vector<int_least32_t> a( n + 1 ); for(auto i = 0; i < n; ++i) { cin >> a[i]; sum += a[i]; } a[n] = a[0]; if((sum % (n * (n + 1) / 2) != 0) { cout << "NO" << endl; return 0; } int_fast64_t temp, k{ sum / (n * (n + 1) / 2) }; for(auto i = 0; i < n; ++i) { temp = a[i + 1] - a[i] - k; if(temp > 0 || (-1 * temp) % n != 0) { //cout << "NO" << endl; //return 0; } } cout << "YES" << endl; }
a.cc: In function 'int main()': a.cc:21:42: error: expected ';' before '{' token 21 | if((sum % (n * (n + 1) / 2) != 0) { | ^~ | ; a.cc:26:26: error: expected initializer before ',' token 26 | int_fast64_t temp, k{ sum / (n * (n + 1) / 2) }; | ^ a.cc:26:26: error: expected ')' before ',' token 26 | int_fast64_t temp, k{ sum / (n * (n + 1) / 2) }; | ^ | ) a.cc:21:11: note: to match this '(' 21 | if((sum % (n * (n + 1) / 2) != 0) { | ^ a.cc:28:17: error: 'temp' was not declared in this scope; did you mean 'tm'? 28 | temp = a[i + 1] - a[i] - k; | ^~~~ | tm a.cc:28:42: error: 'k' was not declared in this scope 28 | temp = a[i + 1] - a[i] - k; | ^
s207316403
p03808
C++
#include <iostream> #include <vector> #include <cstdint> using namespace std; int main() { int_least32_t n; cin >> n; int_fast32_t sum{ 0 }; vector<int_least32_t> a( n ); for(auto& x : a) { cin >> x; sum += x; } int_fast32_t temp, k{ sum / (n * (n + 1) / 2) }; bool isok{ true }; for(auto i = 0; i < n - 1; ++i) { temp = a[i + 1] - a[i] - k; if(temp > 0 && -1 * temp % n != 0)) { isok = false; } } if(isok) { cout << "YES" << endl; } else { cout << "NO" << endl; } }
a.cc: In function 'int main()': a.cc:23:51: error: expected primary-expression before ')' token 23 | if(temp > 0 && -1 * temp % n != 0)) { | ^
s193936766
p03808
C++
#include <iostream> #include <vector> #include <cstdint> using namespace std; int main() { int_least32_t n; cin >> n; int_fast32_t sum{ 0 }; vector<int_least32_t> a( n ); for(auto& x : v) { cin >> x; sum += x; } int_least32_t k{ sum / (n * (n + 1) / 2) }; int_fast32_t temp; bool isok{ true }; for(auto i = 0; i < n - 1; ++i) { temp = a[i + 1] - a[i] - k; if(temp >= 0 || -1 * temp % n != 0) { isok = false; } } if(isok) { cout << "YES" << endl; } else { cout << "NO" << endl; } }
a.cc: In function 'int main()': a.cc:14:23: error: 'v' was not declared in this scope 14 | for(auto& x : v) { | ^ a.cc:19:30: warning: narrowing conversion of '(sum / ((int_fast32_t)((n * (n + 1)) / 2)))' from 'int_fast32_t' {aka 'long int'} to 'int_least32_t' {aka 'int'} [-Wnarrowing] 19 | int_least32_t k{ sum / (n * (n + 1) / 2) }; | ~~~~^~~~~~~~~~~~~~~~~~~
s903310004
p03808
C++
int_least32_t n; cin >> n; int_fast32_t sum{ 0 }; vector<int_least32_t> a( n ); for(auto& x : v) { cin >> x; sum += x; } int_least32_t k{ sum / (n * (n + 1) / 2) }; int_fast32_t temp; bool isok{ true }; for(auto i = 0; i < n - 1; ++i) { temp = a[i + 1] - a[i] - k; if(temp >= 0 || -1 * temp % n != 0) { isok = false; } } if(isok) { cout << "YES" << endl; } else { cout << "NO" << endl; }
a.cc:1:1: error: 'int_least32_t' does not name a type 1 | int_least32_t n; | ^~~~~~~~~~~~~ a.cc:2:9: error: 'cin' does not name a type 2 | cin >> n; | ^~~ a.cc:4:9: error: 'int_fast32_t' does not name a type 4 | int_fast32_t sum{ 0 }; | ^~~~~~~~~~~~ a.cc:5:9: error: 'vector' does not name a type 5 | vector<int_least32_t> a( n ); | ^~~~~~ a.cc:6:9: error: expected unqualified-id before 'for' 6 | for(auto& x : v) { | ^~~ a.cc:11:9: error: 'int_least32_t' does not name a type 11 | int_least32_t k{ sum / (n * (n + 1) / 2) }; | ^~~~~~~~~~~~~ a.cc:12:9: error: 'int_fast32_t' does not name a type 12 | int_fast32_t temp; | ^~~~~~~~~~~~ a.cc:14:9: error: expected unqualified-id before 'for' 14 | for(auto i = 0; i < n - 1; ++i) { | ^~~ a.cc:14:25: error: 'i' does not name a type 14 | for(auto i = 0; i < n - 1; ++i) { | ^ a.cc:14:36: error: expected unqualified-id before '++' token 14 | for(auto i = 0; i < n - 1; ++i) { | ^~ a.cc:21:9: error: expected unqualified-id before 'if' 21 | if(isok) { | ^~ a.cc:24:9: error: expected unqualified-id before 'else' 24 | else { | ^~~~
s302539593
p03808
C++
#include <bits/stdc++.h> using namespace std; typedef long long int ll; int n; int main() { cin >> n; vector<ll> v(n); for (auto& i : v) cin >> i; ll sum = 0; for (auto i : v) sum += i; if (sum % (n * (n+1) / 2)) { cout << "NO" << endl; return 0; } int k = sum / (n * (n + 1) / 2); int zero = 0, count = 0; for (int i = 0; i < n; i++) { int d = v[(i+1)%n] - v[i] - k; if (d == 0) zoro++; else if(d == n) count++; } if (count == k && zero == n - count) { cout << "YES" << endl; } else { cout << "NO" << endl; } return 0; }
a.cc: In function 'int main()': a.cc:24:21: error: 'zoro' was not declared in this scope; did you mean 'zero'? 24 | if (d == 0) zoro++; | ^~~~ | zero
s955961622
p03808
C++
#include<cstdio> int n, w[101000]; long long s, K; int main(){ int i; scanf("%d",&n); for(i=1;i<=n;i++){ scanf("%d",&w[i]); s += w[i]; } K = 1ll*n*(n+1)/2; if(s%K) goto f; s/=K; long long t=0; for(i=1;i<=n;i++){ if((w[i%n+1]%n-w[i]%n+n)%n != s%n)goto f; if(w[i%n+1] - w[i] > s)goto f; t += (s - (w[i%n+1] - w[i])) / n; } if(t!=s) goto f; puts("YES"); return 0; f: puts("NO"); }
a.cc: In function 'int main()': a.cc:23:1: error: jump to label 'f' 23 | f: | ^ a.cc:12:18: note: from here 12 | if(s%K) goto f; | ^ a.cc:14:15: note: crosses initialization of 'long long int t' 14 | long long t=0; | ^
s192826238
p03808
C++
#include <iostream> #include <cstdio> #include <vector> #include <algorithm> #include <set> #include <unordered_set> #include <unordered_map> #include <cstring> #include <string> #include <cmath> #include <functional> #include <queue> #include <map> using namespace std; typedef long long ll; const int M = 1e9 + 7; const int N = 1e5 + 7; const int MAX = 1e9 + 1; //从北开始顺时针 //int dx[] = {-1, 0, 1, 0}, dy[] = {0, 1, 0, -1}; //int exDx[] = {-1, -1, 0, 1, 1, 1, 0, -1}, exDy[] = {0, 1, 1, 1, 0, -1, -1, -1}; int a[N]; int b[N]; int main() { int i, j; int n; cin >> n; ll sum = 0; for (i = 0; i < n; ++i) { cin >> a[i]; sum += (ll)a[i]; } ll perRoundSum = (ll)(1 + n) * (ll)n / 2L; if (sum % perRoundSum != 0) { cout << "NO\n"; return 0; } int cnt = sum / perRoundSum; b[0] = a[0] - a[n - 1]; for (i = 1; i < n; ++i) { b[i] = a[i] - a[i - 1]; } bool flag = true; for (i = 0; i < n; ++i) { if (!(cnt - d[i] >= 0 && (cnt - d[i]) % n == 0)) { flag = false; break; } } cout << (flag ? "YES" : "NO") << endl; return 0; }
a.cc: In function 'int main()': a.cc:51:21: error: 'd' was not declared in this scope 51 | if (!(cnt - d[i] >= 0 && (cnt - d[i]) % n == 0)) { | ^
s983839970
p03808
C++
#include <bits/stdc++.h> using namespace std; #define F first #define S second #define mp make_pair #define pb push_back #define CLEAR(a) memset(a,0,sizeof a) #define REP(i,n) for(int i=0;i<n;i++) #define FOR(i,a,b) for(int i=a;i<=b;i++) #define fr freopen("input.txt", "r", stdin); #define fw freopen("output.txt", "w", stdout); #define int long long typedef long long LL; typedef pair<int,int> pii; const int MOD = 1e9 + 7; const int MAX = 1e5 + 5; int a[MAX]; vector<int> v; main() { int n,T = 0; cin >> n; if(n == 1){ cout <<"YES"; return 0; } REP(i, n) { cin >> a[i]; T += a[i]; } if (T % ((n*(n+1))/2) != 0){ cout << "NO"; return; } int m = T/((n*(n+1))/2); REP(i, n){ v.pb(a[(i+1)%n]-a[i]); } REP(i, v.size()){ if(m-v[i] < 0 || (m-v[i])%n) { cout <<"NO"; return 0; } } cout <<"YES"; return 0; }
a.cc:20:2: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 20 | main() { | ^~~~ a.cc: In function 'int main()': a.cc:34:9: error: return-statement with no value, in function returning 'int' [-fpermissive] 34 | return; | ^~~~~~
s166398049
p03808
C++
#include<iostream> using namespace std; int mian(){ cout<<"NO"<<endl;}
a.cc: In function 'int mian()': a.cc:4:18: warning: no return statement in function returning non-void [-Wreturn-type] 4 | cout<<"NO"<<endl;} | ^ /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
s011001334
p03808
C++
#include <cstdio> #include <cstring> #include <algorithm> #include <iostream> #define ll long long #define N 100005 #define inf 0x3f3f3f3f using namespace std; ll sum,a[N],t,tmp,n; int main() { cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; sum+=a[i]; t+=i; } if(sum%t)cout<<"NO"; else{ tmp=a[1]; for(int i=1;i<n;i++)a[i]=a[i+1]-a[i]; a[n]=tmp-a[n]; ll d=sum/t,ok=1; for(int i=1;i<=n&&ok;i++){ a[i]-=d; if(a[i]%n||a[i]>0)ok=0; } if(ok)cout<<"YES"; else cout<<"NO"; } return 0;
a.cc: In function 'int main()': a.cc:30:14: error: expected '}' at end of input 30 | return 0; | ^ a.cc:10:12: note: to match this '{' 10 | int main() { | ^
s946013039
p03808
Java
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf("%d",&n); long long array[n + 1]; long long diff[n]; long long sum = 0; for(int i = 1;i <= n;i++){ scanf("%lld",&array[i]); sum += array[i]; } array[0] = array[n]; if(sum % ((long)n * (n + 1)/2)){ printf("NO"); return 0; } int times = sum * 2 / ((long)n * (n + 1)); long long cnt = 0; for(int i = 0;i < n;i++){ diff[i] = array[i + 1] - array[i] - times; if(diff[i] > 0){ printf("NO"); return 0; } if(diff[i] < 0){ if(abs(diff[i]) % n){ printf("NO"); return 0; } cnt += abs(diff[i])/n; } } if(cnt > times){ printf("NO"); return 0; } printf("YES"); return 0; }
Main.java:1: error: illegal character: '#' #include <bits/stdc++.h> ^ Main.java:1: error: class, interface, enum, or record expected #include <bits/stdc++.h> ^ Main.java:8: error: not a statement long long array[n + 1]; ^ Main.java:8: error: not a statement long long array[n + 1]; ^ Main.java:9: error: not a statement long long diff[n]; ^ Main.java:9: error: not a statement long long diff[n]; ^ Main.java:10: error: not a statement long long sum = 0; ^ Main.java:21: error: not a statement long long cnt = 0; ^ Main.java:4: error: unnamed classes are a preview feature and are disabled by default. int main() ^ (use --enable-preview to enable unnamed classes) Main.java:7: error: illegal start of expression scanf("%d",&n); ^ Main.java:8: error: ';' expected long long array[n + 1]; ^ Main.java:8: error: ']' expected long long array[n + 1]; ^ Main.java:8: error: ';' expected long long array[n + 1]; ^ Main.java:9: error: ';' expected long long diff[n]; ^ Main.java:9: error: ';' expected long long diff[n]; ^ Main.java:10: error: ';' expected long long sum = 0; ^ Main.java:12: error: illegal start of expression scanf("%lld",&array[i]); ^ Main.java:21: error: ';' expected long long cnt = 0; ^ 18 errors
s244312725
p03808
C++
#include <iostream> #include <vector> #include <set> using namespace std; int main(){ int N, sum=0, k; cin>>N; vector<int> A(N), A2(N); for(int i=0; i<N; i++){ cin>>A[i]; sum+=A[i]; } if(sum%(N*(N+1)/2)!=0){ cout<<"NO"<<endl; rteurn 0; } k=sum/(N*(N+1)/2); for(int i=0; i<N; i++){ A2[i]=A[(i+1)%N]-A[i]; } set<int> s; for(int i=0; i<N; i++){ if(s.find(A2[i]-k)==s.end()){ s.insert((A2[i]-k)*-1); } } const set<int>::const_iterator ite=s.end(); for(set<int>::const_iterator it=s.begin(); it!=ite; ++it){ if((*it)%N!=0){ cout<<"NO"<<endl; return 0; } } cout<<"YES"<<endl; return 0; }
a.cc: In function 'int main()': a.cc:17:17: error: 'rteurn' was not declared in this scope 17 | rteurn 0; | ^~~~~~
s894901648
p03808
C++
#include <iostream> #include <cstdio> #include <vector> #include <cmath> #include <cstring> #include <numeric> #include <algorithm> #include <functional> #include <array> #include <map> #include <queue> #include <limits.h> #include <set> #include <stack> #include <random> #include <complex> #include <unordered_map> #define rep(i,s,n) for(int i = (s); (n) > i; i++) #define REP(i,n) rep(i,0,n) #define RANGE(x,a,b) ((a) <= (x) && (x) <= (b)) #define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b)) #define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d)) #define PW(x) ((x)*(x)) #define ALL(x) (x).begin(), (x).end() #define RALL(x) (x).rbegin(), (x).rend() #define MODU 1000000007 #define bitcheck(a,b) ((a >> b) & 1) #define bitset(a,b) ( a |= (1 << b)) #define bitunset(a,b) (a &= ~(1 << b)) #define MP(a,b) make_pair((a),(b)) #define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second)) #define pritnf printf #define scnaf scanf #define itn int #define PI 3.141592653589 #define izryt bool using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; template<typename A, size_t N, typename T> void Fill(A(&array)[N], const T &val) { std::fill((T*) array, (T*) (array + N), val); } pii Dir[8] = { //移動 { 0 ,1 },{ -1 ,0 },{ 1 ,0 },{ 0 ,-1 }, { 1 ,1 },{ 1 ,-1 },{ -1 ,1 },{ -1 ,-1 } }; #define int ll signed main() { int n; scnaf("%lld", &n); vector<int> num(n); vector<int> sa(n); int Min = INT_MAX,Max = 0; REP(i, n) { scanf("%lld", &num[i]); if (i) { sa[i-1] = num[i] - num[i - 1]; Min = min(Min,sa[i-1]); } } sa[n - 1] = num[0] - num[n-1]; Min = min(Min, sa[n-1]); int fcm = 0,fcc = 0; bool fc = 0; vector<int> dap; REP(i, n) { sa[i] -= Min; Max = max(Max, sa[i]); } REP(i, n) { if (sa[i] % n) { fc = 1; } if((Max-sa[i])/n) dap.push_back(i); fcc += (Max - sa[i]) / n; } if (fc) { printf("NO\n"); return 0; } int inc = 0; REP(j, dap.size()) { inc += (Max-sa[dap[j]])/n * ((((-dap[j])+n)%n) ? (((-dap[j]) + n) % n) : n); } int dapc = 0; int rad = 0,addr = (1+n)*n/2; //REP(i,) } if ((num[0] - inc) % addr) { printf("NO\n"); return 0; } rad = num[0] - inc; REP(i, n) { if (num[i] + rad != inc) { printf("NO\n"); return 0; } inc += fcc; if (dapc < n) { if (dap[dapc] == i) { inc -= Max-sa[dap[dapc]]; dapc++; } } } printf("YES\n"); return 0; }
a.cc:97:9: error: expected unqualified-id before 'if' 97 | if ((num[0] - inc) % addr) { | ^~ a.cc:102:9: error: 'rad' does not name a type 102 | rad = num[0] - inc; | ^~~ a.cc:18:20: error: expected unqualified-id before 'for' 18 | #define rep(i,s,n) for(int i = (s); (n) > i; i++) | ^~~ a.cc:19:18: note: in expansion of macro 'rep' 19 | #define REP(i,n) rep(i,0,n) | ^~~ a.cc:103:9: note: in expansion of macro 'REP' 103 | REP(i, n) { | ^~~ a.cc:18:41: error: expected constructor, destructor, or type conversion before '>' token 18 | #define rep(i,s,n) for(int i = (s); (n) > i; i++) | ^ a.cc:19:18: note: in expansion of macro 'rep' 19 | #define REP(i,n) rep(i,0,n) | ^~~ a.cc:103:9: note: in expansion of macro 'REP' 103 | REP(i, n) { | ^~~ a.cc:103:13: error: 'i' does not name a type 103 | REP(i, n) { | ^ a.cc:18:46: note: in definition of macro 'rep' 18 | #define rep(i,s,n) for(int i = (s); (n) > i; i++) | ^ a.cc:103:9: note: in expansion of macro 'REP' 103 | REP(i, n) { | ^~~ a.cc:116:15: error: expected constructor, destructor, or type conversion before '(' token 116 | printf("YES\n"); | ^ a.cc:118:9: error: expected unqualified-id before 'return' 118 | return 0; | ^~~~~~ a.cc:119:1: error: expected declaration before '}' token 119 | } | ^
s956501994
p03808
C++
#include <algorithm> #include <iostream> #include <cstring> #include <cstdio> #include <cmath> using namespace std; const int N=1e5+100; int a[N]; const int Max=1e5+10; bool prime[N]; void IsPrime(){ prime[0]=prime[1]=0;prime[2]=1; for(int i=3;i<Max;i++) prime[i]=i%2==0?0:1; int t=(int)sqrt(Max*1.0); for(int i=3;i<=t;i++) if(prime[i]) for(int j=i*i;j<Max;j+=2*i) prime[j]=0; } int main() { IsPrime(); int n; while(~scanf("%d",&n)) { long long sum=0,t; for(int i=1;i<=n;i++) {scanf("%d",&a[i]);sum+=a[i];} t=n; t=t*(t-1)/2; if(sum%t!=0) {puts("NO");continue;} int m=n; if(n==1) {puts("YES");continue;} while(m>1&&!prime[m]) m--; // cout<<m<<endl; int id=-1; for(int i=n;i>=1;i--) if(a[i]%m==0) { id=i;break; } if(id==-1) {puts("NO");continue;} int flag1=0,flag2=0,j,j1; // cout<<id<<endl; for(int i=id;i<=id+n;i++) { if(i%n==0) j=n; else j=i%n; if((m+i-id)%n==0) j1=n; else j1=(m+i-id)%n; // cout<<j1<<endl; if(a[j]%(i-id+1)) flag1=1; if(a[j]%(j1)) flag2=1; } if((!flag1||!flag2)&&) puts("YES"); else puts("NO"); } return 0; }
a.cc: In function 'int main()': a.cc:54:33: error: expected primary-expression before ')' token 54 | if((!flag1||!flag2)&&) puts("YES"); | ^
s504273513
p03808
C++
#include <iostream> #include <vector> using namespace std; int main(){ int N; vector<int> a; int b = 0; int sum = 0; int c = 0; int x; cin >> N; for(int i = 0; i < N; i++){ cin >> b; a.push_back(b); sum += b; } int trial = sum / (N*(N+1)/2); if (sum % (N*(N+1)/2) != 0){ cout << "NO" << endl; return 0; } for(int i = 0; i < N-1; i++){ if((a[i] + trial - a[i+1]) % N != 0 || a[i] + trial - a[i+1] < 0){ cout << "NO" << endl; return 0; } } } if((a[N-1] + trial - a[0]) % N != 0 || a[N-1] + trial - a[0]){ cout << "NO" << endl; return 0; } cout << "YES" << endl; return 0; }
a.cc:35:3: error: expected unqualified-id before 'if' 35 | if((a[N-1] + trial - a[0]) % N != 0 || a[N-1] + trial - a[0]){ | ^~ a.cc:41:3: error: 'cout' does not name a type 41 | cout << "YES" << endl; | ^~~~ a.cc:43:3: error: expected unqualified-id before 'return' 43 | return 0; | ^~~~~~ a.cc:44:1: error: expected declaration before '}' token 44 | } | ^