submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s113805702
p00162
C++
#include<stdio.h> int cnt,flg; int solve(int); main(){ int a,b,i; cnt=0; scanf("%d %d",&a,&b); for(i=a;i<=b;i++){ flg=0; solve(i); } printf("%d\n",cnt); return 0; } int solve(int a){ if(flg==0){ if(a==1||a==2||a==3||a==5){ cnt++; flg=1; return; } if(a%2==0) solve(a/2); if(a%3==0) solve(a/3); if(a%5==0) solve(a/5); } return ; }
a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 4 | main(){ | ^~~~ a.cc: In function 'int solve(int)': a.cc:20:5: error: return-statement with no value, in function returning 'int' [-fpermissive] 20 | return; | ^~~~~~ a.cc:26:3: error: return-statement with no value, in function returning 'int' [-fpermissive] 26 | return ; | ^~~~~~
s375667318
p00162
C++
#include <vector> #include <map> #include <set> #include <stack> #include <queue> #include <cstring> #include <string> #include <sstream> #include <algorithm> #include <iomanip> #include <iostream> #define VARIABLE(x) cerr << #x << "=" << x << endl #define rep(i,n) for(int i=0;i<(int)(n);i++) #define REP(i,m,n) for (int i=m;i<(int)(n);i++) const int INF = 10000000; using namespace std; typedef long long ll; /** Problem0162 : Hamming Numbers **/ int main() { set<int> h; rep(i, 20) { rep(j, 20) { rep(k, 20) { h.insert(pow(2.0, i)*pow(3.0, j)*pow(5.0,k)); } } } int m, n, ans; while (cin>>m>>n, m) { ans=0; set<int>::iterator it = h.begin(); for (; it!=h.end(); it++) { if (m<=*it && *it<=n) { ans++; } } cout << ans << endl; } return 0; }
a.cc: In function 'int main()': a.cc:28:42: error: 'pow' was not declared in this scope 28 | h.insert(pow(2.0, i)*pow(3.0, j)*pow(5.0,k)); | ^~~
s278436221
p00163
C++
#include<stdio.h> int main(){ int st1,st2; int h1,h2,m1,m2; int n[8][8]={ {0,300,500,600,700,1350,1650} {6,0,350,450,600,1150,1500} {13,7,0,250,400,1000,1350} {18,12,5,0,250,850,1300} {23,17,10,5,0,600,1150} {43,37,30,25,20,0,500} {58,052,45,40,35,15,0} }; while(1){ scanf("%d",&st1);if(st1==0)break; scanf("%d %d",&h1,&m1); scanf("%d",&st2); scanf("%d %d",&h2,&m2); int t1=100*h1+m1;int t2=100*h2+m2; int T1=st1,T2=st2,S=0; if(st1>=st2){T1=st2;T2=st1;} if((t1>=1730&&t2<=1930)&&n[T2-1][T1-1]<=40) {S=(n[T1-1][T2-1])/2;} else S=(n[T1-1][T2-1]); printf("%d\n",S); } return 0; }
a.cc: In function 'int main()': a.cc:12:1: error: expected '}' before '{' token 12 | {6,0,350,450,600,1150,1500} | ^ a.cc:10:13: note: to match this '{' 10 | int n[8][8]={ | ^ a.cc:12:1: error: expected ',' or ';' before '{' token 12 | {6,0,350,450,600,1150,1500} | ^ a.cc:13:26: error: expected ';' before '}' token 13 | {13,7,0,250,400,1000,1350} | ^ | ; a.cc:14:24: error: expected ';' before '}' token 14 | {18,12,5,0,250,850,1300} | ^ | ; a.cc:15:23: error: expected ';' before '}' token 15 | {23,17,10,5,0,600,1150} | ^ | ; a.cc:16:22: error: expected ';' before '}' token 16 | {43,37,30,25,20,0,500} | ^ | ; a.cc:17:22: error: expected ';' before '}' token 17 | {58,052,45,40,35,15,0} | ^ | ; a.cc: At global scope: a.cc:20:1: error: expected unqualified-id before 'while' 20 | while(1){ | ^~~~~ a.cc:39:1: error: expected unqualified-id before 'return' 39 | return 0; | ^~~~~~ a.cc:40:1: error: expected declaration before '}' token 40 | } | ^
s801107935
p00163
C++
#include <bits/stdc++.h> using namespace std; const int price[7][7] = { {-1, 300, 500, 600, 700, 1350, 1650}, {-1, -1, 350, 450, 600, 1150, 1500}, {-1, -1, -1, 250, 400, 1000, 1350}, {-1, -1, -1, -1, 250, 850, 1300}, {-1, -1, -1, -1, -1, 600, 1150}, {-1, -1, -1, -1, -1, -1, 500} }; const int dist[7][7] = { {-1, 6, 13, 18, 23, 43, 58}, {-1, -1, 7, 12, 17, 37, 52}, {-1, -1, -1, 5, 10, 30, 45}, {-1, -1, -1, -1, 5, 25, 40}, {-1, -1, -1, -1, -1, 20, 35}, {-1, -1, -1, -1, -1, -1, 15} }; int _start = 17*60 + 30, _end = 19*60 + 30; int main() { int sIC, sh, sm, tIC, th, tm; while (scanf("%d", &sIC) ,sIC) { scanf("%d%d", &sh ,&sm); scanf("%d%d%d", &tIC ,&th ,&tm); sIC--; tIC--; bool ok1 = 0, ok2 = 0; int ssum = sh*60 + sm, tsum = th*60 + tm; if ((_start <= ssum && ssum <= _end) || (_start <= tsum && tsum <= _end)) ok1 = 1; if (dist[sIC][tIC] <= 40) ok2 = 1; int ans = price[sIC][tIC]; if (ok1 && ok2) { ans = (ans / 50 + 1) / 2; ans *= 50; } printf("%d\n" ,ans); } return 0; }
/usr/bin/ld: /tmp/cc0TBhhm.o:(.data+0x0): multiple definition of `_start'; /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o:(.text+0x0): first defined here collect2: error: ld returned 1 exit status
s728104464
p00163
C++
#include <bits/stdc++.h> using namespace std; const int price[7][7] = { {-1, 300, 500, 600, 700, 1350, 1650}, {-1, -1, 350, 450, 600, 1150, 1500}, {-1, -1, -1, 250, 400, 1000, 1350}, {-1, -1, -1, -1, 250, 850, 1300}, {-1, -1, -1, -1, -1, 600, 1150}, {-1, -1, -1, -1, -1, -1, 500} }; const int dist[7][7] = { {-1, 6, 13, 18, 23, 43, 58}, {-1, -1, 7, 12, 17, 37, 52}, {-1, -1, -1, 5, 10, 30, 45}, {-1, -1, -1, -1, 5, 25, 40}, {-1, -1, -1, -1, -1, 20, 35}, {-1, -1, -1, -1, -1, -1, 15} }; int _start = 17*60 + 30, _end = 19*60 + 30; int main() { int sIC, sh, sm, tIC, th, tm; while (scanf("%d", &sIC) ,sIC) { scanf("%d%d", &sh ,&sm); scanf("%d%d%d", &tIC ,&th ,&tm); sIC--; tIC--; bool ok1 = 0, ok2 = 0; int ssum = sh*60 + sm, tsum = th*60 + tm; if ((_start <= ssum && ssum <= _end) || (_start <= tsum && tsum <= _end)) ok1 = 1; if (dist[sIC][tIC] <= 40) ok2 = 1; int ans = price[sIC][tIC]; if (ok1 && ok2) { ans = (ans / 50 + 1) / 2; ans *= 50; } printf("%d\n" ,ans); } return 0; }
/usr/bin/ld: /tmp/ccv0gDrq.o:(.data+0x0): multiple definition of `_start'; /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o:(.text+0x0): first defined here collect2: error: ld returned 1 exit status
s331985649
p00163
C++
#include<bits/stdc++.h> using namespace std; int main() { int start,finish; while(cin>>start,start){ int time[2][2]; for(int i=0;i<2;i++)cin>>time[0][i]; cin>>finish; for(int i=0;i<2;i++)cin>>time[1][i]; int num=0,distance[]={6,7,5,5,20,15},money[6][6]={{300,500,600,700,1350,1650},{350,450,600,1150,1500},{250,400,1000,1350},{250,850,1300},{600,1150},{500}}; for(int i=start-1;i<finish;i++)num+=distance[i]; bool kawa=0; for(int i=0;i<2&&!kawa&&num<41;i++)if(time[i][0]==18||time[i][0]==17&&time[i][1]>29||time[i][0]==19&&time[i][1]<31)kawa=1; num=money[start-1][finish-start-1]; if(kawa){ num/=2; if(num%100==25)num+=25; } cout<<num<<endl; }
a.cc: In function 'int main()': a.cc:21:10: error: expected '}' at end of input 21 | } | ^ a.cc:4:1: note: to match this '{' 4 | { | ^
s113629869
p00163
C++
#include<bits/stdc++.h> using namespace std; int main() { int start,finish; while(cin>>start,start){ int time[2][2]; for(int i=0;i<2;i++)cin>>time[0][i]; cin>>finish; for(int i=0;i<2;i++)cin>>time[1][i]; int num=0,distance[]={6,7,5,5,20,15},money[6][6]={{300,500,600,700,1350,1650},{350,450,600,1150,1500},{250,400,1000,1350},{250,850,1300},{600,1150},{500}}; for(int i=start-1;i<finish;i++)num+=distance[i]; bool kawa=0; for(int i=0;i<2&&!kawa&&num<41;i++)if(time[i][0]==18||time[i][0]==17&&time[i][1]>29||time[i][0]==19&&time[i][1]<31)kawa=1; num=money[start-1][finish-start-1]; if(kawa){ num/=2; if(num%100==25)num+=25;
a.cc: In function 'int main()': a.cc:19:36: error: expected '}' at end of input 19 | if(num%100==25)num+=25; | ^ a.cc:17:17: note: to match this '{' 17 | if(kawa){ | ^ a.cc:19:36: error: expected '}' at end of input 19 | if(num%100==25)num+=25; | ^ a.cc:7:28: note: to match this '{' 7 | while(cin>>start,start){ | ^ a.cc:19:36: error: expected '}' at end of input 19 | if(num%100==25)num+=25; | ^ a.cc:5:1: note: to match this '{' 5 | { | ^
s363160128
p00163
C++
# define _CRT_SECURE_NO_WARNINGS 1 # define _USE_MATH_DEFINES # include <iostream> # include <numeric> # include <string> # include <bitset> # include <vector> # include <algorithm> # include <cstdlib> # include <cstdio> # include <cstring> # include <cstdlib> # include <iomanip> # include <queue> # include <sstream> # include <climits> # include <cmath> # include <list> # include <functional> # include <string> # include <ctime> # include <set> # include <forward_list> # include <map> # include <stack> using namespace std; # define INF ((int)(1<<25)) # define REP(i,n) for(int i=0;i<(int)n;i++) # define FOR(i,n) REP(i,n) # define TORAD 2.0*M_PI/360.0 # define INT(x) int x;cin>>x; # define ALL(x) (x).begin(),(x).end() # define RALL(x) (x).rbegin(),(x).rend() # define DEBUG(x) cout<<#x<<" :"<<x<<endl; # define EPS 1e-12 template<class T> void debug(T a) { for (auto iiiiiiiiii : a)cout << iiiiiiiii << endl; } typedef vector<int> vi; typedef vector<string> vs; typedef pair<int, int> pii; typedef pair<int, pii> piii; int dx[4] = { 0,1,0,-1 }, dy[4] = { -1,0,1,0 }; int main() { int n[2]; while (cin >> n[0]&&n[0]) { int t[2]; int h, m; cin >> h >> m; t[0] = h * 60 + m; cin >> n[1]; cin >> h >> m; t[1] = h * 60 + m; int x[][8] = { {0,0,0,0,0,0,0,0},{0,0,300,500,600,700,1350,1650},{0,0,0,350,450,600,1150,1500},{0,0,0,0,250,400,1000,1350},{0,0,0,0,0,250,850,1300},{0,0,0,0,0,0,600,1150},{0,0,0,0,0,0,0,500} }; int ans = x[min(n[0], n[1])][max(n[0], n[1])]; int p = 0; if (t[0] <= 17 * 60 + 30 && 17 * 60 + 30 <= t[1])p++; if (t[0] <= 19 * 60 + 30 && 19 * 60 + 30 <= t[1])p++; int d[] = { 6,7,5,5,20,15 }; int D = 0; if (n[0] > n[1])swap(n[0], n[1]); while (n[0] < n[1]) { D += d[n[0]-1]; n[0]++; } if (p && D <= 40) { ans /= 2; while (ans % 50)ans++; } cout << ans << endl; } }
a.cc: In function 'void debug(T)': a.cc:36:70: error: 'iiiiiiiii' was not declared in this scope; did you mean 'iiiiiiiiii'? 36 | template<class T> void debug(T a) { for (auto iiiiiiiiii : a)cout << iiiiiiiii << endl; } | ^~~~~~~~~ | iiiiiiiiii
s886543750
p00163
C++
#include<bits/stdc++.h> using namespace std; signed main{ int a[7][7]={ {0,300,500,600,700,1350,1650}, {6,0,350,450,600,1150,1500}, {13,7,0,250,400,1000,1350}, {18,12,5,0,250,850,1300}, {23,17,10,5,0,600,1150}, {43,37,30,25,20,0,500}, {58,52,45,40,35,15,0} }; int b; while(cin>>b,b){ int c,d,e,f,g; scanf("%d%d%d%d%d",&c,&d,&e,&f,&g); c=c*60+d; f=f*60+g; if(c>=1050&&c<=1170&&f>=1050&&f<=1170){ if(a[max(b,e)-1][min(b,e)-1]<=40)printf("%d\n",a[min(b,e)-1][max(b,e)-1]/2); else printf("%d\n",a[min(b,e)-1][max(b,e)-1]); } else printf("%d\n",a[min(b,e)-1][max(b,e)-1]); } }
a.cc:4:8: error: cannot declare '::main' to be a global variable 4 | signed main{ | ^~~~ a.cc:5:1: error: expected primary-expression before 'int' 5 | int a[7][7]={ | ^~~ a.cc:5:1: error: expected '}' before 'int' a.cc:4:12: note: to match this '{' 4 | signed main{ | ^ a.cc:15:5: error: expected unqualified-id before 'while' 15 | while(cin>>b,b){ | ^~~~~ a.cc:26:1: error: expected declaration before '}' token 26 | } | ^
s949521161
p00163
C++
#include<cmath> #include<algorithm> using namespace std; int hyo[7][7]={ {0,300,500,600,700,1350,1650}, {6,0,350,450,600,1150,1500}, {13,7,0,250,400,1000,1350}, {18,12,5,0,250,850,1300}, {23,17,10,5,0,600,1150}, {43,37,30,25,20,0,500}, {58,52,45,40,35,15,0} }; int main(){ int s,g, h,m,H,M, c; while(cin>>s,s){ cin>>h>>m>>g>>H>>M; if(s>g)swap(s,g); c=hyo[s-1][g-1]; if(hyo[g-1][s-1]<=40 &&( (1050<=h*60+m&&h*60+m<=1170)||(1050<=H*60+M&&H*60+M<=1170) ) ) c=((int)ceil((c/2/50.0))*50; cout<<c<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:15:15: error: 'cin' was not declared in this scope 15 | while(cin>>s,s){ | ^~~ a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 2 | #include<algorithm> +++ |+#include <iostream> 3 | using namespace std; a.cc:20:44: error: expected ')' before ';' token 20 | c=((int)ceil((c/2/50.0))*50; | ~ ^ | ) a.cc:21:17: error: 'cout' was not declared in this scope 21 | cout<<c<<endl; | ^~~~ a.cc:21:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:21:26: error: 'endl' was not declared in this scope 21 | cout<<c<<endl; | ^~~~ a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 2 | #include<algorithm> +++ |+#include <ostream> 3 | using namespace std;
s103029157
p00163
C++
int half(int y); int main(){ int inic, inh, inm, outic, outh, outm, yen, kyori; while(1){ cin >>inic; if(inic == 0) break; cin >>inh >>inm >>outic >>outh >>outm; yen = charge(inic, outic); kyori = dist(inic, outic); if(checkhalf(inh, inm, outh, outm, kyori)) yen = half(yen); cout <<yen; } return 0; } int charge(int in, int out){ if(in == 1){ if(out == 2) return 300; if(out == 3) return 500; if(out == 4) return 600; if(out == 5) return 700; if(out == 6) return 1350; if(out == 7) return 1650; } else if(in == 2){ if(out == 3) return 350; if(out == 4) return 450; if(out == 5) return 600; if(out == 6) return 1150; if(out == 7) return 1500; } else if(in == 3){ if(out == 4) return 250; if(out == 5) return 400; if(out == 6) return 1000; if(out == 7) return 1350; } else if(in == 4){ if(out == 5) return 250; if(out == 6) return 850; if(out == 7) return 1300; } else if(in == 5){ if(out == 6) return 600; if(out == 7) return 1150; } else if(in == 6){ if(out == 7) return 500; } else{ cout <<"error!"; } } int dist(int in, int out){ if(in == 1){ if(out == 2) return 6; if(out == 3) return 13; if(out == 4) return 18; if(out == 5) return 23; if(out == 6) return 43; if(out == 7) return 58; } else if(in == 2){ if(out == 3) return 7; if(out == 4) return 12; if(out == 5) return 17; if(out == 6) return 37; if(out == 7) return 52; } else if(in == 3){ if(out == 4) return 5; if(out == 5) return 10; if(out == 6) return 30; if(out == 7) return 45; } else if(in == 4){ if(out == 5) return 5; if(out == 6) return 25; if(out == 7) return 40; } else if(in == 5){ if(out == 6) return 20; if(out == 7) return 35; } else if(in == 6){ if(out == 7) return 15; } else{ cout <<"error!"; } } int checkhalf(int ih, int im, int oh, int om, int dis){ int flag1 = 0, flag2 = 0; if(dis > 40) return 0; if(ih < 17 || (ih == 17 && im <= 30)){ if(oh - 17 > 0 || (oh == 17 && om >= 30)){ flag1 = 1; } } if(ih < 19 || (ih == 19 && im <= 30)){ if(oh - 19 > 0 || (oh == 19 && om >= 30)){ flag2 = 1; } } if((flag1 && flag2) || (!flag1 && !flag2)) return 0; else if((flag1 && !flag2) || (!flag1 && flag2)) return 1; } int half(int y){ int temp = y; temp /= 2; if(temp % 50 != 0){ temp = temp + abs((temp % 50 - 50)); } return temp; }
a.cc: In function 'int main()': a.cc:6:9: error: 'cin' was not declared in this scope 6 | cin >>inic; | ^~~ a.cc:10:15: error: 'charge' was not declared in this scope; did you mean 'char'? 10 | yen = charge(inic, outic); | ^~~~~~ | char a.cc:11:17: error: 'dist' was not declared in this scope 11 | kyori = dist(inic, outic); | ^~~~ a.cc:12:12: error: 'checkhalf' was not declared in this scope 12 | if(checkhalf(inh, inm, outh, outm, kyori)) yen = half(yen); | ^~~~~~~~~ a.cc:14:9: error: 'cout' was not declared in this scope 14 | cout <<yen; | ^~~~ a.cc: In function 'int charge(int, int)': a.cc:48:17: error: 'cout' was not declared in this scope; did you mean 'out'? 48 | cout <<"error!"; | ^~~~ | out a.cc: In function 'int dist(int, int)': a.cc:81:17: error: 'cout' was not declared in this scope; did you mean 'out'? 81 | cout <<"error!"; | ^~~~ | out a.cc: In function 'int half(int)': a.cc:110:31: error: 'abs' was not declared in this scope 110 | temp = temp + abs((temp % 50 - 50)); | ^~~ a.cc: In function 'int charge(int, int)': a.cc:50:1: warning: control reaches end of non-void function [-Wreturn-type] 50 | } | ^ a.cc: In function 'int dist(int, int)': a.cc:83:1: warning: control reaches end of non-void function [-Wreturn-type] 83 | } | ^ a.cc: In function 'int checkhalf(int, int, int, int, int)': a.cc:103:1: warning: control reaches end of non-void function [-Wreturn-type] 103 | } | ^
s208671945
p00163
C++
#include<iostream> #include<cstdlib> using namespace std; int charge(int in, int out); int dist(int in, int out); int checkhalf(int ih, int im, int oh, int om, int dis); int half(int y); int main(){ int inic, inh, inm, outic, outh, outm, yen, kyori; while(1){ cin >>inic; if(inic == 0) break; cin >>inh >>inm >>outic >>outh >>outm; yen = charge(inic, outic); kyori = dist(inic, outic); if(checkhalf(inh, inm, outh, outm, kyori)) yen = half(yen); cout <<yen <<endl; } return 0; } int charge(int in, int out){ if(in == 1){ if(out == 2) return 300; if(out == 3) return 500; if(out == 4) return 600; if(out == 5) return 700; if(out == 6) return 1350; if(out == 7) return 1650; } else if(in == 2){ if(out == 3) return 350; if(out == 4) return 450; if(out == 5) return 600; if(out == 6) return 1150; if(out == 7) return 1500; } else if(in == 3){ if(out == 4) return 250; if(out == 5) return 400; if(out == 6) return 1000; if(out == 7) return 1350; } else if(in == 4){ if(out == 5) return 250; if(out == 6) return 850; if(out == 7) return 1300; } else if(in == 5){ if(out == 6) return 600; if(out == 7) return 1150; } else if(in == 6){ if(out == 7) return 500; } int dist(int in, int out){ if(in == 1){ if(out == 2) return 6; if(out == 3) return 13; if(out == 4) return 18; if(out == 5) return 23; if(out == 6) return 43; if(out == 7) return 58; } else if(in == 2){ if(out == 3) return 7; if(out == 4) return 12; if(out == 5) return 17; if(out == 6) return 37; if(out == 7) return 52; } else if(in == 3){ if(out == 4) return 5; if(out == 5) return 10; if(out == 6) return 30; if(out == 7) return 45; } else if(in == 4){ if(out == 5) return 5; if(out == 6) return 25; if(out == 7) return 40; } else if(in == 5){ if(out == 6) return 20; if(out == 7) return 35; } else if(in == 6){ if(out == 7) return 15; } } int checkhalf(int ih, int im, int oh, int om, int dis){ int flag1 = 0, flag2 = 0; if(dis > 40) return 0; if(ih < 17 || (ih == 17 && im <= 30)){ if((oh == 19 && om < 30) || oh < 19){ flag1 = 1; } } if(ih > 17 || (ih == 17 && im > 30)){ if((oh == 19 && om >= 30) || oh > 19){ flag2 = 1; } } if((flag1 && flag2) || (!flag1 && !flag2)) return 0; else return 1; } int half(int y){ int temp = y; temp /= 2; if(temp % 50 != 0){ temp = temp + abs((temp % 50) - 50); } return temp; }
a.cc: In function 'int charge(int, int)': a.cc:56:26: error: a function-definition is not allowed here before '{' token 56 | int dist(int in, int out){ | ^ a.cc:87:55: error: a function-definition is not allowed here before '{' token 87 | int checkhalf(int ih, int im, int oh, int om, int dis){ | ^ a.cc:107:16: error: a function-definition is not allowed here before '{' token 107 | int half(int y){ | ^ a.cc:116:2: error: expected '}' at end of input 116 | } | ^ a.cc:26:28: note: to match this '{' 26 | int charge(int in, int out){ | ^ a.cc:116:2: warning: control reaches end of non-void function [-Wreturn-type] 116 | } | ^
s545675881
p00163
C++
#include<iostream> #include<cstdlib> using namespace std; int charge(int in, int out); int dist(int in, int out); int checkhalf(int ih, int im, int oh, int om, int dis); int half(int y); int main(){ while(1){ int inic, inh, inm, outic, outh, outm, yen, kyori; cin >>inic; if(inic == 0) break; cin >>inh >>inm >>outic >>outh >>outm; yen = charge(inic, outic); kyori = dist(inic, outic); if(checkhalf(inh, inm, outh, outm, kyori)) yen = half(yen); cout <<yen <<endl; } return 0; } int charge(int in, int out){ if(in == 1){ if(out == 2) return 300; if(out == 3) return 500; if(out == 4) return 600; if(out == 5) return 700; if(out == 6) return 1350; if(out == 7) return 1650; } else if(in == 2){ if(out == 1) return 300; if(out == 3) return 350; if(out == 4) return 450; if(out == 5) return 600; if(out == 6) return 1150; if(out == 7) return 1500; } else if(in == 3){ if(out == 1) return 500; if(out == 2) return 350; if(out == 4) return 250; if(out == 5) return 400; if(out == 6) return 1000; if(out == 7) return 1350; } else if(in == 4){ if(out == 1) return 600; if(out == 2) return 450; if(out == 3) return 250; if(out == 5) return 250; if(out == 6) return 850; if(out == 7) return 1300; } else if(in == 5){ if(out == 1) return 700; if(out == 2) return 600; if(out == 3) return 400; if(out == 4) return 250; if(out == 6) return 600; if(out == 7) return 1150; } else if(in == 6){ if(out == 1) return 1350; if(out == 2) return 1150; if(out == 3) return 1000; if(out == 4) return 850; if(out == 5) return 600; if(out == 7) return 500; } else if(in == 7){ if(out == 1) return 1650; if(out == 2) return 1500; if(out == 3) return 1350; if(out == 4) return 1300; if(out == 5) return 1150; if(out == 6) return 500; } } int dist(int in, int out){ if(in == 1){ if(out == 2) return 6; if(out == 3) return 13; if(out == 4) return 18; if(out == 5) return 23; if(out == 6) return 43; if(out == 7) return 58; } else if(in == 2){ if(out == 1) return 6; if(out == 3) return 7; if(out == 4) return 12; if(out == 5) return 17; if(out == 6) return 37; if(out == 7) return 52; } else if(in == 3){ if(out == 1) return 13; if(out == 2) return 7; if(out == 4) return 5; if(out == 5) return 10; if(out == 6) return 30; if(out == 7) return 45; } else if(in == 4){ if(out == 1) return 18; if(out == 2) return 12; if(out == 3) return 5; if(out == 5) return 5; if(out == 6) return 25; if(out == 7) return 40; } else if(in == 5){ if(out == 1) return 23; if(out == 2) return 17; if(out == 3) return 10; if(out == 4) return 5; if(out == 6) return 20; if(out == 7) return 35; } else if(in == 6){ if(out == 1) return 43; if(out == 2) return 37; if(out == 3) return 30; if(out == 4) return 25; if(out == 5) return 20; if(out == 7) return 15; } else if(in == 7){ if(out == 1) return 58; if(out == 2) return 52; if(out == 3) return 45; if(out == 4) return 40; if(out == 5) return 35; if(out == 6) return 15; } } int checkhalf(int ih, int im, int oh, int om, int dis){ int flag = 0; if(dis > 40){ //‘–s‹——£‚ª40km‚æ‚è’·‚¢Žž return 0; } if(ih > oh || (ih == oh && im > om)){ //“ú‚ð‚Ü‚½‚¢‚¾Žž if((ih > 17 || (ih == 17 && im >= 30)) && (ih < 19 || (ih == 19 && im <= 30))){ //“ü‚Á‚½ŽžŠÔ‚ª”¼Šz”͈͓à‚Å if(oh < 17 || (oh == 17 && om < 30)){ //o‚½ŽžŠÔ‚ª“ú‚ð‚Ü‚½‚¢‚Å”¼Šz”͈͊O‚¾‚Á‚½Žž return 1; } } else{ return 0; } if(ih > 19 || (ih == 19 && im > 30)){ //“ü‚Á‚½ŽžŠÔ‚ª”¼Šz”͈͂æ‚è‚àŒã‚Å if((oh > 17 || (oh == 17 && om >= 30)) && (oh < 19 || (oh == 19 && om <= 30))){ //o‚½ŽžŠÔ‚ª“ú‚ð‚Ü‚½‚¢‚Å”¼Šz”ÍˆÍ“à‚¾‚Á‚½Žž return 1; } } else{ return 0; } } if((ih < 17 || (ih == 17 && im <= 30)) && (oh > 17 || (oh == 17 && om >= 30)) && (oh < 19 || (oh == 19 && om < 30))){ //17Žž‚æ‚è‘O‚©17Žž30•ªˆÈ‘O‚É“ü‚èA17Žž‚æ‚èŒã‚©17Žž30•ªˆÈ~A‚©‚A19Žž‚æ‚è‘O‚©19Žž30•ª‚æ‚è‘O‚ɏo‚½Žž flag = 1; } else if((ih > 17 || (ih == 17 && im > 30)) && (ih < 19 || (ih == 19 && im <= 30)) && (oh > 19 || (oh == 19 && om >= 30))){ //‚à‚µ‚­‚́A17Žž‚æ‚èŒã‚©17Žž30•ª‚æ‚èŒãA‚©‚A19Žž‚æ‚è‘O‚©19Žž30•ªˆÈ‘O‚É“ü‚èA19Žž‚æ‚èŒã‚©19Žž30•ªˆÈ~‚ɏo‚½Žž flag = 1; } if(ih == oh && im == om && flag){ //flag‚ª1‚ŁA“ü‚鎞ŠÔ‚Əo‚鎞ŠÔ‚ª“¯‚¶‚¾‚Á‚½Žž flag = 0; } return flag; } int half(int y){ int ans; double temp = y; temp /= 2.0; temp = ceil(temp); ans = (int)temp; if(ans % 50 != 0){ ans = ans + abs((ans % 50) - 50); } return ans; }
a.cc: In function 'int half(int)': a.cc:170:16: error: 'ceil' was not declared in this scope 170 | temp = ceil(temp); | ^~~~ a.cc: In function 'int charge(int, int)': a.cc:77:1: warning: control reaches end of non-void function [-Wreturn-type] 77 | } | ^ a.cc: In function 'int dist(int, int)': a.cc:130:1: warning: control reaches end of non-void function [-Wreturn-type] 130 | } | ^
s028199199
p00164
C
include <stdio.h> int main (void) { int a; int s[5]={}; while(1){ scanf("%d",&a); if(a==0); break; int i; for(i=0;i<a;i++) scanf("%d",&s[i]); int ss[5]={}; int h=0; while(s[h]!=0){ ss[h]=s[h]; h++; } int oha=32; int j; int aaa[32]={}; int k=0; while(1){ oha=oha-(oha-1)%5; aaa[j]=oha; j++; oha=oha-ss[k%h]; aaa[j]=oha; k++; j++; if(oha<=0) break; } for(i=0;i<j-2;i++) printf("%d\n",aaa[i]); printf("0\n"); } return 0; }
main.c:1:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token 1 | include <stdio.h> | ^
s808713604
p00164
C
include <stdio.h> int main (void) { int a; int s[5]={}; while(1){ scanf("%d",&a); if(a==0); break; int i; for(i=0;i<a;i++) scanf("%d",&s[i]); int ss[5]={}; int h=0; while(s[h]!=0){ ss[h]=s[h]; h++; } int oha=32; int j; int aaa[32]={}; int k=0; while(1){ oha=oha-(oha-1)%5; aaa[j]=oha; j++; oha=oha-ss[k%h]; aaa[j]=oha; k++; j++; if(oha<=0) break; } for(i=0;i<j-2;i++) printf("%d\n",aaa[i]); printf("0\n"); } return 0; }
main.c:1:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token 1 | include <stdio.h> | ^
s887476547
p00164
C
include <stdio.h> int main (void) { int a; int s[5]={}; while(1){ scanf("%d",&a); if(a==0) break; int i; for(i=0;i<a;i++) scanf("%d",&s[i]); int ss[5]={}; int h=0; while(s[h]!=0){ ss[h]=s[h]; h++; } int oha=32; int j; int aaa[32]={}; int k=0; while(1){ oha=oha-(oha-1)%5; aaa[j]=oha; j++; oha=oha-ss[k%h]; aaa[j]=oha; k++; j++; if(oha<=0) break; } for(i=0;i<j-2;i++) printf("%d\n",aaa[i]); printf("0\n"); } return 0; }
main.c:1:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token 1 | include <stdio.h> | ^
s038877969
p00164
C
{ int n,i,j,a[32],b,ohajiki; while(scanf("%d",&n)!=EOF) { if(n==0)break; ohajiki=32; for(i=0;i<n;i++) { scanf("%d",&a[i]); } i=0; j=0; while(ohajiki>1) { if(i%2==0) { b=(ohajiki-1)%5; printf("%d\n",ohajiki-b); ohajiki=ohajiki-b; } else { printf("%d\n",ohajiki-a[j]); ohajiki=ohajiki-a[j]; j++; } if(j==n)j=0; i++; } printf("0\n"); } return 0; }
main.c:1:1: error: expected identifier or '(' before '{' token 1 | { | ^
s428238752
p00164
C++
#include<iostream> using namespace std; int n,a[100]; main() { whiel(cin>>n,n) { for(int i=0;i<n;i++)cin>>a[i]; int c=32,i=0; while(c) { c-=(c-1)%5; cout<<c<<endl; c-=(a[i]>c?c:a[i]); cout<<c<<endl; i=(i+1)%n; } } }
a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 4 | main() | ^~~~ a.cc: In function 'int main()': a.cc:6:5: error: 'whiel' was not declared in this scope 6 | whiel(cin>>n,n) | ^~~~~
s257699654
p00164
C++
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 #include <stdio.h> int main(){ int i,j,a[26]; int n,h = 32; while(1) { h = 32; scanf("%d",&n); if(n == 0) break; for(i=0;i<n;i++) scanf("%d",&a[i]); i = 0; while(1) { h = h -(h-1)%5; printf("%d\n",h); h -= a[i%n]; if(h>0) printf("%d\n",h); else { printf("0\n"); break; } i++; } } return 0; }
a.cc:2:1: error: expected unqualified-id before numeric constant 2 | 1 | ^ a.cc: In function 'int main()': a.cc:51:3: error: 'scanf' was not declared in this scope 51 | scanf("%d",&n); | ^~~~~ a.cc:61:5: error: 'printf' was not declared in this scope 61 | printf("%d\n",h); | ^~~~~~ a.cc:42:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' 41 | #include <stdio.h> +++ |+#include <cstdio> 42 |
s407399068
p00164
C++
#include<iostream> #include<string> #include<vector> using namespace std; int main() { while (1) { int a; cin >> a; if (a == 0)break; vector<int>b(a); for (int c = 0; c < a; c++) { cin >> b[c]; } int e = 31; for (uint16_t f = 0; f < 6; f++){ cout <<e<<endl; cout << e - b[f%size(b)] << endl; e -= 5; } cout << 1 << endl << 0 << endl; } }
a.cc: In function 'int main()': a.cc:17:22: error: 'uint16_t' was not declared in this scope 17 | for (uint16_t f = 0; f < 6; f++){ | ^~~~~~~~ a.cc:4:1: note: 'uint16_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' 3 | #include<vector> +++ |+#include <cstdint> 4 | using namespace std; a.cc:17:38: error: 'f' was not declared in this scope 17 | for (uint16_t f = 0; f < 6; f++){ | ^
s528980154
p00164
C++
#include<iostream> #include<string> #include<vector> using namespace std; int main() { while (1) { int a; cin >> a; if (a == 0)break; vector<int>b(a); for (int c = 0; c < a; c++) { cin >> b[c]; } int e = 31; for (uint16_t f = 0; f < 6; f++){ cout <<e<<endl; cout << e -( b[f%size(b)]) << endl; e -= 5; } cout << 1 << endl << 0 << endl; } }
a.cc: In function 'int main()': a.cc:17:22: error: 'uint16_t' was not declared in this scope 17 | for (uint16_t f = 0; f < 6; f++){ | ^~~~~~~~ a.cc:4:1: note: 'uint16_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' 3 | #include<vector> +++ |+#include <cstdint> 4 | using namespace std; a.cc:17:38: error: 'f' was not declared in this scope 17 | for (uint16_t f = 0; f < 6; f++){ | ^
s754017355
p00164
C++
#include<iostream> #include<string> #include<vector> using namespace std; int main() { while (1) { int a; cin >> a; if (a == 0)break; vector<int>b(a); for (int c = 0; c < a; c++) { cin >> b[c]; } uint16_t e = 31; for (uint16_t f = 0; f < 6; f++){ cout <<e<<endl; cout << e -( b[f%size(b)]) << endl; e -= 5; } cout << 1 << endl << 0 << endl; } }
a.cc: In function 'int main()': a.cc:16:17: error: 'uint16_t' was not declared in this scope 16 | uint16_t e = 31; | ^~~~~~~~ a.cc:4:1: note: 'uint16_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' 3 | #include<vector> +++ |+#include <cstdint> 4 | using namespace std; a.cc:17:30: error: expected ';' before 'f' 17 | for (uint16_t f = 0; f < 6; f++){ | ^~ | ; a.cc:17:38: error: 'f' was not declared in this scope 17 | for (uint16_t f = 0; f < 6; f++){ | ^ a.cc:18:32: error: 'e' was not declared in this scope 18 | cout <<e<<endl; | ^
s268556079
p00164
C++
#include<iostream> #include<string> #include<vector> using namespace std; int main() { while (1) { int a; cin >> a; if (a == 0)break; vector<int>b(a); for (int c = 0; c < a; c++) { cin >> b[c]; } uint16_t e = 31; for (uint16_t f = 0; f < 6; f++){ cout <<e<<endl; cout << e -( b[f%(size(b))]) << endl; e -= 5; } cout << 1 << endl << 0 << endl; } }
a.cc: In function 'int main()': a.cc:16:17: error: 'uint16_t' was not declared in this scope 16 | uint16_t e = 31; | ^~~~~~~~ a.cc:4:1: note: 'uint16_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' 3 | #include<vector> +++ |+#include <cstdint> 4 | using namespace std; a.cc:17:30: error: expected ';' before 'f' 17 | for (uint16_t f = 0; f < 6; f++){ | ^~ | ; a.cc:17:38: error: 'f' was not declared in this scope 17 | for (uint16_t f = 0; f < 6; f++){ | ^ a.cc:18:32: error: 'e' was not declared in this scope 18 | cout <<e<<endl; | ^
s020102660
p00164
C++
#include<iostream> #include<vector> using namespace std; int main() { while (1) { int a; cin >> a; if (a == 0)break; vector<int>b(a); for (int c = 0; c < a; c++) { cin >> b[c]; } uint16_t e = 31; for (uint16_t f = 0; f < 6; f++){ cout <<e<<endl; cout << e -(b[f%(size(b))]) << endl; e -= 5; } cout << 1 << endl << 0 << endl; } }
a.cc: In function 'int main()': a.cc:15:17: error: 'uint16_t' was not declared in this scope 15 | uint16_t e = 31; | ^~~~~~~~ a.cc:3:1: note: 'uint16_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' 2 | #include<vector> +++ |+#include <cstdint> 3 | using namespace std; a.cc:16:30: error: expected ';' before 'f' 16 | for (uint16_t f = 0; f < 6; f++){ | ^~ | ; a.cc:16:38: error: 'f' was not declared in this scope 16 | for (uint16_t f = 0; f < 6; f++){ | ^ a.cc:17:32: error: 'e' was not declared in this scope 17 | cout <<e<<endl; | ^
s998605495
p00164
C++
#include<iostream> #include<vector> using namespace std; int main() { while (1) { int a; cin >> a; if (a == 0)break; vector<int>b(a); for (int c = 0; c < a; c++) { cin >> b[c]; } uint16_t e = 31; for (uint16_t f = 0; f < 6; f++){ cout <<e<<endl; cout << (e - b[f % (size(b))]) << endl; e -= 5; } cout << 1 << endl << 0 << endl; } }
a.cc: In function 'int main()': a.cc:15:17: error: 'uint16_t' was not declared in this scope 15 | uint16_t e = 31; | ^~~~~~~~ a.cc:3:1: note: 'uint16_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' 2 | #include<vector> +++ |+#include <cstdint> 3 | using namespace std; a.cc:16:30: error: expected ';' before 'f' 16 | for (uint16_t f = 0; f < 6; f++){ | ^~ | ; a.cc:16:38: error: 'f' was not declared in this scope 16 | for (uint16_t f = 0; f < 6; f++){ | ^ a.cc:17:32: error: 'e' was not declared in this scope 17 | cout <<e<<endl; | ^
s648647264
p00164
C++
#include<iostream> #include<vector> using namespace std; int main() { while (1) { int a; cin >> a; if (a == 0)break; vector<int>b(a); for (int c = 0; c < a; c++) { cin >> b[c]; } uint16_t e = 31; for (uint16_t f = 0; f < 6; f++){ cout <<e<<endl; cout << size(b); e -= 5; } cout << 1 << endl << 0 << endl; } }
a.cc: In function 'int main()': a.cc:15:17: error: 'uint16_t' was not declared in this scope 15 | uint16_t e = 31; | ^~~~~~~~ a.cc:3:1: note: 'uint16_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' 2 | #include<vector> +++ |+#include <cstdint> 3 | using namespace std; a.cc:16:30: error: expected ';' before 'f' 16 | for (uint16_t f = 0; f < 6; f++){ | ^~ | ; a.cc:16:38: error: 'f' was not declared in this scope 16 | for (uint16_t f = 0; f < 6; f++){ | ^ a.cc:17:32: error: 'e' was not declared in this scope 17 | cout <<e<<endl; | ^
s164826858
p00164
C++
#include<iostream> #include<vector> using namespace std; int main() { while (1) { int a; cin >> a; if (a == 0)break; vector<int>b(a); for (int c = 0; c < a; c++) { cin >> b[c]; } uint16_t e = 31; for (uint16_t f = 0; f < 6; f++){ cout <<e<<endl; int k = size(b); cout << k; e -= 5; } cout << 1 << endl << 0 << endl; } }
a.cc: In function 'int main()': a.cc:15:17: error: 'uint16_t' was not declared in this scope 15 | uint16_t e = 31; | ^~~~~~~~ a.cc:3:1: note: 'uint16_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' 2 | #include<vector> +++ |+#include <cstdint> 3 | using namespace std; a.cc:16:30: error: expected ';' before 'f' 16 | for (uint16_t f = 0; f < 6; f++){ | ^~ | ; a.cc:16:38: error: 'f' was not declared in this scope 16 | for (uint16_t f = 0; f < 6; f++){ | ^ a.cc:17:32: error: 'e' was not declared in this scope 17 | cout <<e<<endl; | ^
s162594195
p00165
C++
#include<iostream> #include<algorithm> using namespace std; #define MAX_N 1000000 int prime[MAX_N];//i番目の素数 bool is_prime[MAX_N+1]; int sieve(int n){ int p=0; memset(is_prime,true,sizeof(is_prime)); is_prime[0]=is_prime[1]=false; for(int i=2;i<=n;i++){ if(is_prime[i]){ prime[p++]=i; for(int j=2*i;j<=n;j+=i)is_prime[j]=false; } } return p; } int main(){ int num=sieve(MAX_N),n; while(cin>>n&&n){ int ans=0,x; int p,m; for(int i=0;i<n;i++){ cin>>p>>m; x=upper_bound(prime,prime+num,p+m)-lower_bound(prime,prime+num,p-m); if(x==0)ans--; else ans+=x-1; } cout<<ans<<endl; } return 0; }
a.cc: In function 'int sieve(int)': a.cc:11:9: error: 'memset' was not declared in this scope 11 | memset(is_prime,true,sizeof(is_prime)); | ^~~~~~ 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 | using namespace std;
s123936318
p00165
C++
#include "bits/stdc++.h" using namespace std; vector<int>primes(1e8); vector<int>sums(1e8 + 1); void hurui(const int amax) { static bool flag = false; if (flag)return; vector<int>sos; sos = vector<int>(amax + 1, true); sos[0] = false; sos[1] = false; for (int i = 2; i <= amax; ++i) { if (sos[i]) { for (int j = 2 * i; j <= amax; j += i)sos[j] = false; } } for (int i = 0; i <= amax; ++i) { if (sos[i]) { primes[i] = true; } } flag = true; } int main() { hurui(999983); for (int i = 0; i < 1e7; ++i) { sums[i + 1] = sums[i] + primes[i + 1]; } while (1) { int N; cin >> N; if (!N)break; long long int prize = 0; while (N--) { long long int p, m; cin >> p >> m; int amax = min(999983ll, p + m); int amin = max(0ll, p - m-1); const int aprize = sums[amax] - sums[amin]; prize += aprize - 1; } cout << max(0,prize )<< endl; } return 0; }
a.cc: In function 'int main()': a.cc:42:28: error: no matching function for call to 'max(int, long long int&)' 42 | cout << max(0,prize )<< endl; | ~~~^~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:42:28: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 42 | cout << max(0,prize )<< endl; | ~~~^~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:42:28: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 42 | cout << max(0,prize )<< endl; | ~~~^~~~~~~~~~
s652806374
p00165
C++
using namespace std; int M=1000001,n,p,m,c,S,i,j; bool P[1000001]; int main(){ for(i=2;i<M;i++)if(!P[i])for(j=i+i;j<M;j+=i)P[j]=1; P[0]=P[1]=1; while(cin>>n,n){ for(S=0;n--;){ cin>>p>>m; c=0; for(i=p-m>?0;i<=p+m&&i<M;)if(!P[i++])c++; S+=c>0?c-1:-1; } cout<<S<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:7:15: error: 'cin' was not declared in this scope 7 | while(cin>>n,n){ | ^~~ a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' +++ |+#include <iostream> 1 | using namespace std; a.cc:10:40: error: expected primary-expression before '?' token 10 | c=0; for(i=p-m>?0;i<=p+m&&i<M;)if(!P[i++])c++; | ^ a.cc:10:42: error: expected ':' before ';' token 10 | c=0; for(i=p-m>?0;i<=p+m&&i<M;)if(!P[i++])c++; | ^ | : a.cc:10:42: error: expected primary-expression before ';' token a.cc:13:17: error: 'cout' was not declared in this scope 13 | cout<<S<<endl; | ^~~~ a.cc:13:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:13:26: error: 'endl' was not declared in this scope 13 | cout<<S<<endl; | ^~~~ a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' +++ |+#include <ostream> 1 | using namespace std;
s816075405
p00165
C++
#include<stdio.h> #include<algorithm> using namespace std; int p[1000001]; int main(){ for(int i=0;i<1000001;i++)p[i]=1; p[0]=p[1]=0; for(int i=2;i<1000001;i++) if(p[i]) for(int j=i+i;j<1000001;j+=i) p[j]=0; for(int i=1;i<1000001;i++)p[i]+=p[i-1]; int a;while(scanf("%d",&a),a){ long long r=0; while(a--){ int b,c; scanf("%d%d",&b,&c); r+=p[min(b+c,1000000)]-p[max(0,b-c-1)]-1; }printf("%lld\n",r);}} } }
a.cc:20:1: error: expected declaration before '}' token 20 | } | ^ a.cc:21:1: error: expected declaration before '}' token 21 | } | ^
s074631263
p00165
C++
#include<iostream> #include<algorithm> #define INF (long long)1000001 using namespace std; int main(){ int SOSU[INF]; fill(SOSU,SOSU+INF,1); for(int i=2;i<INF;i++){ if(SOSU[INF]==1){ for(int j=i+i;j<INF;j+=i) SOSU[j] = 0; } } for(int i=2;i<INF;i++) SOSU[i] += SOSU[i-1]; long long a,sum,b,c; while(cin >> a && a){ sum = 0; while(a--){ cin >> b >> c; sum += p[min(b+c,INF-1)]-p[max(0,b-c-1)]+1; } cout << sum << endl; } }
a.cc: In function 'int main()': a.cc:20:32: error: 'p' was not declared in this scope 20 | sum += p[min(b+c,INF-1)]-p[max(0,b-c-1)]+1; | ^ a.cc:20:55: error: no matching function for call to 'max(int, long long int)' 20 | sum += p[min(b+c,INF-1)]-p[max(0,b-c-1)]+1; | ~~~^~~~~~~~~ In file included from /usr/include/c++/14/string:51, 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/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:20:55: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 20 | sum += p[min(b+c,INF-1)]-p[max(0,b-c-1)]+1; | ~~~^~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:2: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:20:55: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 20 | sum += p[min(b+c,INF-1)]-p[max(0,b-c-1)]+1; | ~~~^~~~~~~~~
s434607253
p00166
C
#include <stdio.h> #include <math.h> #define MAX 50 #define EPS 10e-5 int main(void) { int n1,n2; int i; int angle; float s1,s2; while(1){ scanf("%d",&n1); if(n1 == 0){ break; } for(i=0;i<n1-1;i++){ scanf("%d",&angle); s1 += sin((float)angle/180.0*3.141592*2.0); } scanf("%d",&n2); if(n2 == 0){ break; } for(i=0;i<n2-1;i++){ scanf("%d",&angle); s1 += sin((float)angle/180.0*3.141592*2.0); } if(s1 > s2-EPS && si < s2+EPS ){ printf("0\n"); } else if(s1 > s2){ printf("1\n"); } else{ printf("2\n"); } } return 0; }
main.c: In function 'main': main.c:29:35: error: 'si' undeclared (first use in this function); did you mean 's2'? 29 | if(s1 > s2-EPS && si < s2+EPS ){ | ^~ | s2 main.c:29:35: note: each undeclared identifier is reported only once for each function it appears in
s295406470
p00166
C
#define Z(V) for(v=360,m=g();--m;V+=sin(x*z))v-=x=g();V+=sin(v*z) a;g(){scanf("%d",&a);a?a:exit(0);}main(m,v,x){for(;;puts(s>t+e?"1":s+e<t?"2":"0")){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);}}
main.c:2:1: warning: data definition has no type or storage class 2 | a;g(){scanf("%d",&a);a?a:exit(0);}main(m,v,x){for(;;puts(s>t+e?"1":s+e<t?"2":"0")){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);}} | ^ main.c:2:1: error: type defaults to 'int' in declaration of 'a' [-Wimplicit-int] main.c:2:3: error: return type defaults to 'int' [-Wimplicit-int] 2 | a;g(){scanf("%d",&a);a?a:exit(0);}main(m,v,x){for(;;puts(s>t+e?"1":s+e<t?"2":"0")){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);}} | ^ main.c: In function 'g': main.c:2:7: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 2 | a;g(){scanf("%d",&a);a?a:exit(0);}main(m,v,x){for(;;puts(s>t+e?"1":s+e<t?"2":"0")){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);}} | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | #define Z(V) for(v=360,m=g();--m;V+=sin(x*z))v-=x=g();V+=sin(v*z) main.c:2:7: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 2 | a;g(){scanf("%d",&a);a?a:exit(0);}main(m,v,x){for(;;puts(s>t+e?"1":s+e<t?"2":"0")){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);}} | ^~~~~ main.c:2:7: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:2:26: error: implicit declaration of function 'exit' [-Wimplicit-function-declaration] 2 | a;g(){scanf("%d",&a);a?a:exit(0);}main(m,v,x){for(;;puts(s>t+e?"1":s+e<t?"2":"0")){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);}} | ^~~~ main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'exit' +++ |+#include <stdlib.h> 1 | #define Z(V) for(v=360,m=g();--m;V+=sin(x*z))v-=x=g();V+=sin(v*z) main.c:2:26: warning: incompatible implicit declaration of built-in function 'exit' [-Wbuiltin-declaration-mismatch] 2 | a;g(){scanf("%d",&a);a?a:exit(0);}main(m,v,x){for(;;puts(s>t+e?"1":s+e<t?"2":"0")){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);}} | ^~~~ main.c:2:26: note: include '<stdlib.h>' or provide a declaration of 'exit' main.c: At top level: main.c:2:35: error: return type defaults to 'int' [-Wimplicit-int] 2 | a;g(){scanf("%d",&a);a?a:exit(0);}main(m,v,x){for(;;puts(s>t+e?"1":s+e<t?"2":"0")){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);}} | ^~~~ main.c: In function 'main': main.c:2:35: error: type of 'm' defaults to 'int' [-Wimplicit-int] main.c:2:35: error: type of 'v' defaults to 'int' [-Wimplicit-int] main.c:2:35: error: type of 'x' defaults to 'int' [-Wimplicit-int] main.c:2:53: error: implicit declaration of function 'puts' [-Wimplicit-function-declaration] 2 | a;g(){scanf("%d",&a);a?a:exit(0);}main(m,v,x){for(;;puts(s>t+e?"1":s+e<t?"2":"0")){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);}} | ^~~~ main.c:2:53: note: include '<stdio.h>' or provide a declaration of 'puts' main.c:2:58: error: 's' undeclared (first use in this function) 2 | a;g(){scanf("%d",&a);a?a:exit(0);}main(m,v,x){for(;;puts(s>t+e?"1":s+e<t?"2":"0")){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);}} | ^ main.c:2:58: note: each undeclared identifier is reported only once for each function it appears in main.c:2:60: error: 't' undeclared (first use in this function) 2 | a;g(){scanf("%d",&a);a?a:exit(0);}main(m,v,x){for(;;puts(s>t+e?"1":s+e<t?"2":"0")){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);}} | ^ main.c:2:62: error: 'e' undeclared (first use in this function) 2 | a;g(){scanf("%d",&a);a?a:exit(0);}main(m,v,x){for(;;puts(s>t+e?"1":s+e<t?"2":"0")){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);}} | ^ main.c:1:37: error: implicit declaration of function 'sin' [-Wimplicit-function-declaration] 1 | #define Z(V) for(v=360,m=g();--m;V+=sin(x*z))v-=x=g();V+=sin(v*z) | ^~~ main.c:2:114: note: in expansion of macro 'Z' 2 | a;g(){scanf("%d",&a);a?a:exit(0);}main(m,v,x){for(;;puts(s>t+e?"1":s+e<t?"2":"0")){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);}} | ^ main.c:1:1: note: include '<math.h>' or provide a declaration of 'sin' +++ |+#include <math.h> 1 | #define Z(V) for(v=360,m=g();--m;V+=sin(x*z))v-=x=g();V+=sin(v*z) main.c:1:37: warning: incompatible implicit declaration of built-in function 'sin' [-Wbuiltin-declaration-mismatch] 1 | #define Z(V) for(v=360,m=g();--m;V+=sin(x*z))v-=x=g();V+=sin(v*z) | ^~~ main.c:2:114: note: in expansion of macro 'Z' 2 | a;g(){scanf("%d",&a);a?a:exit(0);}main(m,v,x){for(;;puts(s>t+e?"1":s+e<t?"2":"0")){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);}} | ^ main.c:1:37: note: include '<math.h>' or provide a declaration of 'sin' 1 | #define Z(V) for(v=360,m=g();--m;V+=sin(x*z))v-=x=g();V+=sin(v*z) | ^~~ main.c:2:114: note: in expansion of macro 'Z' 2 | a;g(){scanf("%d",&a);a?a:exit(0);}main(m,v,x){for(;;puts(s>t+e?"1":s+e<t?"2":"0")){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);}} | ^ main.c:1:58: warning: incompatible implicit declaration of built-in function 'sin' [-Wbuiltin-declaration-mismatch] 1 | #define Z(V) for(v=360,m=g();--m;V+=sin(x*z))v-=x=g();V+=sin(v*z) | ^~~ main.c:2:114: note: in expansion of macro 'Z' 2 | a;g(){scanf("%d",&a);a?a:exit(0);}main(m,v,x){for(;;puts(s>t+e?"1":s+e<t?"2":"0")){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);}} | ^ main.c:1:58: note: include '<math.h>' or provide a declaration of 'sin' 1 | #define Z(V) for(v=360,m=g();--m;V+=sin(x*z))v-=x=g();V+=sin(v*z) | ^~~ main.c:2:114: note: in expansion of macro 'Z' 2 | a;g(){scanf("%d",&a);a?a:exit(0);}main(m,v,x){for(;;puts(s>t+e?"1":s+e<t?"2":"0")){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);}} | ^
s540634549
p00166
C
#define Z(V) for(v=360,m=g();--m;V+=sin(x*z))v-=x=g();V+=sin(v*z) a;g(){scanf("%d",&a);a?a:exit(0);}main(m,v,x){for(;;puts(s>t+e?"1":s+e<t?"2":"0")){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);}}
main.c:2:1: warning: data definition has no type or storage class 2 | a;g(){scanf("%d",&a);a?a:exit(0);}main(m,v,x){for(;;puts(s>t+e?"1":s+e<t?"2":"0")){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);}} | ^ main.c:2:1: error: type defaults to 'int' in declaration of 'a' [-Wimplicit-int] main.c:2:3: error: return type defaults to 'int' [-Wimplicit-int] 2 | a;g(){scanf("%d",&a);a?a:exit(0);}main(m,v,x){for(;;puts(s>t+e?"1":s+e<t?"2":"0")){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);}} | ^ main.c: In function 'g': main.c:2:7: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 2 | a;g(){scanf("%d",&a);a?a:exit(0);}main(m,v,x){for(;;puts(s>t+e?"1":s+e<t?"2":"0")){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);}} | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | #define Z(V) for(v=360,m=g();--m;V+=sin(x*z))v-=x=g();V+=sin(v*z) main.c:2:7: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 2 | a;g(){scanf("%d",&a);a?a:exit(0);}main(m,v,x){for(;;puts(s>t+e?"1":s+e<t?"2":"0")){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);}} | ^~~~~ main.c:2:7: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:2:26: error: implicit declaration of function 'exit' [-Wimplicit-function-declaration] 2 | a;g(){scanf("%d",&a);a?a:exit(0);}main(m,v,x){for(;;puts(s>t+e?"1":s+e<t?"2":"0")){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);}} | ^~~~ main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'exit' +++ |+#include <stdlib.h> 1 | #define Z(V) for(v=360,m=g();--m;V+=sin(x*z))v-=x=g();V+=sin(v*z) main.c:2:26: warning: incompatible implicit declaration of built-in function 'exit' [-Wbuiltin-declaration-mismatch] 2 | a;g(){scanf("%d",&a);a?a:exit(0);}main(m,v,x){for(;;puts(s>t+e?"1":s+e<t?"2":"0")){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);}} | ^~~~ main.c:2:26: note: include '<stdlib.h>' or provide a declaration of 'exit' main.c: At top level: main.c:2:35: error: return type defaults to 'int' [-Wimplicit-int] 2 | a;g(){scanf("%d",&a);a?a:exit(0);}main(m,v,x){for(;;puts(s>t+e?"1":s+e<t?"2":"0")){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);}} | ^~~~ main.c: In function 'main': main.c:2:35: error: type of 'm' defaults to 'int' [-Wimplicit-int] main.c:2:35: error: type of 'v' defaults to 'int' [-Wimplicit-int] main.c:2:35: error: type of 'x' defaults to 'int' [-Wimplicit-int] main.c:2:53: error: implicit declaration of function 'puts' [-Wimplicit-function-declaration] 2 | a;g(){scanf("%d",&a);a?a:exit(0);}main(m,v,x){for(;;puts(s>t+e?"1":s+e<t?"2":"0")){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);}} | ^~~~ main.c:2:53: note: include '<stdio.h>' or provide a declaration of 'puts' main.c:2:58: error: 's' undeclared (first use in this function) 2 | a;g(){scanf("%d",&a);a?a:exit(0);}main(m,v,x){for(;;puts(s>t+e?"1":s+e<t?"2":"0")){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);}} | ^ main.c:2:58: note: each undeclared identifier is reported only once for each function it appears in main.c:2:60: error: 't' undeclared (first use in this function) 2 | a;g(){scanf("%d",&a);a?a:exit(0);}main(m,v,x){for(;;puts(s>t+e?"1":s+e<t?"2":"0")){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);}} | ^ main.c:2:62: error: 'e' undeclared (first use in this function) 2 | a;g(){scanf("%d",&a);a?a:exit(0);}main(m,v,x){for(;;puts(s>t+e?"1":s+e<t?"2":"0")){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);}} | ^ main.c:1:37: error: implicit declaration of function 'sin' [-Wimplicit-function-declaration] 1 | #define Z(V) for(v=360,m=g();--m;V+=sin(x*z))v-=x=g();V+=sin(v*z) | ^~~ main.c:2:114: note: in expansion of macro 'Z' 2 | a;g(){scanf("%d",&a);a?a:exit(0);}main(m,v,x){for(;;puts(s>t+e?"1":s+e<t?"2":"0")){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);}} | ^ main.c:1:1: note: include '<math.h>' or provide a declaration of 'sin' +++ |+#include <math.h> 1 | #define Z(V) for(v=360,m=g();--m;V+=sin(x*z))v-=x=g();V+=sin(v*z) main.c:1:37: warning: incompatible implicit declaration of built-in function 'sin' [-Wbuiltin-declaration-mismatch] 1 | #define Z(V) for(v=360,m=g();--m;V+=sin(x*z))v-=x=g();V+=sin(v*z) | ^~~ main.c:2:114: note: in expansion of macro 'Z' 2 | a;g(){scanf("%d",&a);a?a:exit(0);}main(m,v,x){for(;;puts(s>t+e?"1":s+e<t?"2":"0")){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);}} | ^ main.c:1:37: note: include '<math.h>' or provide a declaration of 'sin' 1 | #define Z(V) for(v=360,m=g();--m;V+=sin(x*z))v-=x=g();V+=sin(v*z) | ^~~ main.c:2:114: note: in expansion of macro 'Z' 2 | a;g(){scanf("%d",&a);a?a:exit(0);}main(m,v,x){for(;;puts(s>t+e?"1":s+e<t?"2":"0")){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);}} | ^ main.c:1:58: warning: incompatible implicit declaration of built-in function 'sin' [-Wbuiltin-declaration-mismatch] 1 | #define Z(V) for(v=360,m=g();--m;V+=sin(x*z))v-=x=g();V+=sin(v*z) | ^~~ main.c:2:114: note: in expansion of macro 'Z' 2 | a;g(){scanf("%d",&a);a?a:exit(0);}main(m,v,x){for(;;puts(s>t+e?"1":s+e<t?"2":"0")){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);}} | ^ main.c:1:58: note: include '<math.h>' or provide a declaration of 'sin' 1 | #define Z(V) for(v=360,m=g();--m;V+=sin(x*z))v-=x=g();V+=sin(v*z) | ^~~ main.c:2:114: note: in expansion of macro 'Z' 2 | a;g(){scanf("%d",&a);a?a:exit(0);}main(m,v,x){for(;;puts(s>t+e?"1":s+e<t?"2":"0")){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);}} | ^
s173904207
p00166
C
#define Z(V) for(v=360,m=g();--m;V+=sin(x*z))v-=x=g();V+=sin(v*z) a;g(){scanf("%d",&a);a?a:exit();}main(m,v,x){for(;;){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);puts(s>t+e?"1":s+e<t?"2":"0");}}
main.c:2:1: warning: data definition has no type or storage class 2 | a;g(){scanf("%d",&a);a?a:exit();}main(m,v,x){for(;;){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);puts(s>t+e?"1":s+e<t?"2":"0");}} | ^ main.c:2:1: error: type defaults to 'int' in declaration of 'a' [-Wimplicit-int] main.c:2:3: error: return type defaults to 'int' [-Wimplicit-int] 2 | a;g(){scanf("%d",&a);a?a:exit();}main(m,v,x){for(;;){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);puts(s>t+e?"1":s+e<t?"2":"0");}} | ^ main.c: In function 'g': main.c:2:7: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 2 | a;g(){scanf("%d",&a);a?a:exit();}main(m,v,x){for(;;){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);puts(s>t+e?"1":s+e<t?"2":"0");}} | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | #define Z(V) for(v=360,m=g();--m;V+=sin(x*z))v-=x=g();V+=sin(v*z) main.c:2:7: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 2 | a;g(){scanf("%d",&a);a?a:exit();}main(m,v,x){for(;;){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);puts(s>t+e?"1":s+e<t?"2":"0");}} | ^~~~~ main.c:2:7: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:2:26: error: implicit declaration of function 'exit' [-Wimplicit-function-declaration] 2 | a;g(){scanf("%d",&a);a?a:exit();}main(m,v,x){for(;;){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);puts(s>t+e?"1":s+e<t?"2":"0");}} | ^~~~ main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'exit' +++ |+#include <stdlib.h> 1 | #define Z(V) for(v=360,m=g();--m;V+=sin(x*z))v-=x=g();V+=sin(v*z) main.c:2:26: warning: incompatible implicit declaration of built-in function 'exit' [-Wbuiltin-declaration-mismatch] 2 | a;g(){scanf("%d",&a);a?a:exit();}main(m,v,x){for(;;){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);puts(s>t+e?"1":s+e<t?"2":"0");}} | ^~~~ main.c:2:26: note: include '<stdlib.h>' or provide a declaration of 'exit' main.c:2:26: error: too few arguments to function 'exit' main.c: At top level: main.c:2:34: error: return type defaults to 'int' [-Wimplicit-int] 2 | a;g(){scanf("%d",&a);a?a:exit();}main(m,v,x){for(;;){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);puts(s>t+e?"1":s+e<t?"2":"0");}} | ^~~~ main.c: In function 'main': main.c:2:34: error: type of 'm' defaults to 'int' [-Wimplicit-int] main.c:2:34: error: type of 'v' defaults to 'int' [-Wimplicit-int] main.c:2:34: error: type of 'x' defaults to 'int' [-Wimplicit-int] main.c:1:37: error: implicit declaration of function 'sin' [-Wimplicit-function-declaration] 1 | #define Z(V) for(v=360,m=g();--m;V+=sin(x*z))v-=x=g();V+=sin(v*z) | ^~~ main.c:2:84: note: in expansion of macro 'Z' 2 | a;g(){scanf("%d",&a);a?a:exit();}main(m,v,x){for(;;){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);puts(s>t+e?"1":s+e<t?"2":"0");}} | ^ main.c:1:1: note: include '<math.h>' or provide a declaration of 'sin' +++ |+#include <math.h> 1 | #define Z(V) for(v=360,m=g();--m;V+=sin(x*z))v-=x=g();V+=sin(v*z) main.c:1:37: warning: incompatible implicit declaration of built-in function 'sin' [-Wbuiltin-declaration-mismatch] 1 | #define Z(V) for(v=360,m=g();--m;V+=sin(x*z))v-=x=g();V+=sin(v*z) | ^~~ main.c:2:84: note: in expansion of macro 'Z' 2 | a;g(){scanf("%d",&a);a?a:exit();}main(m,v,x){for(;;){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);puts(s>t+e?"1":s+e<t?"2":"0");}} | ^ main.c:1:37: note: include '<math.h>' or provide a declaration of 'sin' 1 | #define Z(V) for(v=360,m=g();--m;V+=sin(x*z))v-=x=g();V+=sin(v*z) | ^~~ main.c:2:84: note: in expansion of macro 'Z' 2 | a;g(){scanf("%d",&a);a?a:exit();}main(m,v,x){for(;;){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);puts(s>t+e?"1":s+e<t?"2":"0");}} | ^ main.c:1:58: warning: incompatible implicit declaration of built-in function 'sin' [-Wbuiltin-declaration-mismatch] 1 | #define Z(V) for(v=360,m=g();--m;V+=sin(x*z))v-=x=g();V+=sin(v*z) | ^~~ main.c:2:84: note: in expansion of macro 'Z' 2 | a;g(){scanf("%d",&a);a?a:exit();}main(m,v,x){for(;;){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);puts(s>t+e?"1":s+e<t?"2":"0");}} | ^ main.c:1:58: note: include '<math.h>' or provide a declaration of 'sin' 1 | #define Z(V) for(v=360,m=g();--m;V+=sin(x*z))v-=x=g();V+=sin(v*z) | ^~~ main.c:2:84: note: in expansion of macro 'Z' 2 | a;g(){scanf("%d",&a);a?a:exit();}main(m,v,x){for(;;){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);puts(s>t+e?"1":s+e<t?"2":"0");}} | ^ main.c:2:94: error: implicit declaration of function 'puts' [-Wimplicit-function-declaration] 2 | a;g(){scanf("%d",&a);a?a:exit();}main(m,v,x){for(;;){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);puts(s>t+e?"1":s+e<t?"2":"0");}} | ^~~~ main.c:2:94: note: include '<stdio.h>' or provide a declaration of 'puts'
s499814715
p00166
C
#include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<cassert> #include<iostream> #include<sstream> #include<string> #include<vector> #include<queue> #include<set> #include<map> #include<utility> #include<numeric> #include<algorithm> #include<bitset> #include<complex> #include<stack> using namespace std; typedef long long Int; typedef vector<int> vint; typedef pair<int,int> pint; typedef vector<string> vstring; typedef vector<pint> vpint; typedef stringstream SS; template<class T> void chmin(T &t, T f) { if (t > f) t = f; } template<class T> void chmax(T &t, T f) { if (t < f) t = f; } #define rep(i,n) for(int i=0;i<(n);++i) #define repn(i,m,n) for(int i=(m);i<(n);++i) #define repd(i,n) for(int i=(n)-1;i>=0;--i) #define repnd(i,m,n) for(int i=(n)-1;i>=(m);--i) #define rep0(i,n) for(i=0;i<(n);++i) #define repn0(i,m,n) for(i=(m);i<(n);++i) #define repd0(i,n) for(i=(n)-1;i>=0;--i) #define repnd0(i,m,n) for(i=(n)-1;i>=(m);--i) #define repc(i,n) for(int i=0;i<=(n);++i) #define repcn(i,m,n) for(int i=(m);i<=(n);++i) #define repcd(i,n) for(int i=(n);i>=0;--i) #define repcnd(i,m,n) for(int i=(n);i>=(m);--i) #define repc0(i,n) for(i=0;i<=(n);++i) #define repcn0(i,m,n) for(i=(m);i<=(n);++i) #define repcd0(i,n) for(i=(n);i>=0;--i) #define repcnd0(i,m,n) for(i=(n);i>=(m);--i) #define all(n) n.begin(),n.end() #define sz(n) ((int)(n).size()) #define IL for(;;) #define MP make_pair #define PB push_back #define X second #define Y first #define p_queue(n) priority_queue<n,vector<n>,greater<n> > #define PUTLINE cout<<"LINE:"<<__LINE__<<endl; const int INF = 2147483647/3; const double EPS = 1e-10; const double PI = acos(-1.0); const int dx[]={1,-1,0,0,1,1,-1,-1,0}; const int dy[]={0,0,1,-1,1,-1,1,-1,0}; int sig(double r) { return r < -EPS ? -1 : r > EPS ? 1 : 0; } struct P { double x, y; P() {} P(double x, double y) : x(x), y(y) {} P operator+(const P &a) const { return P(x + a.x, y + a.y); } P operator-(const P &a) const { return P(x - a.x, y - a.y); } P operator*(const P &a) const { return P(x * a.x - y * a.y, x * a.y + y * a.x); } P operator-() const { return P(-x, -y); } P operator*(const double &k) const { return P(x * k, y * k); } P operator/(const double &k) const { return P(x / k, y / k); } double abs2() const { return x * x + y * y; } double abs() const { return sqrt(abs2()); } double arg() const { return atan2(y, x); } double dot(const P &a) const { return x * a.x + y * a.y; } double det(const P &a) const { return x * a.y - y * a.x; } P proj(const P &a) const { double k = dot(a) / abs2(); return P(x * k, y * k); } bool operator<(const P &a) const { return x != a.x ? x < a.x : y < a.y; } bool operator==(const P &a) const { return sig(x - a.x) == 0 && sig(y - a.y) == 0; } }; ostream &operator<<(ostream&os, const P&a) { os << "(" << a.x << ", " << a.y << ")"; return os; } double tri(P a, P b, P c) { return (b - a).det(c - a); } struct L { P a, b; L() {} L(P a, P b) : a(a), b(b) {} P vec() const { return b - a; } P proj(const P &p) const { return a + vec().proj(p - a); } P refl(const P &p) const { return proj(p) * 2 - p; } int iSP(const P &p) const { int s = sig(vec().det(p - a)); if (s != 0) return s; if (sig(vec().dot(p - a)) < 0) return -2; if (sig(vec().dot(p - b)) < 0) return 2; return 0; } int iLL(const L &l) const { if (sig(vec().det(l.vec()))) return 1; if (sig(vec().det(l.a - a))) return 0; return -1; } bool iLS(const L &l) const { return sig(tri(a, b, l.a)) * sig(tri(a, b, l.b)) <= 0; } bool iSS(const L &l) const { return iLS(l) && l.iLS(*this); } P pLL(const L &l) const { return a + vec() * (l.a - a).det(l.vec()) / b.det(l.vec()); } double dLP(const P &p) const { return abs(tri(a, b, p)) / vec().abs(); } double dSP(const P &p) const { if (sig(vec().dot(p - a)) <= 0) return (p - a).abs(); if (sig(vec().dot(p - b)) >= 0) return (p - b).abs(); return dLP(p); } double dLL(const L &l) const { return iLL(l) ? 0 : dLP(l.a); } double dLS(const L &l) const { return iLS(l) ? 0 : min(dLP(l.a), dLP(l.b)); } double dSS(const L &l) const { return iSS(l) ? 0 : min(min(dSP(l.a), dSP(l.b)), min(l.dSP(a), l.dSP(b))); } }; struct C { P p; double r; C() {} C(P p, double r) : p(p), r(r) {} int iCC(C c) { double d = (c.p - p).abs(); if (sig(d) == 0 && sig(r - c.r) == 0) return -1; if (sig(r - c.r - d) > 0) return 2; if (sig(c.r - r - d) > 0) return -2; return (sig(r + c.r - d) >= 0) ? 1 : 0; } bool iCS(L l) { return (sig(r - l.dSP(p)) >= 0&& sig(r - max((l.a - p).abs(), (l.b - p).abs())) <= 0); } pair<P,P> pCC(C c) { double d = (c.p - p).abs(); double x = (d * d + r * r - c.r * c.r) / (d * 2); P e = (c.p - p) / d, w = e * P(0, 1) * sqrt(max(r * r - x * x, 0.0)); return make_pair(p + e * x - w, p + e * x + w); } pair<P,P> pCL(L l) { P h = l.proj(p); double d = (h - p).abs(); double y = sqrt(max(r * r - d * d, 0.0)); P e = (l.b - l.a) / (l.b - l.a).abs(); return make_pair(h - e * y, h + e * y); } pair<P,P> tCP(P p) { double d2 = (p - this->p).abs2(); double x = sqrt(max(d2 - r * r, 0.0)); P h = this->p + (p - this->p) * (r * r / d2); P w = (p - this->p) * P(0, 1) * (x * r / d2); return make_pair(h - w, h + w); } double aCC(C c) { double d = (p - c.p).abs(); if (sig(r - c.r - d) >= 0) return c.r * c.r * PI; if (sig(c.r - r - d) >= 0) return r * r * PI; if (sig(r + c.r - d) <= 0) return 0; double x = (d * d + r * r - c.r * c.r) / (d * 2); double h = sqrt(r * r - x * x); return r * r * atan2(h, x) + c.r * c.r * atan2(h, d - x) - d * h; } }; int main() { int m, n; int v1[400], v2[400]; double m1, m2; IL { cin >> m; if (m == 0) break; v1[0] = 0; repn (i, 1, m) cin >> v1[i]; cin >> n; v2[0] = 0; repn (i, 1, n) cin >> v2[i]; m1 = m2 = 0; rep (i, m) m1 += sin(v1[i] - v1[(i + 1) % m]); rep (i, n) m2 += sin(v2[i] - v2[(i + 1) % n]); if (sig(m1 - m2) > 0) cout << 1 << endl; if (sig(m1 - m2) < 0) cout << 2 << endl; if (sig(m1 - m2) == 0) cout << 0 << endl; } return 0; }
main.c:1:9: fatal error: cstdio: No such file or directory 1 | #include<cstdio> | ^~~~~~~~ compilation terminated.
s988792454
p00166
C++
#include <iostream> using namespace std; #define PI 3.1415926535 int main() { int n, m; while(cin >> n) { if (n == 0) { break; } int counter = 360; int a; double men1 = 0.0; for (int i = 0; i < n-1; i++) { cin >> a; men1 += 0.5*1.0*1.0*sin(((double)a/360.0)*PI*2.0); counter -= a; } men1 += 0.5*1.0*1.0*sin(((double)a/360.0)*PI*2.0); cin >> m; counter = 360; double men2 = 0.0; for (int i = 0; i < m-1; i++) { cin >> a; men2 += 0.5*1.0*1.0*sin(((double)a/360.0)*PI*2.0); counter -= a; } men2 += 0.5*1.0*1.0*sin(((double)a/360.0)*PI*2.0); if (men1 == men2) { cout << 0 << endl; } else if (men1 > men2){ cout << 1 << endl; } else { cout << 2 << endl; } } return 0; }
a.cc: In function 'int main()': a.cc:18:45: error: 'sin' was not declared in this scope 18 | men1 += 0.5*1.0*1.0*sin(((double)a/360.0)*PI*2.0); | ^~~ a.cc:21:37: error: 'sin' was not declared in this scope 21 | men1 += 0.5*1.0*1.0*sin(((double)a/360.0)*PI*2.0); | ^~~
s380114559
p00166
C++
#include<iostream> #include<cmath> #include<algorithm> #include<vector> using namespace std; #define PI 3.141592653589793238462643L int K[100000]; long double SIN(long double b) { return sinl(b * PI / 180.0L); } int main() { int N, cnt = 0; long double a, sum, V; vector<long double, int>vec; while (true) { cin >> N; V = 0.0L; sum = 0.0L; if (N == 0) { break; } for (int i = 0; i < N; i++) { cin >> a; sum += SIN(a); V += a; } sum += sin(360.0L - V); vec.push_back(make_pair(sum, cnt)); cnt++; } sort(vec.begin(), vec.end()); for (int i = 0; i < cnt; i++) { K[vec[i].second] = i; } for (int i = 0; i < cnt; i++) { cout << K[i] << endl; } return 0; }
In file included from /usr/include/c++/14/vector:66, from a.cc:4: /usr/include/c++/14/bits/stl_vector.h: In instantiation of 'struct std::_Vector_base<long double, int>': /usr/include/c++/14/bits/stl_vector.h:428:11: required from 'class std::vector<long double, int>' 428 | class vector : protected _Vector_base<_Tp, _Alloc> | ^~~~~~ a.cc:10:65: required from here 10 | int N, cnt = 0; long double a, sum, V; vector<long double, int>vec; | ^~~ /usr/include/c++/14/bits/stl_vector.h:87:28: error: 'int' is not a class, struct, or union type 87 | rebind<_Tp>::other _Tp_alloc_type; | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:89:9: error: 'int' is not a class, struct, or union type 89 | pointer; | ^~~~~~~ /usr/include/c++/14/bits/stl_vector.h: In instantiation of 'class std::vector<long double, int>': a.cc:10:65: required from here 10 | int N, cnt = 0; long double a, sum, V; vector<long double, int>vec; | ^~~ /usr/include/c++/14/bits/stl_vector.h:518:20: error: '_M_allocate' has not been declared in 'std::vector<long double, int>::_Base' 518 | using _Base::_M_allocate; | ^~~~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:519:20: error: '_M_deallocate' has not been declared in 'std::vector<long double, int>::_Base' 519 | using _Base::_M_deallocate; | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:521:20: error: '_M_get_Tp_allocator' has not been declared in 'std::vector<long double, int>::_Base' 521 | using _Base::_M_get_Tp_allocator; | ^~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/bits/requires_hosted.h:31, from /usr/include/c++/14/iostream:38, from a.cc:1: /usr/include/c++/14/bits/stl_vector.h: In instantiation of 'std::_Vector_base<_Tp, _Alloc>::_Vector_impl::_Vector_impl() [with _Tp = long double; _Alloc = int]': a.cc:10:65: required from here 10 | int N, cnt = 0; long double a, sum, V; vector<long double, int>vec; | ^~~ /usr/include/c++/14/bits/stl_vector.h:136:24: error: 'int' is not a class, struct, or union type 136 | _Vector_impl() _GLIBCXX_NOEXCEPT_IF( | ^~~~~~~~~~~~~~~~~~~~ a.cc: In function 'int main()': a.cc:14:54: error: no matching function for call to 'std::vector<long double, int>::push_back(std::pair<long double, int>)' 14 | sum += sin(360.0L - V); vec.push_back(make_pair(sum, cnt)); cnt++; | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = long double; _Alloc = int; value_type = long double]' 1283 | push_back(const value_type& __x) | ^~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1283:35: note: no known conversion for argument 1 from 'std::pair<long double, int>' to 'const std::vector<long double, int>::value_type&' {aka 'const long double&'} 1283 | push_back(const value_type& __x) | ~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = long double; _Alloc = int; value_type = long double]' 1300 | push_back(value_type&& __x) | ^~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1300:30: note: no known conversion for argument 1 from 'std::pair<long double, int>' to 'std::vector<long double, int>::value_type&&' {aka 'long double&&'} 1300 | push_back(value_type&& __x) | ~~~~~~~~~~~~~^~~ a.cc:16:18: error: 'class std::vector<long double, int>' has no member named 'begin' 16 | sort(vec.begin(), vec.end()); | ^~~~~ a.cc:16:31: error: 'class std::vector<long double, int>' has no member named 'end' 16 | sort(vec.begin(), vec.end()); | ^~~ a.cc:17:46: error: no match for 'operator[]' (operand types are 'std::vector<long double, int>' and 'int') 17 | for (int i = 0; i < cnt; i++) { K[vec[i].second] = i; } | ^ /usr/include/c++/14/bits/stl_vector.h: In instantiation of 'std::_Vector_base<_Tp, _Alloc>::_Vector_impl::_Vector_impl() [with _Tp = long double; _Alloc = int]': /usr/include/c++/14/bits/stl_vector.h:314:7: required from here 314 | _Vector_base() = default; | ^~~~~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:141:26: error: 'int' is not a class, struct, or union type 141 | : _Tp_alloc_type() | ^
s145338885
p00166
C++
#define Z(V) for(v=360,m=g();--m;V+=sin(x*z))v-=x=g();V+=sin(v*z) a;g(){scanf("%d",&a);a?a:exit();}main(m,v,x){for(;;){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);puts(s>t+e?"1":s+e<t?"2":"0");}}
a.cc:2:1: error: 'a' does not name a type 2 | a;g(){scanf("%d",&a);a?a:exit();}main(m,v,x){for(;;){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);puts(s>t+e?"1":s+e<t?"2":"0");}} | ^ a.cc:2:3: error: ISO C++ forbids declaration of 'g' with no type [-fpermissive] 2 | a;g(){scanf("%d",&a);a?a:exit();}main(m,v,x){for(;;){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);puts(s>t+e?"1":s+e<t?"2":"0");}} | ^ a.cc: In function 'int g()': a.cc:2:19: error: 'a' was not declared in this scope 2 | a;g(){scanf("%d",&a);a?a:exit();}main(m,v,x){for(;;){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);puts(s>t+e?"1":s+e<t?"2":"0");}} | ^ a.cc:2:7: error: 'scanf' was not declared in this scope 2 | a;g(){scanf("%d",&a);a?a:exit();}main(m,v,x){for(;;){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);puts(s>t+e?"1":s+e<t?"2":"0");}} | ^~~~~ a.cc:2:26: error: 'exit' was not declared in this scope 2 | a;g(){scanf("%d",&a);a?a:exit();}main(m,v,x){for(;;){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);puts(s>t+e?"1":s+e<t?"2":"0");}} | ^~~~ a.cc:1:1: note: 'exit' is defined in header '<cstdlib>'; this is probably fixable by adding '#include <cstdlib>' +++ |+#include <cstdlib> 1 | #define Z(V) for(v=360,m=g();--m;V+=sin(x*z))v-=x=g();V+=sin(v*z) a.cc:2:33: warning: no return statement in function returning non-void [-Wreturn-type] 2 | a;g(){scanf("%d",&a);a?a:exit();}main(m,v,x){for(;;){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);puts(s>t+e?"1":s+e<t?"2":"0");}} | ^ a.cc: At global scope: a.cc:2:38: error: expected constructor, destructor, or type conversion before '(' token 2 | a;g(){scanf("%d",&a);a?a:exit();}main(m,v,x){for(;;){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);puts(s>t+e?"1":s+e<t?"2":"0");}} | ^
s064785415
p00166
C++
#include<math.h> n,t,r; float S; main(i){ for(;scanf("%d",&n),n;i=-i){ r=360; for(;--n;){ scanf("%d",&t); r-=t; S+=sin(t*M_PI/180)*i; } S+=sin(r*M_PI/180)*i; if(i<0){ puts(fabs(S)>1e-6?S>0?"1":"2":"0"); S=0; } } exit(0); }
a.cc:2:1: error: 'n' does not name a type 2 | n,t,r; | ^ a.cc:4:5: error: expected constructor, destructor, or type conversion before '(' token 4 | main(i){ | ^
s209596642
p00166
C++
#include <iostream> #include<cmath> using namespace std; double EPS = 1e-10; double pi = 3.1415926535; double calc(int x) { return sin((double)x*pi/180.0); } int main(void){ int n,m; while( cin >> n , n ){ doubles1 = 0, s2 = 0, angle, c = 360; for( int i = 0 ; i < n - 1 ; i++ ){ cin >> angle; c -= angle; s1 += calc(angle); } s1 += calc(c); cin >> m; s = 360; for( int j = 0 ; j < m - 1 ; j++ ){ cin >> angle; c -= angle; s2 += calc(angle); } s2 += calc(c); if( s1 > s2 + EPS ) cout << 1 << endl; else if( s1 + EPS < s2 ) cout << 2 << endl; else cout << 0 << endl; } return 0; }
a.cc: In function 'int main()': a.cc:20:5: error: 'doubles1' was not declared in this scope; did you mean 'double_t'? 20 | doubles1 = 0, s2 = 0, angle, c = 360; | ^~~~~~~~ | double_t a.cc:20:19: error: 's2' was not declared in this scope 20 | doubles1 = 0, s2 = 0, angle, c = 360; | ^~ a.cc:20:27: error: 'angle' was not declared in this scope 20 | doubles1 = 0, s2 = 0, angle, c = 360; | ^~~~~ a.cc:20:34: error: 'c' was not declared in this scope 20 | doubles1 = 0, s2 = 0, angle, c = 360; | ^ a.cc:25:7: error: 's1' was not declared in this scope; did you mean 'y1'? 25 | s1 += calc(angle); | ^~ | y1 a.cc:27:5: error: 's1' was not declared in this scope; did you mean 'y1'? 27 | s1 += calc(c); | ^~ | y1 a.cc:30:5: error: 's' was not declared in this scope 30 | s = 360; | ^
s677022200
p00166
C++
include<iostream> #include<cmath> #include<cstdio> using namespace std; static double EPS = 1.0e-10; bool is_zero(const double x){ return abs(x)<EPS; } double get_area(const double& t){ return sin(t*M_PI/180.0)/2; } double solve(const int& n){ double ans=0; double t, t_=360; for(int i=0; i<n-1; ++i){ cin >> t; t_-=t; ans+=get_area(t); } ans+=get_area(t_); return ans; } int main(){ int n, m; while(cin >> n && n){ double a=solve(n); cin >> m; double b=solve(m); if(a==b) printf("0\n"); else if(a>b) printf("1\n"); else printf("2\n"); } return 0; }
a.cc:1:1: error: 'include' does not name a type 1 | include<iostream> | ^~~~~~~ In file included from /usr/include/c++/14/cmath:45, 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, from /usr/include/c++/14/bits/specfun.h:43, from /usr/include/c++/14/cmath:3906: /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: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)> | ^~~~~~ In file included from /usr/include/stdlib.h:32, from /usr/include/c++/14/bits/std_abs.h:38, from /usr/include/c++/14/cmath:49: /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_algobase.h:65: /usr/include/c++/14/bits/stl_iterator_base_types.h:125:67: error: 'ptrdiff_t' does not name a type 125 | template<typename _Category, typename _Tp, typename _Distance = ptrdiff_t, | ^~~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_types.h:1:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' +++ |+#include <cstddef> 1 | // Types used in iterator implementation -*- C++ -*- /usr/include/c++/14/bits/stl_iterator_base_types.h:214:15: error: 'ptrdiff_t' does not name a type 214 | typedef ptrdiff_t difference_type; | ^~~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_types.h:214:15: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/bits/stl_iterator_base_types.h:225:15: error: 'ptrdiff_t' does not name a type 225 | typedef ptrdiff_t difference_type; | ^~~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_types.h:225:15: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' In file included from /usr/include/c++/14/bits/stl_algobase.h:66: /usr/include/c++/14/bits/stl_iterator_base_funcs.h:112:5: error: 'ptrdiff_t' does not name a type 112 | ptrdiff_t | ^~~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:66:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 65 | #include <debug/assertions.h> +++ |+#include <cstddef> 66 | #include <bits/stl_iterator_base_types.h> /usr/include/c++/14/bits/stl_iterator_base_funcs.h:118:5: error: 'ptrdiff_t' does not name a type 118 | ptrdiff_t | ^~~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:118:5: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' In file included from /usr/include/c++/14/bits/stl_iterator.h:67, from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits
s742663522
p00167
Java
import java.util.Scanner; public class AOJ0167 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(true){ int n = sc.nextInt(); if(n==0)break; int[] a = new int[n]; for(int i=0;i<n;i++)a[i]=sc.nextInt(); int s = 0; for(int j=n-1;j>=1;j--){ for(int i=0;i<j;i++){ if(a[i+1]<a[i]){ int t = a[i]; a[i]=a[i+1]; a[i+1]=t; s++; } } } System.out.println(s); } } }
Main.java:3: error: class AOJ0167 is public, should be declared in a file named AOJ0167.java public class AOJ0167 { ^ 1 error
s107211063
p00167
C
#include <stdio.h> int main (void){ int a,c,i,j,n; for(;;){ scanf("%d",&n); if(n==0)break; int b[101]={},ans=0; for(i=0;i<n;i++){ scanf("%d",&a); b[i]=a; } for(i=1;i<n;i++){ for(j=1;j<n;j++){ if(b[j-1]>=b[j]){ if(b[j-1]>b[j]){ ans++; } c=b[j-1]; b[j-1]=b[j]; b[j]=c; } } } } printf("%d\n",ans); } return 0; }
main.c: In function 'main': main.c:25:23: error: 'ans' undeclared (first use in this function) 25 | printf("%d\n",ans); | ^~~ main.c:25:23: note: each undeclared identifier is reported only once for each function it appears in main.c: At top level: main.c:27:1: error: expected identifier or '(' before 'return' 27 | return 0; | ^~~~~~ main.c:28:1: error: expected identifier or '(' before '}' token 28 | } | ^
s322006476
p00167
C
#include<stdio.h> int main(){ int i; int n; int u[500]; int sum; int cnt; while(scanf("%d", &n), n!=0){ for(i=0; i<n; i++) scanf("%d", &u[i]); cnt=0; for(i=n-1; i>0; i--){ for(j=0; j<i; j++){ if(u[j]>u[j+1]){ sum=u[i]; u[j]=u[j+1]; u[j+1]=sum; cnt++; } } } printf("%d\n", cnt); } return 0; }
main.c: In function 'main': main.c:17:5: error: 'j' undeclared (first use in this function) 17 | for(j=0; j<i; j++){ | ^ main.c:17:5: note: each undeclared identifier is reported only once for each function it appears in
s868632813
p00167
C
#include <stdio.h> main(){ int a,n[100],i,j,max=0,tmp,t; while(1){ scanf("%d",&a); if(a==0) break; for(i=0;i<=a;i++){ scanf("%d",&n[i]); } for(j=0;j<a;j++){ for(i=j;i<a;i++){ t=i+1; if(a[i]>a[t]){ tmp=a[t]; a[t]=a[i]; a[i]=tmp; } } } printf("%d\n",n); } }
main.c:2:1: error: return type defaults to 'int' [-Wimplicit-int] 2 | main(){ | ^~~~ main.c: In function 'main': main.c:14:13: error: subscripted value is neither array nor pointer nor vector 14 | if(a[i]>a[t]){ | ^ main.c:14:18: error: subscripted value is neither array nor pointer nor vector 14 | if(a[i]>a[t]){ | ^ main.c:15:16: error: subscripted value is neither array nor pointer nor vector 15 | tmp=a[t]; | ^ main.c:16:12: error: subscripted value is neither array nor pointer nor vector 16 | a[t]=a[i]; | ^ main.c:16:17: error: subscripted value is neither array nor pointer nor vector 16 | a[t]=a[i]; | ^ main.c:17:12: error: subscripted value is neither array nor pointer nor vector 17 | a[i]=tmp; | ^
s477729982
p00167
C
#include <stdio.h> main(){ int a,n[100],i,j,max=0,tmp,t; while(1){ scanf("%d",&a); if(a==0) break; for(i=0;i<=a;i++){ scanf("%d",&n[i]); } for(j=0;j<a;j++){ for(i=j;i<a-1;i++){ t=i+1; if(a[i]>a[t]){ tmp=a[t]; a[t]=a[i]; a[i]=tmp; } } } printf("%d\n",n); } }
main.c:2:1: error: return type defaults to 'int' [-Wimplicit-int] 2 | main(){ | ^~~~ main.c: In function 'main': main.c:14:13: error: subscripted value is neither array nor pointer nor vector 14 | if(a[i]>a[t]){ | ^ main.c:14:18: error: subscripted value is neither array nor pointer nor vector 14 | if(a[i]>a[t]){ | ^ main.c:15:16: error: subscripted value is neither array nor pointer nor vector 15 | tmp=a[t]; | ^ main.c:16:12: error: subscripted value is neither array nor pointer nor vector 16 | a[t]=a[i]; | ^ main.c:16:17: error: subscripted value is neither array nor pointer nor vector 16 | a[t]=a[i]; | ^ main.c:17:12: error: subscripted value is neither array nor pointer nor vector 17 | a[i]=tmp; | ^
s836109339
p00167
C
#include <stdio.h> main(){ int a,n[100],i,j,max=0,tmp,m; while(1){ scanf("%d",&a); if(a==0) break; for(i=0;i<=a;i++){ scanf("%d",&n[i]); } for(j=0;j<a-1;j++){ for(i=j;i<a-1;i++){ m=i+1; if(a[i]>a[m]){ tmp=a[m]; a[m]=a[i]; a[i]=tmp; } } } printf("%d\n",n); } }
main.c:3:1: error: return type defaults to 'int' [-Wimplicit-int] 3 | main(){ | ^~~~ main.c: In function 'main': main.c:15:13: error: subscripted value is neither array nor pointer nor vector 15 | if(a[i]>a[m]){ | ^ main.c:15:18: error: subscripted value is neither array nor pointer nor vector 15 | if(a[i]>a[m]){ | ^ main.c:16:16: error: subscripted value is neither array nor pointer nor vector 16 | tmp=a[m]; | ^ main.c:17:12: error: subscripted value is neither array nor pointer nor vector 17 | a[m]=a[i]; | ^ main.c:17:17: error: subscripted value is neither array nor pointer nor vector 17 | a[m]=a[i]; | ^ main.c:18:12: error: subscripted value is neither array nor pointer nor vector 18 | a[i]=tmp; | ^
s153740695
p00167
C
#include<stdio.h> void swap(int *x,int *y){ int m=*x; *x=*y; *y=m; } int main(){ int a[200],n,j; while(scanf("%d",&n),n){ j=0; for(i=0;i<n;i++) scanf("%d",&a[i]); for(i=0;i<n-1;i++) if(a[i]>a[i+1]){ swap(&a[i],&a[i+1]); j++; } printf("%d\n",j); } return 0; }
main.c: In function 'main': main.c:11:5: error: 'i' undeclared (first use in this function) 11 | for(i=0;i<n;i++) | ^ main.c:11:5: note: each undeclared identifier is reported only once for each function it appears in
s201502986
p00167
C
#include<stdio.h> void swap(int *x,int *y){ int m=*x; *x=*y; *y=m; } int main(){ int a[200],n,j,k; while(scanf("%d",&n),n){ j=0; for(i=0;i<n;i++) scanf("%d",&a[i]); for(k=0;k<n-1;k++) for(i=0;i<n-1;i++) if(a[i]>a[i+1]){ swap(&a[i],&a[i+1]); j++; } printf("%d\n",j); } return 0; }
main.c: In function 'main': main.c:11:5: error: 'i' undeclared (first use in this function) 11 | for(i=0;i<n;i++) | ^ main.c:11:5: note: each undeclared identifier is reported only once for each function it appears in
s416219486
p00167
C
#include <stdio.h> int main(void) { int N; int i, j; int count; int box[100]; int tmp; while (1){ scanf("%d", &N); if (N == 0){ break; } count = 0; for (i = 0; i < N; i++){ scanf("%d", &box[i]); } for (i = 0; i < N - 1; i++){ for (j = 0; j = N - i - 1; j++){ if (box[j] > box[j + 1]{ tmp = box[j]; box[j] = box[j + 1]; box[j + 1] = tmp; count++; } } } } printf("%d\n", count); return (0); }
main.c: In function 'main': main.c:24:56: error: expected ')' before '{' token 24 | if (box[j] > box[j + 1]{ | ~ ^ | ) main.c:31:25: error: expected expression before '}' token 31 | } | ^
s673862332
p00167
C
5 5 3 2 1 4 6 1 2 3 4 5 6 3 3 2 1 0
main.c:1:1: error: expected identifier or '(' before numeric constant 1 | 5 | ^
s207056403
p00167
C++
#include <iostream> #include <vector> using namespace std; #define rep(i, n) for(int i = 0; i < int(n); i++) int BIT[1000001]; int sum(int idx) { int ret = 0; while (idx != 0) { ret += BIT[idx]; idx -= idx & -idx; } return ret; } int n; void add(int idx, int num) { while (idx <= n) { BIT[idx] += num; idx += idx & -idx; } } signed main() { while (cin >> n && n) { memset(BIT, 0, sizeof(BIT)); int ans = 0; vector<int> arr(n); rep(i, n) cin >> arr[i]; rep(i, n) { ans += sum(arr[n - i - 1]); add(arr[n - i - 1], 1); } cout << ans << endl; } return 0; }
a.cc: In function 'int main()': a.cc:34:17: error: 'memset' was not declared in this scope 34 | memset(BIT, 0, sizeof(BIT)); | ^~~~~~ a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include <vector> +++ |+#include <cstring> 3 |
s481528198
p00167
C++
#include <iostream> #include <Algorithm> using namespace std; int main(void){ int N, M; while(cin >> N, N){ int num[N], cnt = 0; fill_n(num, N, 0); for(int i = 0; i < N; i++){ cin >> num[i]; } for(int i = N-1; i > 0; i--){ for(int j = 1; j <= i; j++){ if(num[j] < num[j-1]){ int tmp; tmp = num[j]; num[j] = num[j-1]; num[j] = tmp; cnt++; } } } cout << cnt << endl; } }
a.cc:2:10: fatal error: Algorithm: No such file or directory 2 | #include <Algorithm> | ^~~~~~~~~~~ compilation terminated.
s648666324
p00167
C++
#include<stdio.h> int main(){ int N; int n[1000001]={}; while(1){ scanf("%d",&N); int c=0; for(int i=0;i<N;i++){ scanf("%d",&n[i]; for(int i=0;i<N;i++) for(int j=N-1;j>i;j--) {if(n[j]<n[j-1]){int T=n[j];n[j]=n[j-1];n[j-1]=T;c++} printf("%d\n",c); } return 0; }
a.cc: In function 'int main()': a.cc:14:17: error: expected ')' before ';' token 14 | scanf("%d",&n[i]; | ~ ^ | ) a.cc:18:53: error: expected ';' before '}' token 18 | {if(n[j]<n[j-1]){int T=n[j];n[j]=n[j-1];n[j-1]=T;c++} | ^ | ; a.cc:23:2: error: expected '}' at end of input 23 | } | ^ a.cc:8:9: note: to match this '{' 8 | while(1){ | ^ a.cc:23:2: error: expected '}' at end of input 23 | } | ^ a.cc:3:11: note: to match this '{' 3 | int main(){ | ^
s956105744
p00167
C++
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define shosu(n) setprecision(n) #define INF 1000000000; using namespace std; int main() { int n; while(cin>>n,n){ int d[n],ans=0; rep(i, n) cin >> d[i]; for (i = 1; i < n; i++) for (j = 0; j < n - i; j++) if (d[j] > d[j + 1]) { swap(d[j], d[j + 1]); ans++; } cout << k << endl; } return 0; }
a.cc: In function 'int main()': a.cc:12:10: error: 'i' was not declared in this scope 12 | for (i = 1; i < n; i++) | ^ a.cc:13:12: error: 'j' was not declared in this scope 13 | for (j = 0; j < n - i; j++) | ^ a.cc:18:13: error: 'k' was not declared in this scope 18 | cout << k << endl; | ^
s615096859
p00167
C++
#include <algorithm> #include <cmath> #include <iostream> #include <utility> using namespace std; constexpr int kaijyou(const int &n) { return n == 0 ? 1 : n * factorial(n - 1); } int main() { int n, t; int ans; double count; while (cin >> n) { if (n == 0) return 0; int a[n]; t = 0; ans = 0; count = 0; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int j = 0; t == 0; j++) { if (j + 1 == n) { j = 0; count += 1; } if (a[j] > a[j + 1]) { swap(a[j], a[j + 1]); ans += 1; } if (count > kaijyou(n)) { cout << ans << endl; t = 1; } } } return 0; }
a.cc: In function 'constexpr int kaijyou(const int&)': a.cc:8:27: error: 'factorial' was not declared in this scope 8 | return n == 0 ? 1 : n * factorial(n - 1); | ^~~~~~~~~
s203670979
p00167
C++
#include<cstdio> int main(){ int a[102],i,j,k; for(;scanf("%d",a),*a;printf("%d\n",k)){ for(i=1;i<=n; i++)scanf("%d",*(a+i++)); k=0; for(j=n;j>1;j--) for(i=2;i<=j;i++) if(a[i-1]>a[i]) a[i-1]^=a[i],a[i]^a[i-1],a[i-1]^=a[i],k++; } }
a.cc: In function 'int main()': a.cc:5:28: error: 'n' was not declared in this scope 5 | for(i=1;i<=n; i++)scanf("%d",*(a+i++)); | ^ a.cc:7:23: error: 'n' was not declared in this scope 7 | for(j=n;j>1;j--) | ^
s834462360
p00167
C++
include<iostream> #include<cstdio> using namespace std; int main(){ int n,i,j,k,c,a[1000000]; while(cin>>n&&n!=0){ for(i=0;i<n;i++){ cin>>a[i]; } for(k=0,i=0;i<n-1;i++){ for(j=i;j<n;j++){ if(a[i]>a[j]){ c=a[i]; a[i]=a[j]; a[j]=c; k++; } } } cout<<k<<endl; } return 0; }
a.cc:1:1: error: 'include' does not name a type 1 | include<iostream> | ^~~~~~~ a.cc: In function 'int main()': a.cc:8:9: error: 'cin' was not declared in this scope 8 | while(cin>>n&&n!=0){ | ^~~ a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 2 | #include<cstdio> +++ |+#include <iostream> 3 | using namespace std; a.cc:23:5: error: 'cout' was not declared in this scope 23 | cout<<k<<endl; | ^~~~ a.cc:23:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:23:14: error: 'endl' was not declared in this scope 23 | cout<<k<<endl; | ^~~~ a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 2 | #include<cstdio> +++ |+#include <ostream> 3 | using namespace std;
s079560972
p00167
C++
#include<iostream> #define MAX_N 1000000 using namespace std; int bit[MAX_N + 1],a[MAX_N + 1],n; int sum(int); void add(int,int); int main(void){ while(cin >> n,n){ int ans=0; for(int i=0;i<n;i++)cin >> a[i]; for(int j=0;j<n;j++){ ans += j - sum(a[j]); add(a[j],1); } printf("%d\n",ans); } } int sum(int i){ int s=0; while(i > 0){ s += bit[i]; i -= i & -i; } return s; }
/usr/bin/ld: /tmp/cczG1yvQ.o: in function `main': a.cc:(.text+0xa3): undefined reference to `add(int, int)' collect2: error: ld returned 1 exit status
s332342376
p00167
C++
#include <iostream> #include <vector> #include <algorithm> using namespace std; #define N (111) int seg[N+1]; void add(int x,int v){ for(int i = x ; i < N ; i+=i&-i){ seg[i] += v; } } int get(int x){ int ans = 0; for(int i = x ; i > 0 ; i -= i & -i){ ans += seg[i]; } return ans; } int a[101]; int main(){ int n; while(cin >> n && n){ vector<int> u; for(int i = 0 ; i < 101 ; i++) seg[i] = 0; for(int i = 0 ; i < n ; i++) cin >> a[i] , u.push_back(a[i]); sort(u.begin(),u.end()); u.erase(unique(u.begin(),u.end()),u.end()); for(int i = 0 ; i < n ; i++) a[i] = (10/i) * lower_bound(u.begin(),u.end(),a[i]) - u.begin() + 1; int ans = 0; for(int i = 0 ; i < n ; i++){ add(a[i],1); ans += (i+1) - get(a[i]); //a[i]より大きな値 } cout << ans << endl; } }
a.cc: In function 'int main()': a.cc:36:39: error: no match for 'operator*' (operand types are 'int' and '__gnu_cxx::__normal_iterator<int*, std::vector<int> >') 36 | a[i] = (10/i) * lower_bound(u.begin(),u.end(),a[i]) - u.begin() + 1; | ~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | int __gnu_cxx::__normal_iterator<int*, std::vector<int> >
s226932976
p00167
C++
#include<iostream> #include<cstdio> #include<time.h> using namespace std; #define N 314159 int a[N],t[N]; long long ans=0; void marge_count(int s,int g){ if(s+1==g){ if(a[s]>a[g]){ swap(a[s],a[g]);ans++; }return; } int m= (s+g)/2; marge_count(s,m); marge_count(m,g); int p=s,q=m,r=s; while(p<m&&q<g){ if(a[p]<a[q]){ t[r++]=a[p++]; ans+=q; }else{ t[r++]=a[q++]; } } if(p<m){ while(p<m){ t[r++]=a[p++];ans+=q; } }else{ t[r++]=a[q++]; } for(int i=s;i<g;i++){ a[i]=t[i]; } } int main(){  while(cin>>n&&n!=0){ ans=0; for(int i=0;i<n;i++)cin>>a[i]; marge_count(0,n); cout<<(int)ans<<endl; } return 0; }
a.cc:38:1: error: extended character   is not valid in an identifier 38 |  while(cin>>n&&n!=0){ | ^ a.cc: In function 'int main()': a.cc:38:14: error: 'n' was not declared in this scope 38 |  while(cin>>n&&n!=0){ | ^ a.cc:38:1: error: '\U00003000while' was not declared in this scope 38 |  while(cin>>n&&n!=0){ | ^~~~~~~
s398476196
p00167
C++
#include<iostream> #include<cstdio> #include<time.h> using namespace std; #define N 314159 int a[N],t[N]; int n; long long ans=0; void marge_count(int s,int g){ if(s+1==g){ if(a[s]>a[g]){ swap(a[s],a[g]);ans++; }return; } int m= (s+g)/2; marge_count(s,m); marge_count(m,g); int p=s,q=m,r=s; while(p<m&&q<g){ if(a[p]<a[q]){ t[r++]=a[p++]; ans+=q; }else{ t[r++]=a[q++]; } } if(p<m){ while(p<m){ t[r++]=a[p++];ans+=q; } }else{ t[r++]=a[q++]; } for(int i=s;i<g;i++){ a[i]=t[i]; } } int main(){  while(cin>>n&&n!=0){ ans=0; for(int i=0;i<n;i++)cin>>a[i]; marge_count(0,n); cout<<(int)ans<<endl; } return 0; }
a.cc:39:1: error: extended character   is not valid in an identifier 39 |  while(cin>>n&&n!=0){ | ^ a.cc: In function 'int main()': a.cc:39:1: error: '\U00003000while' was not declared in this scope 39 |  while(cin>>n&&n!=0){ | ^~~~~~~
s760278629
p00167
C++
<iostream> using namespace std; int main() { int n; for(;cin>>n,n;) { int data[n]; long long int step=0; for(int i=0;i<n;i++) cin>>data[i]; for(int i=0;i<n;i++) for(int j=0;j<n-i-1;j++) { if(data[j]>data[j+1]) { swap(data[j],data[j+1]); step++; } } cout<<step<<endl; } }
a.cc:1:1: error: expected unqualified-id before '<' token 1 | <iostream> | ^ a.cc: In function 'int main()': a.cc:7:8: error: 'cin' was not declared in this scope 7 | for(;cin>>n,n;) | ^~~ a.cc:19:17: error: 'swap' was not declared in this scope 19 | swap(data[j],data[j+1]); | ^~~~ a.cc:23:7: error: 'cout' was not declared in this scope 23 | cout<<step<<endl; | ^~~~ a.cc:23:19: error: 'endl' was not declared in this scope 23 | cout<<step<<endl; | ^~~~
s285906589
p00167
C++
#include <iostream> #include <vector> #include <map> using namespace std; const int N = 100; int bit[N+10]; int sum(int i){ int s = 0; while(i > 0){ s += bit[i]; i -= i & -i; } return s; } void add(int i, int x){ while(i <= N){ bit[i] += x; i += i & -i; } } vector<int> compress(vector<int> v){ map<int, int> mp; for(int i=0;i<v.size();i++)mp[i] = 0; int id = 1; for(map<int,int>::iterator it=mp.begin(); it != mp.end(); it++){ it->second = id++; } for(int i=0;i<v.size();i++)v[i] = mp[v[i]]; return v; } int main(){ while(cin >> n && n){ memset(bit, 0, sizeof(bit)); vector<int> v(n); for(int i=0;i<n;i++)cin >> v[i]; v = compress(v[i]); int ans = 0; for(int i=n-1;i>=0;i--){ ans += sum(v[i] - 1); add(v[i], 1); } cout << ans << endl; } return 0; }
a.cc: In function 'int main()': a.cc:41:22: error: 'n' was not declared in this scope 41 | while(cin >> n && n){ | ^ a.cc:42:17: error: 'memset' was not declared in this scope 42 | memset(bit, 0, sizeof(bit)); | ^~~~~~ a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include <map> +++ |+#include <cstring> 4 | using namespace std; a.cc:47:32: error: 'i' was not declared in this scope 47 | v = compress(v[i]); | ^
s238525681
p00167
C++
#include <iostream> #include <vector> #include <map> #include <cstring> using namespace std; const int N = 100; int bit[N+10]; int sum(int i){ int s = 0; while(i > 0){ s += bit[i]; i -= i & -i; } return s; } void add(int i, int x){ while(i <= N){ bit[i] += x; i += i & -i; } } vector<int> compress(vector<int> v){ map<int, int> mp; for(int i=0;i<v.size();i++)mp[i] = 0; int id = 1; for(map<int,int>::iterator it=mp.begin(); it != mp.end(); it++){ it->second = id++; } for(int i=0;i<v.size();i++)v[i] = mp[v[i]]; return v; } int main(){ int n; while(cin >> n && n){ memset(bit, 0, sizeof(bit)); vector<int> v(n); for(int i=0;i<n;i++)cin >> v[i]; v = compress(v[i]); int ans = 0; for(int i=n-1;i>=0;i--){ ans += sum(v[i] - 1); add(v[i], 1); } cout << ans << endl; } return 0; }
a.cc: In function 'int main()': a.cc:49:32: error: 'i' was not declared in this scope 49 | v = compress(v[i]); | ^
s015361312
p00167
C++
#include<iostream> #include<algorithm> #include<vector> #include <cassert> using namespace std; int N, A[100]; int W[100]; int merge_and_count(int l,int r){ if (l + 1 >= r)return 0; if (l + 2 == r){ if (A[l] <= A[l + 1])return 0; swap(A[l], A[l + 1]); return 1; } int m = (l + r) / 2; int cl = merge_and_count(l, m); int cr = merge_and_count(m, r); int c = 0; int i = 1, j = m; int k = 1; while (i < m && j < r){ if (A[i] <= A[j])W[k++] = A[i++]; else{ W[k++] = A[j++]; c += floor(m-i)-1; } } while (i < m)W[k++] = A[i++]; while (j < r)W[k++] = A[j++]; assert(k == r); return cl + cr + c; } int main() { cin >> N; for (int n = 0; n < N; n++){ cin >> A[n]; } cout << merge_and_count(0, N) << endl; }
a.cc: In function 'int merge_and_count(int, int)': a.cc:28:30: error: 'floor' was not declared in this scope 28 | c += floor(m-i)-1; | ^~~~~
s234026971
p00168
C
#include <stdio.h> #include <string.h> int main(void){ int n; int temp[31]; int i,j; while (scanf("%d", &n), n){ memset(dp, 0, sizeof(dp)); temp[1] = 1; temp[2] = 2; temp[3] = 4; for (i=4;i<=n;i++){ for (j=1;j<=3;j++){ temp[i]+=temp[i-j]; } } if(temp[n]%3650==0){ printf("%d\n", temp[n] / 3650); } else{ printf("%d\n", (temp[n]/3650)+1); } } return 0; }
main.c: In function 'main': main.c:8:16: error: 'dp' undeclared (first use in this function) 8 | memset(dp, 0, sizeof(dp)); | ^~ main.c:8:16: note: each undeclared identifier is reported only once for each function it appears in
s946218611
p00168
C
#include <stdio.h> #include <string.h> int main(void) { int n; int temp[31]; int i,j; while (scanf("%d", &n), n){ memset(dp, 0, sizeof(dp)); temp[1] = 1; temp[2] = 2; temp[3] = 4; for (i=4;i<=n;i++){ for (j=1;j<=3;j++){ temp[i]+=temp[i-j]; } } if(temp[n]%3650==0){ printf("%d\n", temp[n] / 3650); } else{ printf("%d\n", (temp[n]/3650)+1); } } return 0; }
main.c: In function 'main': main.c:9:16: error: 'dp' undeclared (first use in this function) 9 | memset(dp, 0, sizeof(dp)); | ^~ main.c:9:16: note: each undeclared identifier is reported only once for each function it appears in
s147980425
p00168
C
#include <stdio.h> #include <string.h> int main(void) { int n; int temp[31]; int i,j; while (scanf("%d", &n), n){ memset(dp, 0, sizeof(temp)); temp[1] = 1; temp[2] = 2; temp[3] = 4; for (i=4;i<=n;i++){ for (j=1;j<=3;j++){ temp[i]+=temp[i-j]; } } if(temp[n]%3650==0){ printf("%d\n", temp[n] / 3650); } else{ printf("%d\n", (temp[n]/3650)+1); } } return 0; }
main.c: In function 'main': main.c:9:16: error: 'dp' undeclared (first use in this function) 9 | memset(dp, 0, sizeof(temp)); | ^~ main.c:9:16: note: each undeclared identifier is reported only once for each function it appears in
s554603055
p00168
C
#include <stdio.h> #include <string.h> int main() { int n; int temp[31]; int i,j; while (scanf("%d", &n), n){ memset(dp, 0, sizeof(temp)); temp[1] = 1; temp[2] = 2; temp[3] = 4; for (i=4;i<=n;i++){ for (j=1;j<=3;j++){ temp[i]+=temp[i-j]; } } if(temp[n]%3650==0){ printf("%d\n", temp[n] / 3650); } else{ printf("%d\n", (temp[n]/3650)+1); } } return 0; }
main.c: In function 'main': main.c:9:16: error: 'dp' undeclared (first use in this function) 9 | memset(dp, 0, sizeof(temp)); | ^~ main.c:9:16: note: each undeclared identifier is reported only once for each function it appears in
s658982889
p00168
C
#include <stdio.h> #include <string.h> int main() { int n; int temp[31]; int i,j; while (scanf("%d", &n), n){ memset(dp, 0, sizeof(temp)); temp[1] = 1; temp[2] = 2; temp[3] = 4; for (i=4;i<=n;i++){ for (j=1;j<=3;j++){ temp[i]+=temp[i-j]; } } if(temp[n]%3650==0){ printf("%d\n", temp[n] / 3650); } else{ printf("%d\n", (temp[n]/3650)+1); } } return (0); }
main.c: In function 'main': main.c:9:16: error: 'dp' undeclared (first use in this function) 9 | memset(dp, 0, sizeof(temp)); | ^~ main.c:9:16: note: each undeclared identifier is reported only once for each function it appears in
s291061543
p00168
C
#include<stdio.h> int main(){ long long dp[31]={0,1,2,4}; int i,n; for(i=4;i<=30;i++){ dp[i] = dp[i-1] + dp[i-2] + dp[i-3]; } while(scanf("%d",&n),n){ printf("%d\n",
main.c: In function 'main': main.c:12:3: error: expected expression at end of input 12 | printf("%d\n", | ^~~~~~ main.c:12:3: error: expected declaration or statement at end of input main.c:12:3: error: expected declaration or statement at end of input
s754220578
p00168
C
#include<stdio.h> int main() { int n; int a[31] = {1,1,2}; for(int i=3 ; i <= 30 ; i++ ){ a[i] = a[i-1] + a[i-2] + a[i-3]; } scanf("%d",&n); printf("%d",a[n]/10/365+1); } ~ ~
main.c:12:1: error: expected identifier or '(' before '~' token 12 | ~ | ^
s777141387
p00168
C
void main(){int n,a[64],i;ans[0]=ans[1]=1;ans[2]=2;for(i=3;i<31;i++)a[i]=a[i-1]+a[i-2]+a[i-3];for(;;){scanf("%d",&n);if(n==0)break;printf("%d\n",ans[n]/3650+1);}}
main.c: In function 'main': main.c:1:27: error: 'ans' undeclared (first use in this function) 1 | void main(){int n,a[64],i;ans[0]=ans[1]=1;ans[2]=2;for(i=3;i<31;i++)a[i]=a[i-1]+a[i-2]+a[i-3];for(;;){scanf("%d",&n);if(n==0)break;printf("%d\n",ans[n]/3650+1);}} | ^~~ main.c:1:27: note: each undeclared identifier is reported only once for each function it appears in main.c:1:103: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 1 | void main(){int n,a[64],i;ans[0]=ans[1]=1;ans[2]=2;for(i=3;i<31;i++)a[i]=a[i-1]+a[i-2]+a[i-3];for(;;){scanf("%d",&n);if(n==0)break;printf("%d\n",ans[n]/3650+1);}} | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | void main(){int n,a[64],i;ans[0]=ans[1]=1;ans[2]=2;for(i=3;i<31;i++)a[i]=a[i-1]+a[i-2]+a[i-3];for(;;){scanf("%d",&n);if(n==0)break;printf("%d\n",ans[n]/3650+1);}} main.c:1:103: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 1 | void main(){int n,a[64],i;ans[0]=ans[1]=1;ans[2]=2;for(i=3;i<31;i++)a[i]=a[i-1]+a[i-2]+a[i-3];for(;;){scanf("%d",&n);if(n==0)break;printf("%d\n",ans[n]/3650+1);}} | ^~~~~ main.c:1:103: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:1:132: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 1 | void main(){int n,a[64],i;ans[0]=ans[1]=1;ans[2]=2;for(i=3;i<31;i++)a[i]=a[i-1]+a[i-2]+a[i-3];for(;;){scanf("%d",&n);if(n==0)break;printf("%d\n",ans[n]/3650+1);}} | ^~~~~~ main.c:1:132: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:1:132: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:1:132: note: include '<stdio.h>' or provide a declaration of 'printf'
s496954936
p00168
C
main(){n,a[31]={1,1,2};for(n=3;n<31;)a[n++]=a[n-1]+a[n-2]+a[n-3];for(;scanf("%d",&n),n;)printf("%d\n",a[n]/10/365+1);}
main.c:1:1: error: return type defaults to 'int' [-Wimplicit-int] 1 | main(){n,a[31]={1,1,2};for(n=3;n<31;)a[n++]=a[n-1]+a[n-2]+a[n-3];for(;scanf("%d",&n),n;)printf("%d\n",a[n]/10/365+1);} | ^~~~ main.c: In function 'main': main.c:1:8: error: 'n' undeclared (first use in this function) 1 | main(){n,a[31]={1,1,2};for(n=3;n<31;)a[n++]=a[n-1]+a[n-2]+a[n-3];for(;scanf("%d",&n),n;)printf("%d\n",a[n]/10/365+1);} | ^ main.c:1:8: note: each undeclared identifier is reported only once for each function it appears in main.c:1:10: error: 'a' undeclared (first use in this function) 1 | main(){n,a[31]={1,1,2};for(n=3;n<31;)a[n++]=a[n-1]+a[n-2]+a[n-3];for(;scanf("%d",&n),n;)printf("%d\n",a[n]/10/365+1);} | ^ main.c:1:16: error: expected expression before '{' token 1 | main(){n,a[31]={1,1,2};for(n=3;n<31;)a[n++]=a[n-1]+a[n-2]+a[n-3];for(;scanf("%d",&n),n;)printf("%d\n",a[n]/10/365+1);} | ^ main.c:1:71: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 1 | main(){n,a[31]={1,1,2};for(n=3;n<31;)a[n++]=a[n-1]+a[n-2]+a[n-3];for(;scanf("%d",&n),n;)printf("%d\n",a[n]/10/365+1);} | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | main(){n,a[31]={1,1,2};for(n=3;n<31;)a[n++]=a[n-1]+a[n-2]+a[n-3];for(;scanf("%d",&n),n;)printf("%d\n",a[n]/10/365+1);} main.c:1:71: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 1 | main(){n,a[31]={1,1,2};for(n=3;n<31;)a[n++]=a[n-1]+a[n-2]+a[n-3];for(;scanf("%d",&n),n;)printf("%d\n",a[n]/10/365+1);} | ^~~~~ main.c:1:71: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:1:89: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 1 | main(){n,a[31]={1,1,2};for(n=3;n<31;)a[n++]=a[n-1]+a[n-2]+a[n-3];for(;scanf("%d",&n),n;)printf("%d\n",a[n]/10/365+1);} | ^~~~~~ main.c:1:89: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:1:89: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:1:89: note: include '<stdio.h>' or provide a declaration of 'printf'
s856318220
p00168
C
int main(){int a[31]={4,1,1,2};for(;*a<31;)a[*a++]=a[*a-1]+a[*a-2]+a[*a-3];for(;scanf("%d",a),*a;)printf("%d\n",a[*a]/3650+1);}
main.c: In function 'main': main.c:1:48: error: lvalue required as increment operand 1 | int main(){int a[31]={4,1,1,2};for(;*a<31;)a[*a++]=a[*a-1]+a[*a-2]+a[*a-3];for(;scanf("%d",a),*a;)printf("%d\n",a[*a]/3650+1);} | ^~ main.c:1:81: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 1 | int main(){int a[31]={4,1,1,2};for(;*a<31;)a[*a++]=a[*a-1]+a[*a-2]+a[*a-3];for(;scanf("%d",a),*a;)printf("%d\n",a[*a]/3650+1);} | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | int main(){int a[31]={4,1,1,2};for(;*a<31;)a[*a++]=a[*a-1]+a[*a-2]+a[*a-3];for(;scanf("%d",a),*a;)printf("%d\n",a[*a]/3650+1);} main.c:1:81: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 1 | int main(){int a[31]={4,1,1,2};for(;*a<31;)a[*a++]=a[*a-1]+a[*a-2]+a[*a-3];for(;scanf("%d",a),*a;)printf("%d\n",a[*a]/3650+1);} | ^~~~~ main.c:1:81: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:1:99: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 1 | int main(){int a[31]={4,1,1,2};for(;*a<31;)a[*a++]=a[*a-1]+a[*a-2]+a[*a-3];for(;scanf("%d",a),*a;)printf("%d\n",a[*a]/3650+1);} | ^~~~~~ main.c:1:99: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:1:99: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:1:99: note: include '<stdio.h>' or provide a declaration of 'printf'
s435114312
p00168
C
#include <stdio.h> int main(void) { __int64 ans[31]; int a, i; ans[0] = ans[1] = 1; ans[2] = 2; for (i = 3; i < 31; i++){ ans[i] = ans[i - 1] + ans[i - 2] + ans[i - 3]; } while (1){ scanf("%d", &a); if (!a){ break; } printf("%d\n", ans[a] / 3650 + ((a % 3650 == 0) ? 0 : 1)); } return (0); }
main.c: In function 'main': main.c:5:9: error: unknown type name '__int64'; did you mean '__int64_t'? 5 | __int64 ans[31]; | ^~~~~~~ | __int64_t
s294872703
p00168
C
#include <stdio.h> #include <windows.h> int memo[31]; int getways( int n ); int main( void ) { int n; int year; scanf("%d",&n); year = (getways(n)/10)/365+1; printf("%d\n",year); return 0; } int getways( int n ) { int ways; if( memo[n] != 0 ) { return memo[n]; } if( n <= 1 ) { return 1; } if( n == 2 ) { return 2; } return (memo[n] = getways(n-1) + getways(n-2) + getways(n-3) ); }
main.c:2:10: fatal error: windows.h: No such file or directory 2 | #include <windows.h> | ^~~~~~~~~~~ compilation terminated.
s743209786
p00168
C
main(i,n[99]){for(n[1]=1,n[2]=2,n[3]=4,i=4;i-31;n[i]=n[i-1]+n[i-2]+n[i++-3]);for(;scanf("%d",&i)*i;printf("%d\n",n[i]/3650+(n[i]%3650?1:0)));}
main.c:1:9: error: expected ')' before '[' token 1 | main(i,n[99]){for(n[1]=1,n[2]=2,n[3]=4,i=4;i-31;n[i]=n[i-1]+n[i-2]+n[i++-3]);for(;scanf("%d",&i)*i;printf("%d\n",n[i]/3650+(n[i]%3650?1:0)));} | ^ | )
s743318916
p00168
C++
#include <bits/stdc++.h> using namespace std; #define int long long int dp[50]; int n; void init() { dp[1] = dp[2] = dp[3] = 1; for (int i = 1; i <= 30; i++) { dp[i+1] += dp[i]; dp[i+2] += dp[i]; dp[i+3] += dp[i]; } } signed main() { init(); while (1) { cin >> n; if (n == 0) break; int year = dp[n] / 3650; int day = (dp[n] + 3650 - 1) / 3650 cout << max(1LL, year + (days >= 1)) << endl; } return 0; }
a.cc: In function 'int main()': a.cc:25:5: error: expected ',' or ';' before 'cout' 25 | cout << max(1LL, year + (days >= 1)) << endl; | ^~~~
s161643815
p00168
C++
#include <bits/stdc++.h> using namespace std; const long long INF=1LL << 60; int main() { ios::sync_with_stdio(false); cin.tie(0); vector<int> dan; vector<int> dp(35,0); int N; for(int i=0;i<35;i++){ int tmp; cin>>tmp; if(tmp==0) break; dan.push_back(tmp); } dp[0]=1; for(int i=1;i<31;i++){ dp[i]+=dp[i-1]; if(i>1)dp[i]+=dp[i-2]; if(i>2)dp[i]+=dp[i-3]; } for(int i:dan){ int tmp=dp[i]/3650 if(dp[i]%3650!=0) tmp++; cout << tmp <<endl; } return 0; }
a.cc: In function 'int main()': a.cc:27:9: error: expected ',' or ';' before 'if' 27 | if(dp[i]%3650!=0) tmp++; | ^~
s043782728
p00168
C++
a = [1, 1, 2] for i in range(3, 31): a.append(sum(a[-3:])) while True: n = int(input()) if not n: break print(((a[n] + 9) / 10 + 364) / 365)
a.cc:1:1: error: 'a' does not name a type 1 | a = [1, 1, 2] | ^
s629366764
p00168
C++
#include<iostream> #include<stdio.h> using namespace std; int main(){ int dp[31][31]; int n; while(1){ cin >> n; if(n==0)break; memset(dp, 0, sizeof(dp)); dp[1][1] = 1; dp[1][2] = 1; dp[1][3] = 1; for (int i = 1; i <= 27; i++){ for (int i2 = 1; i2 <= 27; i2++){ dp[i + 1][i2 + 1] += dp[i][i2]; dp[i + 1][i2 + 2] += dp[i][i2]; dp[i + 1][i2 + 3] += dp[i][i2]; } } int sum=0; for (int i = 0; i < 30; i++){ sum += dp[i][n]; } cout << sum / 10/365+1<<endl; } }
a.cc: In function 'int main()': a.cc:10:9: error: 'memset' was not declared in this scope 10 | memset(dp, 0, sizeof(dp)); | ^~~~~~ a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include<iostream> +++ |+#include <cstring> 2 | #include<stdio.h>
s994833837
p00168
C++
#include <iostream> using namespace std; int main() { string s; cin >> s; cout << num(n) <<endl; return 0; } int num(int n){ if(n<0)return 0; return num(n-1)+num(n-2)+num(n-3); }
a.cc: In function 'int main()': a.cc:8:15: error: 'n' was not declared in this scope 8 | cout << num(n) <<endl; | ^ a.cc:8:11: error: 'num' was not declared in this scope; did you mean 'enum'? 8 | cout << num(n) <<endl; | ^~~ | enum
s931286651
p00168
C++
#include <iostream> using namespace std; int main() { string s; cin >> s; cout << num((int)s) <<endl; return 0; } int num(int n){ if(n<0)return 0; return num(n-1)+num(n-2)+num(n-3); }
a.cc: In function 'int main()': a.cc:8:15: error: invalid cast from type 'std::string' {aka 'std::__cxx11::basic_string<char>'} to type 'int' 8 | cout << num((int)s) <<endl; | ^~~~~~ a.cc:8:11: error: 'num' was not declared in this scope; did you mean 'enum'? 8 | cout << num((int)s) <<endl; | ^~~ | enum
s706621279
p00168
C++
#include <iostream> using namespace std; int main() { string s; cin >> s; cout << num(stoi(strPlus)) <<endl; return 0; } int num(int n){ if(n<0)return 0; return num(n-1)+num(n-2)+num(n-3); }
a.cc: In function 'int main()': a.cc:8:20: error: 'strPlus' was not declared in this scope 8 | cout << num(stoi(strPlus)) <<endl; | ^~~~~~~ a.cc:8:11: error: 'num' was not declared in this scope; did you mean 'enum'? 8 | cout << num(stoi(strPlus)) <<endl; | ^~~ | enum
s482469411
p00168
C++
#include <iostream> using namespace std; int main() { string s; cin >> s; cout << num(stoi(s)) <<endl; return 0; } int num(int n){ if(n<0)return 0; return num(n-1)+num(n-2)+num(n-3); }
a.cc: In function 'int main()': a.cc:8:11: error: 'num' was not declared in this scope; did you mean 'enum'? 8 | cout << num(stoi(s)) <<endl; | ^~~ | enum
s923093336
p00168
C++
#include <iostream> using namespace std; int num(int n); int main() { string s; cin >> s; int n = stoi(s) cout << num(n) <<endl; } int num(int n){ if(n<0)return 0; return num(n-1)+num(n-2)+num(n-3); }
a.cc: In function 'int main()': a.cc:11:3: error: expected ',' or ';' before 'cout' 11 | cout << num(n) <<endl; | ^~~~
s693338744
p00168
C++
#include <iostream> using namespace std; int num(int n); int main() { string s; cin >> s; int n = std::stoi; cout << num(n) <<endl; } int num(int n){ if(n<0)return 0; return num(n-1)+num(n-2)+num(n-3); }
a.cc: In function 'int main()': a.cc:10:16: error: cannot resolve overloaded function 'stoi' based on conversion to type 'int' 10 | int n = std::stoi; | ^~~~
s397557349
p00168
C++
#include <iostream> using namespace std; int num(int n); int main() { int n; cout << num(cin>>n) <<endl; } int num(int n){ if(n<0)return 0; return num(n-1)+num(n-2)+num(n-3); }
a.cc: In function 'int main()': a.cc:9:18: error: cannot convert 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'int' 9 | cout << num(cin>>n) <<endl; | ~~~^~~ | | | std::basic_istream<char>::__istream_type {aka std::basic_istream<char>} a.cc:4:13: note: initializing argument 1 of 'int num(int)' 4 | int num(int n); | ~~~~^
s315370264
p00168
C++
#include <iostream> using namespace std; int num(int n); int main(){ int n; cout << num(cin>>n) <<endl; } int num(int n){ if(n<0)return 0; return num(n-1)+num(n-2)+num(n-3); }
a.cc: In function 'int main()': a.cc:8:18: error: cannot convert 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'int' 8 | cout << num(cin>>n) <<endl; | ~~~^~~ | | | std::basic_istream<char>::__istream_type {aka std::basic_istream<char>} a.cc:4:13: note: initializing argument 1 of 'int num(int)' 4 | int num(int n); | ~~~~^
s720815218
p00168
C++
#include <iostream> using namespace std; int num(int n); int main(){ int n; cin>>n; cout << num(n)//3650+1 <<endl; } int num(int n){ if(n<1)return 0; return num(n-1)+num(n-2)+num(n-3); }
a.cc: In function 'int main()': a.cc:9:17: error: expected ';' before '}' token 9 | cout << num(n)//3650+1 <<endl; | ^ | ; 10 | } | ~
s316328237
p00168
C++
#include <iostream> using namespace std; int main(){ int n;cin >> n; cout << num(num(n)/3650+1) <<endl; } int num(int n){ if(n<0)return 0; if(n==0)return 1; return num(n-1)+num(n-2)+num(n-3); }
a.cc: In function 'int main()': a.cc:5:15: error: 'num' was not declared in this scope; did you mean 'enum'? 5 | cout << num(num(n)/3650+1) <<endl; | ^~~ | enum a.cc:5:11: error: 'num' was not declared in this scope; did you mean 'enum'? 5 | cout << num(num(n)/3650+1) <<endl; | ^~~ | enum
s709545978
p00168
C++
#include <iostream> using namespace std; int f(int n){ if(n<0) return 0; if(n==0) return 1; if ( memo[n]!= -1 ) return memo[n]; return f(n-1)+f(n-2)+f(n-3); } int main(){ int n; memo.resize(31,-1); while(1){ cin >> n; if(n==0) break; int num=f(n); cout <<num/10/365+1<< endl; } return 0; }
a.cc: In function 'int f(int)': a.cc:8:10: error: 'memo' was not declared in this scope 8 | if ( memo[n]!= -1 ) | ^~~~ a.cc: In function 'int main()': a.cc:15:5: error: 'memo' was not declared in this scope 15 | memo.resize(31,-1); | ^~~~
s287554903
p00168
C++
#include <iostream> using namespace std; VI memo; int f(int n){ if(n<0) return 0; if(n==0) return 1; if ( memo[n]!= -1 ) return memo[n]; return f(n-1)+f(n-2)+f(n-3); } int main(){ int n; memo.resize(31,-1); while(1){ cin >> n; if(n==0) break; int num=f(n); cout <<num/10/365+1<< endl; } return 0; }
a.cc:3:1: error: 'VI' does not name a type 3 | VI memo; | ^~ a.cc: In function 'int f(int)': a.cc:9:10: error: 'memo' was not declared in this scope 9 | if ( memo[n]!= -1 ) | ^~~~ a.cc: In function 'int main()': a.cc:16:5: error: 'memo' was not declared in this scope 16 | memo.resize(31,-1); | ^~~~
s812918326
p00168
C++
#include <iostream> using namespace std; vector<int> memo; int f(int n){ if(n<0) return 0; if(n==0) return 1; if ( memo[n]!= -1 ) return memo[n]; return f(n-1)+f(n-2)+f(n-3); } int main(){ int n; memo.resize(31,-1); while(1){ cin >> n; if(n==0) break; int num=f(n); cout <<num/10/365+1<< endl; } return 0; }
a.cc:3:1: error: 'vector' does not name a type 3 | vector<int> memo; | ^~~~~~ a.cc: In function 'int f(int)': a.cc:9:10: error: 'memo' was not declared in this scope 9 | if ( memo[n]!= -1 ) | ^~~~ a.cc: In function 'int main()': a.cc:16:5: error: 'memo' was not declared in this scope 16 | memo.resize(31,-1); | ^~~~
s793319472
p00168
C++
#include <iostream> using namespace std; typedef long long LL; typedef unsigned long long ULL; typedef vector<int> VI; typedef vector<VI > VVI; typedef vector<string> VS; typedef vector<LL> VLL; typedef pair<int,int> PII; const int INF = 0x3f3f3f3f; const LL INFL = 0x3f3f3f3f3f3f3f3fLL; const double EPS = 1e-9; const int DX[]={1,0,-1,0},DY[]={0,-1,0,1}; VI memo; int f(int n){ if(n<0) return 0; if(n==0) return 1; if ( memo[n]!= -1 ) return memo[n]; return f(n-1)+f(n-2)+f(n-3); } int main(){ int n; memo.resize(31,-1); while(1){ cin >> n; if(n==0) break; int num=f(n); cout <<num/10/365+1<< endl; } return 0; }
a.cc:6:9: error: 'vector' does not name a type 6 | typedef vector<int> VI; | ^~~~~~ a.cc:7:9: error: 'vector' does not name a type 7 | typedef vector<VI > VVI; | ^~~~~~ a.cc:8:9: error: 'vector' does not name a type 8 | typedef vector<string> VS; | ^~~~~~ a.cc:9:9: error: 'vector' does not name a type 9 | typedef vector<LL> VLL; | ^~~~~~ a.cc:18:1: error: 'VI' does not name a type 18 | VI memo; | ^~ a.cc: In function 'int f(int)': a.cc:24:10: error: 'memo' was not declared in this scope 24 | if ( memo[n]!= -1 ) | ^~~~ a.cc: In function 'int main()': a.cc:31:5: error: 'memo' was not declared in this scope 31 | memo.resize(31,-1); | ^~~~
s986817883
p00168
C++
#include <iostream> #include <cstdio> #include <algorithm> using namespace std; int main() { int p[31]; p[0] = 1; p[1] = 1; p[2] = 2; for (int i = 3; i <= 30; ++i) { p[i] = p[i-1] + p[i-2] + p[i-3]; } while(1){ int y; cin >> n; if(n == 0){ break; } y = p[n] / 10 / 365 + 1; cout << y << endl; } return 0; }
a.cc: In function 'int main()': a.cc:18:24: error: 'n' was not declared in this scope 18 | cin >> n; | ^