submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s267260981
p04020
C++
#include <bits/stdc++.h> #define LL long long #define N 1000005 using namespace std; LL int n,ar[N],sum; char c[N]; int main() { scanf("%lld",&n); for(int i=1;i<=n;i++ scanf("%d",&ar[i]); for(int i=1;i<=n;i++) { sum+=ar[i]/2; if(ar[i]%2 && ar[i+1]) sum++,ar[i+1]--; } //~ for(int i=1;i<=n;i++) //~ { /...
a.cc: In function 'int main()': a.cc:10:29: error: expected ')' before 'scanf' 10 | for(int i=1;i<=n;i++ | ~ ^ | ) 11 | scanf("%d",&ar[i]); | ~~~~~
s340665849
p04020
C++
#include<iostream> #include<vector> #include<string> #include<array> #include<cmath> #include<algorithm> #include<map> #include<set> #include<queue> #include<numeric> #include<iomanip> #include<utility> #include<cstdlib> #include<typeinfo> using namespace std; #define INF 1000000005 int main() { int n; std::vector<in...
a.cc: In function 'int main()': a.cc:55:9: error: 'sumb' was not declared in this scope; did you mean 'suma'? 55 | sumb += temp; | ^~~~ | suma
s408699243
p04020
C++
#pragma GCC optimize(2) #include<bits/stdc++.h> typedef long long ll; using namespace std; int main() { int n,a[100005]; bool vis[100005]; while(scanf("%d",&n)!=EOF) { LL ans=0; memset(vis,false,sizeof(vis)); for(int i=0; i<n; i++) { scanf("%d",&a[i]); if(a[i])vis[i]=true; ans+=a[i]/2; a[i]%=2; }...
a.cc: In function 'int main()': a.cc:9:17: error: 'LL' was not declared in this scope; did you mean 'll'? 9 | LL ans=0; | ^~ | ll a.cc:14:25: error: 'ans' was not declared in this scope; did you mean 'abs'? 14 | ans+=a[i]/2; ...
s657219657
p04020
C++
#include<bits/stdc++.h> #define int long long using namespace std; const int N=1e5+20; inline int read() { int x=0,f=1;char ch=getchar(); while(!isdigit(ch)){if(ch=='-') f=-1;ch=getchar();} while(isdigit(ch)){x=(x<<3)+(x<<1)+(ch&15);ch=getchar();} return x*f; } int n,a[N];ll ans; int main() { n=read(); for(int...
a.cc:14:12: error: 'll' does not name a type 14 | int n,a[N];ll ans; | ^~ cc1plus: error: '::main' must return 'int' a.cc: In function 'int main()': a.cc:22:17: error: 'ans' was not declared in this scope; did you mean 'abs'? 22 | ans+=a[i]/2;a[i]%=2; | ^~~ ...
s222089694
p04020
C++
#pragma comment(linker, "/stack:200000000") #pragma GCC optimize("Ofast") #pragma GCC optimize(3) #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #pragma GCC target("sse3","sse2","sse") #pragma GCC target("avx","sse4","sse4.1","sse4.2","ssse3") #pragma GCC target("f16c") #pragma GCC optimi...
a.cc:9:30: warning: '-fwhole-program' is not an option that controls warnings [-Wpragmas] 9 | #pragma GCC diagnostic error "-fwhole-program" | ^~~~~~~~~~~~~~~~~ a.cc:10:30: warning: '-fcse-skip-blocks' is not an option that controls warnings [-Wpragmas] 10 | #pragma GCC diagnos...
s811172890
p04020
C++
#include<bits/stdc++.h> #define ll long long #define pb push_back using namespace std; const int mnx = 3e5 + 9; const int mod = 1e9 + 7; ll n; ll a[mnx]; int main(){ cin>>n; for(int i=1; i<=n; i++){ cin>>a[i]; } for(int i=1; i<=n; i++){ ans += a[i] / 2; if(a[i] % 2 != 0 && a[i+1] != 0){ ans++; a[i+1]-...
a.cc: In function 'int main()': a.cc:21:5: error: 'ans' was not declared in this scope; did you mean 'abs'? 21 | ans += a[i] / 2; | ^~~ | abs a.cc:25:7: error: 'ans' was not declared in this scope; did you mean 'abs'? 25 | cout<<ans<<'\n'; | ^~~ | abs
s696110723
p04020
C++
#include "stdafx.h" #include <cstdio> #include <cstdlib> #include <cmath> #include <climits> #include <cfloat> #include <map> #include <utility> #include <set> #include <iostream> #include <memory> #include <string> #include <vector> #include <algorithm> #include <functional> #include <sstream> #include <complex> #in...
a.cc:1:10: fatal error: stdafx.h: No such file or directory 1 | #include "stdafx.h" | ^~~~~~~~~~ compilation terminated.
s728713650
p04020
C++
#include <bits/stdc++.h> using namespace std; const int N = 100005; int n, num, a[N], b[N]; ll cnt; int main () { cin >> n, cnt = 0; for (int i = 1; i <= n; ++i) scanf("%d", &a[i]); for (int i = 1; i <= n; ++i) cnt += a[i] >> 1, a[i] &= 1; for (int i = 1; i <= n; ++i) if (a[i]) b[++num] = i; for (int i = 1; i < n...
a.cc:5:25: error: 'll' does not name a type 5 | int n, num, a[N], b[N]; ll cnt; | ^~ a.cc: In function 'int main()': a.cc:7:19: error: 'cnt' was not declared in this scope; did you mean 'int'? 7 | cin >> n, cnt = 0; | ^~~ | in...
s793265317
p04020
C++
#include <bits/stdc++.h> using namespace std; const int N = 100005; int n, num, a[N], b[N]; ll cnt; int main () { cin >> n, cnt = 0; for (int i = 1; i <= n; ++i) scanf("%d", &a[i]); for (int i = 1; i <= n; ++i) cnt += a[i] >> 1, a[i] &= 1; for (int i = 1; i <= n; ++i) if (a[i]) b[++num] = i; for (int i = 1; i < n...
a.cc:5:25: error: 'll' does not name a type 5 | int n, num, a[N], b[N]; ll cnt; | ^~ a.cc: In function 'int main()': a.cc:7:19: error: 'cnt' was not declared in this scope; did you mean 'int'? 7 | cin >> n, cnt = 0; | ^~~ | in...
s621654482
p04020
C++
#include <bits/stdc++.h> using namespace std; int main(){ long long ans=0,a,cnt=0; int n; cin>>n; for(int i=0;i<n;i++){ cin>>a; if(a)cnt+=a[i]; else{ ans+=cnt/2; cnt=0; } } cout<<ans+(cnt/2)<<endl; return 0; }
a.cc: In function 'int main()': a.cc:9:20: error: invalid types 'long long int[int]' for array subscript 9 | if(a)cnt+=a[i]; | ^
s237306650
p04020
C++
#include <bits/stdc++.h> using namespace std; int main(){ long long ans=0; int n,a[100000],int cnt=0; cin>>n; for(int i=0;i<n;i++){ cin>>a[i]; if(a[i])cnt+=a[i]; else{ ans+=cnt/2; cnt=0; } } cout<<ans+(cnt/2)<<endl; return 0; }
a.cc: In function 'int main()': a.cc:5:21: error: expected unqualified-id before 'int' 5 | int n,a[100000],int cnt=0; | ^~~ a.cc:9:17: error: 'cnt' was not declared in this scope; did you mean 'int'? 9 | if(a[i])cnt+=a[i]; | ^~~ | ...
s469979320
p04020
C++
#include <iostream> #include<bits/stdc++.h> using namespace std; int solve(vector<int>&a) { int n=a.size(); int d=0; for(int i=0;i<n;i++){ if(a==0)continue; if(!(a[i]%2)) { d+=a[i]/2; } else { d+=a[i]/2; if(i+1<n&&a[i+1]!=0)...
a.cc: In function 'int solve(std::vector<int>&)': a.cc:10:17: error: no match for 'operator==' (operand types are 'std::vector<int>' and 'int') 10 | if(a==0)continue; | ~^~~ | | | | | int | std::vector<int> In file incl...
s970447932
p04020
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; #define MOD 1000000007 int main(){ int n; cin>>n; ll a[n]; for(int i=0;i<n;i++) cin>>a[i]; ll ans=0; for(int i=0;i<n-1;i++){ ans+=a[i]/2; if(a[i]%2==1&&a[i+1]>=1){ a[i+1]--; ans++; } ...
a.cc: In function 'int main()': a.cc:22:9: error: expected primary-expression at end of input 22 | return | ^ a.cc:22:9: error: expected ';' at end of input 22 | return | ^ | ; a.cc:22:9: error: expected '}' at end of input a.cc:7:11: note: to match this '{' 7 | i...
s434070288
p04020
C++
#include <bits/stdc++.h> #define ll long long using namespace std; int n; ll a[100005]; ll kilk(int l,int r) { ll s1=0; for(int i=l;i<=r;i++) s1+=a[i]; return s1/2; } int main()a { cin>>n; for(int i=1;i<=n;i++) cin>>a[i]; ...
a.cc:17:11: error: expected initializer before 'a' 17 | int main()a | ^
s126269103
p04020
C++
#include <iostream> using namespace std; int main() { int n; cin >> n; int a[n]; int ans = 0; bool r = false; for (int i = 0,i < n,i++) { cin >> a[i]; ans += a[i] / 2; a[i] = a[i] % 2; } for (int i = 0,i < n,i++) { if (a[i] == 1) { if (r) { ans++; r = false; } else { r = true; ...
a.cc: In function 'int main()': a.cc:11:25: error: expected ';' before '<' token 11 | for (int i = 0,i < n,i++) { | ^~ | ; a.cc:11:26: error: expected primary-expression before '<' token 11 | for (int i = 0,i < n,i++) { | ...
s497053821
p04020
C++
#include <iostream> #include <cmath> #include <algorithm> using namespace std; int tree[100010]; int root(int x) { return tree[x] == x ? x : tree[x] = root(tree[x]); } int main() { int N, A[100010]; cin >> N; int d = 0; int a,b; for (int i = 0; i < N; i++) { cin >> A[i]; } for (int i = 0; i < N; i++) { ...
a.cc: In function 'int main()': a.cc:33:18: error: expected '}' at end of input 33 | return 0; | ^ a.cc:13:12: note: to match this '{' 13 | int main() { | ^
s668554816
p04020
C++
#include <iostream> #include <algorithm> #include <string> #include <regex> using namespace std; int main() { int N,A[100010]; cin >> N; for (int i = 0; i < N; i++)cin >> A[i]; int d = 0; for (int i = 0; i < N - 1; i++) { while (A[i] > 0 && A[i + 1] > 0) { d++; A[i]--; A[i + 1]--; } } for (int i = ...
a.cc: In function 'int main()': a.cc:23:27: error: expected '}' at end of input 23 | cout << d << endl; | ^ a.cc:8:1: note: to match this '{' 8 | { | ^
s129706111
p04020
C++
#include <bits/stdc++.h> using namespace std; typedef long longll; int main() { int n; cin >> n; ll res = 0; ll keep = 0; for(int i=0; i<n; i++) { ll a; cin >> a; if(keep==1 && a>0) { res++; a--; } res+= a / 2; keep = a % 2; } cout << res << endl; }
a.cc: In function 'int main()': a.cc:10:9: error: 'll' was not declared in this scope 10 | ll res = 0; | ^~ a.cc:11:11: error: expected ';' before 'keep' 11 | ll keep = 0; | ^~~~~ | ; a.cc:14:19: error: expected ';' before 'a' 14 | l...
s653179434
p04020
C++
import java.util.Scanner; public class Main { public static void main(String[] args) { new Main().solve(); } void solve(){ Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int[]a=new int[n]; for(int i=0;i<n;i++)a[i]=sc.nextInt(); int pair_count=0; for(int i=0;i<n;i++){ if(a[i]%2==0){ p...
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:3:1: error: expected unqualified-id before 'public' 3 | public class Main { | ^~~~~~
s749531659
p04020
C++
#include<bits/stdc++.h> using namespace std; int main() { long long t=0,c=0; int n,i,k; cin>>n; for(i=0,i<n;i++) { cin>>k; if(k==0) { t+=c/2; c=0; } c+=k; } t+=c/2; cout<<t<<endl; return 0; }
a.cc: In function 'int main()': a.cc:8:24: error: expected ';' before ')' token 8 | for(i=0,i<n;i++) { | ^ | ;
s662378958
p04020
C++
# include <stdio.h> # include <string.h> # include <stdlib.h> # include <queue> # include <stack> # include <map> # include <math.h> # include <algorithm> using namespace std; # define MAXN 55 # define MAXM 100005 # define INF 1000000000 # define MIN(a,b) (a)>(b)?(b):(a) # define MAX(a,b) (a)<(b)?(b):(a) # define mem(a...
a.cc:19:9: error: '__int64' does not name a type; did you mean '__int64_t'? 19 | typedef __int64 LL; | ^~~~~~~ | __int64_t a.cc: In function 'int main()': a.cc:28:5: error: 'LL' was not declared in this scope 28 | LL ans=0; | ^~ a.cc:30:32: error: 'ans' was not declared i...
s545894998
p04020
C++
#include <bits/stdc++.h> using namespace std; const int MAX_N = 100000; const int INF = 1e9; #define int long long; int n; int a[MAX_N+10]; signed main(){ cin>>n; for(int i=1;i<=n;i++)cin>>a[i]; int ans=0; for(int i=1;i<=n;i++){ ans+=a[i]/2; a[i]%=2; if(a[i]==1 && a[i+1]!=0 && i!=n){ a[i...
a.cc:7:18: error: declaration does not declare anything [-fpermissive] 7 | #define int long long; | ^~~~ a.cc:9:1: note: in expansion of macro 'int' 9 | int n; | ^~~ a.cc:9:5: error: 'n' does not name a type 9 | int n; | ^ a.cc:7:18: error: declaration does not declare...
s687428289
p04020
C++
#include <bits/stdc++.h> using namespace std; const int MAX_N = 100000; const int INF = 1e9; #define int ll; int n; int a[MAX_N+10]; signed main(){ cin>>n; for(int i=1;i<=n;i++)cin>>a[i]; int ans=0; for(int i=1;i<=n;i++){ ans+=a[i]/2; a[i]%=2; if(a[i]==1 && a[i+1]!=0 && i!=n){ a[i+1]--; ...
a.cc:7:13: error: 'll' does not name a type 7 | #define int ll; | ^~ a.cc:9:1: note: in expansion of macro 'int' 9 | int n; | ^~~ a.cc:9:5: error: 'n' does not name a type 9 | int n; | ^ a.cc:7:13: error: 'll' does not name a type 7 | #define int ll; | ...
s451089086
p04020
C++
#include <stdio.h> int main(void){ int i,n,s=0; scanf("%d",&n); int a[n]; for(i=0;i<n;i++){ scanf("%d",&a[i]); } for(i=0;i<n;i++){ if(a[i]%2==0){ s+=a[i]/2; } else if(a[i]%2==1){ s+=(a[i]-1)/2; if(a[i+1]>=1&&i+1<n){ ...
a.cc:25:2: error: stray '#' in program 25 | }#include <stdio.h> | ^ a.cc:25:3: error: 'include' does not name a type 25 | }#include <stdio.h> | ^~~~~~~
s678972159
p04020
Java
public class Main { void run() { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new int[n + 1]; for (int i = 0; i < n; i++) { a[i] = sc.nextInt(); } long sum = 0; for (int i = 0; i < n; i++) { sum += a[i] / 2; a[i] %= 2; if (0 < a[i] && 0 < a[i + 1]) { sum++; a...
Main.java:3: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:3: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors
s123928965
p04020
Java
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.*; public class Main { int N; int[] A; public void solve() { N = nextInt(); A = new int[N]; for(int i = 0;i < N;i++){ A[i] = nextInt(); } long ans = 0; for(int i = 0;i < N - 1;i++){ int min = M...
Main.java:30: error: cannot find symbol out.println(ans9); ^ symbol: variable ans9 location: class Main 1 error
s034558449
p04020
C
#include <stdio.h> int n, data[100001], tmp; int main(void) { int i, j; long long int ans; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d", &data[i]); } tmp = 0; for (i = 0; i < n; i++) { if (data[i] != 0) { data[i] += tmp; ans += data[i] / 2; ...
main.c: In function 'main': main.c:24:13: error: expected ';' before '}' token 24 | return 0 | ^ | ; 25 | } | ~
s554516322
p04020
C++
#include <stdio.h> unsigned long long int min(unsigned long long int a,unsigned long long int b){ if(a > b) return a; else return b; } int main(void) { unsigned long long int N = 0,A[100000] = {0}; int i = 0,j = 0,k = 0,l = 0; unsigned long long int ans = 0; scanf("%d",&N); for(i = 0;i < N;i++) scanf...
a.cc: In function 'int main()': a.cc:28:42: error: expected ';' before 'A' 28 | A[i] -= l | ^ | ; 29 | A[i + 1] -= l; | ...
s523014565
p04020
C++
unsigned long long int min(unsigned long long int a,unsigned long long int b){ if(a < b) return a; else return b; } int main(void) { unsigned long long int N = 0,A[100000] = {0}; int i = 0,j = 0,k = 0,l = 0; unsigned long long int ans = 0; scanf("%d",&N); for(i = 0;i < N;i++) scanf("%d",&A[i]); for(...
a.cc: In function 'int main()': a.cc:14:9: error: 'scanf' was not declared in this scope 14 | scanf("%d",&N); | ^~~~~ a.cc:32:9: error: 'printf' was not declared in this scope 32 | printf("%lld\n",ans); | ^~~~~~ a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; ...
s907495364
p04020
C++
8 2 0 1 6 0 8 2 1
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 8 | ^
s160180691
p04020
Java
import java.util.*; import java.io.*; public class Main{ static final Reader sc = new Reader(); static final PrintWriter out = new PrintWriter(System.out,false); public static void main(String[] args) throws Exception { int n = sc.nextInt(); long[] a = new long[n]; for(int i=0;i<n;i++){ ...
Main.java:21: error: ';' expected a[i]-=0 ^ 1 error
s492342809
p04020
C++
\#include<cstdio> #include<iostream> #include<cmath> #include<ctype.h> #include<vector> #include<cstdlib> #include<cstdlib> #include<string> #include<algorithm> #include<stack> #include<queue> #include<map> #include<set> #include<time.h> #define ll long long #define LL long long #define ULL unsigned long long #define...
a.cc:1:1: error: stray '\' in program 1 | \#include<cstdio> | ^ a.cc:1:2: error: stray '#' in program 1 | \#include<cstdio> | ^ a.cc:1:3: error: 'include' does not name a type 1 | \#include<cstdio> | ^~~~~~~ In file included from /usr/include/c++/14/iosfwd:42, from /usr...
s773988125
p04020
Java
import java.util.Scanner; public class B { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long[] cards = new long[n]; for (int i = 0; i < n; i++) { cards[i] = sc.nextInt(); } int pairCount = 0; ...
Main.java:3: error: class B is public, should be declared in a file named B.java public class B { ^ 1 error
s997744933
p04020
C++
#include<iostream> #include<queue> #include<cstring> #include<vector> using namespace std; typedef long long ll; int main() { int n; cin>>n; vector<ll> v; for(int i=0;i<n;i++) { ll a; cin>>a; v.push_back(a); } ll dp1[n+1]; ll dp2[n+1]; memset(dp1,0,sizeof(dp1)...
a.cc: In function 'int main()': a.cc:27:72: error: expected ')' before ';' token 27 | dp2[i]=max(dp2[i-1],((dp1[i-1]-(v[i-1]/2))+((v[i-1]+(v[i]/2)))); | ~ ^ | ...
s254322890
p04020
C++
#include<cstdio> #include<cstring> long long int a[100010]; int main(){ int n long long int ans=0; scanf("%d",&n); for(int i=1;i<=n;i++){ scanf("%lld",&a[i]); if(a[i]!=0 && a[i]%2==0){ ans+=(a[i]/2-1); a[i]=2; } else if(a[i]!=0){ ans+=(a[i]/2); a[i]=1; } //printf("ans1:%d\n",ans); ...
a.cc: In function 'int main()': a.cc:9:9: error: expected initializer before 'long' 9 | long long int ans=0; | ^~~~ a.cc:10:21: error: 'n' was not declared in this scope 10 | scanf("%d",&n); | ^ a.cc:14:25: error: 'ans' was not declared in this scope 14 ...
s467952214
p04020
Java
import java.util.Scanner; public class B { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long[] cards = new long[n]; for (int i = 0; i < n; i++) { cards[i] = sc.nextInt(); } int pairCount = 0; ...
Main.java:3: error: class B is public, should be declared in a file named B.java public class B { ^ 1 error
s671574268
p04020
C++
//ここからテンプレート //#define PLASMA_NO_BOOST #if 1 #include<iostream> #include<list> #include<algorithm> #include<utility> #include<type_traits> #include<tuple> #include<memory> #include<iterator> #include<string> #include<functional> #include<list> #include<array> #include<complex> #include<numeric> #include<iomanip> #incl...
a.cc:29:9: fatal error: boost/optional.hpp: No such file or directory 29 | #include<boost/optional.hpp> | ^~~~~~~~~~~~~~~~~~~~ compilation terminated.
s784502730
p04020
C++
#include <sstream> #include <string> #include <vector> #include <algorithm> #include <numeric> #include <set> #include <map> #include <queue> #include <iostream> #include <cstdio> #include <cmath> #include <cstring> using namespace std; int main(){ int N,ret=0; long long int tmp; vector<long long int> A; cin>>N;...
a.cc: In function 'int main()': a.cc:65:2: error: expected '}' at end of input 65 | } | ^ a.cc:16:11: note: to match this '{' 16 | int main(){ | ^
s079693158
p04020
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; import java.math.*; public class Main { public static void main(String[] args)throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new Strin...
Main.java:22: error: incompatible types: possible lossy conversion from long to int a[i] = v-e*2; ^ 1 error
s077470554
p04020
C
#include<stdio.h> int main(void){ int i=0,j=0; int x=0,y[10000000000]; scanf("%d",&x); for (j= 1; j<= x; ++j) { scanf("%d",&y[j]) } for (i = 1; i <= x; ++i) { j+=y[i]/2;y[i+1]=y[i]%2; } printf("%d\n",j); return 0; }
main.c: In function 'main': main.c:10:34: error: expected ';' before '}' token 10 | scanf("%d",&y[j]) | ^ | ; 11 | } | ~
s040122631
p04020
C++
#include <bits/stdc++.h> using namespace std; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<string> vs; typedef vector<bool> vb; typedef vector<vb> vvb; typedef pair<int, int> pii; typedef long long ll; typedef unsigned long long ull; #define all(a) (a).begin(),(a).end() #define rall(a) (a).rbegin()...
a.cc: In function 'int main()': a.cc:31:29: error: 'a' was not declared in this scope 31 | std::vector<long long> v; a(n); | ^
s600117957
p04020
Java
import java.util.Scanner; public class B { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long[] cards = new long[n]; for (int i = 0; i < n; i++) { cards[i] = sc.nextInt(); } int pairCount = 0; ...
Main.java:3: error: class B is public, should be declared in a file named B.java public class B { ^ 1 error
s056785172
p04020
C++
//VS2015エラー回避用 #define _CRT_SECURE_NO_WARNINGS 0 //include #include<stdio.h> #include<stdlib.h> //関数プロトタイプ宣言 void probremA(void); void probremB(void); void probremC(void); void probremD(void); //メイン関数 int main(void) { //A問題 //probremA(); //B問題 probremB(); //C問題 //probremC(); //D問題 //probremD(); // getchar...
a.cc: In function 'void probremC()': a.cc:166:23: error: 'pairs' was not declared in this scope 166 | printf("%ld", pairs); | ^~~~~ a.cc:168:14: error: invalid conversion from 'long int' to 'void*' [-fpermissive] 168 | free(ope1); | ^~~~ | ...
s815695235
p04020
C++
#include<bits/stdc++.h> #define range(i,a,b) for(int i = (a); i < (b); i++) #define rep(i,b) range(i,0,b) #define all(a) (a).begin(), (a).end() #define debug(x) cout << "debug " << x << endl; #define INF (1 << 30) using namespace std; int main(){ long long a[200005]; long longn; long long ans = 0; cin...
a.cc: In function 'int main()': a.cc:14:12: error: 'n' was not declared in this scope 14 | cin >> n; | ^
s003377755
p04020
C++
#include <vector> #include <cstdlib> using namespace std; int main() { int n,d,cnt=0; vector<long long> a; cin >> n; for (int i = 0; i < n; i++) { cin >> d; a.push_back(d); } for (int i = 0; i < n; i++) { cnt += a[i] / 2; if (i != n - 1) { if (a[i] % 2 == 1) { if (abs(a[i + 1] - a[i]) <= 1) { ...
a.cc: In function 'int main()': a.cc:7:9: error: 'cin' was not declared in this scope 7 | cin >> n; | ^~~ a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 2 | #include <cstdlib> +++ |+#include <iostream> 3 | using ...
s165504069
p04020
C++
#include <iostream> #include <fstream> #include <typeinfo> #include <vector> #include <cmath> #include <map> #include <string> #include <algorithm> #include <cstdio> #include <queue> #include <iomanip> #include <cctype> #define syosu(x) fixed<<setprecision(x) using namespace std; using namespace std; typedef long long ...
a.cc: In function 'int main()': a.cc:34:17: error: no match for 'operator=' (operand types are 'std::vector<long long int>' and 'vi' {aka 'std::vector<int>'}) 34 | num=vi(n); | ^ In file included from /usr/include/c++/14/vector:72, from a.cc:4: /usr/include/c++/14/bits/...
s269317627
p04020
Java
import java.io.BufferedReader; import java.io.InputStreamReader; public class B { public static void main(String[] args) throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int N = Integer.parseInt(br.readLine()); int[] A = new int[N]; int sum = 0; for(int i=0;i<N;i+...
Main.java:4: error: class B is public, should be declared in a file named B.java public class B { ^ 1 error
s583585324
p04020
C++
#include "stdio.h" int i = 0; int num; long long int figure[100000]; long long int box[100000]; long long int ans=0; long long int sum = 0; int main() { sscanf("%d", &num); for (i = 0; i < num; i++) { figure[i] = 0; box[i] = 0; sscanf("%lld", &figure[i]); box[i] = figure[i]; } for (i = 0; i < num-1; i++)...
a.cc: In function 'int main()': a.cc:12:22: error: cannot convert 'int*' to 'const char*' 12 | sscanf("%d", &num); | ^~~~ | | | int* In file included from a.cc:1: /usr/include/stdio.h:431:43: note: initializing argument 2 of '...
s504963175
p04020
C++
#include <iostream> using namespace std; long long n; unsigned long long a[1000000]; unsigned long long dp[1000000][3]; int main() { cin >> n; for(int i = 1 ; i <= n ; i++) { cin >> a[i]; } dp[1][0] = a[1] / 2; dp[1][1] = (a[1] + a[2]) / 2; for(int i = 2 ; i <= n ; i++) { ...
a.cc: In function 'int main()': a.cc:23:28: error: no matching function for call to 'max(long long unsigned int)' 23 | else dp[i][1] = max(dp[i-1][0] + ((a[i]/2) , dp[i-1][1] )); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, ...
s522307769
p04020
C++
#include <iostream> using namespace std; long long n; unsigned long long a[1000000]; unsigned long long dp[1000000][3]; int main() { cin >> n; for(int i = 1 ; i <= n ; i++) { cin >> a[i]; } dp[1][0] = a[1] / 2; dp[1][1] = (a[1] + a[2]) / 2; for(int i = 2 ; i <= n ; i++) { ...
a.cc: In function 'int main()': a.cc:23:66: error: expected ')' before ';' token 23 | else dp[i][1] = max(dp[i-1][0] + ((a[i]/2) , dp[i-1][1] ); | ~ ^ | )
s062235520
p04020
C++
#include <bits/stdc++.h> using namespace std; LL q,rs,n,a; int main() { cin>>n; for(int i=1; i<=n; ++i) { cin>>a; if(a%2==1) { rs+=a/2; if(q) { q=0; rs++; }else { q=1; } }else { if(a>=2){ rs+=a/2; }else q=0; } } cout<<rs; }
a.cc:4:1: error: 'LL' does not name a type 4 | LL q,rs,n,a; | ^~ a.cc: In function 'int main()': a.cc:7:14: error: 'n' was not declared in this scope; did you mean 'yn'? 7 | cin>>n; | ^ | yn a.cc:10:22: error: 'a' was not declared in this scope 10 | ...
s603785230
p04020
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main(){ int n,a; cin>>n; int arr[n]; for(int i=0; i<n; ++i){ arr[i]=0; } for(int i=0; i<n; ++i){ cin>>a; arr[i-1]=a; } int x=0; for(int i=0; i<n; ++i){ int b=arr[i]; while(1){ if(b<2){ arr[i]=b; ...
a.cc: In function 'int main()': a.cc:30:16: error: expected primary-expression before ';' token 30 | arr[i-1]-; | ^
s235871497
p04020
C++
#include <iostream> using namespace std ; int main() { int t ; cin>>t ; long int a[t], z ; long long int ans = 0 ; for (int i=0;i<t;i++) cin>>a[i] ; for (int i=0;i<t-1;i++) { z = min(a[i],a[i+1]) ; ans += z ; a[i+1] -= z ; a[i] -= z ; ans += a[i]/2 ; } ans += a[n-1]/2 ; cout<<ans<...
a.cc: In function 'int main()': a.cc:18:12: error: 'n' was not declared in this scope 18 | ans += a[n-1]/2 ; | ^
s965422920
p04020
C++
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <ctype.h> #include <deque> #include <queue> #include <cstring> #include <set> #include <list> #include <map> #include <random> #include <unordered_map> #include <stdio.h> using namespace std; typedef long long ll; typedef std::vecto...
a.cc: In function 'int main()': a.cc:58:14: error: 'i' was not declared in this scope 58 | if(a[i+1]-a[i] < 2) { | ^
s177523586
p04021
C++
#include "bits/stdc++.h" using namespace std; using ll=long long; using vll=vector< ll>; using vvll=vector< vll>; using vvvll=vector< vvll>; using vvvvll=vector<vvvll>; using dd=double; using vdd=vector< dd>; using vvdd=vector< vdd>; using pll=pair<ll,ll>; using tll=tuple<ll,ll,ll>; using qll=...
a.cc:81:10: fatal error: atcoder/all: No such file or directory 81 | #include <atcoder/all> | ^~~~~~~~~~~~~ compilation terminated.
s537492541
p04021
C++
#include <bits/stdc++.h> #include<atcoder/all> #define ll long long #define ld long double #define rep(i, n) for(ll i = 0; i < n; ++i) #define rep2(i, a, b) for(ll i = a; i <= b; ++i) #define rrep(i, a, b) for(ll i = a; i >= b; --i) #define pii pair<int, int> #define pll pair<ll, ll> #define fi first #define se sec...
a.cc:2:9: fatal error: atcoder/all: No such file or directory 2 | #include<atcoder/all> | ^~~~~~~~~~~~~ compilation terminated.
s046509319
p04021
C++
#include <algorithm> #include <bitset> #include <cassert> #include <chrono> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <limits> #include <list> #include <map> #in...
a.cc: In function 'void solve()': a.cc:69:20: error: no match for 'operator>>' (operand types are 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} and 'long long int') 69 | cout << ans>>1ll << endl; | ~~~~~~~~~~~^~~~~ | | | | ...
s715604469
p04021
Java
import java.util.*; import java.io.*; import java.math.*; public class Main{ //Don't have to see. start------------------------------------------ static class InputIterator{ ArrayList<String> inputLine = new ArrayList<String>(1024); int index = 0; int max; String read; InputIterator(){ BufferedReader br = ne...
Main.java:86: error: no suitable method found for fill(int[]) Arrays.fill(list); ^ method Arrays.fill(long[],long) is not applicable (actual and formal argument lists differ in length) method Arrays.fill(long[],int,int,long) is not applicable (actual and formal argument lists differ in len...
s695995099
p04021
C++
#include <bits/stdc++.h> #include <cstdlib> #include <cmath> #include <algorithm> using namespace std; using ll = long long; using P = pair<int,int>; using Graph= vector<vector<ll>>; #define rep(i,n) for (ll i=0; i < (n); ++i) #define rep2(i,n,m) for(ll i=n;i<=m;i++) #define rep3(i,n,m) for(ll i=n;i>=m;i--) #define pb...
a.cc: In function 'int main()': a.cc:30:27: error: 'ans' was not declared in this scope; did you mean 'abs'? 30 | if((mp[A[i]]-i)%2==1) ans++ ; | ^~~ | abs a.cc:32:13: error: 'ans' was not declared in this scope; did you mean 'abs'? 32 | cout...
s511787907
p04021
C++
#include <iostream> #include <algorithm> #define int long long signed main() { int n; std::cin >> n; std::pair<int, int> a[n]; for(int i = 0; i < n; i++) { std::cin >> a[i].first; a[i].second = i%2; } std::sort(a, a+n); int ans = 0; for(int i = 0; i < n; i++) ans += (i%2 != a[i].s...
a.cc: In function 'int main()': a.cc:23:34: error: expected ';' before 'return' 23 | std::cout << ans/2 << std::endl | ^ | ; 24 | return 0; | ~~~~~~
s268574591
p04021
C++
#include <Bits/stdc++.h> using namespace std; const int maxn=1e5+5; const long long sg=1e10; long long a,b,c,d,e,f,g,n,m,i,j,sdg[maxn],lili,t; long long x[maxn][10],z[maxn],v[101][101],h[maxn]; string p[maxn],s[maxn]; queue<int>q; bool mark[maxn]; vector<long long> o[maxn],sgd; map<long long,long long> mp; char l[10]...
a.cc:1:10: fatal error: Bits/stdc++.h: No such file or directory 1 | #include <Bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s864366569
p04021
C++
#include<Bits/stdc++.h> using namespace std; const int maxn=1e5+5; const long long sg=1e10; long long a,b,c,d,e,f,g,n,m,i,j,sdg[maxn],lili,t; long long x[maxn][10],z[maxn],v[101][101],h[maxn]; string p[maxn],s[maxn]; queue<int>q; bool mark[maxn]; vector<long long> o[maxn],sgd; map<long long,long long> mp; char l[10][...
a.cc:1:9: fatal error: Bits/stdc++.h: No such file or directory 1 | #include<Bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s249125446
p04021
C++
#include<Bits/stdc++.h> using namespace std; const int maxn=1e5+5; const long long sg=1e10; long long a,b,c,d,e,f,g,n,m,i,j,sdg[maxn],lili,t; long long x[maxn][10],z[maxn],v[101][101],h[maxn]; string p[maxn],s[maxn]; queue<int>q; bool mark[maxn]; vector<long long> o[maxn],sgd; map<long long,long long> mp; char l[10][...
a.cc:1:9: fatal error: Bits/stdc++.h: No such file or directory 1 | #include<Bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s256276490
p04021
C++
#include<bits\stdc++.h> using namespace std; const int maxn=1e5+5; const long long sg=1e10; long long a,b,c,d,e,f,g,n,m,i,j,sdg[maxn],lili,t; long long x[maxn][10],z[maxn],v[101][101],h[maxn]; string p[maxn],s[maxn]; queue<int>q; bool mark[maxn]; vector<long long> o[maxn],sgd; map<long long,long long> mp; char l[10][...
a.cc:1:9: fatal error: bits\stdc++.h: No such file or directory 1 | #include<bits\stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s095874074
p04021
C++
#include<bits\stdc++.h> using namespace std; const int maxn=10e5+5; const long long sg=1e10; long long a,b,c,d,e,f,g,n,m,i,j,sdg[maxn],lili,t; long long x[maxn][10],z[maxn],v[101][101],h[maxn]; string p[maxn],s[maxn]; queue<int>q; bool mark[maxn]; vector<long long> o[maxn],sgd; map<long long,long long> mp; char l[10]...
a.cc:1:9: fatal error: bits\stdc++.h: No such file or directory 1 | #include<bits\stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s948789661
p04021
C++
#include<bits\stdc++.h> using namespace std; const int maxn=10e5+5; const long long sg=1e10; long long a,b,c,d,e,f,g,n,m,i,j,sdg[maxn],lili,t; long long x[maxn][10],z[maxn],v[101][101],h[maxn]; string p[maxn],s[maxn]; queue<int>q; bool mark[maxn]; vector<long long> o[maxn],sgd; map<long long,long long> mp; char l[10]...
a.cc:1:9: fatal error: bits\stdc++.h: No such file or directory 1 | #include<bits\stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s800974390
p04021
C++
#include<bits\stdc++.h> using namespace std; const int maxn=10e5+5; const long long sg=1e10; long long a,b,c,d,e,f,g,n,m,i,j,sdg[maxn],lili,t; long long x[maxn][10],z[maxn],v[101][101],h[maxn]; string p[maxn],s[maxn]; queue<int>q; bool mark[maxn]; vector<long long> o[maxn],sgd; map<long long,long long> mp; char l[10]...
a.cc:1:9: fatal error: bits\stdc++.h: No such file or directory 1 | #include<bits\stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s566257137
p04021
C++
#include <bits/stdc++.h> using ll = long long; using namespace std; #define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++) #define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++) #define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--) #define rreps(i,n) for(int i=((int)(n));i>0;i--) #define repi(i,x) for(a...
a.cc: In function 'int main()': a.cc:49:9: error: declaration of 'auto ter' has no initializer 49 | auto ter; | ^~~~ a.cc:54:19: error: 'else' without a previous 'if' 54 | } else if (a[i * 2] != *ter) | ^~~~
s898488895
p04021
C++
#include<bits/stdc++.h> using namespace std; #define int long long #define double long double #define fo(a,b) for(int a=0;a<b;a++) #define Sort(a) sort(a.begin(),a.end()) #define rev(a) reverse(a.begin(),a.end()) #define fi first #define se second #define sz size() #define bgn begin() #define en end() #define pb push_b...
a.cc: In function 'int main()': a.cc:5:30: error: no match for 'operator<' (operand types are 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > >') 5 | #define fo(a,b) for(int a=0;a<b;a++) | ^ a.cc:382:3: note: in expansion of macr...
s329441063
p04021
C++
#include<bits/stdc++.h> using namespace std; #define int long long #define double long double #define fo(a,b) for(int a=0;a<b;a++) #define Sort(a) sort(a.begin(),a.end()) #define rev(a) reverse(a.begin(),a.end()) #define fi first #define se second #define sz size() #define bgn begin() #define en end() #define pb push_b...
a.cc: In function 'int main()': a.cc:381:7: error: conflicting declaration 'long long int c' 381 | int c=0,d=0; | ^ a.cc:374:29: note: previous declaration as 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > > c' 374 | V<P<int,P<int,int>>> b(a),c; | ...
s929385455
p04021
C++
#include <iostream> #include<algorithm> #include<vector> #define int long long using namespace std; int re(int i){return (i/2)*2;} int solve(int i,int j,int l){ return re(i)+re(j)+re(l); } #define vel vector<long long> #define rep(i,n) for(int i=0;i<n;i++) signed main(void){ int n;cin >>n; vel a(n); rep...
a.cc: In function 'int main()': a.cc:19:60: error: expected ',' or ';' before ')' token 19 | int x=lower_bound(s.begin(),s.end(),a[i])-s.begin()); | ^
s901032789
p04021
C++
#include <iostream> #include<algorithm> #include<vector> #define int long long using namespace std; int re(int i){return (i/2)*2;} int solve(int i,int j,int l){ return re(i)+re(j)+re(l); } #define vel vector<long long> signed main(void){ int n;cin >>n; vel a(n); rep(i,n){cin >>a[i];} vel s=a;sort(s....
a.cc: In function 'int main()': a.cc:14:9: error: 'i' was not declared in this scope 14 | rep(i,n){cin >>a[i];} | ^ a.cc:14:5: error: 'rep' was not declared in this scope; did you mean 're'? 14 | rep(i,n){cin >>a[i];} | ^~~ | re a.cc:18:60: error: expected ',' or ';' befo...
s724534261
p04021
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; priority_queue<int> kisu,gusu; int a; for(int i=0;i<n;i++){ cin >> a; if(i%2 == 0){ kisu.push(a); }else{ gusu.push(a); } } int ans = 0; for(int i=0;i<n;i++){ if(i%2 == 0){ if(kisu.empty()){ ...
a.cc: In function 'int main()': a.cc:45:2: error: expected '}' at end of input 45 | } | ^ a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s074557168
p04021
C++
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(ll i=0; i<n; i++) typedef long long ll; typedef long long unsigned int llu; ll MOD = 1000000007; ll INF = 1000000009; /* 操作1は連続する2整数を、操作2はひとつ飛ばしの2整数を逆順にする 本来の位置とずれている距離が奇数なら1を足す 51234 21435 */ void solve(){ int n; cin >> n; int a[n+10];...
a.cc: In function 'void solve()': a.cc:54:22: error: 'dist2' was not declared in this scope; did you mean 'dist'? 54 | cout << min(dist,dist2)/2 << endl; | ^~~~~ | dist
s556292974
p04021
C++
#include <iostream> #include <vector> using namespace std; int main () { int n; cin >> n; vector<pair<int, int> > a(n); for (int i = 0; i < n; i++) { cin >> a.at(i).first; a.at(i).second = i; } sort(a.begin(), a.end()); int ans = 0; for (int i = 0; i < n; i += 2) { ans += (a.at(i).second - ...
a.cc: In function 'int main()': a.cc:13:3: error: 'sort' was not declared in this scope; did you mean 'short'? 13 | sort(a.begin(), a.end()); | ^~~~ | short
s085459896
p04021
C++
#include <iostream> #include <cstring> #include <algorithm> #include <vector> #include <string> #include <math.h> #include <stdio.h> #include <iomanip> #include <limits> #include <list> #include <queue> #include <tuple> #include <map> #include <sstream> using namespace std; #define MOD (long long int)(1e9+7) #define ll...
a.cc: In function 'int main()': a.cc:58:10: error: 'guuki' was not declared in this scope 58 | memset(guuki, -1, sizeof(guuki)); | ^~~~~
s201766377
p04021
C++
#include <iostream> #include <cstring> #include <algorithm> #include <vector> #include <string> #include <math.h> #include <stdio.h> #include <iomanip> #include <limits> #include <list> #include <queue> #include <tuple> #include <map> #include <sstream> using namespace std; #define MOD (long long int)(1e9+7) #define ll...
a.cc: In function 'int main()': a.cc:63:5: error: 'VI' {aka 'class std::vector<int>'} has no member named 'sort' 63 | B.sort(); | ^~~~
s981908401
p04021
C++
#include <iostream> #include <cstring> #include <algorithm> #include <vector> #include <string> #include <math.h> #include <stdio.h> #include <iomanip> #include <limits> #include <list> #include <queue> #include <tuple> #include <map> #include <sstream> using namespace std; #define MOD (long long int)(1e9+7) #define ll...
a.cc:55:1: error: expected unqualified-id before 'signed' 55 | signed main(){ | ^~~~~~
s857225043
p04021
C++
#include <iostream> #include <cstring> #include <algorithm> #include <vector> #include <string> #include <math.h> #include <stdio.h> #include <iomanip> #include <limits> #include <list> #include <queue> #include <tuple> #include <map> #include <sstream> using namespace std; #define MOD (long long int)(1e9+7) #define ll...
a.cc:52:4: error: expected initializer before 'A' 52 | VI A(lim), B(lim); | ^ a.cc: In function 'int main()': a.cc:61:5: error: 'A' was not declared in this scope 61 | A[i] = a; B[i] = a; | ^ a.cc:61:15: error: 'B' was not declared in this scope 61 | A[i] = a; B[i] = a; | ...
s036432681
p04021
C++
#include <iostream> #include <cstring> #include <algorithm> #include <vector> #include <string> #include <math.h> #include <stdio.h> #include <iomanip> #include <limits> #include <list> #include <queue> #include <tuple> #include <map> #include <sstream> using namespace std; #define MOD (long long int)(1e9+7) #define ll...
a.cc: In function 'int main()': a.cc:62:5: error: request for member 'sort' in 'B', which is of non-class type 'int [100100]' 62 | B.sort(); | ^~~~ a.cc:70:18: error: invalid types 'int[int]' for array subscript 70 | if(i!=guuki[a[i]]) ans++; | ^
s474015864
p04021
C++
#include <bits/stdc++.h> #define REP(i,n) for(int i=0;i<n;i++) #define REPP(i,n) for(int i=1;i<=n;i++) const double PI = acos(-1); const double EPS = 1e-15; long long INF=(long long)1E17; #define i_7 (long long)(1E9+7) long mod(long a){ long long c=a%i_7; if(c>=0)return c; return c+i_7; } using namespace st...
a.cc: In function 'int main()': a.cc:99:10: error: expected ']' before '[' token 99 | map[a[i]] = i%2; | ^ | ] a.cc:99:19: error: class template argument deduction failed: 99 | map[a[i]] = i%2; | ^ a.cc:99:19: error: no matching function for call to 'm...
s800538922
p04021
C++
#include<iostream> #include<map> using namespace std; const int N=1e5+4; map<int,int> pos1,pos2; int a[N]; int main(){ int n; cin>>n; for(int i=0;i<n;++i) cin>>a[i]; for(int i=0;i<n;++i){ pos1[a[i]]=i; } sort(a,a+n); for(int i=0;i<n;++i){ pos2[a[i]]=i; } int ans=0; for(int i=0;i<n;++i){ int diff=abs(...
a.cc: In function 'int main()': a.cc:16:9: error: 'sort' was not declared in this scope; did you mean 'short'? 16 | sort(a,a+n); | ^~~~ | short
s585893397
p04021
C++
#include<bits/stdc++.h> using namespace std; int main(){ int N; cin >> N; vector<pair<int, int>> A; for(int i=0; i<N; i++){ int a; cin >> a; A.push_back({a, i}) } sort(A.begin(), A.end()); int ans = 0; for(int i=0; i<N; i++){ if((A[i].second - i) % 2 == 0) ans++; } cout << ans << endl; ...
a.cc: In function 'int main()': a.cc:9:24: error: expected ';' before '}' token 9 | A.push_back({a, i}) | ^ | ; 10 | } | ~
s020993410
p04021
C++
#include<bits/stdc++.h> using namespace std; #define IL inline #define rep(i,j,k) for(int i=j;i<=k;++i) #define repd(i,j,k) for(int i=j;i>=k;--i) #define pb push_back #define db double #define mp make_pair #define mp3(a,b,c) mp(mp(a,b),c) #define pii pair<int,int> #define piii pair<pii,int> #define fr first #define se ...
a.cc: In function 'int main()': a.cc:44:22: error: invalid operands of types 'int' and 'int*' to binary 'operator-' 44 | if((i-lower_bound(b+1,b+1+n,a[i])-b)%2==1)cnt++; | ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | in...
s180661297
p04021
C++
#include<iostream> #include<vector> using namespace std; pair<int, int> temp; int main(){ cin >> N; vector<pair<int, int>> A[N]; int a, b; for (int i = 0; i < N; i ++) { cin >> a; temp.first = i; temp.second = a A.push_back(temp); }
a.cc: In function 'int main()': a.cc:9:10: error: 'N' was not declared in this scope 9 | cin >> N; | ^ a.cc:17:20: error: expected ';' before 'A' 17 | temp.second = a | ^ | ; 18 | A.push_back(temp); | ~ a.cc:20...
s176863350
p04021
C++
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0;i<n;i++) #define int long long int n,a[100010],cnt; map<int,int>mp; int main(){ cin>> n; rep(i,n){ cin>>a[i]; mp[a[i]]=i; } sort(a,a+n); rep(i,n)cnt+=abs(mp[a[i]]-i); cout<<(cnt%4)/2<<endl; return 0; }
cc1plus: error: '::main' must return 'int'
s407254714
p04021
C++
5 10 8 5 3 2
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 5 | ^
s084262378
p04021
C++
#include<bits/stdc++.h> using namespace std; #define rep(i, n) for(int (i)=0; (i)<(n); (i)++) #define reps(i, A, n) for(int (i)=(A); (i)<(n); (i)++) #define pb emplace_back #define all(p) (p).begin(), (p).end() using LL = long long; const LL MOD = 1e9+7; int N; vector<int> B[2]; vector<int> A, C; LL BIT[114514]; ...
a.cc: In function 'int main()': a.cc:43:17: error: expected ')' before ';' token 43 | sort(all(B[0]); | ~ ^ a.cc:44:17: error: expected ')' before ';' token 44 | sort(all(B[1]); | ~ ^
s364801617
p04021
C++
#include <iostream> #include <map> using namespace std; int main(){ int n; long long int a[100000]; int count = 0; map<long int, int> m; cin >> n; for(int i = 0;i < n;i++){ cin >> a[i]; m[a[i]] = i; } sort(a, a + n); for(int i = 0;i < n;i++){ if((m[a[i]] - i) % 2){ count++; } } cout << (count / 2)...
a.cc: In function 'int main()': a.cc:14:9: error: 'sort' was not declared in this scope; did you mean 'short'? 14 | sort(a, a + n); | ^~~~ | short
s774073059
p04021
C++
#include <iostream> #include <map> using namespace std; int main(){ int n; long int int a[100000]; int count = 0; map<long int, int> m; cin >> n; for(int i = 0;i < n;i++){ cin >> a[i]; m[a[i]] = i; } sort(a, a + n); for(int i = 0;i < n;i++){ if((m[a[i]] - i) % 2){ count++; } } cout << (count / 2) ...
a.cc: In function 'int main()': a.cc:6:14: error: two or more data types in declaration of 'a' 6 | long int int a[100000]; | ^~~ a.cc:11:24: error: 'a' was not declared in this scope 11 | cin >> a[i]; | ^ a.cc:14:14: error: 'a' was not decla...
s379546479
p04021
C++
#include <bits/stdc++.h> #define pb push_back #define ppb pop_back #define fi first #define se second #define mid ((x + y) / 2) #define left (ind * 2) #define right (ind * 2 + 1) #define mp make_pair #define timer ((double)clock() / CLOCKS_PER_SEC) #define endl "\n" #define spc " " #define d1(x) cerr<<#x<<":"<<x<<endl ...
a.cc: In function 'int main()': a.cc:33:16: error: 'n' was not declared in this scope 33 | cin >> n; | ^
s337294335
p04021
C++
#include <iostream> #include <vector> #include <math.h> #include <cmath> #include <algorithm> #include <numeric> #include <string> #include <cstring> #include <regex> #include <bits/stdc++.h> using namespace std; using ll = long long; using dbl = double; using pii = pair<int, int>; using pl4 = pair<ll, ll>; using vi ...
a.cc: In function 'int main()': a.cc:244:12: error: no match for 'operator%' (operand types are 'std::vector<long long int>::iterator' and 'int') 244 | aa = a.be%2; | ^~ | | | int In file included from /usr/include/c++/14/valarray:605, from /usr/...
s604251878
p04021
C++
#include<cstdio> #include<cctype> #include<map> #include<algorithm> using namespace std; const int maxn=1e5+7; int a[maxn],b[maxn]; inline int read() { int f = 1, num = 0; char ch = getchar(); while(0 == isdigit(ch)) { if(ch == '-')f = -1; ch = getchar(); } while(0 != isdigit(ch)) nu...
a.cc: In function 'int main()': a.cc:27:9: error: reference to 'rank' is ambiguous 27 | rank[a[i]]=i; | ^~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/bits/stl_tree.h:...
s548529457
p04021
C++
#include<bits/stdc++.h> #define SC scanf using namespace std; struct data { long long ywz,num; } tong[100001]; long long n,ans; bool cmp1(data x,data y) { return x.num < y.num; } int main() { SC("%lld",&n); for(long long i = 1; i <= n; i++) { SC("%lld",&tong[i].num); tong[i].ywz = i; } sort(tong+1,tong+n+...
a.cc:11:11: error: reference to 'data' is ambiguous 11 | bool cmp1(data x,data y) | ^~~~ In file included from /usr/include/c++/14/string:53, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52, from a.cc:1:...
s399559009
p04021
C++
#include<cstdio> #include<cstring> #include<algorithm> using namespace std; struct node { int x=0,p=0; }; bool cmp(node a,node b) { return a.x<b.x; } int main() { data a[100005]; data b[100005]; int l=1,n,i; scanf("%d",&n); for(i=1;i<=n;i++) { scanf("%d",&a[i].x); a[i].p=i...
a.cc: In function 'int main()': a.cc:14:5: error: 'data' was not declared in this scope 14 | { data a[100005]; | ^~~~ a.cc:15:9: error: expected ';' before 'b' 15 | data b[100005]; | ^~ | ; a.cc:20:21: error: 'a' was not declared in this scope 20 | scanf("%d"...
s016283125
p04021
C++
#include <iostream> using namespace std; const int N = 1e6 + 10; typedef pair <int, int> pii; int n; pii a[N]; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> a[i].first; a[i].second = i; } int ans = 0; sort (a, a + n); for (int i = 0; i < n; i += 2) if ((i % 2) != (a[i].second % 2)) ans ...
a.cc: In function 'int main()': a.cc:18:9: error: 'sort' was not declared in this scope; did you mean 'short'? 18 | sort (a, a + n); | ^~~~ | short
s861595591
p04021
C
#include<iostream> #include<algorithm> #include<iomanip> #include <stdio.h> #include <string.h> #include <vector> #include <map> #include <set> #include <queue> #include <new> #include <cmath> #include<fstream> using namespace std; #define Precision(i) cout << fixed << setprecision(i) #define endl '\n' typedef long lon...
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s467947947
p04021
C
// IN THE NAME OF GOD #include <bits/stdc++.h> #define ll long long #define pb push_back #define ff first #define ss second using namespace std; const int MAXN = 1e5 + 15; int n, a[MAXN], ans; map <int, int> pos; vector <int> vect; int main(){ //ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); cin >> n; for(int ...
main.c:2:10: fatal error: bits/stdc++.h: No such file or directory 2 | #include <bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s644520736
p04021
C
// IN THE NAME OF GOD #include <bits/stdc++.h> #define ll long long #define pb push_back #define ff first #define ss second using namespace std; const int MAXN = 1e5 + 15; int n, a[MAXN], ans; map <int, int> pos; vector <int> vect; int main(){ //ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); cin >> n; for(int ...
main.c:2:10: fatal error: bits/stdc++.h: No such file or directory 2 | #include <bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s874797731
p04021
C++
#include<bits/stdc++.h> using namespace std; #define fs first #define sc second #define mp make_pair #define pb push_back #define eb emplace_back #define ALL(A) A.begin(),A.end() #define RALL(A) A.rbegin(),A.rend() typedef long long LL; typedef pair<LL,LL> P; const LL mod=1e9+7; const LL LINF=1LL<<62; int main(){ i...
a.cc: In function 'int main()': a.cc:18:3: error: 'cic' was not declared in this scope 18 | cic >> N; | ^~~