submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s209611482
p00439
C
#include <stdio.h> int main(){ int n,k,i,max=0; int x[100001]; scanf("%d %d",&n,&k); for(i=0;i<n;i++)[ scanf("%d",&x[i]); } for(i=0;i<k;i++){ max+=x[i]; } for(i=0;i<n-k;i++){ if(x[i]<x[i+k]){ max-=x[i]; max+=x[i+k]; }} printf("%d\n",max); return 0; }
main.c: In function 'main': main.c:6:25: error: expected expression before '[' token 6 | for(i=0;i<n;i++)[ | ^ main.c:7:27: error: expected ';' before '}' token 7 | scanf("%d",&x[i]); | ^ | ; 8 | } | ~ main.c: At top level: main.c:9:1: error: expected identifier or '(' before 'for' 9 | for(i=0;i<k;i++){ | ^~~ main.c:9:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token 9 | for(i=0;i<k;i++){ | ^ main.c:9:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token 9 | for(i=0;i<k;i++){ | ^~ main.c:12:9: error: expected identifier or '(' before 'for' 12 | for(i=0;i<n-k;i++){ | ^~~ main.c:12:18: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token 12 | for(i=0;i<n-k;i++){ | ^ main.c:12:24: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token 12 | for(i=0;i<n-k;i++){ | ^~ main.c:17:24: error: expected declaration specifiers or '...' before string constant 17 | printf("%d\n",max); | ^~~~~~ main.c:17:31: error: unknown type name 'max' 17 | printf("%d\n",max); | ^~~ main.c:18:17: error: expected identifier or '(' before 'return' 18 | return 0; | ^~~~~~ main.c:19:17: error: expected identifier or '(' before '}' token 19 | } | ^
s975341864
p00439
C
#include <stdio.h> int main(void){ int c1,c2; int i,j,n; int ans; int max_index; int num[100000]; while(1){ scanf("%d %d",&c1,&c2); if(c1 == 0 && c2 == 0){ break; } ans = 0; max_index = c1 - c2; c1 -=1; for(i = 0;i <= c1;i++){ scanf("%d",num+i); } for(i = 0;i <= max_index;i++){ for(j = 1;j < c2;j++){ num[i] += num[i+j]; } if(num[i] > ans){ ans = num[i]; n = i; } } printf("%d\n",num+n); } return 0;
main.c: In function 'main': main.c:37:3: error: expected declaration or statement at end of input 37 | return 0; | ^~~~~~
s884540991
p00439
C
#include <stdio.h> int main(void){ int c1,c2; int i,j,n; int ans; int max_index; int num[100000]; while(1){ scanf("%d %d",&c1,&c2); if(c1 == 0 && c2 == 0){ break; } ans = 0; max_index = c1 - c2; c1 -=1; for(i = 0;i <= c1;i++){ scanf("%d",num+i); } for(i = 0;i <= max_index;i++){ for(j = 1;j < c2;j++){ num[i] += num[i+j]; } if(num[i] > ans){ ans = num[i]; } } printf("%d\n",ans); return 0; }
main.c: In function 'main': main.c:39:1: error: expected declaration or statement at end of input 39 | } | ^
s876537022
p00439
C++
#include <iostream> #include <algorithm> #include <string> using namespace std; int a[100000 + 1]; int s[100000 + 1]; int main() { int n, k; int i, j, l; int sum = 0, asus = 0; while (true) { memset(s, 0, sizeof(s)); memset(a, 0, sizeof(a)); cin >> n >> k; if (n == 0 && k == 0) return 0; for (i = 0; i < n; ++i) cin >> a[i]; for (i = 0; i < n-k; ++i) { for (j = 0; j < k; ++j) { sum += a[i + j]; } asus = max(asus, sum); sum = 0; } cout << asus << endl; } }
a.cc: In function 'int main()': a.cc:18:17: error: 'memset' was not declared in this scope 18 | memset(s, 0, sizeof(s)); | ^~~~~~ a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include <algorithm> +++ |+#include <cstring> 3 | #include <string>
s437323407
p00439
C++
#include <iostream> #include <cstdio> #include <algorithm> #define ini 0 using namespace std; int rlay[100001]; int main (){ while (1){ memset(rlay, 0,sizeof(rlay)); int n,k,input,ansmax=0; cin>>n>>k; if (n==0&&k==0)break; rlay[0]=ini; for (int i=1;i<=n;i++){ cin>>input; rlay[i]=input+rlay[i-1]; } for (int i=n;i-k>0;i--){ ansmax = max ( rlay[i]-rlay[i-k] ,ansmax ); } cout<<ansmax<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:13:1: error: 'memset' was not declared in this scope 13 | memset(rlay, 0,sizeof(rlay)); | ^~~~~~ a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include <algorithm> +++ |+#include <cstring> 4 | #define ini 0
s611892871
p00439
C++
#include <iostream> #include <cstdio> #include <algorithm> #define ini 0 using namespace std; int rlay[100001]; int main (){ while (1){ memset(rlay, 0,sizeof(rlay)); int n,k,input,ansmax=0; cin>>n>>k; if (n==0&&k==0)break; rlay[0]=ini; for (int i=1;i<=n;i++){ cin>>input; rlay[i]=input+rlay[i-1]; } for (int i=n;i-k>0;i--){ ansmax = max ( rlay[i]-rlay[i-k] ,ansmax ); } cout<<ansmax<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:13:1: error: 'memset' was not declared in this scope 13 | memset(rlay, 0,sizeof(rlay)); | ^~~~~~ a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include <algorithm> +++ |+#include <cstring> 4 | #define ini 0
s109836903
p00439
C++
#include <iostream> #include <cstdio> #include <algorithm> #define ini 0 using namespace std; int rlay[100001]; int main (){ while (1){ memset(rlay ,0 ,sizeof(rlay)); int n,k,input,ansmax=0; cin>>n>>k; if (n==0 && k==0)break; rlay[0]=ini; for (int i=1;i<=n;i++){ cin>>input; rlay[i]=input+rlay[i-1]; } for (int i=n;i-k>0;i--){ ansmax = max ( rlay[i]-rlay[i-k] ,ansmax ); } cout<<ansmax<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:14:1: error: 'memset' was not declared in this scope 14 | memset(rlay ,0 ,sizeof(rlay)); | ^~~~~~ a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include <algorithm> +++ |+#include <cstring> 4 |
s087954964
p00439
C++
#include<iostream> #include<algorithm> using namespace std; int main(){ long long n,k; while(1) { ans=-1000000000; cin>>n>>k; if(n == 0 and k == 0) break; long long a[n];for(int i=0;i<n;i++)cin>>a[i]; for(int i=0;i<n-k+1;i++){ long long temp=0; for(int j=i;j<i+k;j++){ temp+=a[j]; } ans=max(temp,ans); } cout<<ans<<endl; } }
a.cc: In function 'int main()': a.cc:9:5: error: 'ans' was not declared in this scope; did you mean 'abs'? 9 | ans=-1000000000; | ^~~ | abs
s698226530
p00439
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N, k; cin >> N >> k; vector<int> a(N); for(int i = 0; i < N; i++){ cin >> a.at(i); } int ans = 0; for(int i = 0; i < N; i++){ if(i < 3) total += a[i]; else total = total + a[i] - a[i-3]; if(ans < total) ans = total; } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:12:19: error: 'total' was not declared in this scope 12 | if(i < 3) total += a[i]; | ^~~~~ a.cc:13:18: error: 'total' was not declared in this scope 13 | else total = total + a[i] - a[i-3]; | ^~~~~ a.cc:14:22: error: 'total' was not declared in this scope 14 | if(ans < total) ans = total; | ^~~~~
s826069969
p00439
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N, k; cin >> N >> k; vector<int> a(N); for(int i = 0; i < N; i++){ cin >> a.at(i); } int ans = 0; for(int i = 0; i < N; i++){ if(i < 3){ total += a[i]; }else{ total = total + a[i] - a[i-3]; } if(ans < total){ ans = total; } } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:13:13: error: 'total' was not declared in this scope 13 | total += a[i]; | ^~~~~ a.cc:15:13: error: 'total' was not declared in this scope 15 | total = total + a[i] - a[i-3]; | ^~~~~ a.cc:17:22: error: 'total' was not declared in this scope 17 | if(ans < total){ | ^~~~~
s326550300
p00439
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n,k; vector<int> ans(0);x while(1){ cin>>n>>k; if(n==0&&k==0){ break; } vector<int> vec(n); for(int i=0;i<n;i++){ cin>>vec.at(i); } vector<int> rsw(n+1); rsw.at(0)=0; for(int i=1;i<n+1;i++){ rsw.at(i) = rsw.at(i-1) + vec.at(i-1); } ans.push_back(0); for(int i=k;i<n+1;i++){ if(ans.at(ans.size()) < rsw.at(i) - rsw.at(i-k)){ ans.at(ans.size()) = rsw.at(i) - rsw.at(i-k); } } cout << ans.at(ans.size()) << endl; } }
a.cc: In function 'int main()': a.cc:5:24: error: 'x' was not declared in this scope 5 | vector<int> ans(0);x | ^
s739513374
p00439
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n,k; vector<int> ans(0);x while(1){ cin>>n>>k; if(n==0&&k==0){ break; } vector<int> vec(n); for(int i=0;i<n;i++){ cin>>vec.at(i); } vector<int> rsw(n+1); rsw.at(0)=0; for(int i=1;i<n+1;i++){ rsw.at(i) = rsw.at(i-1) + vec.at(i-1); } ans.push_back(0); for(int i=k;i<n+1;i++){ if(ans.at(ans.size()) < rsw.at(i) - rsw.at(i-k)){ ans.at(ans.size()) = rsw.at(i) - rsw.at(i-k); } } cout << ans.at(ans.size()) << endl; } }
a.cc: In function 'int main()': a.cc:5:24: error: 'x' was not declared in this scope 5 | vector<int> ans(0);x | ^
s984740855
p00439
C++
#include <bits/stdc++.h> using namespace std; int main(){ for(int count = 0; count < 5; count++){ int none(2); int N, k; cin >> N >> k; vector<int> a(N); for(int i = 0; i < N; i++){ cin >> a.at(i); } int ans = 0; int total = 0; for(int i = 0; i < N; i++){ if(i < k) total += a[i]; else total = total + a[i] - a[i-k]; if(ans < total) ans = total; } cout << ans << endl; cin >> none.at(0) >> none.at(1);   } }
a.cc:21:1: error: extended character   is not valid in an identifier 21 |   } | ^ a.cc:21:1: error: extended character   is not valid in an identifier a.cc: In function 'int main()': a.cc:20:25: error: request for member 'at' in 'none', which is of non-class type 'int' 20 | cin >> none.at(0) >> none.at(1); | ^~ a.cc:20:39: error: request for member 'at' in 'none', which is of non-class type 'int' 20 | cin >> none.at(0) >> none.at(1); | ^~ a.cc:21:1: error: '\U00003000\U00003000' was not declared in this scope 21 |   } | ^~~~
s541511776
p00439
C++
#include <bits/stdc++.h> using namespace std; int main(){ for(int count = 0; count < 5; count++){ int none(2); int N, k; cin >> N >> k; vector<int> a(N); for(int i = 0; i < N; i++){ cin >> a.at(i); } int ans = 0; int total = 0; for(int i = 0; i < N; i++){ if(i < k) total += a[i]; else total = total + a[i] - a[i-k]; if(ans < total) ans = total; } cout << ans << endl; cin >> none[0] >> none[1];   } }
a.cc:21:1: error: extended character   is not valid in an identifier 21 |   } | ^ a.cc:21:1: error: extended character   is not valid in an identifier a.cc: In function 'int main()': a.cc:20:24: error: invalid types 'int[int]' for array subscript 20 | cin >> none[0] >> none[1]; | ^ a.cc:20:35: error: invalid types 'int[int]' for array subscript 20 | cin >> none[0] >> none[1]; | ^ a.cc:21:1: error: '\U00003000\U00003000' was not declared in this scope 21 |   } | ^~~~
s792899619
p00439
C++
#include <bits/stdc++.h> using namespace std; int main(){ for(int count = 0; count < 5; count++){ int none(2); int N, k; cin >> N >> k; vector<int> a(N); for(int i = 0; i < N; i++){ cin >> a.at(i); } int ans = 0; int total = 0; for(int i = 0; i < N; i++){ if(i < k) total += a[i]; else total = total + a[i] - a[i-k]; if(ans < total) ans = total; } cout << ans << endl; for(int i = 0; i < 2; i++){ cin >> none.at(i); }   } }
a.cc:23:1: error: extended character   is not valid in an identifier 23 |   } | ^ a.cc:23:1: error: extended character   is not valid in an identifier a.cc: In function 'int main()': a.cc:21:25: error: request for member 'at' in 'none', which is of non-class type 'int' 21 | cin >> none.at(i); | ^~ a.cc:23:1: error: '\U00003000\U00003000' was not declared in this scope 23 |   } | ^~~~
s648170741
p00439
C++
#include<iostream> using namespace std; int main() { int n,k; cin >> n >> k; while(n!=0||k!=0){ vector<int> a(N); cin >> a; S[0]=0; for(int i=1;i==n;i++){ S[i]=S[i-1]+a.at(i-1); } int x=S[k] for(int l=1;l==n-k;l++){ if(x<S[k+l]-S[l]){ x==S[k+l]-S[l]; } } cout << x; cin >> n >> k; } } }
a.cc: In function 'int main()': a.cc:8:8: error: 'vector' was not declared in this scope 8 | vector<int> a(N); | ^~~~~~ a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 1 | #include<iostream> +++ |+#include <vector> 2 | using namespace std; a.cc:8:15: error: expected primary-expression before 'int' 8 | vector<int> a(N); | ^~~ a.cc:9:16: error: 'a' was not declared in this scope 9 | cin >> a; | ^ a.cc:10:9: error: 'S' was not declared in this scope 10 | S[0]=0; | ^ a.cc:15:21: error: 'l' was not declared in this scope 15 | for(int l=1;l==n-k;l++){ | ^ a.cc: At global scope: a.cc:26:1: error: expected declaration before '}' token 26 | } | ^
s392610689
p00439
C++
#include <bits/stdc++.h> using namespace std; int main(){ for(int count = 0; count < 5; count++){ vecotor<int> none(2); int N, k; cin >> N >> k; vector<int> a(N); for(int i = 0; i < N; i++){ cin >> a.at(i); } int ans = 0; int total = 0; for(int i = 0; i < N; i++){ if(i < k) total += a[i]; else total = total + a[i] - a[i-k]; if(ans < total) ans = total; } cout << ans << endl; for(int i = 0; i < 2; i++){ cin >> none.at(i); }   } }
a.cc:23:1: error: extended character   is not valid in an identifier 23 |   } | ^ a.cc:23:1: error: extended character   is not valid in an identifier a.cc: In function 'int main()': a.cc:5:13: error: 'vecotor' was not declared in this scope 5 | vecotor<int> none(2); | ^~~~~~~ a.cc:5:21: error: expected primary-expression before 'int' 5 | vecotor<int> none(2); | ^~~ a.cc:21:20: error: 'none' was not declared in this scope 21 | cin >> none.at(i); | ^~~~ a.cc:21:20: note: suggested alternatives: In file included from /usr/include/c++/14/filesystem:51, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200, from a.cc:1: /usr/include/c++/14/bits/fs_fwd.h:276:7: note: 'std::filesystem::directory_options::none' 276 | none = 0, follow_directory_symlink = 1, skip_permission_denied = 2 | ^~~~ /usr/include/c++/14/bits/fs_fwd.h:145:7: note: 'std::filesystem::perms::none' 145 | none = 0, | ^~~~ /usr/include/c++/14/bits/fs_fwd.h:85:7: note: 'std::filesystem::copy_options::none' 85 | none = 0, | ^~~~ /usr/include/c++/14/bits/fs_fwd.h:79:7: note: 'std::filesystem::file_type::none' 79 | none = 0, not_found = -1, regular = 1, directory = 2, symlink = 3, | ^~~~ a.cc:23:1: error: '\U00003000\U00003000' was not declared in this scope 23 |   } | ^~~~
s811328077
p00439
C++
#include <bits/stdc++.h> using namespace std; int main(){ for(int count = 0; count < 5; count++){ vector<int> none(2); int N, k; cin >> N >> k; vector<int> a(N); for(int i = 0; i < N; i++){ cin >> a.at(i); } int ans = 0; int total = 0; for(int i = 0; i < N; i++){ if(i < k) total += a[i]; else total = total + a[i] - a[i-k]; if(ans < total) ans = total; } cout << ans << endl; for(int i = 0; i < 2; i++){ cin >> none.at(i); }   } }
a.cc:23:1: error: extended character   is not valid in an identifier 23 |   } | ^ a.cc:23:1: error: extended character   is not valid in an identifier a.cc: In function 'int main()': a.cc:23:1: error: '\U00003000\U00003000' was not declared in this scope 23 |   } | ^~~~
s693367315
p00439
C++
#include<iostream> using namespace std; int main() { int n,k; cin >> n >> k; while(n!=0||k!=0){ vector<int> a(N); cin >> a; S[0]=0; for(int i=1;i==n;i++){ S[i]=S[i-1]+a.at(i-1); } int x=S[k]; for(int l=1;l==n-k;l++){ if(x<S[k+l]-S[l]){ x==S[k+l]-S[l]; } } cout << x << endl;; cin >> n >> k; } } }
a.cc: In function 'int main()': a.cc:8:8: error: 'vector' was not declared in this scope 8 | vector<int> a(N); | ^~~~~~ a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 1 | #include<iostream> +++ |+#include <vector> 2 | using namespace std; a.cc:8:15: error: expected primary-expression before 'int' 8 | vector<int> a(N); | ^~~ a.cc:9:16: error: 'a' was not declared in this scope 9 | cin >> a; | ^ a.cc:10:9: error: 'S' was not declared in this scope 10 | S[0]=0; | ^ a.cc: At global scope: a.cc:26:1: error: expected declaration before '}' token 26 | } | ^
s203934603
p00439
C++
#include<iostream> using namespace std; int main() { int n,k; cin >> n >> k; while(n!=0||k!=0){ vector<int> a(n); cin >> a; S[0]=0; for(int i=1;i==n;i++){ S[i]=S[i-1]+a.at(i-1); } int x=S[k]; for(int l=1;l==n-k;l++){ if(x<S[k+l]-S[l]){ x==S[k+l]-S[l]; } } cout << x << endl;; cin >> n >> k; } } }
a.cc: In function 'int main()': a.cc:8:8: error: 'vector' was not declared in this scope 8 | vector<int> a(n); | ^~~~~~ a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 1 | #include<iostream> +++ |+#include <vector> 2 | using namespace std; a.cc:8:15: error: expected primary-expression before 'int' 8 | vector<int> a(n); | ^~~ a.cc:9:16: error: 'a' was not declared in this scope 9 | cin >> a; | ^ a.cc:10:9: error: 'S' was not declared in this scope 10 | S[0]=0; | ^ a.cc: At global scope: a.cc:26:1: error: expected declaration before '}' token 26 | } | ^
s562854058
p00439
C++
#include<iostream> using namespace std; int main() { int n,k; cin >> n >> k; while(n!=0||k!=0){ vector<int> a(n); cin >> a; S[0]=0; for(int i=1;i==n;i++){ S[i]=S[i-1]+a.at(i-1); } int x=S[k]; for(int l=1;l==n-k;l++){ if(x<S[k+l]-S[l]){ x==S[k+l]-S[l]; } } cout << x << endl; cin >> n >> k; } } }
a.cc: In function 'int main()': a.cc:8:8: error: 'vector' was not declared in this scope 8 | vector<int> a(n); | ^~~~~~ a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 1 | #include<iostream> +++ |+#include <vector> 2 | using namespace std; a.cc:8:15: error: expected primary-expression before 'int' 8 | vector<int> a(n); | ^~~ a.cc:9:16: error: 'a' was not declared in this scope 9 | cin >> a; | ^ a.cc:10:9: error: 'S' was not declared in this scope 10 | S[0]=0; | ^ a.cc: At global scope: a.cc:26:1: error: expected declaration before '}' token 26 | } | ^
s315629753
p00439
C++
#include <bits/stdc++.h> using namespace std; int main(){ for(int count = 0; count < 5; count++){ vector<int> none(2); int N, k; cin >> N >> k; vector<int> a(N); for(int i = 0; i < N; i++){ cin >> a.at(i); } int ans = 0; int total = 0; for(int i = 0; i < N; i++){ if(i < k) total += a[i]; else total = total + a[i] - a[i-k]; if(ans < total) ans = total; } cout << ans << endl; for(int i = 0; i < 2; i++){ cin >> none.at(i); }   } }
a.cc:26:1: error: extended character   is not valid in an identifier 26 |   } | ^ a.cc:26:1: error: extended character   is not valid in an identifier a.cc: In function 'int main()': a.cc:26:1: error: '\U00003000\U00003000' was not declared in this scope 26 |   } | ^~~~
s178210875
p00439
C++
#include<iostream> using namespace std; int main() { int n,k; cin >> n >> k; while(n!=0||k!=0){ vector<int> a(n); cin >> a; S[0]=0; for(int i=1;i==n;i++){ S[i]=S[i-1]+a.at(i-1); } int x=S[k]; for(int l=1;l==n-k;l++){ if(x<S[k+l]-S[l]){ x==S[k+l]-S[l]; } cout << x << endl; cin >> n >> k; } } }
a.cc: In function 'int main()': a.cc:8:8: error: 'vector' was not declared in this scope 8 | vector<int> a(n); | ^~~~~~ a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 1 | #include<iostream> +++ |+#include <vector> 2 | using namespace std; a.cc:8:15: error: expected primary-expression before 'int' 8 | vector<int> a(n); | ^~~ a.cc:9:16: error: 'a' was not declared in this scope 9 | cin >> a; | ^ a.cc:10:9: error: 'S' was not declared in this scope 10 | S[0]=0; | ^
s173068000
p00439
C++
#include<iostream> using namespace std; int main() { int n,k; cin >> n >> k; while(n!=0||k!=0){ vector<int> a(n); cin >> a; S[0]=0; for(int i=1;i<n;i++){ S[i]=S[i-1]+a.at(i-1); } int x=S[k]; for(int l=1;l<n-k;l++){ if(x<S[k+l]-S[l]){ x=S[k+l]-S[l]; } cout << x << endl; cin >> n >> k; } } }
a.cc: In function 'int main()': a.cc:8:8: error: 'vector' was not declared in this scope 8 | vector<int> a(n); | ^~~~~~ a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 1 | #include<iostream> +++ |+#include <vector> 2 | using namespace std; a.cc:8:15: error: expected primary-expression before 'int' 8 | vector<int> a(n); | ^~~ a.cc:9:16: error: 'a' was not declared in this scope 9 | cin >> a; | ^ a.cc:10:9: error: 'S' was not declared in this scope 10 | S[0]=0; | ^
s666396900
p00439
C++
#include<iostream> using namespace std; int main() { int n,k; cin >> n >> k; while(n!=0||k!=0){ vector<int> a(n); cin >> a; S[0]=0; for(int i=1;i<n;i++){ S[i]=S[i-1]+a.at(i-1); } int x=S[k]; for(int l=1;l<n-k;l++){ if(x<S[k+l]-S[l]){ x=S[k+l]-S[l]; } } cout << x << endl; cin >> n >> k; } }
a.cc: In function 'int main()': a.cc:8:8: error: 'vector' was not declared in this scope 8 | vector<int> a(n); | ^~~~~~ a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 1 | #include<iostream> +++ |+#include <vector> 2 | using namespace std; a.cc:8:15: error: expected primary-expression before 'int' 8 | vector<int> a(n); | ^~~ a.cc:9:16: error: 'a' was not declared in this scope 9 | cin >> a; | ^ a.cc:10:9: error: 'S' was not declared in this scope 10 | S[0]=0; | ^
s520824745
p00439
C++
#include<iostream> using namespace std; int main() { int n,k; cin >> n >> k; while(n!=0||k!=0){ vector<int> a(n); cin >> a; S[0]=0; for(int i=1;i<n;i++){ S[i]=S[i-1]+a.at(i-1); } int x=S[k]; for(int l=1;l<n-k;l++){ if(x<S[k+l]-S[l]){ x=S[k+l]-S[l]; } } cout << x << endl; cin >> n >> k; } }
a.cc: In function 'int main()': a.cc:8:8: error: 'vector' was not declared in this scope 8 | vector<int> a(n); | ^~~~~~ a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 1 | #include<iostream> +++ |+#include <vector> 2 | using namespace std; a.cc:8:15: error: expected primary-expression before 'int' 8 | vector<int> a(n); | ^~~ a.cc:9:16: error: 'a' was not declared in this scope 9 | cin >> a; | ^ a.cc:10:9: error: 'S' was not declared in this scope 10 | S[0]=0; | ^
s082858688
p00439
C++
#include<iostream> using namespace std; int main() { int n,k,x; cin >> n >> k; while(n!=0||k!=0){ vector<int> a(n); cin >> a; S[0]=0; for(int i=1;i<n;i++){ S[i]=S[i-1]+a.at(i-1); } x=S[k]; for(int l=1;l<n-k;l++){ if(x<S[k+l]-S[l]){ x=S[k+l]-S[l]; } } cout << x << endl; cin >> n >> k; } }
a.cc: In function 'int main()': a.cc:8:8: error: 'vector' was not declared in this scope 8 | vector<int> a(n); | ^~~~~~ a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 1 | #include<iostream> +++ |+#include <vector> 2 | using namespace std; a.cc:8:15: error: expected primary-expression before 'int' 8 | vector<int> a(n); | ^~~ a.cc:9:16: error: 'a' was not declared in this scope 9 | cin >> a; | ^ a.cc:10:9: error: 'S' was not declared in this scope 10 | S[0]=0; | ^
s960407520
p00439
C++
#include <bits/stdc++.h> using namespace std; int main() { int n,k,i,ans=0; cin >> n >> k; while(n!=0 || k!=0){ int a,sum[1000000],S; sum[0]=0; for(i=0;i<n;++i){ cin >> a; sum[i+1] = sum[i] + a; } for(i=0;i<n-k;++i){ S=sum[i+k]-sum[i]; ans = max(ans,S[i]); } cout << ans << endl; cin >> n >> k; } }
a.cc: In function 'int main()': a.cc:18:28: error: invalid types 'int[int]' for array subscript 18 | ans = max(ans,S[i]); | ^
s365731991
p00439
C++
// This file is a "Hello, world!" in C++ language by GCC for wandbox. #include <iostream> #include <cstdlib> #include <vector> using namespace std; int main() { int n,k; cin >> n >> k; int max = 0; vector<int> a(100005, 0); vector<int> s(100005,0); while (n != 0 || k != 0) { int b; s[0] = 0 for(int i = 0; i < n; i++) { cin >> b; s[i+1] = s[i] + b; } for (int j = 0; j < n-k; j++) { if(max < s[i+k] - s[i]) { max = s[i+k] - s[i]; } } cout << max << endl; cin >> n >> k; } }
a.cc: In function 'int main()': a.cc:15:17: error: expected ';' before 'for' 15 | s[0] = 0 | ^ | ; 16 | for(int i = 0; i < n; i++) { | ~~~ a.cc:16:24: error: 'i' was not declared in this scope 16 | for(int i = 0; i < n; i++) { | ^
s357789050
p00439
C++
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <sstream> #include <queue> #include <deque> #include <bitset> #include <iterator> #include <list> #include <stack> #include <map> #include <set> #include <functional> #include <numeric> #include <utility> #include <limits> #include <time.h> #include <math.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <assert.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; typedef vector<ll> vec; typedef vector<vec> vec2; typedef map<ll,ll> MPll; typedef set<ll> setl; const ll INF = 1ll << 60; const ld EPS = 1e-10; signed main(){ ll n,k; bool flag = true; while(flag) { cin >> n; cin >> k; if(n == 0 and k == 0){ return 0; } vec A(n + 1, 0); ll a; for (ll i = 1; i < n + 1; i++) { cin >> a; A[i] = A[i - 1] + a; }; ll max = -9223372036854775808; ll temp; for (int j = k+1; j < n + 1; ++j) { temp = A[j] - A[j - k]; amax(max, temp); } cout << max<<endl; } }
a.cc:55:19: warning: integer constant is so large that it is unsigned 55 | ll max = -9223372036854775808; | ^~~~~~~~~~~~~~~~~~~ a.cc: In function 'int main()': a.cc:59:13: error: 'amax' was not declared in this scope; did you mean 'max'? 59 | amax(max, temp); | ^~~~ | max
s012136182
p00439
C++
#include<map> #include<set> #include<list> #include<cmath> #include<queue> #include<stack> #include<cstdio> #include<string> #include<vector> #include<complex> #include<cstdlib> #include<cstring> #include<numeric> #include<sstream> #include<iostream> #include<algorithm> #include<functional> using namespace std; int main(){ while(1){ int k,n,s=0,cn=0; cin>>k>>n; if(k==0 && n==0){ break; } int dat[1000]; for(int i=0;i<k;i++){ cin>>S>>dat[i]; } for(int j=0;j<k-n+1;j++){ cn=0; for(int k=0;k<n;k++){ cn+=dat[j+k]; } s=max(s,cn); } cout<<s<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:28:22: error: 'S' was not declared in this scope 28 | cin>>S>>dat[i]; | ^
s661934077
p00439
C++
#include <iostream> #include <algorithm> using namespace std; int main () { int n, k, a[100000], i, S[100000],m; cin >> n >> k; for(I=0;i<n;i++) { cin >> a[i]; } for(i=0;i<n-k+1) { S[i]=S[i-1] - a[i-1] + a[i+k]; m = max(m,s[i]); } cout << m << endl; }
a.cc: In function 'int main()': a.cc:8:9: error: 'I' was not declared in this scope 8 | for(I=0;i<n;i++) { | ^ a.cc:11:20: error: expected ';' before ')' token 11 | for(i=0;i<n-k+1) { | ^ | ; a.cc:13:19: error: 's' was not declared in this scope 13 | m = max(m,s[i]); | ^
s113448125
p00439
C++
#include <iostream> #include <algorithm> using namespace std; int main () { int n, k, a[100000], i, S[100000],m; cin >> n >> k; for(i=0;i<n;i++) { cin >> a[i]; } for(i=0;i<n-k+1) { S[i]=S[i-1] - a[i-1] + a[i+k]; m = max(m,S[i]); } cout << m << endl; }
a.cc: In function 'int main()': a.cc:11:20: error: expected ';' before ')' token 11 | for(i=0;i<n-k+1) { | ^ | ;
s643880629
p00439
C++
#include<cstdio> int main() { int n,m,a[100008]; while(~scanf("%d%d",&n,&m)) { if(!n&&!m) break; for(int i=0;i<n;i++) scanf("%d",&a[i]); for(int i=0;i<m;i++) temp += a[i]; int sum = 0,cap = 0; for(int i=0;i<n;i++){ if(cap!=m){ sum += a[i]; cap++; } else sum += a[i]-a[i-3]; if(sum>temp) temp=sum; } printf("%d\n",temp); } return 0; }
a.cc: In function 'int main()': a.cc:10:30: error: 'temp' was not declared in this scope 10 | for(int i=0;i<m;i++) temp += a[i]; | ^~~~ a.cc:15:20: error: 'temp' was not declared in this scope 15 | if(sum>temp) temp=sum; | ^~~~ a.cc:17:23: error: 'temp' was not declared in this scope 17 | printf("%d\n",temp); | ^~~~
s855581972
p00439
C++
#include <iostream> #include <algorithm> using namespace std; int main(){ int n, k; int a[100000]; int sum = 0; int Max = 0; while(true){ cin >> n >> k; if(n + k == 0){ for(int i = 0; i < n; i++){ cin >> a[i]; } for(int i = 0; i < n-k+1; i++){ sum = 0; for(int j = i; j < i+k; j++){ sum += a[j]; } Max = max(Max, sum); } cout << Max << endl; } return 0; }
a.cc: In function 'int main()': a.cc:29:2: error: expected '}' at end of input 29 | } | ^ a.cc:5:11: note: to match this '{' 5 | int main(){ | ^
s348983790
p00439
C++
int main(){ int n,k; int sum1=0 , max = 0; int now = 0, nextdata, next; int* s; while(1){ sum1 = 0; max = 0; cin >>n >>k; if(n == 0) break; s = (int*)malloc(sizeof(int) * n); int data; for(int i = 0; i<k; i++){ cin >>data; s[i] = data; sum1 += data; } max = sum1; now = n-1; for(int i = 0; i<n-k; i++){ cin >>data; if(now+1 == n) { next = 0; nextdata = s[0]; } else{ next = now + 1; nextdata = s[next]; } sum1 = sum1- nextdata + data; if( sum1 > max) max = sum1; now = next; } cout << max << endl; } return 0; }
a.cc: In function 'int main()': a.cc:9:5: error: 'cin' was not declared in this scope 9 | cin >>n >>k; | ^~~ a.cc:13:15: error: 'malloc' was not declared in this scope 13 | s = (int*)malloc(sizeof(int) * n); | ^~~~~~ a.cc:1:1: note: 'malloc' is defined in header '<cstdlib>'; this is probably fixable by adding '#include <cstdlib>' +++ |+#include <cstdlib> 1 | int main(){ a.cc:39:5: error: 'cout' was not declared in this scope 39 | cout << max << endl; | ^~~~ a.cc:39:20: error: 'endl' was not declared in this scope 39 | cout << max << endl; | ^~~~
s848775065
p00439
C++
#include<iostream> using namespace std; int main(){ int n, k; double a[100001] = {}, b[100001] = {}, ans; cin >> n >> k; if (n == 0 || k == 0) break; for (int i = 1; i <= n; i++){ cin >> a[i]; } for (int i = 1; i <= n; i++){ for (int x = 0; x<k; x++){ if (a[i + k] == 0) break; b[i] = a[i + x]; } if (b[i]>b[i - 1]){ ans = b[i]; } } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:7:41: error: break statement not within loop or switch 7 | if (n == 0 || k == 0) break; | ^~~~~
s288575177
p00439
C++
#include <iostream> using namespace std; int main() { int a[100000];int n,m;int b[100000];int p=0; cin >> n >> m; for(int i = 0;i<n;i++){ cin >> a[i]; } for(int i = 0;i<100000;i++){ b[i]=0; } for(int i = 0;i<n-m;i++){ if(a[i]>a[i+m]){ for(int k = i;k<i+m;k++){ b[p]+=a[k]; } p++; } } for(int k = n-m;k<n;k++){ b[p]+=a[k]; } for(int i = 1;i<100000;i++){ if(b[0]<b[i]){b[0]=b[i];} } cout << b[0]<<endl; return 0;
a.cc: In function 'int main()': a.cc:28:18: error: expected '}' at end of input 28 | return 0; | ^ a.cc:4:12: note: to match this '{' 4 | int main() { | ^
s863477213
p00439
C++
#include <stdio.h> int a[100000],e[100000]; int main(){ int b,c,d,f,g=-100000000; while(1){ scanf("%d %d",&c,&b); if(c==0){ return 0; } for(d=0;d<c;d++){ scanf("%d",a[i]); } for(d=0;d<c-b;d++){ for(f=0;f<b;f++){ e[d]+=a[f]; } } for(d=0;d<c-b;d++){ if(g<=e[d]){ g=e[d]; } } printf("%d\n",g); } }
a.cc: In function 'int main()': a.cc:12:38: error: 'i' was not declared in this scope 12 | scanf("%d",a[i]); | ^
s219326951
p00439
C++
#include <cstdio> #include <algorithm> #include <iostream> #include <vector> #include <string> #include <math.h> using namespace std; int main(){ cout >> "56\n788\n650404" ; return 0; }
a.cc: In function 'int main()': a.cc:11:14: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'const char [14]') 11 | cout >> "56\n788\n650404" ; | ~~~~ ^~ ~~~~~~~~~~~~~~~~~ | | | | | const char [14] | std::ostream {aka std::basic_ostream<char>} In file included from /usr/include/c++/14/string:55, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:3: /usr/include/c++/14/bits/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 835 | operator>>(basic_istream<_CharT, _Traits>& __in, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed: a.cc:11:17: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 11 | cout >> "56\n788\n650404" ; | ^~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/bits/memory_resource.h:38, from /usr/include/c++/14/string:68: /usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)' 131 | operator>>(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed: a.cc:11:9: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte' 11 | cout >> "56\n788\n650404" ; | ^~~~ In file included from /usr/include/c++/14/istream:1109, from /usr/include/c++/14/iostream:42: /usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)' 978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c) | ^~~~~~~~ /usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed: a.cc:11:17: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 11 | cout >> "56\n788\n650404" ; | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)' 849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed: a.cc:11:17: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 11 | cout >> "56\n788\n650404" ; | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)' 854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed: a.cc:11:17: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 11 | cout >> "56\n788\n650404" ; | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)' 896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed: a.cc:11:17: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 11 | cout >> "56\n788\n650404" ; | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)' 939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed: a.cc:11:17: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 11 | cout >> "56\n788\n650404" ; | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)' 945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed: a.cc:11:17: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 11 | cout >> "56\n788\n650404" ; | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed: /usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = const char (&)[14]]': a.cc:11:10: required from here 11 | cout >> "56\n788\n650404" ; | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~
s740581366
p00439
C++
#include<cstdio> int N,K; int a[100000]; int main() { scanf("%d%d",&N,&K); for(int i=0;i<N;i++)scanf("%d",&a[i]); int sum=0; for(int i=0;i<K;i++)sum+=a[i]; int ma=sum; for(int i=K;i<N;i++){ sum-=a[i-K]; sum+=a[i]; ma=max(ma,sum); } printf("%d\n",ma); return 0; }
a.cc: In function 'int main()': a.cc:19:12: error: 'max' was not declared in this scope; did you mean 'ma'? 19 | ma=max(ma,sum); | ^~~ | ma
s552710904
p00439
C++
#include<iostream> using namespace std; int num[100100]; int main(){ int n,m; int ans=0; while(1){ for(int i=0;i<100100;i++)num[i]=0; cin>>n>>m; if(n==0&&m==0)break; for(int i=0;i<n;i++) cin>>num[i]; for(int i=0;i<m-n;i++){ int min=num[i]+num[i+1]+num[i+2]; if(ans<min)ans=0; } count<<ans<<endl; ans=0; } return 0; }
a.cc: In function 'int main()': a.cc:16:10: error: 'count' was not declared in this scope 16 | count<<ans<<endl; | ^~~~~
s844990817
p00439
C++
#include<iostream> using namespace std; int num[100100]; int main(){ int n,m; int ans=0; while(1){ for(int i=0;i<100001;i++){ num[i]=0; if(num[i+1]==0)braek; } cin>>n>>m; if(n==0&&m==0)break; for(int i=0;i<n;i++) cin>>num[i]; for(int i=0;i<n-m;i++){ int min=0; for(int j=i;j<i+m;j++)min+=num[j]; if(ans<min)ans=min; } cout<<ans<<endl; ans=0; } return 0; }
a.cc: In function 'int main()': a.cc:10:30: error: 'braek' was not declared in this scope 10 | if(num[i+1]==0)braek; | ^~~~~
s795874981
p00439
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n, k; while(cin >> n >> k, n|k){ int ans, = 0, data[111111] = {}; for(int i=0;i<n;i++) cin >> data[i]; for(int i=1;i<n;i++) data[i] += data[i-1]; for(int i=0;i<n-k;i++) ans = max(ans, data[i+k] - data[i]); cout << ans << endl; } }
a.cc: In function 'int main()': a.cc:10:14: error: expected unqualified-id before '=' token 10 | int ans, = 0, data[111111] = {}; | ^ a.cc:11:37: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 11 | for(int i=0;i<n;i++) cin >> data[i]; | ^ a.cc:12:30: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 12 | for(int i=1;i<n;i++) data[i] += data[i-1]; | ^ a.cc:12:41: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 12 | for(int i=1;i<n;i++) data[i] += data[i-1]; | ^ a.cc:14:47: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 14 | for(int i=0;i<n-k;i++) ans = max(ans, data[i+k] - data[i]); | ^ a.cc:14:59: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 14 | for(int i=0;i<n-k;i++) ans = max(ans, data[i+k] - data[i]); | ^
s783899589
p00439
C++
#include <iostream> #include <algorithm> int N = 1 << 17; int seg[N * 2]; void update(int x, int v) { x += N - 1; seg[x] = v; while (x) { x = (x - 1) / 2; seg[x] = seg[x + x + 1] + seg[x + x + 2]; } } int query(int a, int b, int x, int l, int r) { if (b <= l || r <= a) return 0; if (l <= a && b <= r) return seg[x]; return query(a, b, x + x + 1, l, (l + r) / 2) + query(a, b, x + x + 2, (l + r) / 2, r); } int Q(int a, int b) { return query(a, b, 0, 0, N); } int in() { int x; scanf("%d", &x); return x;} int main(void) { int n = in(), K = in(); for (int i = 0; i < n; i++) update(i, in()); int mini = 1 << 30; for (int i = 0; i < n - K; i++) mini = min(mini, Q(i, i + K)); cout << mini << endl; return 0; }
a.cc:5:11: error: size of array 'seg' is not an integral constant-expression 5 | int seg[N * 2]; | ~~^~~ a.cc: In function 'int main()': a.cc:29:44: error: 'min' was not declared in this scope; did you mean 'std::min'? 29 | for (int i = 0; i < n - K; i++) mini = min(mini, Q(i, i + K)); | ^~~ | std::min In file included from /usr/include/c++/14/algorithm:61, from a.cc:2: /usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ a.cc:30:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 30 | cout << mini << endl; | ^~~~ | std::cout In file included 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:30:21: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 30 | cout << mini << endl; | ^~~~ | std::endl In file included from /usr/include/c++/14/iostream:41: /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~
s667948627
p00439
C++
include<iostream> #include<algorithm> using namespace std; int n, k ,i = 0, a[100000]; long long int b[100000]; long long int result[100][2]; int main() { for (;; i++) { cin >> n >> k; if (n == 0) { break; } for (int p = 0; p < n; p++) { cin >> a[p]; } for (int p = 0; p < n - k; p++) { for (int q = 0; q < k; q++) { result[i][0] += a[p + q]; } result[i][1] = max(result[i][0], result[i][1]); result[i][0] = 0; } } for (int p = 0; p < i; p++) { cout << result[p][1] << endl; } return 0; }
a.cc:1:1: error: 'include' does not name a type 1 | include<iostream> | ^~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/algorithm:60, from a.cc:2: /usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity 164 | __is_null_pointer(std::nullptr_t) | ^ /usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)' 159 | __is_null_pointer(_Type) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std' 164 | __is_null_pointer(std::nullptr_t) | ^~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/type_traits:295:27: error: 'size_t' has not been declared 295 | template <typename _Tp, size_t = sizeof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std' 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:984:26: error: 'size_t' has not been declared 984 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std' 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std' 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std' 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std' 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1451:32: error: 'size_t' was not declared in this scope 1451 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 63 | #include <bits/version.h> +++ |+#include <cstddef> 64 | /usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid 1451 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared 1453 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope 1454 | struct extent<_Tp[_Size], 0> | ^~~~~ /usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid 1454 | struct extent<_Tp[_Size], 0> | ^ /usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~ /usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid 1455 | : public integral_constant<size_t, _Size> { }; | ^ /usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid /usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared 1457 | template<typename _Tp, unsigned _Uint, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope 1458 | struct extent<_Tp[_Size], _Uint> | ^~~~~ /usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid 1458 | struct extent<_Tp[_Size], _Uint> | ^ /usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope 1463 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid 1463 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type 1857 | { static constexpr size_t __size = sizeof(_Tp); }; | ^~~~~~ /usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~~~~ /usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~ /usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp' 1860 | struct __select; | ^~~~~~~~ /usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared 1862 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^~~ /usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^ /usr/include/c++/14/type_traits:1866:14: error: 'size_t' has not been declared 1866 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1867:23: error: '_Sz' was not declared in this scope 1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false> | ^~~ /usr/include/c++/14/type_traits:1867:58: error: template argument 1 is invalid 1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false>
s451365862
p00439
C++
#include <iostream> using namespace std; #define MAX_N 100010 int N, K; int S[MAX_N]; int main() { while (true) { cin >> N >> K; if (N == 0 && K == 0) break; int ans = INT_MIN; for (int i=0; i<N; i++) cin >> S[i]; for (int i=0; i<=N-K; i++) { int t = 0; for (int j=0; j<K; j++) t += S[i+j]; ans = max(ans, t); } cout << ans << "\n"; } return 0; }
a.cc: In function 'int main()': a.cc:12:13: error: 'INT_MIN' was not declared in this scope 12 | int ans = INT_MIN; | ^~~~~~~ a.cc:2:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 1 | #include <iostream> +++ |+#include <climits> 2 | using namespace std;
s252806169
p00439
C++
#include <iostream> #include <cstdlib> using namespace std; #define MAX_N 100010 int N, K; int S[MAX_N]; int main() { while (true) { cin >> N >> K; if (N == 0 && K == 0) break; int ans = INT_MIN; for (int i=0; i<N; i++) cin >> S[i]; for (int i=0; i<=N-K; i++) { int t = 0; for (int j=0; j<K; j++) t += S[i+j]; ans = max(ans, t); } cout << ans << "\n"; } return 0; }
a.cc: In function 'int main()': a.cc:13:13: error: 'INT_MIN' was not declared in this scope 13 | int ans = INT_MIN; | ^~~~~~~ a.cc:3:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 2 | #include <cstdlib> +++ |+#include <climits> 3 | using namespace std;
s553823171
p00439
C++
#include <vector> #include <iostream> #include <utility> #include <algorithm> #include <string> #include <deque> #include <tuple> #include <queue> #include <functional> using namespace std; const int INF = 1 << 30; int main(){ int n, k; for (cin >> n >> k, n) { vector<int> a(n); for (int &x : a)cin >> x; int pos = 0; int sum = 0; for (int i = 0; i < k; i++) { sum += a[i]; } int max = sum; for (int i = 0; i < n - k; i++) { sum += a[i + k] - a[i]; max = std::max(max, sum); } cout << max << endl; } return 0; }
a.cc: In function 'int main()': a.cc:14:30: error: expected ';' before ')' token 14 | for (cin >> n >> k, n) { | ^ | ; a.cc:29:9: error: expected primary-expression before 'return' 29 | return 0; | ^~~~~~ a.cc:28:10: error: expected ';' before 'return' 28 | } | ^ | ; 29 | return 0; | ~~~~~~ a.cc:29:9: error: expected primary-expression before 'return' 29 | return 0; | ^~~~~~ a.cc:28:10: error: expected ')' before 'return' 28 | } | ^ | ) 29 | return 0; | ~~~~~~ a.cc:14:13: note: to match this '(' 14 | for (cin >> n >> k, n) { | ^
s291558117
p00439
C++
#include <iostream> using namespace std; int n; int a[100000]; int main() { cin >> n; static int ra[100001]; //ra[i] = a[0] + ??? + a[i-1] ra[0] = 0; for (int i = 0; i < n; i++) { ra[i+1] = ra[i] + a[i]; } int ans = -1000000001; for (int i = 0; i < n - k; i++) { //a[i] + ??? + a[i+k-1] ans = max(ans, ra[i+k] - ra[i]); } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:17:33: error: 'k' was not declared in this scope 17 | for (int i = 0; i < n - k; i++) { | ^
s492557011
p00439
C++
#include<cstdio> #include<utility> #include<algorithm> #define INF INT_MAX/2-1 #define rep(i,n) for(int i=0;i<n;i++) using namespace std; typedef long long ll; int a[100000]; int main(){ int n, k; while (scanf("%d%d", &n, &k), n){ rep(i, n) scanf("%d", &a[i]); int Max = -INF; rep(i, n - k + 1){ int sum = 0; rep(j, k){ sum += a[i + j]; } Max = max(Max, sum); } printf("%d\n", Max); } return 0; }
a.cc: In function 'int main()': a.cc:4:13: error: 'INT_MAX' was not declared in this scope 4 | #define INF INT_MAX/2-1 | ^~~~~~~ a.cc:15:28: note: in expansion of macro 'INF' 15 | int Max = -INF; | ^~~ a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 3 | #include<algorithm> +++ |+#include <climits> 4 | #define INF INT_MAX/2-1
s966990613
p00439
C++
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; int a[101010] = {0}; cin >> a[1]; for (int i = 2; i < n + 1; i++){ cin >> a[i]; a[i] += a[i - 1]; } int max_n = -1e9; for (int i = 0; i < n - k; i++){ max_n = max(max_n, a[k + i] - a[i]); } cout << max_n << endl; } #include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; int a[101010] = {0}; cin >> a[1]; for (int i = 2; i < n + 1; i++){ cin >> a[i]; a[i] += a[i - 1]; } int max_n = -1e9; for (int i = 0; i < n - k; i++){ max_n = max(max_n, a[k + i] - a[i]); } cout << max_n << endl; }
a.cc:27:5: error: redefinition of 'int main()' 27 | int main() | ^~~~ a.cc:4:5: note: 'int main()' previously defined here 4 | int main() | ^~~~
s109551160
p00439
C++
000 0 0 0
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 000 | ^~~
s831587368
p00439
C++
#include <iostream> #define r(i,n) for(int i=0;i<n;i++) using namespace std; int main(){ int a,b while(cin>>a>>b,a){ int c[a],w=0; r(i,a)cin>>c[i]; r(i,a-2)w=max(w,c[i]+c[i+2]+c[i+1]; cout<<w<<endl; } }
a.cc: In function 'int main()': a.cc:6:3: error: expected initializer before 'while' 6 | while(cin>>a>>b,a){ | ^~~~~
s673449815
p00439
C++
aaaaaaaaa
a.cc:1:1: error: 'aaaaaaaaa' does not name a type 1 | aaaaaaaaa | ^~~~~~~~~
s575891884
p00439
C++
aaaaaaaaa
a.cc:1:1: error: 'aaaaaaaaa' does not name a type 1 | aaaaaaaaa | ^~~~~~~~~
s797452188
p00439
C++
#include<iostream> using namespace std; int a[1000000] int main(){ int i,i2,n,k,a[5001],max=-100000000,sum; cin>>n>>k; while(n!=0){ for(i=1;i<=n;i++)cin>>a[i]; for(i=1;i<=n-k+1;i++){ sum=0; for(i2=i;i2<i+k;i2++)sum+=a[i2]; if(sum>max){ max=sum; } } cout<<max<<endl; cin>>n>>k; } } /*#include <stdio.h> int a[100000]; int main() { int i, j, n, m, k, t; while (1) { scanf("%d%d", &n, &k); if (!n && !k) break; for (i = 0; i < n; i++) ~scanf("%d",a+i); for (i = m = 0; i < n - k; i++) { for (j = t = 0; j < k; j++) t += a[i+j]; if (t > m) m = t; } printf("%d\n", m); } return 0; }*/
a.cc:4:1: error: expected initializer before 'int' 4 | int main(){ | ^~~
s831183726
p00439
C++
#include<iostream> using namespace std; int a[1000000] int main(){ int i,i2,n,k,max=-100000000,sum; cin>>n>>k; while(n!=0){ for(i=1;i<=n;i++)cin>>a[i]; for(i=1;i<=n-k+1;i++){ sum=0; for(i2=i;i2<i+k;i2++)sum+=a[i2]; if(sum>max){ max=sum; } } cout<<max<<endl; cin>>n>>k; } } /*#include <stdio.h> int a[100000]; int main() { int i, j, n, m, k, t; while (1) { scanf("%d%d", &n, &k); if (!n && !k) break; for (i = 0; i < n; i++) ~scanf("%d",a+i); for (i = m = 0; i < n - k; i++) { for (j = t = 0; j < k; j++) t += a[i+j]; if (t > m) m = t; } printf("%d\n", m); } return 0; }*/
a.cc:4:1: error: expected initializer before 'int' 4 | int main(){ | ^~~
s408020795
p00439
C++
#include <string> #include <stdio.h> #include <queue> #include <stack> #include <math.h> using namespace std; int main(void) { for (;;) { int a,b,c,d,max=0; scanf("%d %d",&a,&b); int e[a]; if (a==0&&b==0) break; for (c=0;c<a;c++){ scanf("%d",&d); e[c]=d; } for (int f=0;f<=a-b;f++){ for (int g=1;g<b;g++){ e[f]=e[f]+e[f+g]; } if (e[f]>=max) max=e[f]; } printf("%d\n",max); return 0; }
a.cc: In function 'int main()': a.cc:27:2: error: expected '}' at end of input 27 | } | ^ a.cc:8:1: note: to match this '{' 8 | { | ^
s082403343
p00439
C++
while 1: n,k = [int(i) for i in input().split()] if not n and k: break a = [int(input()) for i in range(n)] b = [0]*len(a) for i in range(n): b[i] = b[i-1] + a[i] b = b + [0] c = [b[i + k - 1] - b[i - 1] for i in range(n - k + 1)] print(max(c))
a.cc:1:1: error: expected unqualified-id before 'while' 1 | while 1: | ^~~~~
s236304606
p00439
C++
#include<iostream> using namespace std; int suretu[100000]; int cont = 0, max_sum = 0; int ret_maxsum(int n, int k, int wa ) { int temp = 0; int i; /* if(isBegin == 1){ for(i = 0; i < k; i++){ temp += suretu[cont+i]; } } */ else{temp += wa + suretu[cont+k-1];} wa = temp - suretu[cont]; cont++; if(max_sum < temp){max_sum = temp;} if(cont == n-k+1){return max_sum;} else{return ret_maxsum(n, k, wa, 0);} } main() { for(;;){ int n,k; cin >> n; cin >> k; if(n == 0 && k == 0){ break; } for(int i = 0; i < n; i++){ cin >> suretu[i]; } printf("%d\n",ret_maxsum(n, k, 0)); } }
a.cc: In function 'int ret_maxsum(int, int, int)': a.cc:17:9: error: 'else' without a previous 'if' 17 | else{temp += wa + suretu[cont+k-1];} | ^~~~ a.cc:22:31: error: too many arguments to function 'int ret_maxsum(int, int, int)' 22 | else{return ret_maxsum(n, k, wa, 0);} | ~~~~~~~~~~^~~~~~~~~~~~~ a.cc:6:5: note: declared here 6 | int ret_maxsum(int n, int k, int wa ) | ^~~~~~~~~~ a.cc: At global scope: a.cc:24:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 24 | main() | ^~~~
s819888402
p00439
C++
#include<iostream> using namespace std; int suretu[100000]; int cont = 0, max_sum = 0; int ret_maxsum(int n, int k, int wa ) { int temp = 0; int i; /* if(isBegin == 1){ for(i = 0; i < k; i++){ temp += suretu[cont+i]; } } */ else{temp += wa + suretu[cont+k-1];} wa = temp - suretu[cont]; cont++; if(max_sum < temp){max_sum = temp;} if(cont == n-k+1){return max_sum;} else{return ret_maxsum(n, k, wa);} } main() { for(;;){ int n,k; cin >> n; cin >> k; if(n == 0 && k == 0){ break; } for(int i = 0; i < n; i++){ cin >> suretu[i]; } printf("%d\n",ret_maxsum(n, k, 0)); } }
a.cc: In function 'int ret_maxsum(int, int, int)': a.cc:17:9: error: 'else' without a previous 'if' 17 | else{temp += wa + suretu[cont+k-1];} | ^~~~ a.cc: At global scope: a.cc:24:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 24 | main() | ^~~~
s956998005
p00439
C++
#include<iostream> main(){for(intn,k,a[100000],s,M,i;std::cin>>n>>k,n;printf("%d\n",M))for(M=1<<31,i=s=0;i<n;s+=a[i++],k<i&&(s-=a[ik-1]),M<s&&(M=s))std::cin>>a[i];}
a.cc:2:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 2 | main(){for(intn,k,a[100000],s,M,i;std::cin>>n>>k,n;printf("%d\n",M))for(M=1<<31,i=s=0;i<n;s+=a[i++],k<i&&(s-=a[ik-1]),M<s&&(M=s))std::cin>>a[i];} | ^~~~ a.cc: In function 'int main()': a.cc:2:12: error: 'intn' was not declared in this scope; did you mean 'int'? 2 | main(){for(intn,k,a[100000],s,M,i;std::cin>>n>>k,n;printf("%d\n",M))for(M=1<<31,i=s=0;i<n;s+=a[i++],k<i&&(s-=a[ik-1]),M<s&&(M=s))std::cin>>a[i];} | ^~~~ | int a.cc:2:17: error: 'k' was not declared in this scope 2 | main(){for(intn,k,a[100000],s,M,i;std::cin>>n>>k,n;printf("%d\n",M))for(M=1<<31,i=s=0;i<n;s+=a[i++],k<i&&(s-=a[ik-1]),M<s&&(M=s))std::cin>>a[i];} | ^ a.cc:2:19: error: 'a' was not declared in this scope 2 | main(){for(intn,k,a[100000],s,M,i;std::cin>>n>>k,n;printf("%d\n",M))for(M=1<<31,i=s=0;i<n;s+=a[i++],k<i&&(s-=a[ik-1]),M<s&&(M=s))std::cin>>a[i];} | ^ a.cc:2:29: error: 's' was not declared in this scope 2 | main(){for(intn,k,a[100000],s,M,i;std::cin>>n>>k,n;printf("%d\n",M))for(M=1<<31,i=s=0;i<n;s+=a[i++],k<i&&(s-=a[ik-1]),M<s&&(M=s))std::cin>>a[i];} | ^ a.cc:2:31: error: 'M' was not declared in this scope 2 | main(){for(intn,k,a[100000],s,M,i;std::cin>>n>>k,n;printf("%d\n",M))for(M=1<<31,i=s=0;i<n;s+=a[i++],k<i&&(s-=a[ik-1]),M<s&&(M=s))std::cin>>a[i];} | ^ a.cc:2:33: error: 'i' was not declared in this scope 2 | main(){for(intn,k,a[100000],s,M,i;std::cin>>n>>k,n;printf("%d\n",M))for(M=1<<31,i=s=0;i<n;s+=a[i++],k<i&&(s-=a[ik-1]),M<s&&(M=s))std::cin>>a[i];} | ^ a.cc:2:45: error: 'n' was not declared in this scope 2 | main(){for(intn,k,a[100000],s,M,i;std::cin>>n>>k,n;printf("%d\n",M))for(M=1<<31,i=s=0;i<n;s+=a[i++],k<i&&(s-=a[ik-1]),M<s&&(M=s))std::cin>>a[i];} | ^ a.cc:2:112: error: 'ik' was not declared in this scope 2 | main(){for(intn,k,a[100000],s,M,i;std::cin>>n>>k,n;printf("%d\n",M))for(M=1<<31,i=s=0;i<n;s+=a[i++],k<i&&(s-=a[ik-1]),M<s&&(M=s))std::cin>>a[i];} | ^~
s930963438
p00439
C++
#include <cstdio> #define MAX(x, y) (x < y) ? y : x int main(void) { int n, k; int data[100000] = {0}; while (1){ scanf("%d %d", &n, &k); if (n == 0 && k == 0) break; for (int i = 0; i < n; i++){ scanf("%d", &data[i]); } for (int i = 0; i < n - 1; i++){ if (data[j] < 0) data[j] *= 2; } for (int i = 0; i < n - 1; i++){ data[i + 1] += data[i]; } int max = 0; for (int i = 0; i <= (n - k); i++){ int tmp = data[i + k] - data[i]; // for (int j = i; j < (i + k); j++){ // if (data[j] < 0) tmp += data[j]; // } max = MAX(max, tmp); } /* int max = 0, tmp; for (int i = 0; i <= (n - k); i++){ tmp = 0; for (int j = i; j < (i + k); j++){ tmp += data[j]; } max = MAX(max, tmp); }*/ printf("%d\n", max); } return (0); }
a.cc: In function 'int main()': a.cc:18:34: error: 'j' was not declared in this scope 18 | if (data[j] < 0) data[j] *= 2; | ^
s829145613
p00439
C++
#include <cstdio> #define MAX(x, y) (x < y) ? y : x int main(void) { int n, k; int data[100000] = {0}; while (1){ scanf("%d %d", &n, &k); if (n == 0 && k == 0) break; for (int i = 0; i < n; i++){ scanf("%d", &data[i]); } for (int i = 0; i < n - 1; i++){ if (data[j] < 0) data[j] *= 2; } for (int i = 0; i < n - 1; i++){ data[i + 1] += data[i]; } int max = 0; for (int i = 0; i <= (n - k); i++){ int tmp = data[i + k] - data[i]; // for (int j = i; j < (i + k); j++){ // if (data[j] < 0) tmp += data[j]; // } max = MAX(max, tmp); } /* int max = 0, tmp; for (int i = 0; i <= (n - k); i++){ tmp = 0; for (int j = i; j < (i + k); j++){ tmp += data[j]; } max = MAX(max, tmp); }*/ printf("%d\n", max); } return (0); }
a.cc: In function 'int main()': a.cc:18:34: error: 'j' was not declared in this scope 18 | if (data[j] < 0) data[j] *= 2; | ^
s623208025
p00439
C++
#include <iostream> using namespace std; int main(){ int n,k,max,buf,*a; while(1){ cin >> n >> k; if(n || k){ max = 0; a = new int[n]; for(int i = 0; i < n; i++){ cin >> a[i]; } for(int i = 0; i <= n-k; i++){ buf = 0; for(int j = 0; j < k; j++){ buf += a[i+j]; } if(max < buf){ max = buf; } } cout << max << endl; } return 0; }
a.cc: In function 'int main()': a.cc:35:2: error: expected '}' at end of input 35 | } | ^ a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s016990413
p00439
C++
import java.util.ArrayDeque; import java.util.Deque; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); while (in.hasNext()) { final int n = in.nextInt(); final int k = in.nextInt(); if (n == 0 && k == 0) { throw new RuntimeException(); } int max = Integer.MIN_VALUE, val = 0; Deque<Integer> deq = new ArrayDeque<Integer>(k); for (int i = 0; i < n; i++) { final int number = in.nextInt(); if (i < k) { val += number; } else { final int f = deq.poll(); val += (number - f); } deq.addLast(number); if (val > max) { max = val; } } System.out.println(max); } } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.ArrayDeque; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:2:1: error: 'import' does not name a type 2 | import java.util.Deque; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: 'import' does not name a type 3 | import java.util.Scanner; | ^~~~~~ a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:5:1: error: expected unqualified-id before 'public' 5 | public class Main { | ^~~~~~
s624148922
p00439
C++
#include <vector> #include <map> #include <set> #include <stack> #include <queue> #include <deque> #include <algorithm> #include <utility> #include <functional> #include <sstream> #include <iostream> #include <cstdio> #include <cmath> #include <cstdlib> #include <cctype> #include <string> #include <cstring> #include <ctime> #include <climits> using namespace std; inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v;} template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str();} typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<string> vs; typedef pair<int, int> pii; typedef long long ll; #define ALL(a) (a).begin(),(a).end() #define RALL(a) (a).rbegin(),(a).rend() #define EACH(t,i,c) for(t::iretator i=(c).begin(); i!=(c).end(); ++i) #define EXIST(s,e) ((s).find(e)!=(s).end()) #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) const double EPS = 1e-10; int main() { int n, k; ll result, tmp; cin >> n >> k; vi nums(n); result = -_UI64_MAX; REP(i, n) { cin >> nums[i]; } REP(i, n-k+1) { tmp = 0; REP(j, k) { tmp += nums[i+j]; } if(result < tmp) { result = tmp; } } cout << result << endl; return 0; }
a.cc: In function 'int main()': a.cc:48:19: error: '_UI64_MAX' was not declared in this scope; did you mean 'UINT_MAX'? 48 | result = -_UI64_MAX; | ^~~~~~~~~ | UINT_MAX
s911340724
p00439
C++
#include <stdio.h> int main(){ while(1){ int k,n,i,x[100000]; long long int max,sum=0; scanf("%d%d",&n,&k); if(n==0 && k==0) break; for(i=0;<n;i++){ scanf("%d",&x[i]); } for(i=0;i<k;i++){ sum+=x[i]; } max=sum; for(i=1;i<=n-k;i++){ for(j=i;j<i+k;j++){ sum=0; sum+=x[j]; } if(max<sum) max=sum; } printf("%lld\n",max); return 0; }
a.cc: In function 'int main()': a.cc:8:9: error: expected primary-expression before '<' token 8 | for(i=0;<n;i++){ | ^ a.cc:16:5: error: 'j' was not declared in this scope 16 | for(j=i;j<i+k;j++){ | ^ a.cc:24:2: error: expected '}' at end of input 24 | } | ^ a.cc:2:11: note: to match this '{' 2 | int main(){ | ^
s766249819
p00439
C++
#include <stdio.h> int main(){ int n,k,i,max=0; int x[100001]; scanf("%d %d",&n,&k); for(i=0;i<n;i++)[ scanf("%d",&x[i]); } for(i=0;i<k;i++){ max+=x[i]; } for(i=0;i<n-k;i++){ if(x[i]<x[i+k]){ max-=x[i]; max+=x[i+k]; }} printf("%d\n",max); return 0; }
a.cc: In function 'int main()': a.cc:7:25: error: expression list treated as compound expression in initializer [-fpermissive] 7 | scanf("%d",&x[i]); | ^ a.cc:7:26: error: expected ',' before ';' token 7 | scanf("%d",&x[i]); | ^ | , a.cc:7:26: error: expected identifier before ';' token a.cc:7:26: error: expected ']' before ';' token 7 | scanf("%d",&x[i]); | ^ | ] a.cc: In lambda function: a.cc:7:26: error: expected '{' before ';' token a.cc: At global scope: a.cc:9:1: error: expected unqualified-id before 'for' 9 | for(i=0;i<k;i++){ | ^~~ a.cc:9:9: error: 'i' does not name a type 9 | for(i=0;i<k;i++){ | ^ a.cc:9:13: error: 'i' does not name a type 9 | for(i=0;i<k;i++){ | ^ a.cc:12:9: error: expected unqualified-id before 'for' 12 | for(i=0;i<n-k;i++){ | ^~~ a.cc:12:17: error: 'i' does not name a type 12 | for(i=0;i<n-k;i++){ | ^ a.cc:12:23: error: 'i' does not name a type 12 | for(i=0;i<n-k;i++){ | ^ a.cc:17:23: error: expected constructor, destructor, or type conversion before '(' token 17 | printf("%d\n",max); | ^ a.cc:18:17: error: expected unqualified-id before 'return' 18 | return 0; | ^~~~~~ a.cc:19:17: error: expected declaration before '}' token 19 | } | ^
s999369769
p00439
C++
#include<string> #include<vector> #include<algorithm> #include<queue> using namespace std; int main() { int n, k, num, ans, sam; while(cin >> n >> k) { queue<int> que; ans = 0; sam = 0; for(int i = 0; i < n; i++) { cin >> num; que.push(num); sam += num; if(que.size() == 3 ) { if(ans < sam) { ans = sam; } sam -= que.front(); que.pop(); } } cout << ans << endl; } }
a.cc: In function 'int main()': a.cc:12:15: error: 'cin' was not declared in this scope 12 | while(cin >> n >> k) | ^~~ a.cc:5:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 4 | #include<queue> +++ |+#include <iostream> 5 | a.cc:32:17: error: 'cout' was not declared in this scope 32 | cout << ans << endl; | ^~~~ a.cc:32:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:32:32: error: 'endl' was not declared in this scope 32 | cout << ans << endl; | ^~~~ a.cc:5:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 4 | #include<queue> +++ |+#include <ostream> 5 |
s434096182
p00439
C++
const int MAX_N = 1 << 17, INF = 1 << 24; class BIT{ public: BIT(int _n) :n(_n){ std::fill(bit, bit+n, 0); } int sum(int i){ int s = 0; while(i > 0){ s += bit[i]; i -= i & -i; } return s; } int add(int i, int x){ while(i <= n){ bit[i] += x; i += i & -i; } } private: int bit[MAX_N], n; }; int main(){ int n, k; while(std::cin >> n >> k, n){ BIT b(n+1); for(int i=1;i<=n;i++){ int a_i; std::cin >> a_i; b.add(i, a_i); } int res = -INF; for(int i=1;i+k-1<=n;i++){ res = std::max(res, b.sum(i+k-1) - b.sum(i-1)); } std::cout << res << std::endl; } }
a.cc: In constructor 'BIT::BIT(int)': a.cc:6:22: error: 'fill' is not a member of 'std' 6 | std::fill(bit, bit+n, 0); | ^~~~ a.cc: In member function 'int BIT::add(int, int)': a.cc:21:9: warning: no return statement in function returning non-void [-Wreturn-type] 21 | } | ^ a.cc: In function 'int main()': a.cc:28:20: error: 'cin' is not a member of 'std' 28 | while(std::cin >> n >> k, n){ | ^~~ a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' +++ |+#include <iostream> 1 | const int MAX_N = 1 << 17, INF = 1 << 24; a.cc:32:30: error: 'cin' is not a member of 'std' 32 | std::cin >> a_i; | ^~~ a.cc:32:30: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:38:36: error: 'max' is not a member of 'std' 38 | res = std::max(res, b.sum(i+k-1) - b.sum(i-1)); | ^~~ a.cc:41:22: error: 'cout' is not a member of 'std' 41 | std::cout << res << std::endl; | ^~~~ a.cc:41:22: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:41:42: error: 'endl' is not a member of 'std' 41 | std::cout << res << std::endl; | ^~~~ a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' +++ |+#include <ostream> 1 | const int MAX_N = 1 << 17, INF = 1 << 24;
s447660166
p00439
C++
#include <iostream> #include <queue> #include <cctype> #include <stdio.h> #include <map> #include <string.h> using namespace std; int main(int argc, char const* argv[]) { int n,k; while (cin >> n >> k) { if (n == 0 && k==0) { break; } vector<int> vec(n); vector<int> sum(n -k +1); int input; for (int i = 0; i < n; i++) { cin >> vec[i];//input; //vec.push_back(input); } for (int i = 0; i < n - k + 1; i++) { sum[i]=0; for (int j = 0; j < k; j++) { sum[i] += vec[i + j]; //cout << " " << vec[i+j] << endl; } //cout << "sum="<< sum[i] << endl; } //for (int i = 0; i < n-k+1; i++) //{ // cout << vec[i]<<endl; //} sort(sum.begin(), sum.end() , greater<int>() ); //for (int i = 0; i < n-k+1; i++) //{ // cout << vec[i]<<endl; //} cout << sum[0]; } return 0; }
a.cc: In function 'int main(int, const char**)': a.cc:41:9: error: 'sort' was not declared in this scope; did you mean 'short'? 41 | sort(sum.begin(), sum.end() , greater<int>() ); | ^~~~ | short
s514453653
p00439
C++
#include <iostream> #include <queue> #include <cctype> #include <stdio.h> #include <map> #include <string.h> using namespace std; int main(int argc, char const* argv[]) { int n,k; while (cin >> n >> k) { if (n == 0 && k==0) { break; } vector<int> vec(n); vector<int> sum(n -k +1); int input; for (int i = 0; i < n; i++) { cin >> vec[i];//input; //vec.push_back(input); } for (int i = 0; i < n - k + 1; i++) { sum[i]=0; for (int j = 0; j < k; j++) { sum[i] += vec[i + j]; //cout << " " << vec[i+j] << endl; } //cout << "sum="<< sum[i] << endl; } //for (int i = 0; i < n-k+1; i++) //{ // cout << vec[i]<<endl; //} sort(sum.begin(), sum.end() , greater<int>() ); //for (int i = 0; i < n-k+1; i++) //{ // cout << vec[i]<<endl; //} cout << sum[0]; } return 0; }
a.cc: In function 'int main(int, const char**)': a.cc:41:9: error: 'sort' was not declared in this scope; did you mean 'short'? 41 | sort(sum.begin(), sum.end() , greater<int>() ); | ^~~~ | short
s163336465
p00439
C++
#include <iostream> #include <algorithm> #include <string> #include <vector> #define rep(i, a, b) for(int i = (a); (i) < (b); i++) using namespace std; int main() { int n, k; while(cin >> n >> k, n) { vector<int> num; int tmp; rep(i, 0, n) { cin >> tmp; num.push_back(tmp); } int s = 0; rep(i, 1, n-k+1) { tmp = 0; rep(j, 0, k) { tmp += num[i+j-1]; } if(s < tmp) s = tmp; } } cout << s << endl; return 0; }
a.cc: In function 'int main()': a.cc:31:17: error: 's' was not declared in this scope 31 | cout << s << endl; | ^
s899115961
p00439
C++
#include <iostream> #include <vector> #include <algorithm> #include <utility> #include <string> #include <sstream> #include <cstring> #include <cstdio> #include <cstdlib> #include <cmath> #include <cctype> #include <queue> #include <stack> #include <map> #include <set> #include <bitset> #define rep(i, n) for(int i = 0; i < (n); i++) #define FOR(i, a, b) for(int i = (a); i < (b); i++) #define all(v) (v).begin(), (v).end() #define rev(s) (s).rbegin(), (s).rend() #define MP make_pair #define X first #define Y second #define debug(x) cout << #x << " = " << x << endl; #define sq(x) ((x)*(x)) using namespace std; typedef long long ll; typedef pair<int, int> P; typedef vector<int> vi; int main(){ int n, k; cin >> n >> k; queue<int> q; int sum = 0; int ans = -INT_MAX; rep(i, n){ int a; cin >> a; sum += a; q.push(a); if(q.size() >= k){ ans = max(ans, sum); sum -= q.front(); q.pop(); } } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:39:20: error: 'INT_MAX' was not declared in this scope 39 | int ans = -INT_MAX; | ^~~~~~~ a.cc:17:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 16 | #include <bitset> +++ |+#include <climits> 17 |
s514284818
p00439
C++
import sys #fp = open("input.txt", "r") fp = sys.stdin while True: req = map(int, fp.readline()[:-1].split(" ")) if req[0] + req[1] == 0: break n = req[0] k = req[1] sum_max = 0 num_list = [] for i in xrange(n): num = int(fp.readline()[:-1]) num_list.append(num) if k > 0: sum_max += num k -= 1 continue else: num_list.pop(0) sum_tmp = sum(num_list) if sum_tmp > sum_max: sum_max = sum_tmp print sum_max
a.cc:3:2: error: invalid preprocessing directive #fp 3 | #fp = open("input.txt", "r") | ^~ a.cc:1:1: error: 'import' does not name a type 1 | import sys | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
s871942963
p00440
Java
public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int flagN = in.nextInt(); int flagK = in.nextInt(); while ((flagN != 0) && (flagK != 0)) { final int k = flagK; boolean has0 = false; NumTree nums = null; for (int i = 0; i < k; i++) { int num = in.nextInt(); if (!has0 && (num == 0)) { has0 = true; } else if (nums == null) { nums = new NumTree(num); } else { nums = nums.put(num); } } System.out.println(nums.maxCount(has0)); flagN = in.nextInt(); flagK = in.nextInt(); } } } class NumTree { int low, high; NumTree upperHigh = null; NumTree(int num) { this.low = num; this.high = num; } int count() { return (high - low) + 1; } int maxCount(boolean has0) { if (upperHigh == null) { return count(); } int upperMax = upperHigh.maxCount(has0); int count = count(); if (has0 && ((upperHigh.low - 2) == high)) { count += upperHigh.count() + 1; } return Math.max(upperMax, count); } NumTree put(int num) { if (num <= (low - 2)) { NumTree result = new NumTree(num); result.upperHigh = this; return result; } if (num == (low - 1)) { low = num; } else if (num == (high + 1)) { high = num; if ((upperHigh != null) && ((high + 1) == upperHigh.low)) { high = upperHigh.high; upperHigh = upperHigh.upperHigh; } } else if (num > high) { if (upperHigh != null) { upperHigh = upperHigh.put(num); } else { upperHigh = new NumTree(num); } } return this; } }
Main.java:3: error: cannot find symbol Scanner in = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:3: error: cannot find symbol Scanner in = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors
s814686119
p00440
Java
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); while (in.hasNext()) { int flagN = Integer.parseInt(in.next()); int flagK = Integer.parseInt(in.next()); if (flagN == 0) { break; } int k = flagK; int[] array = new int[flagK]; boolean has0 = false; NumTree nums = NumTree.QQQ; for (int i = 0; i < k; i++) { array[i] = Integer.parseInt(in.next()); } for (int num : array) { if (!has0 && (num == 0)) { has0 = true; } else { nums = nums.put(num); } } System.out.println(nums.maxCount(has0)); } } } class NumTree { static final NumTree QQQ = new NumTree(Integer.MAX_VALUE); int low, high; NumTree upperHigh = QQQ; NumTree(int num) { this.low = num; this.high = num; } int count() { return (high - low) + 1; } int maxCount(boolean has0) { if (upperHigh == QQQ) { return count(); } int upperMax = upperHigh.maxCount(has0); int count = count(); if (has0 && ((upperHigh.low - 2) == high)) { count += upperHigh.count() + 1; } return Math.max(upperMax, count); } NumTree put(int num) { if (num <= (low - 2)) { NumTree result = new NumTree(num); result.upperHigh = this; return result; } if (num == (low - 1)) { low = num; } else if (num == (high + 1)) { high = num; if ((high + 1) == upperHigh.low) { high = upperHigh.high; upperHigh = upperHigh.upperHigh; } } else if (num > high) { if (upperHigh != QQQ) { upperHigh = upperHigh.put(num); } else { upperHigh = new NumTree(num); } } return this; }
Main.java:77: error: reached end of file while parsing } ^ 1 error
s357903563
p00440
Java
public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); while (in.hasNext()) { int flagN = Integer.parseInt(in.next()); int flagK = Integer.parseInt(in.next()); if (flagN == 0) { break; } int k = flagK; int[] array = new int[flagK]; boolean has0 = false; NumTree nums = NumTree.QQQ; for (int i = 0; i < k; i++) { array[i] = Integer.parseInt(in.next()); } try { for (int num : array) { if (!has0 && (num == 0)) { has0 = true; } else { nums = nums.put(num); } } } catch (RuntimeException e) { System.out.println(3); nums = NumTree.QQQ; } System.out.println(nums.maxCount(has0)); } } } class NumTree { static final NumTree QQQ = new NumTree(99999); long low = 0, high = 0; NumTree upperHigh = QQQ; NumTree(int num) { this.low = num; this.high = num; } long count() { return (high - low) + 1; } long maxCount(boolean has0) { long count = count(); if (upperHigh == QQQ) { return count; } if (has0 && ((upperHigh.low - 2) == high)) { count += (((upperHigh.high - upperHigh.low) + 1) + 1); } long upperMax = upperHigh.maxCount(has0); return (upperMax < count) ? count : upperMax; } NumTree put(int num) { if (num <= (low - 2)) { NumTree result = new NumTree(num); result.upperHigh = this; return result; } if (num == (low - 1)) { low = num; } else if (num == (high + 1)) { high = num; if ((high + 1) == upperHigh.low) { high = upperHigh.high; upperHigh = upperHigh.upperHigh; } } else if (num > high) { if (upperHigh != QQQ) { upperHigh = upperHigh.put(num); } else { upperHigh = new NumTree(num); } } return this; } }
Main.java:3: error: cannot find symbol Scanner in = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:3: error: cannot find symbol Scanner in = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors
s862511661
p00440
Java
import java.util.Scanner; public class Main2 { /** * @param args */ public static void main(String[] args) { // TODO 自動生成されたメソッド・スタブ Scanner sc=new Scanner(System.in); for(;;){ int n = sc.nextInt(),k=sc.nextInt(); if(n+k==0)break; int[] a = new int[n+1]; int[] b = new int[n+2]; int[] c = new int[n+2]; for(int i=0;i<k;i++){ a[sc.nextInt()]=1; } int max=-1; for(int i=1;i<=n;i++){ if(a[i]==1){ b[i]=b[i-1]+1; max=Math.max(max, b[i]); } } for(int i=n;i>=1;i--){ if(a[i]==1){ c[i]=c[i+1]+1; max=Math.max(max, c[i]); } } if(a[0]==1){ for(int i=1;i<=n;i++){ if(a[i]==0){ max=Math.max(max, b[i-1]+c[i+1]+1); } } } System.out.println(max); } } }
Main.java:3: error: class Main2 is public, should be declared in a file named Main2.java public class Main2 { ^ 1 error
s680665115
p00440
C
#include <cstdio> using namespace std; void CheckLongest(int& longest, int i, int j) { if (longest < j - i + 1){ longest = j - i + 1; //printf("length:%d\n\n", longest); } } int main() { int n; int k; while (scanf("%d %d", &n, &k) * n != 0){ char card[100005] = {0}; int longest = 0; bool zero_flag; for (int i = 0; i < k; i++){ int tmp; scanf("%d", &tmp); card[tmp] = 1; } zero_flag = card[0]; for (int i = 1, j = 1; i <= n; ){ //for (int k = i; k <= j || !printf("f:%d\n", zero_flag); k++) printf("%d ", k); if (card[j] != 1){ if (j <= n && zero_flag){ zero_flag = false; CheckLongest(longest, i, j); j++; } else { if (card[i] != 1){ zero_flag = card[0]; } i++; if (j < i){ j = i; } } } else { CheckLongest(longest, i, j); j++; } } printf("%d\n", longest); //puts(""); } return 0; }
main.c:1:10: fatal error: cstdio: No such file or directory 1 | #include <cstdio> | ^~~~~~~~ compilation terminated.
s296997108
p00440
C
#include <iostream> #include <algorithm> using namespace std; int main(){ while (1){ int n, k, a[100000] = {}, sam, b[1000] = {}, roop = 0, save[1000] = {0}, ans[1000] = {}, w = 0; cin >> n >> k; if (n == 0 || k == 0) break; for (int i = 0; i<k; i++){ cin >> a[i]; } sort(a, a + k); for (int i = 0; i<k; i++){ if (a[i + 1] - a[i] == 1){ sam++; } else if (a[i + 1] - a[i] != 1){ b[roop] = sam+1; if(a[0]==0){ if (a[i + 1] - a[i] == 2){ save[w] = roop; w++; } } sam = 0; roop++; } } for (int i = 0; i <= roop; i++){ if (save[i] != 0){ ans[i] = b[save[i]]; ans[i]+= b[save[i] + 1] + 1; } } sort(b, b + roop+1); sort(ans, ans + roop+1); if (ans[roop]>b[roop]) cout << ans[roop] << endl; if (ans[roop] <= b[roop]) cout << b[roop] << endl; } return 0; }
main.c:1:10: fatal error: iostream: No such file or directory 1 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s557636552
p00440
C++
while(n,k=gets.split.map &:to_i)[0]>0 l=(1..k).map{gets.to_i}.sort d=l.each_cons(2).map{|i,j|"#{j-i}"}*"" r=l[0]>0?/1+/:/1+21*|1*21+|1+/ p d.scan(r).map(&:size).max+1 end
a.cc:2:4: error: too many decimal points in number 2 | l=(1..k).map{gets.to_i}.sort | ^~~~ a.cc:1:1: error: expected unqualified-id before 'while' 1 | while(n,k=gets.split.map &:to_i)[0]>0 | ^~~~~ a.cc:2:24: error: expected unqualified-id before '.' token 2 | l=(1..k).map{gets.to_i}.sort | ^ a.cc:3:37: error: expected unqualified-id before string constant 3 | d=l.each_cons(2).map{|i,j|"#{j-i}"}*"" | ^~
s078513002
p00440
C++
#include<iostream> #include<algorithm> #include<functional> using namespace std; int main() { while(1){ int n,k; cin>>n>>k; if(!n&&!k){break;} else{ int *a; a=new int[k]; for(int i=0;i<k;i++){ cin>>a[i]; } sort(a,a+k); int lx=0,l=1; if(a[0]){ for(int i=0;i<k-1;i++){ if(a[i]+1==a[i+1]){l++;} else{ lx=(l>lx)?l:lx; l=1; } } lx=(l>lx)?l:lx; } else{ int m=0; for(int i=1;i<k-1;i++){ if(a[i]+1==a[i+1]){l++;} else if(a[i]+2==a[i+1]){ lx=(lx<l+m)?l+m:lx; m=l+1;l=1; } else{ lx=(lx<l+m)?l+m:lx; m=0;l=1; } } lx=(lx<l+m)?l+m:lx; } cout<<lx<<endl; delete []a; } } return 0;
a.cc: In function 'int main()': a.cc:56:12: error: expected '}' at end of input 56 | return 0; | ^ a.cc:8:1: note: to match this '{' 8 | { | ^
s093114651
p00440
C++
while True: n, k = map(int, raw_input().split()) if n==0: break t = [0]*(n+2) for i in xrange(k): t[input()] += 1 for i in xrange(2,n+1): if t[i] > 0: t[i] += t[i-1] ans = 0 if t[0]==0: for x in t: if ans < x: ans = x else: nt = [] for i in xrange(2,n+2): if t[i]==0: t[i-t[i-1]] = t[i-1] for i in xrange(2,n+1): if t[i]==0: nt += [t[i-1]+1+t[i+1]] else: nt += [t[i]] for x in nt: if ans < x: ans = x print ans
a.cc:1:1: error: expected unqualified-id before 'while' 1 | while True: | ^~~~~
s202030897
p00440
C++
#include<stdio.h>;main(){printf("7\n11\n53\n");}
a.cc:1:18: warning: extra tokens at end of #include directive 1 | #include<stdio.h>;main(){printf("7\n11\n53\n");} | ^ /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
s477601978
p00440
C++
#include <iostream> #include <cstring> using namespace std; #define rep1(i,x) for(int i=1;i<=(x);++i) int a[MAX_N + 1]; int memo[MAX_N + 1]; int start[MAX_N + 1]; int main() { int N, K; while (cin >> N >> K, N || K) { memset(a, 0, sizeof(a)); memset(memo, 0, sizeof(memo)); memset(start, 0, sizeof(start)); bool f = false; rep1(i, K) { int tmp; cin >> tmp; if (tmp == 0) f = true; else a[tmp] = true; } rep1(i, N) { if (a[i]) { if (i - 1 >= 0 && a[i - 1]) { start[i] = start[i - 1]; memo[start[i]]++; } else { start[i] = i; memo[start[i]]++; } } } int ma = 0; int now = -1; rep1(i, N) { if (a[i]) { if (now == start[i]) continue; if (ma < memo[start[i]]) { ma = memo[start[i]]; now = start[i]; } } else if (f) { int v; if (i + 1 <= N && a[i - 1] && a[i + 1]) { v = memo[start[i - 1]] + memo[start[i + 1]] + 1; if (ma < v) { ma = v; now = start[i + 1]; } } else if (a[i - 1]) { v = memo[start[i - 1]] + 1; if (ma < v) { ma = v; now = start[i - 1]; } } else if (i + 1 <= N && a[i + 1]) { v = memo[start[i + 1]] + 1; if (ma < v) { ma = v; now = start[i + 1]; } } } } cout << ma << endl; } }
a.cc:8:7: error: 'MAX_N' was not declared in this scope 8 | int a[MAX_N + 1]; | ^~~~~ a.cc:9:10: error: 'MAX_N' was not declared in this scope 9 | int memo[MAX_N + 1]; | ^~~~~ a.cc:10:11: error: 'MAX_N' was not declared in this scope 10 | int start[MAX_N + 1]; | ^~~~~ a.cc: In function 'int main()': a.cc:16:24: error: 'a' was not declared in this scope 16 | memset(a, 0, sizeof(a)); | ^ a.cc:17:24: error: 'memo' was not declared in this scope 17 | memset(memo, 0, sizeof(memo)); | ^~~~ a.cc:18:24: error: 'start' was not declared in this scope 18 | memset(start, 0, sizeof(start)); | ^~~~~
s302706117
p00440
C++
#include <iostream> #include <algorithm> #include <vector> #include <cstdio> #include <cstdlib> #include <set> using namespace std; #define rep(i,n) for(int i=0;i<(n);i++) #define reps(i,f,n) for(int i=(f);i<(n);i++) int main(void){ while(1){ int n, k, ans = 0; cin >> n >> k; if(n == 0 && k == 0) break;//00??????????????????????????? bool flag = false;//?????¨???????????????0??????????????????????????????????????° vector<bool> num(n + 1, false);//?????±?????????????????????????????? rep(i, k){ int tmp; scanf("%d", &tmp); if(tmp == 0){ flag = true; continue; } num[tmp] = true;//?????±???????????? } int pre = 0;//???????????£?¶??¢????????????°???????????°?????\???????????? int cnt = 0;//?????????????????£?¶??¢????????????°???????????°????????????????????????????????¨ int now; int end = 0;//???????????£?¶???¨????¢?????????????????????°????????\???????????? bool rennkekanouflag = false;//??£??\????????£?¶??¢????????????????1?????¨?????????true reps(i, 1, n + 1){ //??°???i???????????? if(num[i] == true){ if(i == end + 2) rennkekanouflag = true;//???????????£?¶??¢?????????¨?????????1 cnt++; //??°???i???????????¨??? }else{ now = cnt; if(flag == true???&& rennkekanouflag = true;){ //?????¨?????????0????????????????????????????????£??\????????£?¶???¨??????????????°???1???????????¨?????????????????£?¶???¨???????????????????????£???????????? ans = max(ans, pre + now + 1); }else{ //???????????¶????????????????????¨?????????????????£?¶???¨????¢???????????????§?????§??????????????¢?????°?????? ans = max(ans, now); } // ????????? cnt = 0; rennkekanouflag = false; pre = now;//?????¢??£????????? end = i; } } printf("%d\n", ans); } return 0; }
a.cc: In function 'int main()': a.cc:39:33: error: expected primary-expression before '?' token 39 | if(flag == true???&& rennkekanouflag = true;){ | ^ a.cc:39:34: error: expected primary-expression before '?' token 39 | if(flag == true???&& rennkekanouflag = true;){ | ^ a.cc:39:35: error: lvalue required as left operand of assignment 39 | if(flag == true???&& rennkekanouflag = true;){ | ^~~~~~~~~~~~~~~~~~ a.cc:39:60: error: expected ':' before ';' token 39 | if(flag == true???&& rennkekanouflag = true;){ | ^ | : a.cc:39:60: error: expected primary-expression before ';' token a.cc:39:60: error: expected ':' before ';' token 39 | if(flag == true???&& rennkekanouflag = true;){ | ^ | : a.cc:39:60: error: expected primary-expression before ';' token a.cc:39:60: error: expected ':' before ';' token 39 | if(flag == true???&& rennkekanouflag = true;){ | ^ | : a.cc:39:60: error: expected primary-expression before ';' token a.cc:39:60: error: expected ')' before ';' token 39 | if(flag == true???&& rennkekanouflag = true;){ | ~ ^ | ) a.cc:39:61: error: expected primary-expression before ')' token 39 | if(flag == true???&& rennkekanouflag = true;){ | ^ a.cc:42:18: error: 'else' without a previous 'if' 42 | }else{ | ^~~~ a.cc:39:38: error: label 'rennkekanouflag' used but not defined 39 | if(flag == true???&& rennkekanouflag = true;){ | ^~~~~~~~~~~~~~~
s221135452
p00440
C++
#include <iostream> #include <algorithm> #include <vector> #include <cstdio> #include <cstdlib> #include <set> using namespace std; #define rep(i,n) for(int i=0;i<(n);i++) #define reps(i,f,n) for(int i=(f);i<(n);i++) int main(void){ while(1){ int n, k, ans = 0; cin >> n >> k; if(n == 0 && k == 0) break;//00??????????????????????????? bool flag = false;//?????¨???????????????0??????????????????????????????????????° vector<bool> num(n + 1, false);//?????±?????????????????????????????? rep(i, k){ int tmp; scanf("%d", &tmp); if(tmp == 0){ flag = true; continue; } num[tmp] = true;//?????±???????????? } int pre = 0;//???????????£?¶??¢????????????°???????????°?????\???????????? int cnt = 0;//?????????????????£?¶??¢????????????°???????????°????????????????????????????????¨ int now; int end = 0;//???????????£?¶???¨????¢?????????????????????°????????\???????????? bool rennketukanouseiflag = false;//??£??\????????£?¶??¢????????????????1?????¨?????????true reps(i, 1, n + 1){ //??°???i???????????? if(num[i] == true){ if(i == end + 2) rennketukanouseiflag = true;//???????????£?¶??¢?????????¨?????????1 cnt++; //??°???i???????????¨??? }else{ now = cnt;//?????¨??????????????£?¶???¨????¢????????????°???????????° //?????¨?????????0????????????????????????????????£??\????????£?¶???¨??????????????°???1???????????¨?????????????????£?¶???¨???????????????????????£???????????? if(flag == true???&& rennketukanouseiflag == true){ ans = max(ans, pre + now + 1); } //???????????¶????????????????????¨?????????????????£?¶???¨????¢???????????????§?????§??????????????¢?????°?????? else{ ans = max(ans, now); } // ????????? cnt = 0; rennketukanouseiflag = false; pre = now;//?????¢??£????????? end = i; } } printf("%d\n", ans); } return 0; }
a.cc: In function 'int main()': a.cc:40:33: error: expected primary-expression before '?' token 40 | if(flag == true???&& rennketukanouseiflag == true){ | ^ a.cc:40:34: error: expected primary-expression before '?' token 40 | if(flag == true???&& rennketukanouseiflag == true){ | ^ a.cc:40:59: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 40 | if(flag == true???&& rennketukanouseiflag == true){ | ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~ a.cc:40:66: error: expected ':' before ')' token 40 | if(flag == true???&& rennketukanouseiflag == true){ | ^ | : a.cc:40:66: error: expected primary-expression before ')' token a.cc:40:66: error: expected ':' before ')' token 40 | if(flag == true???&& rennketukanouseiflag == true){ | ^ | : a.cc:40:66: error: expected primary-expression before ')' token a.cc:40:66: error: expected ':' before ')' token 40 | if(flag == true???&& rennketukanouseiflag == true){ | ^ | : a.cc:40:66: error: expected primary-expression before ')' token a.cc:40:38: error: label 'rennketukanouseiflag' used but not defined 40 | if(flag == true???&& rennketukanouseiflag == true){ | ^~~~~~~~~~~~~~~~~~~~
s876991756
p00440
C++
7 5 6 2 4 7 1 7 5 6 2 0 4 7 0 0
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 7 5 | ^
s304171494
p00440
C++
888B 48B #include <bits/stdc++.h> using namespace std; #define loop(i,n) for(int i=0;i<n;i++) struct R {int from,to,len;}; vector<int> c; vector<R> s; int main(){ int n,k,t; bool b; while(cin>>n>>k,n){ b=0; c.clear(); loop(_,k){ cin>>t; if(!t)b=1; else c.push_back(t); } sort(c.begin(),c.end()); loop(i,c.size()){ if(!s.empty()&&s.back().to+1==c[i]){ s.back().to=c[i]; s.back().len++; }else{ s.push_back({c[i],c[i],1}); } } int m=0; loop(i,s.size()){ m=max(m,s[i].len); } if(b){ m++; loop(i,s.size()){ if(!i)continue; if(s[i-1].to+2==s[i].from){ m=max(m,s[i-1].len+1+s[i].len); } } } cout<<m<<endl; } return 0; }
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 888B 48B | ^~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:3: /usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity 164 | __is_null_pointer(std::nullptr_t) | ^ /usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)' 159 | __is_null_pointer(_Type) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'? 164 | __is_null_pointer(std::nullptr_t) | ^~~~~~~~~ In file included from /usr/include/c++/14/cstddef:50, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41: /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here 443 | typedef decltype(nullptr) nullptr_t; | ^~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'? 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here 443 | typedef decltype(nullptr) nullptr_t; | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared 2086 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope 2087 | struct remove_extent<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid 2087 | struct remove_extent<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared 2099 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope 2100 | struct remove_all_extents<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid 2100 | struct remove_all_extents<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared 2171 | template<std::size_t _Len> | ^~~ /usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope 2176 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^~~~ /usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^ /usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope 2202 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope 2203 | struct __attribute__((__aligned__((_Align)))) { } __align; | ^~~~~~ In file included from /usr/include/c++/14/bits/stl_tempbuf.h:59, from /usr/include/c++/14/bits/stl_algo.h:69, from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive] 132 | __attribute__((__externally_visible__)); | ^ /usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive] 134 | __attribute__((__externally_visible__)); |
s235193553
p00440
C++
#include<iostream> #include<stdio.h> #include<string> #include<math.h> #include<iomanip> #include<algorithm> #include<string.h> #include<cctype> #include<map> #include<set> #include<vector> #include<sstream> #include<stack> #include<queue> using namespace std; int arr[100000+5]={0}; int main() { int n,k; while(cin>>n>>k) { if(n==0&&k==0) break; int num; int count=0; bool flag_2=false; for(int i=0;i<k;i++) { cin>>num; if(num==0) flag_2=true; else { //count++; arr[num]++; } } //if(k-count==1) flag_2=true; int sum1=0; int sum2=0; int max=0; bool flag=false; int blank_num=0; for(int i=1;i<=n;i++) { while((i<=n)&&arr[i]&&(!flag)) { if(flag_2==true&&(blank_num==1)) break; else { sum1++; i++; if(sum1>max) max=sum1; } } //if(sum1>max) max=sum1; if(i<=n&&arr[i]&&(flag_2)&&(blank_num==1)) { while((i<=n)&&arr[i]) { sum2++; i++; } if((sum1+sum2+1)>max) { max=sum1+sum2+1; flag=true; } sum1=sum2; sum2=0; } if(arr[i-1]) { if(i<=n&&(!arr[i])) blank_num=1; if(i+1<=n&&(!arr[i+1])) blank_num=2; if(blank_num==2&&(flag_2)) { sum1=0; flag=false; } if((blank_num==1||black_num==2)&&(!flag_2)) sum1=0; } } cout<<max<<endl; } //while(1); return 0; }
a.cc: In function 'int main()': a.cc:83:26: error: 'black_num' was not declared in this scope; did you mean 'blank_num'? 83 | if((blank_num==1||black_num==2)&&(!flag_2)) sum1=0; | ^~~~~~~~~ | blank_num
s738624528
p00440
C++
#include <bits/stdc++.h> using namespace std; #define FOR(i, j, k) for(int i = j; i < k; ++i) #define rep(i, j) FOR(i, 0, j) #define repr(i, j) for(int i = j; i >= 0; --i) #define INF (1 << 30) #define MOD 1e9 + 7 typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> P; int N, K; bool card[100010]; int main() { while(scanf("%d %d", &N, &K), N || K) { memset(card, false, sizeof(card)); rep(i, K) { int c; scanf("%d", &c); card[c] = true; } if(!card[0]) { int cnt = 1, ans = 0; rep(i, K - 1) { if(card[i] && card[i + 1]) ++cnt; else { ans = max(ans, cnt); cnt = 1; } } printf("%d\n", ans); } else { int now, non, mini = 0, maxi = 0; FOR(i, 1, N + 1) if(!card[i]) { non = i; now = i + 1; break; } int ans = 0; FOR(i, now, N + 1) { if(!card[i]) { maxi = i - (mini) - 1; ans = max(ans, maxi); mini = non; non = i; } } maxi = i - (mini) - 1; printf("%d\n", ans); } } return 0; }
a.cc: In function 'int main()': a.cc:53:32: error: 'i' was not declared in this scope 53 | maxi = i - (mini) - 1; | ^
s987562797
p00440
C++
#include <iostream> #include <cstdlib> using namespace std; int main(int argc, char **argv) { int k, n, a[100001], s, t, p, q, r, j; while(1){ cin >> n >> k; if(n == 0 && k == 0){ break; } for(int i = 0; i < k; i++){ cin >> a[i]; } sort(a, a+k); for(int i = 0; i < k; i++){ } if(a[0] == 0){ q = 1; while(a[q] == 0 && q < k){ q++; } s = q; for(int i = q; i < k-1; i++){ t = 1; p = q; j = i; while(j < k-1){ r = a[j+1]-a[j]-1; if(r == 0){ t++; } else if(p == r){ t += (1+p); p -= r; } else if(p > r){ t += r; p -= r; } else { t += p; break; } j++; } if(s < t){ s = t; } } } else { t = a[0]; s = 1; for(int i = 1; i < k; i++){ if(t+1 == a[i]){ p = 2; i++; while(a[i] == t+p && i < k){ i++; p++; } if(s < p){ s = p; } if(i == k){ break; } } t = a[i]; } } cout << s << endl; } return 0; }
a.cc: In function 'int main(int, char**)': a.cc:19:5: error: 'sort' was not declared in this scope; did you mean 'short'? 19 | sort(a, a+k); | ^~~~ | short
s284487362
p00440
C++
#include<iostream> #include<vector> using namespace std; vector<int> cards; int MAX = 0; int cont = 0; int flg = false; int use = false; void saiki(int now_card); int main() { for(;;){ int n, k, temp; int cont = 0; cards.clear(); cin >> n; cin >> k; if(n == 0 && k == 0){ break; } for(int i = 0; i < k; i++){ cin >> temp; cards.push_back(temp); } //ƒ\[ƒg sort(cards.begin(), cards.end()); //”’ކƒJ[ƒh–³‚µ‚Å’Tõ for(int i = 0; i < k; i++){ // cout << cards[i] <<"‚̃J[ƒh‚ð’Tõ"<< endl; if(cards[i] == 0){ //ƒtƒ‰ƒO‚ª—§‚Á‚½‚º // printf("flg >> on\n"); flg = true; } else{ saiki(i); } } //”’ކƒJ[ƒhƒAƒŠ‚Å’Tõ if(flg == true){ use = true; for(int i = 1; i < k; i++){ // cout <<"‚à‚¤ˆê‰ñ"<< cards[i] <<"‚̃J[ƒh‚ð’Tõ"<< endl; saiki(i); use = true; } } cout << MAX << endl; } } void saiki(int now_card) //”z—ñ‚Ì“Y‚¦Žš { // printf("¡‚̃J[ƒh¨%d ŽŸ‚̃J[ƒh¨%d\n",cards[now_card],cards[now_card+1]); if(cards[now_card]+1 == cards[now_card+1]){ // printf("ŽŸ‚̃J[ƒh‚Ö\n"); cont++; saiki(now_card+1); } else{ if(use == true && cards[now_card]+2 == cards[now_card+1]){ // printf("„„’ú‚ß‚ñ‚È‚æIƒƒ\n"); cont+=2; use = false; //cards[now_card]+1 == cards[now_card+1]‚Å‚ ‚邯‚·‚é saiki(now_card+1); } // printf("****I—¹:%dƒXƒeƒbƒv****\n",cont+1); if(cont+1 > MAX){ MAX = cont+1; } cont = 0; } }
a.cc: In function 'int main()': a.cc:35:17: error: 'sort' was not declared in this scope; did you mean 'short'? 35 | sort(cards.begin(), cards.end()); | ^~~~ | short
s910243522
p00440
C++
#include<cstdio> #include<cstring> #define ma(a,b) (a>b?a:b) int main(){ int k[100001],a,b,table[2][100001]; memset(k,0,sizeof(k)); memset(table,0,sizeof(table)); while(scanf("%d%d",&a,&b),a,b){ for(int i=0;i<b;i++){ int c; scanf("%d",&c);k[c]=1; } int res=0; for(int i=1;i<=a;i++){ if(k[i]){ table[0][i]=table[0][i-1]+1; } else{ if(k[0]){ table[1][i]=table[0][i-1]+1; } } res=max(res,max(table[0][i],table[1][i])); } printf("%d\n",res); } return 0; }
a.cc: In function 'int main()': a.cc:23:37: error: 'max' was not declared in this scope; did you mean 'ma'? 23 | res=max(res,max(table[0][i],table[1][i])); | ^~~ | ma a.cc:23:29: error: 'max' was not declared in this scope; did you mean 'ma'? 23 | res=max(res,max(table[0][i],table[1][i])); | ^~~ | ma
s354261113
p00440
C++
1>------ ビルド開始: プロジェクト: AOJ, 構成: Debug Win32 ------ 1> 0517.cpp 1> AOJ.vcxproj -> C:\Users\ちきんぐ\documents\visual studio 2010\Projects\AOJ\Debug\AOJ.exe ========== ビルド: 1 正常終了、0 失敗、0 更新不要、0 スキップ ==========
a.cc:3:22: error: stray '\' in program 3 | 1> AOJ.vcxproj -> C:\Users\ちきんぐ\documents\visual studio 2010\Projects\AOJ\Debug\AOJ.exe | ^ a.cc:3:28: error: stray '\' in program 3 | 1> AOJ.vcxproj -> C:\Users\ちきんぐ\documents\visual studio 2010\Projects\AOJ\Debug\AOJ.exe | ^ a.cc:3:37: error: stray '\' in program 3 | 1> AOJ.vcxproj -> C:\Users\ちきんぐ\documents\visual studio 2010\Projects\AOJ\Debug\AOJ.exe | ^ a.cc:3:47: error: stray '\' in program 3 | 1> AOJ.vcxproj -> C:\Users\ちきんぐ\documents\visual studio 2010\Projects\AOJ\Debug\AOJ.exe | ^ a.cc:3:66: error: stray '\' in program 3 | 1> AOJ.vcxproj -> C:\Users\ちきんぐ\documents\visual studio 2010\Projects\AOJ\Debug\AOJ.exe | ^ a.cc:3:75: error: stray '\' in program 3 | 1> AOJ.vcxproj -> C:\Users\ちきんぐ\documents\visual studio 2010\Projects\AOJ\Debug\AOJ.exe | ^ a.cc:3:79: error: stray '\' in program 3 | 1> AOJ.vcxproj -> C:\Users\ちきんぐ\documents\visual studio 2010\Projects\AOJ\Debug\AOJ.exe | ^ a.cc:3:85: error: stray '\' in program 3 | 1> AOJ.vcxproj -> C:\Users\ちきんぐ\documents\visual studio 2010\Projects\AOJ\Debug\AOJ.exe | ^ a.cc:4:22: error: extended character 、 is not valid in an identifier 4 | ========== ビルド: 1 正常終了、0 失敗、0 更新不要、0 スキップ ========== | ^ a.cc:4:34: error: extended character 、 is not valid in an identifier 4 | ========== ビルド: 1 正常終了、0 失敗、0 更新不要、0 スキップ ========== | ^ a.cc:4:42: error: extended character 、 is not valid in an identifier 4 | ========== ビルド: 1 正常終了、0 失敗、0 更新不要、0 スキップ ========== | ^ a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 1>------ ビルド開始: プロジェクト: AOJ, 構成: Debug Win32 ------ | ^
s589731138
p00440
C++
#include <cstdio> #include <algorithm> #include <vector> using namespace std; struct Cards { int start,end; Cards(int _start,int _end) {start=_start,end=_end;} }; vector<Cards> cards; int card[100000]; int main() { int n,k,i,j; bool blank; while(scanf("%d %d",&n,&k),n|k) { memset(card,0,sizeof(card)); cards.clear(); blank=0; for(i=0;i<k;i++) { scanf("%d",&card[i-blank]); if(card[i-blank]==0) blank=1; } k-=blank; sort(card,card+k); int ans=0; for(i=0;i<k;i++) { for(j=i+1;j<k;j++) {if((card[j]-card[j-1])!=1)break;} cards.push_back(Cards(card[i],card[j-1])); ans=max(ans,card[j-1]-card[i]+1); i=j-1; } if(!blank) {printf("%d\n",ans); continue;} for(i=0;i<cards.size();i++) { if(i==0) { if(cards[i].start>1) ans=max(ans,cards[i].end-cards[i].start+2); }else if((cards[i].start-cards[i-1].end)==2) { ans=max(ans,(cards[i].end-cards[i].start+1)+(cards[i-1].end-cards[i-1].start+1)+1); } } if(cards[i-1].end<n) ans=max(ans,(cards[i-1].end-cards[i-1].start+1)); printf("%d\n",ans); } }
a.cc: In function 'int main()': a.cc:15:17: error: 'memset' was not declared in this scope 15 | memset(card,0,sizeof(card)); | ^~~~~~ a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include <vector> +++ |+#include <cstring> 4 | using namespace std;
s073366239
p00440
C++
#include<iostream> using namespace std; int N,K; int data[100001]; int taba[100001]; //最初から連続して並んでいる数字の数 int main(){ int i,num; int max[1000]; int mcor = 0; while(1){ cin >> N >> K; if(N == 0 && K == 0) break; for(i = 0;i < K;i++){ cin >> num; data[num] = 1; } int tcor,count; tcor = 0; count = 0; for(i = 1;i <= N;i++){ if(data[i] == 1){ count++; } else{ taba[tcor] = count; tcor++; if(count > 0){ taba[tcor] = 0; tcor++; } count = 0; } } taba[tcor] = count; max[mcor] = 0; for(i = 0;i <= tcor;i++){ if(taba[i] != 0) continue; if(i == 0){ if(1+taba[i+1] > max[mcor]) max[mcor] = 1+taba[i+1]; } else if(i == tcor){ if(1+taba[i-1] > max[mcor]) max[mcor] = 1+taba[i-1]; } else{ if(taba[i-1]+1+taba[i+1] > max) max[mcor] = taba[i-1]+1+taba[i+1]; } } mcor++; } for(i = 0;i < mcor;i++){ cout << max[i] << endl; } return 0; }
a.cc: In function 'int main()': a.cc:18:25: error: reference to 'data' is ambiguous 18 | data[num] = 1; | ^~~~ In file included from /usr/include/c++/14/string:53, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:5:5: note: 'int data [100001]' 5 | int data[100001]; | ^~~~ a.cc:24:28: error: reference to 'data' is ambiguous 24 | if(data[i] == 1){ | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:5:5: note: 'int data [100001]' 5 | int data[100001]; | ^~~~ a.cc:51:58: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 51 | if(taba[i-1]+1+taba[i+1] > max) | ~~~~~~~~~~~~~~~~~~~~~~^~~~~