submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s145944953
p00239
Java
import java.util.*; public class Program2{ void run(){ Scanner sc = new Scanner(System.in); for(;;){ int n = sc.nextInt(); if(n==0)break; int[] id = new int[n], p = new int[n], q = new int[n], r = new int[n]; for(int i=0;i<n;i++){ id[i] = sc.nextInt(); p[i] = sc.nextInt(); q[i] = sc.nextInt(); r[i] = sc.nextInt(); } List<Integer> l = new ArrayList<Integer>(); int P = sc.nextInt(), Q = sc.nextInt(), R = sc.nextInt(), C = sc.nextInt(); for(int i=0;i<n;i++){ if(p[i]<=P && q[i]<=Q && r[i]<=R && p[i]*4+q[i]*9+r[i]*4<=C)l.add(id[i]); } if(l.isEmpty())System.out.println("NA"); else for(int x:l)System.out.println(x); } } public static void main(String[] args) { new Program2().run(); } }
Main.java:3: error: class Program2 is public, should be declared in a file named Program2.java public class Program2{ ^ 1 error
s097507003
p00239
Java
import java.util.ArrayList; import java.util.List; import java.util.Scanner; //Calorie Counting public class Program2{ void run(){ Scanner sc = new Scanner(System.in); for(;;){ int n = sc.nextInt(); if(n==0)break; int[] id = new int[n], p = new int[n], q = new int[n], r = new int[n]; for(int i=0;i<n;i++){ id[i] = sc.nextInt(); p[i] = sc.nextInt(); q[i] = sc.nextInt(); r[i] = sc.nextInt(); } List<Integer> l = new ArrayList<Integer>(); int P = sc.nextInt(), Q = sc.nextInt(), R = sc.nextInt(), C = sc.nextInt(); for(int i=0;i<n;i++){ if(p[i]<=P && q[i]<=Q && r[i]<=R && p[i]*4+q[i]*9+r[i]*4<=C)l.add(id[i]); } if(l.isEmpty())System.out.println("NA"); else for(int x:l)System.out.println(x); } } public static void main(String[] args) { new Program2().run(); } }
Main.java:6: error: class Program2 is public, should be declared in a file named Program2.java public class Program2{ ^ 1 error
s270860427
p00239
Java
import java.util.Scanner; public class Main_0239{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n,i,P,Q,R,C,han; int[] p = new int[1000]; int[] q = new int[1000]; int[] r = new int[1000]; int[] kei = new int[1000]; int[] hoz = new int[1000]; n = sc.nextInt(); while(n!=0){ for(int j=0; j<n; j++){ i = sc.nextInt(); p[j] = sc.nextInt(); q[j] = sc.nextInt(); r[j] = sc.nextInt(); kei[j] = ((p[j]*4)+(q[j]*9)+(r[j]*4)); hoz[j] = i; } P = sc.nextInt(); Q = sc.nextInt(); R = sc.nextInt(); C = sc.nextInt(); han = 0; for(int j=0; j<n; j++){ if(p[j]>P || q[j]>Q || r[j]>R || kei[j]>C){ }else{ han+=1; System.out.println(hoz[j]); } } if(han==0){ System.out.println("NA"); } n = sc.nextInt(); } } }
Main.java:2: error: class Main_0239 is public, should be declared in a file named Main_0239.java public class Main_0239{ ^ 1 error
s213093269
p00239
C
#include <stdio.h> struct candy { int i, p, q, r; }; int main(void) { int n; while (scanf("%d", &n), n != 0){ candy c[1024]; candy maxi; int sum; int i; for (i = 0; i < n; i++) scanf("%d %d %d %d", &c[i].i, &c[i].p, &c[i].q, &c[i].r); scanf("%d %d %d %d", &maxi.i, &maxi.p, &maxi.q, &maxi.r); for (i = sum = 0; i < n; i++){ if (c[i].i <= maxi.i && c[i].p <= maxi.p && c[i].q <= maxi.q && c[i].r <= maxi.r){ sum++; } } printf("%d\n", sum); } return 0; }
main.c: In function 'main': main.c:10:9: error: unknown type name 'candy'; use 'struct' keyword to refer to the type 10 | candy c[1024]; | ^~~~~ | struct main.c:11:9: error: unknown type name 'candy'; use 'struct' keyword to refer to the type 11 | candy maxi; | ^~~~~ | struct main.c:15:59: error: request for member 'i' in something not a structure or union 15 | for (i = 0; i < n; i++) scanf("%d %d %d %d", &c[i].i, &c[i].p, &c[i].q, &c[i].r); | ^ main.c:15:68: error: request for member 'p' in something not a structure or union 15 | for (i = 0; i < n; i++) scanf("%d %d %d %d", &c[i].i, &c[i].p, &c[i].q, &c[i].r); | ^ main.c:15:77: error: request for member 'q' in something not a structure or union 15 | for (i = 0; i < n; i++) scanf("%d %d %d %d", &c[i].i, &c[i].p, &c[i].q, &c[i].r); | ^ main.c:15:86: error: request for member 'r' in something not a structure or union 15 | for (i = 0; i < n; i++) scanf("%d %d %d %d", &c[i].i, &c[i].p, &c[i].q, &c[i].r); | ^ main.c:16:35: error: request for member 'i' in something not a structure or union 16 | scanf("%d %d %d %d", &maxi.i, &maxi.p, &maxi.q, &maxi.r); | ^ main.c:16:44: error: request for member 'p' in something not a structure or union 16 | scanf("%d %d %d %d", &maxi.i, &maxi.p, &maxi.q, &maxi.r); | ^ main.c:16:53: error: request for member 'q' in something not a structure or union 16 | scanf("%d %d %d %d", &maxi.i, &maxi.p, &maxi.q, &maxi.r); | ^ main.c:16:62: error: request for member 'r' in something not a structure or union 16 | scanf("%d %d %d %d", &maxi.i, &maxi.p, &maxi.q, &maxi.r); | ^ main.c:18:21: error: request for member 'i' in something not a structure or union 18 | if (c[i].i <= maxi.i && c[i].p <= maxi.p && c[i].q <= maxi.q && c[i].r <= maxi.r){ | ^ main.c:18:31: error: request for member 'i' in something not a structure or union 18 | if (c[i].i <= maxi.i && c[i].p <= maxi.p && c[i].q <= maxi.q && c[i].r <= maxi.r){ | ^ main.c:18:41: error: request for member 'p' in something not a structure or union 18 | if (c[i].i <= maxi.i && c[i].p <= maxi.p && c[i].q <= maxi.q && c[i].r <= maxi.r){ | ^ main.c:18:51: error: request for member 'p' in something not a structure or union 18 | if (c[i].i <= maxi.i && c[i].p <= maxi.p && c[i].q <= maxi.q && c[i].r <= maxi.r){ | ^ main.c:18:61: error: request for member 'q' in something not a structure or union 18 | if (c[i].i <= maxi.i && c[i].p <= maxi.p && c[i].q <= maxi.q && c[i].r <= maxi.r){ | ^ main.c:18:71: error: request for member 'q' in something not a structure or union 18 | if (c[i].i <= maxi.i && c[i].p <= maxi.p && c[i].q <= maxi.q && c[i].r <= maxi.r){ | ^ main.c:18:81: error: request for member 'r' in something not a structure or union 18 | if (c[i].i <= maxi.i && c[i].p <= maxi.p && c[i].q <= maxi.q && c[i].r <= maxi.r){ | ^ main.c:18:91: error: request for member 'r' in something not a structure or union 18 | if (c[i].i <= maxi.i && c[i].p <= maxi.p && c[i].q <= maxi.q && c[i].r <= maxi.r){ | ^
s913946352
p00239
C
/* ?????????????????????????????????????¨???? ?????????4 ?????? ???????????¬??\???????§?????????????????£??????????????????????????????£?????§??????????????????????????? ??????????????¬?????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????¢???????????????§?????\???????????????????????????????????????????????????????????? ????????´??????????£???????????????????????????????????????????????????????????´?????????????????????¶??? ???????????´??????????£??????????????????????????£???????????????????????????¨?£????????????????????????? ??????????????????????????¨?????????????????? ?£????????????? 3 ??§???????´???¨?????°?????????????????±????????????????????????????°´?????????????????? ??????????´???????????????????????????????g?????°??????????????????????????±????????¨????°´????????? 4kcal???????????????????????????????????? 9kcal ??¨?¨????????????????????????¨?????°???????????¨??? ????????¨??????????????±??????????????????????????? 7g????????? 14g???????°´?????? 47g ???????????? ?????????????????????????????¨???????????????????????????????¨????????????¨??? 4 ?? 7 + 9 ?? 14 + 4 ?? 47 = 342 kcal ??¨???????????????????????????????§?????¨????????????????????????? ?????? ?????? ????????±??????(g) ??????(g) ????°´??????(g) ????????????(kcal) 1 ??±?????? 7 14 47 342 2 ????????????????????? 5 35 55 555 3 ???????????? 6 3 59 287 4 ????????? 6 5 15 129 ?????????????±???¨???????????????????????° n ??¨????????????????????±?????¶???????????±?????\?????¨?????? ???????????????????????????????????¶???????¶????????????¨?????????????£?????????????????????????????????? ??§???????????????????????°???????????????????????????????????? ?????????????????±???????????????????????? i?????????????????????????????????????????±??????????????? p??? ??????????????? q???????°´??????????????? r ?????????????????£?????????????????¶???????????±????????? ???????????¨?????§???????????§???????????±??????????????? P?????????????????? Q???????°´???????????? ??? R?????????????????????????????¨?????§???????????§???????????????C ???????????£????????????????????? ??????????????????????°´???????????????????????????????????????????????§????¶?????????¨??¶???????????¨??? ??????????£????????????????????????????????????¨????????????????????? ?????????????????° n ??? 1 ??\??? 1000 ??\????????´??°????????????????????? i ??? 1 ??\??? 1000 ??\????????´??°?????????????´?????????? p, q, r ??? 0 ??\??? 100 ??\????????´??°??§???????????? ???????????????????´??????¶?????? P, Q, R ??? 0 ??\??? 100 ??\????????´??°???????????????C ??? 0 ??\??? 1700 ??\????????´??°??¨?????????????£?????????????????????????????????§???????£????????????? ??????????????????????????\??????????????????????????????????????????????£??????????????????????????????? ????????°???NA?????¨??????????????????????????? ????????¨????????? 4 ??????????????????????????????P=10,Q=15,R=50,C=400 ??¨????????¶????????´ ????????±????????¨??????????????????????????????????´????????????????????????¶????????????????????§?£???? ????????????????????????????????????????????????????????????????????????????°´????????¨?????????????????? ????????????????°´?????????????????¶??????????¶????????????????????£????????????????????????????????????? ?????????????????? ??\??? ?????°???????????????????????????????????\?????¨?????????????????????????????\??????????????????????????? ??¨???????????§????????????????????????????????????????????\????????¨????????§?????? 1 ?????? ??????????????° n?????´??°??? 2 ?????? ?¬¬ 1 ????????????????????± i p q r?????´??° ??´??° ??´??° ??´??°???????§??????????????????? 3 ?????? ?¬¬ 2 ????????????????????± ??? n+1 ?????? ?¬¬ n ????????????????????± n+2 ?????? ??????????´????????????????????????¶?????? P Q R C?????´??° ??´??° ??´??° ??´??°???????§??????????????????? ?????? ??\??????????????????????????¨???????£??????????????????????????????????????????????NA???????????????????????? */ #include <stdio.h> #define NUM 1000 // #define P 0 // ????????±??????(g) #define Q 1 // ??????(g) #define R 2 // ????°´??????(g) #define C 3 // ????????????(kcal) int main( void ) { int pp, qq, rr, cc; int t[ NUM ][ 4 ]; int i, j; int n; // ??????????????° n?????´??°??? while ( 1 ) { scanf( "%d", &n ); // ?????????????????° n?????´??°???????????\??? if ( t == 0 ) { break; // ??\?????????????????????????????¨????????? } for ( i = 0 ; i < n ; i++ ) { scanf( "%d %d %d %d ", &pp, &qq, &rr, &cc ); t[ i ][ P ] = pp; t[ i ][ Q ] = qq; t[ i ][ R ] = rr; t[ i ][ C ] = cc; } scanf( "%d %d %d %d ", &pp, &qq, &rr, &cc ); j = 0; // ?£??????????????????????????????° for ( i = 0 ; i < n ; i++ ) { if ( ( pp => t[ i ][ P ] ) && ( qq => t[ i ][ Q ] ) && ( rr => t[ i ][ R ] ) && ( cc => t[ i ][ C ] ) ) { printf( "%d\n", i + 1 ); j++; } } if ( j == 0 ) { printf( "NA\n" ); } } return 0; }
main.c: In function 'main': main.c:104:36: error: expected expression before '>' token 104 | if ( ( pp => t[ i ][ P ] ) && | ^ main.c:105:40: error: expected expression before '>' token 105 | ( qq => t[ i ][ Q ] ) && | ^ main.c:106:40: error: expected expression before '>' token 106 | ( rr => t[ i ][ R ] ) && | ^ main.c:107:40: error: expected expression before '>' token 107 | ( cc => t[ i ][ C ] ) ) { | ^
s464760290
p00239
C
#include <stdio.h> int main(){ int n,j,i; int x[1001][4]; int p,q,r,c; scanf("%d",&n); for(j=0;j<n;j++){ scanf("%d %d %d %d",&i,&x[j+1][1],&x[j+1][2],&x[j+1][3]); x[j+1][0]=x[j+1][1]*4 + x[j+1][2]*9 + [j+1][3]*4; } printf("%d %d %d %d",&p,&q,&r,&c); for(j=0;j<n;j++){ int sum; if(x[j+1][1]<=p && x[j+1][2]<=q && x[j+1][3]<=r && x[j+1][0]<=c){ printf("%d\n",j+1); }else{ sum++; } if(sum==n){ printf("NA"); printf("\n"); } } return 0; }
main.c: In function 'main': main.c:9:39: error: expected expression before '[' token 9 | x[j+1][0]=x[j+1][1]*4 + x[j+1][2]*9 + [j+1][3]*4; | ^
s638793273
p00239
C++
include <iostream> using namespace std; int main(){ int n; while(cin >> n, n){ int id[1001], p[1001], q[1001], r[1001]; int P, Q, R, C; for(int i = 0; i < n; i++) cin >> id[i] >> p[i] >> q[i] >> r[i]; cin >> P >> Q >> R >> C; bool judge = true; for(int i = 0; i < n; i++){ if(p[i] <= P && q[i] <= Q && r[i] <= R && p[i]*4 + q[i]*9 + r[i]*4 <= C){ cout << id[i] << endl; judge = false; } } if(judge) cout << "NA" << endl; } }
a.cc:1:1: error: 'include' does not name a type 1 | include <iostream> | ^~~~~~~ a.cc: In function 'int main()': a.cc:7:9: error: 'cin' was not declared in this scope 7 | while(cin >> n, n){ | ^~~ a.cc:16:9: error: 'cout' was not declared in this scope 16 | cout << id[i] << endl; | ^~~~ a.cc:16:26: error: 'endl' was not declared in this scope 16 | cout << id[i] << endl; | ^~~~ a.cc:20:15: error: 'cout' was not declared in this scope 20 | if(judge) cout << "NA" << endl; | ^~~~ a.cc:20:31: error: 'endl' was not declared in this scope 20 | if(judge) cout << "NA" << endl; | ^~~~
s097013365
p00239
C++
include <iostream> using namespace std; int main() { for (;;) { int n; cin >> n; if (n == 0) return 0; int p[n], q[n], r[n], c[n]; for (int x = 0; x < n; x++) { int _; cin >> _ >> p[x] >> q[x] >> r[x]; c[x] = p[x] * 4 + q[x] * 9 + r[x] * 4; } int P, Q, R, C; cin >> P >> Q >> R >> C; bool output; for (int x = 0; x < n; x++) { if (p[x] <= P && q[x] <= Q && r[x] <= R && c[x] <= C) { cout << x + 1 << endl; output = true; } } if (!output) cout << "NA" << 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:17: error: 'cin' was not declared in this scope 8 | cin >> n; | ^~~ a.cc:26:33: error: 'cout' was not declared in this scope 26 | cout << x + 1 << endl; | ^~~~ a.cc:26:50: error: 'endl' was not declared in this scope 26 | cout << x + 1 << endl; | ^~~~ a.cc:32:25: error: 'cout' was not declared in this scope 32 | cout << "NA" << endl; | ^~~~ a.cc:32:41: error: 'endl' was not declared in this scope 32 | cout << "NA" << endl; | ^~~~
s341155120
p00239
C++
#include<iostream> using namespace std; int main(){ int x[1000],n,i,p[100],q[100],r[100],c[1700],P,Q,R,C,w; while(cin>>n){ if(n==0){ // nに0個になると停止 return 0; } for(i=0;i<n;i++){ //n個の箱を用意する cin>>x[i]>>p[i]>>q[i]>>r[i]; //お菓子の情報入力 c[i]=p[i]*4+q[i]*9+r[i]*4; } cin>>P>>Q>>R>>C; P*=4; Q*=9; R*=4; C=P+Q+R; for(i=0;i<n;i++){ if(P>=p[i]*4&&Q>=q[i]*9&&R>=r[i]*4&&C>=c[i]){ cout<<x[i]<<endl; } } if(x[i]==3){ cout<<"NA"<<endl; } } } return 0; }
a.cc:33:6: error: expected unqualified-id before 'return' 33 | return 0; | ^~~~~~ a.cc:34:1: error: expected declaration before '}' token 34 | } | ^
s747552875
p00239
C++
#include<stdio.h> int main(void) { int a,s[10001],d[10001],f[10001],g[10001]; int h,j,k,z,i,flg; scanf("%d",&a); while(a!=0){ flg=0; for(i=1;i<=a;i++){ scanf("%d %d %d %d",&s[i],&d[i],&f[i],&g[i]); } scanf("%d %d %d %d",&h,&j,&k,&z); for(i=1;i<=a;i++){ if(h>d[i]&&j>f[i]&&k>g[i]&&z>d[i]+f[i]+g[i]){ printf("%d\n",s[i]); flg=1; } } else if(flg==0){ printf("NA\n"); } scanf("%d",&a); } return 0; }
a.cc: In function 'int main()': a.cc:19:17: error: 'else' without a previous 'if' 19 | else if(flg==0){ | ^~~~
s639350581
p00239
C++
#include<iostream> #include<math.h> #include<algorithm> #include<string> using namespace std; int n,P,Q,R,C,flag; struct DATA{ int name,p,f,c,cal,sum,flag; } DATA data[1001]; int main(){ while(1){ flag=0; for(int i=0;i<n;i++){data[i].flag=0;} cin>>n; if(n==0){break;} for(int i=0;i<n;i++){ cin>>data[i].name>>data[i].p>>data[i].f>>data[i].c; data[i].cal=data[i].p*4+data[i].f*9+data[i].c*4; } cin>>P>>Q>>R>>C; for(int i=0;i<n;i++){ if(data[i].p<=P && data[i].f<=Q && data[i].c<=R && data[i].cal<=C){ data[i].flag=1; } } for(int i=0;i<n;i++){ if(data[i].flag==1){ cout<<data[i].name<<endl; flag++; } } if(flag==0){cout<<"NA"<<endl;} } return 0; }
a.cc:11:6: error: expected initializer before 'data' 11 | DATA data[1001]; | ^~~~ a.cc: In function 'int main()': a.cc:16:42: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 16 | for(int i=0;i<n;i++){data[i].flag=0;} | ^ a.cc:20:34: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 20 | cin>>data[i].name>>data[i].p>>data[i].f>>data[i].c; | ^ a.cc:20:48: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 20 | cin>>data[i].name>>data[i].p>>data[i].f>>data[i].c; | ^ a.cc:20:59: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 20 | cin>>data[i].name>>data[i].p>>data[i].f>>data[i].c; | ^ a.cc:20:70: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 20 | cin>>data[i].name>>data[i].p>>data[i].f>>data[i].c; | ^ a.cc:21:29: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 21 | data[i].cal=data[i].p*4+data[i].f*9+data[i].c*4; | ^ a.cc:21:41: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 21 | data[i].cal=data[i].p*4+data[i].f*9+data[i].c*4; | ^ a.cc:21:53: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 21 | data[i].cal=data[i].p*4+data[i].f*9+data[i].c*4; | ^ a.cc:21:65: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 21 | data[i].cal=data[i].p*4+data[i].f*9+data[i].c*4; | ^ a.cc:25:32: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 25 | if(data[i].p<=P && data[i].f<=Q && data[i].c<=R && data[i].cal<=C){ | ^ a.cc:25:48: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 25 | if(data[i].p<=P && data[i].f<=Q && data[i].c<=R && data[i].cal<=C){ | ^ a.cc:25:64: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 25 | if(data[i].p<=P && data[i].f<=Q && data[i].c<=R && data[i].cal<=C){ | ^ a.cc:25:80: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 25 | if(data[i].p<=P && data[i].f<=Q && data[i].c<=R && data[i].cal<=C){ | ^ a.cc:26:37: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 26 | data[i].flag=1; | ^ a.cc:30:32: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 30 | if(data[i].flag==1){ | ^ a.cc:31:43: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 31 | cout<<data[i].name<<endl; | ^
s154612919
p00239
C++
#include<stdio.h> int main(void) { int n,j,i[1000],p[100],q[100],r[100],p2,q2,r2,c,flg,x[1000]; while(1){ cnt=0; flg=0; scanf("%d",&n); if(n==0)break; for(j=0;j<n;j++){ scanf("%d %d %d %d",&i[j],&p[j],&q[j],&r[j]); } scanf("%d %d %d %d",&p2,&q2,&r2,&c); for(j=0;j<n;j++){ if(p[j]<=p2&&q[j]<=q2&&r[j]<=r2&&p[j]*4+q[j]+r[j]*4<=c){ x[cnt]=i[j]; cnt++; flg=1; break; } } if(flg==1){ for(j=0;j<cnt;j++){ printf("%d\n",x[j]); } } else{ printf("NA\n"); } } return 0; }
a.cc: In function 'int main()': a.cc:6:17: error: 'cnt' was not declared in this scope; did you mean 'int'? 6 | cnt=0; | ^~~ | int
s791060901
p00239
C++
#include<stdio.h> int main(void) { int n,i,a[1000],s[1000],d[1000],f[10000],g,h,j,k,w[1000],flg; while(1){ scanf("%d",&n); if(n==0) break; for(i=0;i<n;i++){ scanf("%d %d %d %d",&a[i],&s[i],&d[i],&f[i]); w[i]=4*s[i]+9*d[i]+4*f[i]; } scanf("%d %d %d %d",&g,&h,&j,&k); flg=0; for(i=0;i<n;i++){ if(g=>s[i]&&h=>d[i]&&j=>f[i]&&k=>w[i]){ printf("%d\n",a[i]); flg=1; } } if(flg=0){ printf("NA\n"); } } return 0; }
a.cc: In function 'int main()': a.cc:15:14: error: expected primary-expression before '>' token 15 | if(g=>s[i]&&h=>d[i]&&j=>f[i]&&k=>w[i]){ | ^ a.cc:15:23: error: expected primary-expression before '>' token 15 | if(g=>s[i]&&h=>d[i]&&j=>f[i]&&k=>w[i]){ | ^ a.cc:15:32: error: expected primary-expression before '>' token 15 | if(g=>s[i]&&h=>d[i]&&j=>f[i]&&k=>w[i]){ | ^ a.cc:15:41: error: expected primary-expression before '>' token 15 | if(g=>s[i]&&h=>d[i]&&j=>f[i]&&k=>w[i]){ | ^
s119599043
p00239
C++
#include<stdio.h> int main(void) { int n,i,a[1000],s[1000],d[1000],f[10000],g,h,j,k,w[1000],flg; while(1){ scanf("%d",&n); if(n==0) break; for(i=0;i<n;i++){ scanf("%d %d %d %d",&a[i],&s[i],&d[i],&f[i]); w[i]=4*s[i]+9*d[i]+4*f[i]; } scanf("%d %d %d %d",&g,&h,&j,&k); flg=0; for(i=0;i<n;i++){ if(g=>s[i]&&h=>d[i]&&j=>f[i]&&k=>w[i]){ printf("%d\n",a[i]); flg=1; } } if(flg==0){ printf("NA\n"); } } return 0; }
a.cc: In function 'int main()': a.cc:15:14: error: expected primary-expression before '>' token 15 | if(g=>s[i]&&h=>d[i]&&j=>f[i]&&k=>w[i]){ | ^ a.cc:15:23: error: expected primary-expression before '>' token 15 | if(g=>s[i]&&h=>d[i]&&j=>f[i]&&k=>w[i]){ | ^ a.cc:15:32: error: expected primary-expression before '>' token 15 | if(g=>s[i]&&h=>d[i]&&j=>f[i]&&k=>w[i]){ | ^ a.cc:15:41: error: expected primary-expression before '>' token 15 | if(g=>s[i]&&h=>d[i]&&j=>f[i]&&k=>w[i]){ | ^
s051228687
p00239
C++
#include<stdio.h> int main(main) { int n,a,i[1010]; int p[1010],q[1010],r[1010],c[1010]; int pc[1010],qc[1010],rc[1010],cc[1010]; int f; while (scanf("%d",&n),n!=0){ for (a=0;a<n;a++){ scanf("%d %d %d %d",&i[a],&p[a],&q[a],&r[a]); c[a]=4*p[a]+9*q[a]+4*r[a]; } scanf("%d %d %d %d",&pc,&qc,&rc,&cc); f=0; for (a=0;a<n;a++){ if (pc[a]>=p[a]&&qc[a]>=q[a]&&rc[a]>=r[a]&&cc[a]>=c[a]){ printf("%d\n",i[a]); f=1; } } if (f==0){ printf("NA\n"); } } return 0; }
a.cc:2:5: error: cannot declare '::main' to be a global variable 2 | int main(main) | ^~~~ a.cc:3:1: error: expected ',' or ';' before '{' token 3 | { | ^
s447162283
p00239
C++
#include<stdio.h> int main(main) { int n,a,i[1010]; int p[1010],q[1010],r[1010],c[1010]; int pc,qc,rc,cc; int f; while (scanf("%d",&n),n!=0){ for (a=0;a<n;a++){ scanf("%d %d %d %d",&i[a],&p[a],&q[a],&r[a]); c[a]=4*p[a]+9*q[a]+4*r[a]; } scanf("%d %d %d %d",&pc,&qc,&rc,&cc); f=0; for (a=0;a<n;a++){ if (pc[a]>=p[a]&&qc[a]>=q[a]&&rc[a]>=r[a]&&cc[a]>=c[a]){ printf("%d\n",i[a]); f=1; } } if (f==0){ printf("NA\n"); } } return 0; }
a.cc:2:5: error: cannot declare '::main' to be a global variable 2 | int main(main) | ^~~~ a.cc:3:1: error: expected ',' or ';' before '{' token 3 | { | ^
s350332866
p00239
C++
#include<stdio.h> int main(void) { int n,a,i[1010]; int p[1010],q[1010],r[1010],c[1010]; int pc,qc,rc,cc; int f; while (scanf("%d",&n),n!=0){ for (a=0;a<n;a++){ scanf("%d %d %d %d",&i[a],&p[a],&q[a],&r[a]); c[a]=4*p[a]+9*q[a]+4*r[a]; } scanf("%d %d %d %d",&pc,&qc,&rc,&cc); f=0; for (a=0;a<n;a++){ if (pc[a]>=p[a]&&qc[a]>=q[a]&&rc[a]>=r[a]&&cc[a]>=c[a]){ printf("%d\n",i[a]); f=1; } } if (f==0){ printf("NA\n"); } } return 0; }
a.cc: In function 'int main()': a.cc:16:27: error: invalid types 'int[int]' for array subscript 16 | if (pc[a]>=p[a]&&qc[a]>=q[a]&&rc[a]>=r[a]&&cc[a]>=c[a]){ | ^ a.cc:16:40: error: invalid types 'int[int]' for array subscript 16 | if (pc[a]>=p[a]&&qc[a]>=q[a]&&rc[a]>=r[a]&&cc[a]>=c[a]){ | ^ a.cc:16:53: error: invalid types 'int[int]' for array subscript 16 | if (pc[a]>=p[a]&&qc[a]>=q[a]&&rc[a]>=r[a]&&cc[a]>=c[a]){ | ^ a.cc:16:66: error: invalid types 'int[int]' for array subscript 16 | if (pc[a]>=p[a]&&qc[a]>=q[a]&&rc[a]>=r[a]&&cc[a]>=c[a]){ | ^
s338565660
p00239
C++
#include <stdio.h> #include<iostream> using namespace std; int main() { int pp = 4, qq = 9, rr = 4; while (1) { int n, P, Q, R, C, cou = 0; int okasi[1000][4]; bool b; scanf_s("%d", &n); if (n == 0) break; for (int i = 0; i<n; ++i) { scanf_s("%d %d %d %d", &okasi[i][0], &okasi[i][1], &okasi[i][2], &okasi[i][3]); } scanf_s("%d %d %d %d", &P, &Q, &R, &C); cou = 0; for (int i = 0; i<n; ++i) { b = true; if (okasi[i][1] > P) b = false; if (okasi[i][2] > Q) b = false; if (okasi[i][3] > R) b = false; if (okasi[i][1] * pp + okasi[i][2] * qq + okasi[i][3] * rr > C) b = false; if (b == true) { printf("%d\n", okasi[i][0]); ++cou; } } if (cou == 0) printf("NA\n"); } }
a.cc: In function 'int main()': a.cc:11:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 11 | scanf_s("%d", &n); | ^~~~~~~ | scanf
s055526512
p00239
C++
4 1 7 14 47 2 5 35 55 3 6 3 59 4 6 5 15 10 15 50 400 2 1 8 10 78 2 4 18 33 10 10 50 300 0
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 4 | ^
s282162805
p00239
C++
#include <iostream> #include <vector> #define calc(a, b, c) (4*a+8*b+4*c) using namespace std; class St { public: int id, p, q, r; St() {} St(int _id, int _p, int _q, int _r): id(_id), p(_p), q(_q), r(_r) {} void print(){ cout << id << endl; } bool check(int s, int t, int u, int v){ if(s < p || t < q || u < r) return false; if(calc(p, q, r) > v) return false; return true; } } int main() { int n, s, t, u, v; vector<St> vec; bool f; while(cin >> n && n){ for(int i = 0; i < n; ++i){ cin >> s >> t >> u >> v; vec.push_back(St(s, t, u, v)); } f = true; cin >> s >> t >> u >> v; for(int i = 0; i < n; ++i) if(vec[i].check(s, t, u, v)){ f = false; vec[i].print(); } if(f) cout << "NA" << endl; vec.clear(); } return 0; }
a.cc:24:2: error: expected ';' after class definition 24 | } | ^ | ;
s757744449
p00239
C++
#include <iostream> #include <vector> #define calc(a, b, c) (4*a+8*b+4*c) using namespace std; class St { public: int id, p, q, r; St() {} St(int _id, int _p, int _q, int _r): id(_id), p(_p), q(_q), r(_r) {} void print(){ cout << id << endl; } bool check(int s, int t, int u, int v){ if(s <= p || t <= q || u <= r) return false; if(calc(p, q, r) => v) return false; return true; } }; int main() { int n, s, t, u, v; vector<St> vec; bool f; while(cin >> n && n){ for(int i = 0; i < n; ++i){ cin >> s >> t >> u >> v; vec.push_back(St(s, t, u, v)); } f = true; cin >> s >> t >> u >> v; for(int i = 0; i < n; ++i) if(vec[i].check(s, t, u, v)){ f = false; vec[i].print(); } if(f) cout << "NA" << endl; vec.clear(); } return 0; }
a.cc: In member function 'bool St::check(int, int, int, int)': a.cc:21:23: error: expected primary-expression before '>' token 21 | if(calc(p, q, r) => v) return false; | ^
s376395896
p00239
C++
#include<iostream> using namespace std; struct cal{ int i; int p; int q; int r; int c; }; int main() { int n, P, Q, R, C; struct cal *ans; bool flg; while(cin >> n && n!=0){ ans = new struct cal[n]; for(int i=0; i<n; i++){ cin >> ans[i].i >> ans[i].p >> ans[i].q >> ans[i].r; ans[i].c = ans[i].p*4 + ans[i].q*9 + ans[i].r*4; } cin >> P >> Q >> R >> C; for(int i=0; i<n; i++){ if(ans[i].p < P && ans[i].q < Q && ans[i].r < R && ans[i].c < C){ cout << ans[i].i << endl; } else{ flg = false; continue; } flg = true; } else if(!flg){ cout << "NA" << endl; } } return 0; }
a.cc: In function 'int main()': a.cc:37:17: error: 'else' without a previous 'if' 37 | else if(!flg){ | ^~~~
s263436911
p00239
C++
#include <stdio.h> int main(){ int n,j; int x[1001][4]; int p,q,r,c; scanf("%d",&n); for(j=0;j<n;j++){ scanf("%d %d %d %d",&i,&x[j+1][1],&x[j+1][2],&x[j+1][3],&x[j+1][0); } printf("%d %d %d %d",&p,&q,&r,&c); for(j=0;j<n;j++){ if(x[j+1][1]<=p && x[j+1][2]<=q && x[j+1][3]<=r && x[j+1][0]<=c){ printf("%d\n",j+1); } } return 0; }
a.cc: In function 'int main()': a.cc:8:28: error: 'i' was not declared in this scope 8 | scanf("%d %d %d %d",&i,&x[j+1][1],&x[j+1][2],&x[j+1][3],&x[j+1][0); | ^ a.cc:8:72: error: expected ']' before ')' token 8 | scanf("%d %d %d %d",&i,&x[j+1][1],&x[j+1][2],&x[j+1][3],&x[j+1][0); | ^ | ]
s236461226
p00239
C++
#include <stdio.h> int main(){ int n,j; int x[1001][4]; int p,q,r,c; scanf("%d",&n); for(j=0;j<n;j++){ scanf("%d %d %d %d",&i,&x[j+1][1],&x[j+1][2],&x[j+1][3],&x[j+1][0]); } printf("%d %d %d %d",&p,&q,&r,&c); for(j=0;j<n;j++){ if(x[j+1][1]<=p && x[j+1][2]<=q && x[j+1][3]<=r && x[j+1][0]<=c){ printf("%d\n",j+1); } } return 0; }
a.cc: In function 'int main()': a.cc:8:28: error: 'i' was not declared in this scope 8 | scanf("%d %d %d %d",&i,&x[j+1][1],&x[j+1][2],&x[j+1][3],&x[j+1][0]); | ^
s020480577
p00239
C++
#include <stdio.h> int main(){ int n,j,i; int x[1001][4]; int p,q,r,c; scanf("%d",&n); for(j=0;j<n;j++){ scanf("%d %d %d %d",&i,&x[j+1][1],&x[j+1][2],&x[j+1][3],&x[j+1][0]); } printf("%d %d %d %d",&p,&q,&r,&c); for(j=0;j<n;j++){ int sum; if(x[j+1][1]<=p && x[j+1][2]<=q && x[j+1][3]<=r && x[j+1][0]<=c){ printf("%d\n",j+1); }else{ sum++; } if(sum==n){ printf("NA\n"); } return 0; }
a.cc: In function 'int main()': a.cc:22:2: error: expected '}' at end of input 22 | } | ^ a.cc:2:13: note: to match this '{' 2 | int main(){ | ^
s716573007
p00239
C++
#include <stdio.h> int main(){ int n,j,i; int x[1001][4]; int p,q,r,c; scanf("%d",&n); for(j=0;j<n;j++){ scanf("%d %d %d %d",&i,&x[j+1][1],&x[j+1][2],&x[j+1][3],&x[j+1][0]); } printf("%d %d %d %d",&p,&q,&r,&c); for(j=0;j<n;j++){ int sum; if(x[j+1][1]<=p && x[j+1][2]<=q && x[j+1][3]<=r && x[j+1][0]<=c){ printf("%d\n",j+1); }else{ sum++; } if(sum==n){ printf("NA"); printf("\n"); } return 0; }
a.cc: In function 'int main()': a.cc:23:2: error: expected '}' at end of input 23 | } | ^ a.cc:2:13: note: to match this '{' 2 | int main(){ | ^
s294415880
p00239
C++
#include <stdio.h> int main(){ int n,j,i; int x[1001][4]; int p,q,r,c; scanf("%d",&n); for(j=0;j<n;j++){ scanf("%d %d %d %d",&i,&x[j+1][1],&x[j+1][2],&x[j+1][3]); x[j+1][0]=4*x[j+1][1]+9*x[j+1][2]+4*[j+1][3]; } printf("%d %d %d %d",&p,&q,&r,&c); for(j=0;j<n;j++){ int sum; if(x[j+1][1]<=p && x[j+1][2]<=q && x[j+1][3]<=r && x[j+1][0]<=c){ printf("%d\n",j+1); }else{ sum++; } if(sum==n){ printf("NA"); printf("\n"); } } return 0; }
a.cc: In function 'int main()': a.cc:9:39: error: expected ',' before '+' token 9 | x[j+1][0]=4*x[j+1][1]+9*x[j+1][2]+4*[j+1][3]; | ^ | , a.cc:9:39: error: expected identifier before '+' token a.cc: In lambda function: a.cc:9:42: error: expected '{' before '[' token 9 | x[j+1][0]=4*x[j+1][1]+9*x[j+1][2]+4*[j+1][3]; | ^ a.cc: In function 'int main()': a.cc:9:42: error: no match for 'operator[]' (operand types are 'main()::<lambda()>' and 'int')
s103909430
p00239
C++
#include <stdio.h> int main(){ int n,j,i; int x[1001][4]; int p,q,r,c; scanf("%d",&n); for(j=0;j<n;j++){ scanf("%d %d %d %d",&i,&x[j+1][1],&x[j+1][2],&x[j+1][3]); x[j+1][0]=x[j+1][1]*4+x[j+1][2]*9+[j+1][3]*4; } printf("%d %d %d %d",&p,&q,&r,&c); for(j=0;j<n;j++){ int sum; if(x[j+1][1]<=p && x[j+1][2]<=q && x[j+1][3]<=r && x[j+1][0]<=c){ printf("%d\n",j+1); }else{ sum++; } if(sum==n){ printf("NA"); printf("\n"); } } return 0; }
a.cc: In function 'int main()': a.cc:9:37: error: expected ',' before '+' token 9 | x[j+1][0]=x[j+1][1]*4+x[j+1][2]*9+[j+1][3]*4; | ^ | , a.cc:9:37: error: expected identifier before '+' token a.cc: In lambda function: a.cc:9:40: error: expected '{' before '[' token 9 | x[j+1][0]=x[j+1][1]*4+x[j+1][2]*9+[j+1][3]*4; | ^ a.cc: In function 'int main()': a.cc:9:40: error: no match for 'operator[]' (operand types are 'main()::<lambda()>' and 'int')
s501631597
p00239
C++
#include <stdio.h> int main(){ while(1){ int n; int j,i; int p,q,r,c; int x[1001][4]; int sum=0; scanf("%d",&n); if(n==0){ goto a; } for(j=0;j<n;j++){ scanf("%d %d %d %d",&i,&x[j+1][1],&x[j+1][2],&x[j+1][3]); x[i][0]=x[i][1]*4+x[i][2]*9+x[i][3]*4; } scanf("%d %d %d %d",&p,&q,&r,&c); for(j=0;j<n;j++){ if(x[j+1][1]<=p && x[j+1][2]<=q && x[j+1][3]<=r && x[j+1][0]<=c){ printf("%d\n",j+1); }else{ sum++; } } if(sum==n){ printf("NA\n"); } sum=0; } a: return 0; }
a.cc:1:22: warning: extra tokens at end of #include directive 1 | #include <stdio.h> int main(){ while(1){ int n; int j,i; int p,q,r,c; int x[1001][4]; int sum=0; scanf("%d",&n); if(n==0){ goto a; } for(j=0;j<n;j++){ scanf("%d %d %d %d",&i,&x[j+1][1],&x[j+1][2],&x[j+1][3]); x[i][0]=x[i][1]*4+x[i][2]*9+x[i][3]*4; } scanf("%d %d %d %d",&p,&q,&r,&c); for(j=0;j<n;j++){ if(x[j+1][1]<=p && x[j+1][2]<=q && x[j+1][3]<=r && x[j+1][0]<=c){ printf("%d\n",j+1); }else{ sum++; } } if(sum==n){ printf("NA\n"); } sum=0; } a: return 0; } | ^~~ /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s590408250
p00239
C++
#include<stdio.h> int main() { int n,i,P,Q,R,C,x,y=0; int a[1000][5]={0}; while(scanf("%d",&n) && n!=0){ for(x=0; x<n; x++){ scanf("%d %d %d %d",&i,&p,&q,&r); a[x][1]=p; a[x][2]=q; a[x][3]=r; a[x][4]=a[x][1]*4+a[x][2]*9+a[x][3]*4; } scanf("%d %d %d %d",&P,&Q,&R,&C); for(x=0; x<n; x++){ if(a[x][1]<=P && a[x][2]<=Q && a[x][3]<=R && a[x][4]<=C){y=1; printf("%d\n",a[x][0]); } } if(y==0) printf("NA\n"); y=0; } return 0; }
a.cc: In function 'int main()': a.cc:7:37: error: 'p' was not declared in this scope 7 | scanf("%d %d %d %d",&i,&p,&q,&r); | ^ a.cc:7:40: error: 'q' was not declared in this scope 7 | scanf("%d %d %d %d",&i,&p,&q,&r); | ^ a.cc:7:43: error: 'r' was not declared in this scope 7 | scanf("%d %d %d %d",&i,&p,&q,&r); | ^
s445162186
p00239
C++
#include<cstdio> using namespace std; int main(){ int n; while(scanf("%d",&n),n){ int a[1024],b[1024],c[1024],d[1024],cal[1024]; for(int i = 0;i < n; i++){ scanf("%d%d%d%d",&a[i],&b[i],&c[i],&d[i]); cal[i] = (4*b[i]) + (7*c[i]) + (4*d[i]); } int P,Q,R,C; scanf("%d%d%d%d",&P,&Q,&R,&C); bool f = false; for(int i = 0;i < n; i++){ if(b[i] <= P&&c[i] <= Q&&d[i] <= R&&cal[i] <= C){ printf("%d\n",a[i]); f = true; } } if(f == false)printf("NA\n"); } return 0; } #include<cstdio> using namespace std; int main(){ int n; while(scanf("%d",&n),n){ int a[1024],b[1024],c[1024],d[1024],cal[1024]; for(int i = 0;i < n; i++){ scanf("%d%d%d%d",&a[i],&b[i],&c[i],&d[i]); cal[i] = (4*b[i]) + (7*c[i]) + (4*d[i]); } int P,Q,R,C; scanf("%d%d%d%d",&P,&Q,&R,&C); bool f = false; for(int i = 0;i < n; i++){ if(b[i] <= P&&c[i] <= Q&&d[i] <= R&&cal[i] <= C){ printf("%d\n",a[i]); f = true; } } if(f == false)printf("NA\n"); } return 0; } #include<cstdio> using namespace std; int main(){ int n; while(scanf("%d",&n),n){ int a[1024],b[1024],c[1024],d[1024],cal[1024]; for(int i = 0;i < n; i++){ scanf("%d%d%d%d",&a[i],&b[i],&c[i],&d[i]); cal[i] = (4*b[i]) + (7*c[i]) + (4*d[i]); } int P,Q,R,C; scanf("%d%d%d%d",&P,&Q,&R,&C); bool f = false; for(int i = 0;i < n; i++){ if(b[i] <= P&&c[i] <= Q&&d[i] <= R&&cal[i] <= C){ printf("%d\n",a[i]); f = true; } } if(f == false)printf("NA\n"); } return 0; } #include<cstdio> using namespace std; int main(){ int n; while(scanf("%d",&n),n){ int a[1024],b[1024],c[1024],d[1024],cal[1024]; for(int i = 0;i < n; i++){ scanf("%d%d%d%d",&a[i],&b[i],&c[i],&d[i]); cal[i] = (4*b[i]) + (7*c[i]) + (4*d[i]); } int P,Q,R,C; scanf("%d%d%d%d",&P,&Q,&R,&C); bool f = false; for(int i = 0;i < n; i++){ if(b[i] <= P&&c[i] <= Q&&d[i] <= R&&cal[i] <= C){ printf("%d\n",a[i]); f = true; } } if(f == false)printf("NA\n"); } return 0; }
a.cc:28:5: error: redefinition of 'int main()' 28 | int main(){ | ^~~~ a.cc:3:5: note: 'int main()' previously defined here 3 | int main(){ | ^~~~ a.cc:53:5: error: redefinition of 'int main()' 53 | int main(){ | ^~~~ a.cc:3:5: note: 'int main()' previously defined here 3 | int main(){ | ^~~~ a.cc:78:5: error: redefinition of 'int main()' 78 | int main(){ | ^~~~ a.cc:3:5: note: 'int main()' previously defined here 3 | int main(){ | ^~~~
s970110430
p00239
C++
#include <iostream> #include <vector> using namespace std; int n; class State { public: int i, p, q, r, c; State(int i, int p, int q, int r):i(i),p(p),q(q),r(r){} }; vector<State> states; int main() { while (cin >> n && n) { states.resize(n); for (int j = 0; j < n; j++) { int i, p, q, r; cin >> states[j].i >> states[j].p >> states[j].q >> states[j].r; states[j].c = states[j].p * 4 + states[j].q * 4 + states[j].r * 9; } int mp, mq, mr, mc; cin >> mp >> mq >> mr >>mc; bool flag = true; for (int j = 0; j < n; j++) { if(states[j].p <= mp && states[j].q <= mq &&states[j].r <= mr && states[j].c <= mc) { flag = false; cout << states[j].i; } } if(flag) cout << "NA" << endl; } return 0; }
In file included from /usr/include/c++/14/bits/alloc_traits.h:33, from /usr/include/c++/14/ext/alloc_traits.h:34, from /usr/include/c++/14/bits/basic_string.h:39, from /usr/include/c++/14/string:54, 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_construct.h: In instantiation of 'void std::_Construct(_Tp*, _Args&& ...) [with _Tp = State; _Args = {}]': /usr/include/c++/14/bits/stl_uninitialized.h:643:18: required from 'static _ForwardIterator std::__uninitialized_default_n_1<_TrivialValueType>::__uninit_default_n(_ForwardIterator, _Size) [with _ForwardIterator = State*; _Size = long unsigned int; bool _TrivialValueType = false]' 643 | std::_Construct(std::__addressof(*__cur)); | ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_uninitialized.h:712:20: required from '_ForwardIterator std::__uninitialized_default_n(_ForwardIterator, _Size) [with _ForwardIterator = State*; _Size = long unsigned int]' 710 | return __uninitialized_default_n_1<__is_trivial(_ValueType) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 711 | && __can_fill>:: | ~~~~~~~~~~~~~~~~ 712 | __uninit_default_n(__first, __n); | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_uninitialized.h:779:44: required from '_ForwardIterator std::__uninitialized_default_n_a(_ForwardIterator, _Size, allocator<_Tp>&) [with _ForwardIterator = State*; _Size = long unsigned int; _Tp = State]' 779 | { return std::__uninitialized_default_n(__first, __n); } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~ /usr/include/c++/14/bits/vector.tcc:821:35: required from 'void std::vector<_Tp, _Alloc>::_M_default_append(size_type) [with _Tp = State; _Alloc = std::allocator<State>; size_type = long unsigned int]' 821 | std::__uninitialized_default_n_a(this->_M_impl._M_finish, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ 822 | __n, _M_get_Tp_allocator()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1016:4: required from 'void std::vector<_Tp, _Alloc>::resize(size_type) [with _Tp = State; _Alloc = std::allocator<State>; size_type = long unsigned int]' 1016 | _M_default_append(__new_size - size()); | ^~~~~~~~~~~~~~~~~ a.cc:20:16: required from here 20 | states.resize(n); | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_construct.h:119:7: error: no matching function for call to 'State::State()' 119 | ::new((void*)__p) _Tp(std::forward<_Args>(__args)...); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:11:9: note: candidate: 'State::State(int, int, int, int)' 11 | State(int i, int p, int q, int r):i(i),p(p),q(q),r(r){} | ^~~~~ a.cc:11:9: note: candidate expects 4 arguments, 0 provided a.cc:7:7: note: candidate: 'constexpr State::State(const State&)' 7 | class State | ^~~~~ a.cc:7:7: note: candidate expects 1 argument, 0 provided a.cc:7:7: note: candidate: 'constexpr State::State(State&&)' a.cc:7:7: note: candidate expects 1 argument, 0 provided
s628143232
p00239
C++
#include<iostream> #include<vector> #include<set> using namespace std; int main(){ int n; while(cin>>n&&n){ int P,Q,R,C; set<vector<int> > s; set<vector<int> >::iterator it; while(n--){ vector<int> v(4); cin>>v[0]>>v[1]>>v[2]>>v[3]; s.insert(v); } bool f=false; cin>>P>>Q>>R>>C; for(it=s.begin();it!=s.end();++it){ vector<int> &v=*it; if(v[1]<=P&&v[2]<=Q&&v[3]<=R&&v[1]*4+v[2]*9+v[3]*4<=C){ cout<<v[0]<<endl; f=true; } } if(!f)cout<<"NA\n"; } return 0; }
a.cc: In function 'int main()': a.cc:20:40: error: binding reference of type 'std::vector<int>&' to 'const std::vector<int>' discards qualifiers 20 | vector<int> &v=*it; | ^~~
s868507681
p00240
C
#include <vector> #include <algorithm> #include <cstdio> using namespace std; int main(){ int n,y,b,r,t,j; for(;scanf("%d%d",&n,&y),n;){ vector<pair<double,int> >v; for(;n--;){ scanf("%d%d%d",&b,&r,&t); if(t==1)v.push_back(make_pair(1+y*r/100.0,b)); else{ double d=1; for(j=0;j<y;j++)d*=1+r/100.0; v.push_back(make_pair(d,b)); } } sort(v.begin(),v.end()); printf("%d\n",v[v.size()-1].second); } }
main.c:1:10: fatal error: vector: No such file or directory 1 | #include <vector> | ^~~~~~~~ compilation terminated.
s415937766
p00240
C++
#include<iostream> #include<vector> using namespace std; class Bank{ public: int id, r, t; Bank(int id, int r, int t) :id(id), r(r), t(t){} }; int main(){ while (true){ int n; cin >> n; int y; cin >> y; vector<Bank> vb; for (int i = 0; i < n; ++i) { int b, r, t; cin >> b >> r >> t; vb.push_back(Bank(b, r, t)); } // ganpon * (1 + y * r/100) // ganpon * (1 + r/100)^y double maxi = 0; int ans = -1; for (int i = 0; i < vb.size(); ++i){ double g = 100000; double r1 = g * (1. + y * vb[i].r / 100.); double r2 = g * pow(1 + vb[i].r / 100., y); if (vb[i].t == 1){ if (maxi < r1){ maxi = r1; ans = vb[i].id; } } else{ if (maxi < r2){ maxi = r2; ans = vb[i].id; } } } cout << ans << endl; } } // 1
a.cc: In function 'int main()': a.cc:36:41: error: 'pow' was not declared in this scope 36 | double r2 = g * pow(1 + vb[i].r / 100., y); | ^~~
s418592972
p00240
C++
#include <iostream> #include <cstdio> #include <cmath> using namespace std; typedef pair<double, int> P; int main(void) { int kosu, year; while(cin >> kosu, kosu != 0){ cin >> year; P max = P((double)INT_MIN, 0); for(int r = 0; r < kosu; r++) { int number, kind, nennri; cin >> number >> kind >> nennri; double motoriMultiple; if(kind == 1) {motoriMultiple = (1 + year * nennri / 100.0);} else {motoriMultiple = pow((1 + nennri / 100.0), year);} if(motoriMultiple > max.first) { max = P(motoriMultiple, number); } } cout << max.second << endl; } return(0); }
a.cc: In function 'int main()': a.cc:11:27: error: 'INT_MIN' was not declared in this scope 11 | P max = P((double)INT_MIN, 0); | ^~~~~~~ a.cc:4:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 3 | #include <cmath> +++ |+#include <climits> 4 | using namespace std;
s383831542
p00240
C++
#include<iostream> #include<string> #include<algorithm> #include<sstream> #include <functional> using namespace std; int main(){ int n; while(cin>>n&&n){ double now=10000,y,r,t,ans,iti=0; int b; cin>>y; for(int i=0;i<n;i++){ cin>>b>>r>>t; now=10000; if(t==1){ now=now*(1+y*(r/100)); } else if(t==2){ now=now*pow((1+r/100),y); } if(now>iti){ iti=now; ans=b; } //cout<<b<<" "<<now<<endl; } cout<<ans<<endl; } }
a.cc: In function 'int main()': a.cc:22:49: error: 'pow' was not declared in this scope; did you mean 'now'? 22 | now=now*pow((1+r/100),y); | ^~~ | now
s334798027
p00240
C++
#include <iostream> #include <string> #include <vector> using namespace std; int main() { int n, y; while (cin >> n, n) { cin >> y; int b, r, t, res; double mx = 0; for (int i=0; i<n; ++i) { cin >> b >> r >> t; if (t == 1) { double interest = 10000.0 * (1 + y * r / 100.0); if (mx < interest) { mx = interest; res = b; } } else { double interest = 10000.0 * pow(1 + r / 100.0, y); if (mx < interest) { mx = interest; res = b; } } } cout << res << endl; } return 0; }
a.cc: In function 'int main()': a.cc:21:45: error: 'pow' was not declared in this scope 21 | double interest = 10000.0 * pow(1 + r / 100.0, y); | ^~~
s116634152
p00240
C++
#include<stdio.h> #include<iostream> using namespace std; int main(){ int n; while(1){ scanf("%d",&n);if(n==0)break; int y,t,b,r; double s=0; int max=0,MM=0; scanf("%d",&y); for(int i=0;i<n;i++){ scanf("%d %d %d",&b,&r,&t) if(t==1){ s=1+y*r/100; } else{ double s1=1+r/100???s=s1; for(int j=0;j<y;j++) s*=s1; } if(s>max){max=s;MM=b} } printf("%d\n",MM); } return 0; }
a.cc: In function 'int main()': a.cc:17:27: error: expected ';' before 'if' 17 | scanf("%d %d %d",&b,&r,&t) | ^ | ; 18 | 19 | if(t==1){ | ~~ a.cc:22:1: error: 'else' without a previous 'if' 22 | else{ | ^~~~ a.cc:23:19: error: expected primary-expression before '?' token 23 | double s1=1+r/100???s=s1; | ^ a.cc:23:20: error: expected primary-expression before '?' token 23 | double s1=1+r/100???s=s1; | ^ a.cc:23:25: error: expected ':' before ';' token 23 | double s1=1+r/100???s=s1; | ^ | : a.cc:23:25: error: expected primary-expression before ';' token a.cc:23:25: error: expected ':' before ';' token 23 | double s1=1+r/100???s=s1; | ^ | : a.cc:23:25: error: expected primary-expression before ';' token a.cc:23:25: error: expected ':' before ';' token 23 | double s1=1+r/100???s=s1; | ^ | : a.cc:23:25: error: expected primary-expression before ';' token a.cc:28:21: error: expected ';' before '}' token 28 | if(s>max){max=s;MM=b} | ^ | ;
s677979199
p00240
C++
#include<bits/stdc++.h> using namespace std; int main() { int N; while(cin >> N, N) { int Y; int b, r, t; int ans; double ma = 0; cin >> Y; for(int i = 0; i < N; i++) { cin >> b >> r >> t; double latte = (t == 1) ? (1 + Y * (r / 100.0)) : pow(1 + r / 100.0)); if(latte > ma) { ma = latte; ans = b; } } printf("%d\n", ans); } }
a.cc: In function 'int main()': a.cc:18:66: error: no matching function for call to 'pow(double)' 18 | double latte = (t == 1) ? (1 + Y * (r / 100.0)) : pow(1 + r / 100.0)); | ~~~^~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/valarray:605, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166, from a.cc:1: /usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::_Pow, std::_Constant, std::_ValArray, _Tp, _Tp>, _Tp> std::pow(const typename valarray<_Tp>::value_type&, const valarray<_Tp>&)' 549 | _DEFINE_EXPR_BINARY_FUNCTION(pow, struct std::_Pow) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::_Pow, std::_ValArray, std::_Constant, _Tp, _Tp>, _Tp> std::pow(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)' 549 | _DEFINE_EXPR_BINARY_FUNCTION(pow, struct std::_Pow) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::_Pow, std::_ValArray, std::_ValArray, _Tp, _Tp>, _Tp> std::pow(const valarray<_Tp>&, const valarray<_Tp>&)' 549 | _DEFINE_EXPR_BINARY_FUNCTION(pow, struct std::_Pow) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::_Pow, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename _Dom::value_type> std::pow(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 549 | _DEFINE_EXPR_BINARY_FUNCTION(pow, struct std::_Pow) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::_Pow, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename _Dom::value_type> std::pow(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)' 549 | _DEFINE_EXPR_BINARY_FUNCTION(pow, struct std::_Pow) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::_Pow, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename _Dom::value_type> std::pow(const valarray<typename _Dom::valarray>&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 549 | _DEFINE_EXPR_BINARY_FUNCTION(pow, struct std::_Pow) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::_Pow, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename _Dom::value_type> std::pow(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)' 549 | _DEFINE_EXPR_BINARY_FUNCTION(pow, struct std::_Pow) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::_Pow, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename _Dom1::value_type> std::pow(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)' 549 | _DEFINE_EXPR_BINARY_FUNCTION(pow, struct std::_Pow) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate expects 2 arguments, 1 provided In file included from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/complex:2482:5: note: candidate: 'template<class _Tp, class _Up> std::complex<typename __gnu_cxx::__promote<decltype (((typename __gnu_cxx::__promote<_Tp, std::__is_integer<_Tp>::__value>::__type)(0) + (typename __gnu_cxx::__promote<_Up, std::__is_integer<_Up>::__value>::__type)(0)))>::__type> std::pow(const complex<_Tp>&, const complex<_Up>&)' 2482 | pow(const std::complex<_Tp>& __x, const std::complex<_Up>& __y) | ^~~ /usr/include/c++/14/complex:2482:5: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/complex:2474:5: note: candidate: 'template<class _Tp, class _Up> std::complex<typename __gnu_cxx::__promote<decltype (((typename __gnu_cxx::__promote<_Tp, std::__is_integer<_Tp>::__value>::__type)(0) + (typename __gnu_cxx::__promote<_Up, std::__is_integer<_Up>::__value>::__type)(0)))>::__type> std::pow(const _Tp&, const complex<_Up>&)' 2474 | pow(const _Tp& __x, const std::complex<_Up>& __y) | ^~~ /usr/include/c++/14/complex:2474:5: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/complex:2466:5: note: candidate: 'template<class _Tp, class _Up> std::complex<typename __gnu_cxx::__promote<decltype (((typename __gnu_cxx::__promote<_Tp, std::__is_integer<_Tp>::__value>::__type)(0) + (typename __gnu_cxx::__promote<_Up, std::__is_integer<_Up>::__value>::__type)(0)))>::__type> std::pow(const complex<_Tp>&, const _Up&)' 2466 | pow(const std::complex<_Tp>& __x, const _Up& __y) | ^~~ /usr/include/c++/14/complex:2466:5: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/complex:1339:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::pow(const _Tp&, const complex<_Tp>&)' 1339 | pow(const _Tp& __x, const complex<_Tp>& __y) | ^~~ /usr/include/c++/14/complex:1339:5: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/complex:1328:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::pow(const complex<_Tp>&, const complex<_Tp>&)' 1328 | pow(const complex<_Tp>& __x, const complex<_Tp>& __y) | ^~~ /usr/include/c++/14/complex:1328:5: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/complex:1294:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::pow(const complex<_Tp>&, const _Tp&)' 1294 | pow(const complex<_Tp>& __x, const _Tp& __y) | ^~~ /usr/include/c++/14/complex:1294:5: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/complex:1285:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::pow(const complex<_Tp>&, int)' 1285 | pow(const complex<_Tp>& __z, int __n) | ^~~ /usr/include/c++/14/complex:1285:5: note: candidate expects 2 arguments, 1 provided In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:114: /usr/include/c++/14/cmath:1074:5: note: candidate: 'template<class _Tp, class _Up> constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type std::pow(_Tp, _Up)' 1074 | pow(_Tp __x, _Up __y) | ^~~ /usr/include/c++/14/cmath:1074:5: note: candidate expects 2 arguments, 1 provided In file included from /usr/include/features.h:523, from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683, from /usr/include/c++/14/cassert:43, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:33: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:173:1: note: candidate: 'double pow(double, double)' 173 | __MATHCALL_VEC (pow,, (_Mdouble_ __x, _Mdouble_ __y)); | ^~~~~~~~~~~~~~ /usr/include/x86_64-linux-gnu/bits/mathcalls.h:173:1: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/cmath:380:3: note: candidate: 'constexpr long double std::pow(long double, long double)' 380 | pow(long double __x, long double __y) | ^~~ /usr/include/c++/14/cmath:380:3: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/cmath:376:3: note: candidate: 'constexpr float std::pow(float, float)' 376 | pow(float __x, float __y) | ^~~ /usr/include/c++/14/cmath:376:3: note: candidate expects 2 arguments, 1 provided
s358093812
p00240
C++
#include<iostream> #include<math.h> #include<algorithm> #include<string> using namespace std; int n,y; struct DATA{ int name,r,t; double money; }; DATA data[1001]; int main(){ while(1){ cin>>n; if(n==0){break;} cin>>y; for(int i=0;i<n;i++){ cin>>data[i].name>>data[i].r>>data[i].t; if(data[i].t==1){data[i].money=(1.0+y*data[i].r/100.0)} if(data[i].t==2){data[i].money=pow(1.0+data[i].r/100.0,y);} } sort(data.money,data+n.money); cout<<data[n-1].money; } return 0; }
a.cc: In function 'int main()': a.cc:20:30: error: reference to 'data' is ambiguous 20 | cin>>data[i].name>>data[i].r>>data[i].t; | ^~~~ In file included from /usr/include/c++/14/string:53, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:12:6: note: 'DATA data [1001]' 12 | DATA data[1001]; | ^~~~ a.cc:20:44: error: reference to 'data' is ambiguous 20 | cin>>data[i].name>>data[i].r>>data[i].t; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:12:6: note: 'DATA data [1001]' 12 | DATA data[1001]; | ^~~~ a.cc:20:55: error: reference to 'data' is ambiguous 20 | cin>>data[i].name>>data[i].r>>data[i].t; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:12:6: note: 'DATA data [1001]' 12 | DATA data[1001]; | ^~~~ a.cc:21:28: error: reference to 'data' is ambiguous 21 | if(data[i].t==1){data[i].money=(1.0+y*data[i].r/100.0)} | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:12:6: note: 'DATA data [1001]' 12 | DATA data[1001]; | ^~~~ a.cc:21:42: error: reference to 'data' is ambiguous 21 | if(data[i].t==1){data[i].money=(1.0+y*data[i].r/100.0)} | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:12:6: note: 'DATA data [1001]' 12 | DATA data[1001]; | ^~~~ a.cc:21:63: error: reference to 'data' is ambiguous 21 | if(data[i].t==1){data[i].money=(1.0+y*data[i].r/100.0)} | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:12:6: note: 'DATA data [1001]' 12 | DATA data[1001]; | ^~~~ a.cc:22:28: error: reference to 'data' is ambiguous 22 | if(data[i].t==2){data[i].money=pow(1.0+data[i].r/100.0,y);} | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:12:6: note: 'DATA data [1001]' 12 | DATA data[1001]; | ^~~~ a.cc:22:42: error: reference to 'data' is ambiguous 22 | if(data[i].t==2){data[i].money=pow(1.0+data[i].r/100.0,y);} | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:12:6: note: 'DATA data [1001]' 12 | DATA data[1001]; | ^~~~ a.cc:22:64: error: reference to 'data' is ambiguous 22 | if(data[i].t==2){d
s247043772
p00240
C++
#include<iostream> #include<math.h> #include<algorithm> #include<string> using namespace std; int n,y; struct DATA{ int name,r,t; double money; }; DATA data[1001]; int main(){ while(1){ cin>>n; if(n==0){break;} cin>>y; for(int i=0;i<n;i++){ cin>>data[i].name>>data[i].r>>data[i].t; if(data[i].t==1){data[i].money=(1.0+y*data[i].r/100.0);} if(data[i].t==2){data[i].money=pow(1.0+data[i].r/100.0,y);} } sort(data.money,data+n.money); cout<<data[n-1].money; } return 0; }
a.cc: In function 'int main()': a.cc:20:30: error: reference to 'data' is ambiguous 20 | cin>>data[i].name>>data[i].r>>data[i].t; | ^~~~ In file included from /usr/include/c++/14/string:53, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:12:6: note: 'DATA data [1001]' 12 | DATA data[1001]; | ^~~~ a.cc:20:44: error: reference to 'data' is ambiguous 20 | cin>>data[i].name>>data[i].r>>data[i].t; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:12:6: note: 'DATA data [1001]' 12 | DATA data[1001]; | ^~~~ a.cc:20:55: error: reference to 'data' is ambiguous 20 | cin>>data[i].name>>data[i].r>>data[i].t; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:12:6: note: 'DATA data [1001]' 12 | DATA data[1001]; | ^~~~ a.cc:21:28: error: reference to 'data' is ambiguous 21 | if(data[i].t==1){data[i].money=(1.0+y*data[i].r/100.0);} | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:12:6: note: 'DATA data [1001]' 12 | DATA data[1001]; | ^~~~ a.cc:21:42: error: reference to 'data' is ambiguous 21 | if(data[i].t==1){data[i].money=(1.0+y*data[i].r/100.0);} | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:12:6: note: 'DATA data [1001]' 12 | DATA data[1001]; | ^~~~ a.cc:21:63: error: reference to 'data' is ambiguous 21 | if(data[i].t==1){data[i].money=(1.0+y*data[i].r/100.0);} | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:12:6: note: 'DATA data [1001]' 12 | DATA data[1001]; | ^~~~ a.cc:22:28: error: reference to 'data' is ambiguous 22 | if(data[i].t==2){data[i].money=pow(1.0+data[i].r/100.0,y);} | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:12:6: note: 'DATA data [1001]' 12 | DATA data[1001]; | ^~~~ a.cc:22:42: error: reference to 'data' is ambiguous 22 | if(data[i].t==2){data[i].money=pow(1.0+data[i].r/100.0,y);} | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:12:6: note: 'DATA data [1001]' 12 | DATA data[1001]; | ^~~~ a.cc:22:64: error: reference to 'data' is ambiguous 22 | if(data[i].t==2
s075105972
p00240
C++
#include<iostream> #include<math.h> #include<algorithm> #include<string> using namespace std; int n,y; struct DATA{ int name,r,t; double money; }; DATA data[1001]; int main(){ while(1){ cin>>n; if(n==0){break;} cin>>y; for(int i=0;i<n;i++){ cin>>data[i].name>>data[i].r>>data[i].t; if(data[i].t==1){data[i].money=(1.0+y*data[i].r/100.0);} if(data[i].t==2){data[i].money=pow(1.0+data[i].r/100.0,y);} } sort(data.money,data+n.money); cout<<data[n-1].money; } return 0; }
a.cc: In function 'int main()': a.cc:20:30: error: reference to 'data' is ambiguous 20 | cin>>data[i].name>>data[i].r>>data[i].t; | ^~~~ In file included from /usr/include/c++/14/string:53, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:12:6: note: 'DATA data [1001]' 12 | DATA data[1001]; | ^~~~ a.cc:20:44: error: reference to 'data' is ambiguous 20 | cin>>data[i].name>>data[i].r>>data[i].t; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:12:6: note: 'DATA data [1001]' 12 | DATA data[1001]; | ^~~~ a.cc:20:55: error: reference to 'data' is ambiguous 20 | cin>>data[i].name>>data[i].r>>data[i].t; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:12:6: note: 'DATA data [1001]' 12 | DATA data[1001]; | ^~~~ a.cc:21:28: error: reference to 'data' is ambiguous 21 | if(data[i].t==1){data[i].money=(1.0+y*data[i].r/100.0);} | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:12:6: note: 'DATA data [1001]' 12 | DATA data[1001]; | ^~~~ a.cc:21:42: error: reference to 'data' is ambiguous 21 | if(data[i].t==1){data[i].money=(1.0+y*data[i].r/100.0);} | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:12:6: note: 'DATA data [1001]' 12 | DATA data[1001]; | ^~~~ a.cc:21:63: error: reference to 'data' is ambiguous 21 | if(data[i].t==1){data[i].money=(1.0+y*data[i].r/100.0);} | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:12:6: note: 'DATA data [1001]' 12 | DATA data[1001]; | ^~~~ a.cc:22:28: error: reference to 'data' is ambiguous 22 | if(data[i].t==2){data[i].money=pow(1.0+data[i].r/100.0,y);} | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:12:6: note: 'DATA data [1001]' 12 | DATA data[1001]; | ^~~~ a.cc:22:42: error: reference to 'data' is ambiguous 22 | if(data[i].t==2){data[i].money=pow(1.0+data[i].r/100.0,y);} | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:12:6: note: 'DATA data [1001]' 12 | DATA data[1001]; | ^~~~ a.cc:22:64: error: reference to 'data' is ambiguous 22 | if(data[i].t==2
s925918778
p00240
C++
#include<stdio.h> int main(void){ int n,y,b[50],x,r,t,sum[50],max,i; while(1){ max=-1; scanf("%d",&n); scanf("%d",&y); for(i=0;i<n;i++){ scanf("%d %d %d",&b[i],&r.&t); if(t==1){ sum[j]=100*(1+y*(r/100)); } if(t==2){ sum[j]=100*((1+r/100)^y); } } for(i=0;i<n;i++){ if(max<sum[j]){ max=sum[j]; x=b[j]; } } printf("%d\n",x); } return 0; }
a.cc: In function 'int main()': a.cc:9:51: error: expected unqualified-id before '&' token 9 | scanf("%d %d %d",&b[i],&r.&t); | ^ a.cc:11:37: error: 'j' was not declared in this scope 11 | sum[j]=100*(1+y*(r/100)); | ^ a.cc:14:37: error: 'j' was not declared in this scope 14 | sum[j]=100*((1+r/100)^y); | ^ a.cc:18:36: error: 'j' was not declared in this scope 18 | if(max<sum[j]){ | ^
s783019030
p00240
C++
#include<iostream> using namespace std; int main(){ int n,y,b,r,t,ma=0,c,ni; while(1){ cin>>n; if(n=0) break; cin>>y; for(i=1;i<=n;i++){ cin>>b>>r>>t; if(t==1){ if(ma<10000*(1+y*r/100)){ ma=10000*(1+y*r/100); c=b; } } if(t==2){ ni=10000; for(i=1;i<=y;i++){ ni=ni*(1+r/100); } if(ma<ni){ ma=ni; c=b; } } } cout<<c; } return 0; }
a.cc: In function 'int main()': a.cc:10:13: error: 'i' was not declared in this scope; did you mean 'ni'? 10 | for(i=1;i<=n;i++){ | ^ | ni
s318992830
p00240
C++
#include<iostream> using namespace std; int main(){ int n,y,b,r,t,ma=0,c,ni; while(1){ cin>>n; if(n=0) break; cin>>y; for(i=1;i<=n;i++){ cin>>b>>r>>t; if(t==1){ ni=10000*(1+y*r/100); if(ma<ni){ ma=ni c=b; } } if(t==2){ ni=10000; for(i=1;i<=y;i++){ ni=ni*(1+r/100); } if(ma<ni){ ma=ni; c=b; } } } cout<<c<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:10:13: error: 'i' was not declared in this scope; did you mean 'ni'? 10 | for(i=1;i<=n;i++){ | ^ | ni a.cc:15:38: error: expected ';' before 'c' 15 | ma=ni | ^ | ; 16 | c=b; | ~
s780312797
p00240
C++
#include<stdio.h> int main() { int n, y, b, r, t; float many1[100] = { 0 }, many2[100] = { 0 }; int i, j, k, l, cnt = 0, max = 0; while (1) { many1[100] = { 0 }; many2[100] = { 0 }; scanf("%d", &n); if (n == 0) { break; } scanf("%d", &y); for (i = 0; i < n; i++) { scanf("%d %d %d", &b, &r, &t); if (t == 1) { many1[b] = 100 * (1 + y*(r / 100)); } if (t == 2) { many1[b] = 100 * (1 + (y / 100)); for (j = 0; j < y; j++) { many1[b] = many1[b] * many1[b]; } for (i = 0; i < 100; i++) { if (many1[i] > max) { max = many1[i]; cnt = i; } } printf("%d\n",cnt); } }
a.cc: In function 'int main()': a.cc:35:2: error: expected '}' at end of input 35 | } | ^ a.cc:7:19: note: to match this '{' 7 | while (1) { | ^ a.cc:35:2: error: expected '}' at end of input 35 | } | ^ a.cc:3:1: note: to match this '{' 3 | { | ^
s202044698
p00240
C++
#include<iostream> using namespace std; int main(){ int n,y,b,r,t,ma=0,c,ni; while(1){ cin>>n; if(n==0) break; cin>>y; for(i=1;i<=n;i++){ cin>>b>>r>>t; if(t==1){ ni=10000*(1+y*r/100); if(ma<ni){ ma=ni c=b; } } if(t==2){ ni=10000; for(i=1;i<=y;i++){ ni=ni*(1+r/100); } if(ma<ni){ ma=ni; c=b; } } } cout<<c<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:10:13: error: 'i' was not declared in this scope; did you mean 'ni'? 10 | for(i=1;i<=n;i++){ | ^ | ni a.cc:15:38: error: expected ';' before 'c' 15 | ma=ni | ^ | ; 16 | c=b; | ~
s491702876
p00240
C++
#include<stdio.h> int man() { int i, j, n, b, t, y, cnt = 0; float many[52] = { 0 }, r, suu, max=0; while (1) { scanf("%d", &n); if (n == 0) { break; } scanf("%d", &y); scanf("%d %f %d", &b, &r, &t); if (t == 1) { many[b] = 100.0*(1 + y*(float)r / 100); } else { many[b] = 100.0*(1 + (float)y / 100); suu = many[b]; for (j = 0; j < y; j++) { many[b] = suu*many[b]; } } for (i = 0; i < 50; i++) { if (many[i] > max) { max = many[i]; cnt = i; } } printf("%d\n", cnt); } }
a.cc: In function 'int man()': a.cc:31:1: warning: no return statement in function returning non-void [-Wreturn-type] 31 | } | ^ /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s451665327
p00240
C++
#include<iostream> using namespace std; int main(){ int n,y,b,r,t,c; float ni,ma=0; while(1){ cin>>n; if(n==0) break; cin>>y; for(i=1;i<=n;i++){ cin>>b>>r>>t; if(t==1){ ni=10000*(1+y*r*0.01); if(ma<ni){ ma=ni c=b; } } if(t==2){ ni=10000; for(i=1;i<=y;i++){ ni=ni*(1+r*0.01); } if(ma<ni){ ma=ni; c=b; } } } cout<<c<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:11:13: error: 'i' was not declared in this scope; did you mean 'ni'? 11 | for(i=1;i<=n;i++){ | ^ | ni a.cc:16:38: error: expected ';' before 'c' 16 | ma=ni | ^ | ; 17 | c=b; | ~
s662824951
p00240
C++
#include<iostream> using namespace std;
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s732038049
p00240
C++
#include<cstdio> #include<iostream> #include<math.h> using namespace std; int main(void){ int n,gin,kinri,i,m,maxgin,cpy; double y,nenri,ganri,max,d; while(1){ m=10000; cin>>n; if(n==0) break; cin>>y; max=-1; for(i=0;i<n;i++){ cin>>gin>>nenri>>kinri; if(kinri==1) ganri=m*(1+y*(nenri/100)); if(kinri==2){ d=(1+nenri/100); cpy=d; for(i=0;i<y;i+) d=d*cpy; ganri=m*d; } if(max<ganri){ max=ganri; maxgin=gin; } } cout<<maxgin<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:20:47: error: expected primary-expression before ')' token 20 | for(i=0;i<y;i+) d=d*cpy; | ^
s482333488
p00240
C++
#include <iostream> #include <cstdio> #include <vector> #include <cmath> using namespace std; int main(){ int n; while(cin >> n && n){ int y; cin >> y; vector< pair<double,int> > S; for(int i = 0 ; i < n ; i++){ double b,r,t; cin >> b >> r >> t; if( t == 1 ){ S.push_back(make_pair(1+y*r/100.0,(int)b)); }else{ S.push_back(make_pair(pow(1+r/100.0,y),(int)b)); } } sort(S.rbegin(),S.rend()); cout << S[0].second << endl; } }
a.cc: In function 'int main()': a.cc:23:17: error: 'sort' was not declared in this scope; did you mean 'sqrt'? 23 | sort(S.rbegin(),S.rend()); | ^~~~ | sqrt
s505204082
p00240
C++
int main() { while(true){ int n; cin >> n; if(n==0) break; int y; double sum; int num=0; double max=0.0; cin >> y; for(int i=0 ;i<n ;i++){ int b,r,t; cin >> b >> r >> t; if(t==1){ sum = 1.0+(double)y*(double)r/100.0; sum *= 10.0; } else{ sum = 1.0; for(int j=0 ;j<y ;j++){ sum *= 1.0+(double)r/100.0; } sum *= 10.0; } if(max < sum){ max = sum; num = b; } } cout << num << endl; } return 0; }
a.cc: In function 'int main()': a.cc:5:17: error: 'cin' was not declared in this scope 5 | cin >> n; | ^~~ a.cc:37:17: error: 'cout' was not declared in this scope 37 | cout << num << endl; | ^~~~ a.cc:37:32: error: 'endl' was not declared in this scope 37 | cout << num << endl; | ^~~~
s499942924
p00240
C++
#include<algorithm> #include<cstdio> using namespace std; int main(){ int i; int n; while(scanf("%d",&n),n){ int y; scanf("%d",&y); double mx=0; int my; for(i=0;i<n;++i){ int p,q,r; scanf("%d%d%d",&p,&q,&r); if((r==1?y*q/100.+1:pow(q/100.+1,y))>mx){ mx=r==1?y*q/100.+1:pow(q/100.+1,y); my=p; } } printf("%d\n",my); } return 0; }
a.cc: In function 'int main()': a.cc:15:45: error: 'pow' was not declared in this scope 15 | if((r==1?y*q/100.+1:pow(q/100.+1,y))>mx){ | ^~~
s675873259
p00240
C++
#include <iostream> #include <algorithm> #include <cmath> using namespace std; int main(){ int n while( cin >> n,n){ double money = 10000; double b,r,t,ansi,year; double moto = 0; cin >> year; for(int i = 1 ; i <= n ; i++ ){ cin >> b >> r >> t; if(t == 1){ if(moto < money*(1+year*(r/100))){ moto = money*(1+year*(r/100)); ansi = i; } }else if(t == 2){ if(moto < money*pow((1+(r/100)),year)){ moto = money*pow((1+(r/100)),year); ansi = i; } } } cout << ansi << endl; } }
a.cc: In function 'int main()': a.cc:8:3: error: expected initializer before 'while' 8 | while( cin >> n,n){ | ^~~~~
s194887353
p00241
Java
import java.util.*; class Main{ public static void main(String args[]){ Solve s = new Solve(); s.solve(); } } class Solve{ Scanner in = new Scanner(System.in); void solve(){ int[][] s = {{1,2,3,4},{2,-1,4,-3},{3,-4,-1,2},{4,3,-2,-1}}; int n = in.nextInt(); for(int k = 0; k < n; k++){ int[] a = new int[4]; int[] b = new int[4]; long[] ans = new int[4]; for(int i = 0; i < 4; i++) a[i] = in.nextInt(); for(int i = 0; i < 4; i++) b[i] = in.nextInt(); for(int i = 0; i < 4; i++){ for(int j = 0; j < 4; j++){ int t = s[i][j], d = 1; if(t < 0){ t = -t; d = -1; } --t; ans[t] += (long)d * a[i] * b[j]; } } for(int i = 0; i < 4; i++){ if(i != 0) System.out.print(" "); System.out.print(ans[i]); } System.out.println(); } } }
Main.java:19: error: incompatible types: int[] cannot be converted to long[] long[] ans = new int[4]; ^ 1 error
s947225078
p00241
C++
int main(){ int n; cin>>n; for(int i=0;i<n;i++){ int a,b,c,d,e,f,g,h; cin>>a>>b>>c>>d>>e>>f>>g>>h; int w=0,x=0,y=0,z=0; w=(a*e)-(b*f)-(c*g)-(d*h); x=b*e+a*f+c*h-d*g; y=a*g+c*e+d*f-b*h; z=a*h+d*e+b*g-c*f; cout<<w<<" "<<x<<" "<<y<<" "<<z<<endl; if(i==n-1){ int tmp; cin>>tmp; if(tmp==0)break; } } }
a.cc: In function 'int main()': a.cc:3:9: error: 'cin' was not declared in this scope 3 | cin>>n; | ^~~ a.cc:12:9: error: 'cout' was not declared in this scope 12 | cout<<w<<" "<<x<<" "<<y<<" "<<z<<endl; | ^~~~ a.cc:12:42: error: 'endl' was not declared in this scope 12 | cout<<w<<" "<<x<<" "<<y<<" "<<z<<endl; | ^~~~
s173421056
p00241
C++
// AOJ 0241 #include <iostream> #include <cmath> using namespace std; int data[4][4] = {{1, 2, 3, 4}, {2, -1, 4, -3}, {3, -4, -1, 2}, {4, 3, -2, -1}}; int main() { int n; while (cin >> n, n){ while (n--){ int num1[4][2], num2[4][2]; for (int i = 0; i < 4; i++){ cin >> num1[i][0]; num1[i][1] = i; } for (int i = 0; i < 4; i++){ cin >> num2[i][0]; num2[i][1] = i; } int ret[4] = {}; for (int i = 0; i < 4; i++){ for (int j = 0; j < 4; j++){ int t = data[num1[i][1]][num2[j][1]]; int tmp = num1[i][0] * num2[j][0]; // cout << t << endl; if (t < 0){ ret[abs(t) - 1] -= tmp; } else { ret[abs(t) - 1] += tmp; } } } for (int i = 0; i < 4; i++){ cout << ret[i] << (i + 1 == 4 ? '\n' : ' '); } } } return 0; }
a.cc: In function 'int main()': a.cc:29:49: error: reference to 'data' is ambiguous 29 | int t = data[num1[i][1]][num2[j][1]]; | ^~~~ In file included from /usr/include/c++/14/string:53, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:2: /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:7:5: note: 'int data [4][4]' 7 | int data[4][4] = {{1, 2, 3, 4}, | ^~~~
s159113512
p00241
C++
#include<iostream> #include<cmath> #include<algorithm> #include<string> using namespace std; int x1,y1,z1,w1,x2,y2,z2,w2; int main(){ while(1){ cin>>n; if(n==0){break;} for(int i=0;i<n;i++){ cin>>x1>>y1>>z1>>w1>>x2>>y2>>z2>>w2; cout<<x1*x2-y1*y2-z1*z2-w1*w2; cout<<" "; cout<<x2*y1+x1*y2+z1*w2-w1*z2; cout<<" "; cout<<x1*z2+z1*x2+w1*y2-y1*z2; cout<<" "; cout<<w1*x2-zq*y2+y1*z2+x1*w2; cout<<endl; } } return 0; }
a.cc:7:8: error: 'int y1' redeclared as different kind of entity 7 | int x1,y1,z1,w1,x2,y2,z2,w2; | ^~ In file included from /usr/include/features.h:523, from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683, from /usr/include/c++/14/bits/requires_hosted.h:31, from /usr/include/c++/14/iostream:38, from a.cc:1: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:257:1: note: previous declaration 'double y1(double)' 257 | __MATHCALL (y1,, (_Mdouble_)); | ^~~~~~~~~~ a.cc: In function 'int main()': a.cc:11:22: error: 'n' was not declared in this scope; did you mean 'yn'? 11 | cin>>n; | ^ | yn a.cc:14:32: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'double(double) noexcept') 14 | cin>>x1>>y1>>z1>>w1>>x2>>y2>>z2>>w2; | ~~~~~~~^~~~ | | | | | double(double) noexcept | std::basic_istream<char>::__istream_type {aka std::basic_istream<char>} In file included from /usr/include/c++/14/iostream:42: /usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed: a.cc:14:34: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'double (*)(double) noexcept' 14 | cin>>x1>>y1>>z1>>w1>>x2>>y2>>z2>>w2; | ^~ /usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed: a.cc:14:34: error: invalid conversion from 'double (*)(double) noexcept' to 'short int' [-fpermissive] 14 | cin>>x1>>y1>>z1>>w1>>x2>>y2>>z2>>w2; | ^~ | | | double (*)(double) noexcept a.cc:14:34: error: cannot bind rvalue '(short int)y1' to 'short int&' /usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed: a.cc:14:34: error: invalid conversion from 'double (*)(double) noexcept' to 'short unsigned int' [-fpermissive] 14 | cin>>x1>>y1>>z1>>w1>>x2>>y2>>z2>>w2; | ^~ | | | double (*)(double) noexcept a.cc:14:34: error: cannot bind rvalue '(short unsigned int)y1' to 'short unsigned int&' /usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed: a.cc:14:34: error: invalid conversion from 'double (*)(double) noexcept' to 'int' [-fpermissive] 14 | cin>>x1>>y1>>z1>>w1>>x2>>y2>>z2>>w2; | ^~ | | | double (*)(double) noexcept a.cc:14:34: error: cannot bind rvalue '(int)y1' to 'int&' /usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed: a.cc:14:34: error: invalid conversion from 'double (*)(double) noexcept' to 'unsigned int' [-fpermissive] 14 | cin>>x1>>y1>>z1>>w1>>x2>>y2>>z2>>w2; | ^~ | | | double (*)(double) noexcept a.cc:14:34: error: cannot bind rvalue '(unsigned int)y1' to 'unsigned int&' /usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed: a.cc:14:34: error: invalid conversion from 'double (*)(double) noexcept' to 'long int' [-fpermissive] 14 | cin>>x1>>y1>>z1>>w1>>x2>>y2>>z2>>w2; | ^~ | | | double (*)(double) noexcept a.cc:14:34: error: cannot bind rvalue '(long int)y1' to 'long int&' /usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed: a.cc:14:34: error: invalid conversion from 'double (*)(double) noexcept' to 'long unsigned int' [-fpermissive] 14 | cin>>x1>>y1>>z1>>w1>>x2>>y2>>z2>>w2; | ^~ | | | double (*)(double) noexcept a.cc:14:34: error: cannot bind rvalue '(long unsigned int)y1' to 'long unsigned int&' /usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed: a.cc:14:34: error: invalid conversion from 'double (*)(double) noexcept' to 'long long int' [-fpermissive] 14 | cin>>x1>>y1>>z1>>w1>>x2>>y2>>z2>>w2; | ^~ | | | double (*)(double) noexcept a.cc:14:34: error: cannot bind rvalue '(long long int)y1' to 'long long int&' /usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed: a.cc:14:34: error: invalid conversion from 'double (*)(double) noexcept' to 'long long unsigned int' [-fpermissive] 14 | cin>>x1>>y1>>z1>>w1>>x2>>y2>>z2>>w2; | ^~ | | | double (*)(double) noexcept a.cc:14:34: error: cannot bind rvalue '(long long unsigned int)y1' to 'long long unsigned int&' /usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed: a.cc:14:34: error: invalid conversion from 'double (*)(double) noexcept' to 'void*' [-fpermissive] 14 | cin>>x1>>y1>>z1>>w1>>x2>>y2>>z2>>w2; | ^~ | | | double (*)(double) noexcept a.cc:14:34: error: cannot bind rvalue '(void*)y1' to 'void*&' /usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:122:7: note: conversion of argument 1 would be ill-formed: a.cc:14:34: error: invalid conversion from 'double (*)(double) noexcept' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} [-fpermissive]
s129875314
p00241
C++
#include<iostream> #include<cmath> #include<algorithm> #include<string> using namespace std; int x1,y1,z1,w1,x2,y2,z2,w2; int main(){ while(1){ cin>>n; if(n==0){break;} for(int i=0;i<n;i++){ cin>>x1>>y1>>z1>>w1>>x2>>y2>>z2>>w2; cout<<x1*x2-y1*y2-z1*z2-w1*w2; cout<<" "; cout<<x2*y1+x1*y2+z1*w2-w1*z2; cout<<" "; cout<<x1*z2+z1*x2+w1*y2-y1*z2; cout<<" "; cout<<w1*x2-z1*y2+y1*z2+x1*w2; cout<<endl; } } return 0; }
a.cc:7:8: error: 'int y1' redeclared as different kind of entity 7 | int x1,y1,z1,w1,x2,y2,z2,w2; | ^~ In file included from /usr/include/features.h:523, from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683, from /usr/include/c++/14/bits/requires_hosted.h:31, from /usr/include/c++/14/iostream:38, from a.cc:1: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:257:1: note: previous declaration 'double y1(double)' 257 | __MATHCALL (y1,, (_Mdouble_)); | ^~~~~~~~~~ a.cc: In function 'int main()': a.cc:11:22: error: 'n' was not declared in this scope; did you mean 'yn'? 11 | cin>>n; | ^ | yn a.cc:14:32: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'double(double) noexcept') 14 | cin>>x1>>y1>>z1>>w1>>x2>>y2>>z2>>w2; | ~~~~~~~^~~~ | | | | | double(double) noexcept | std::basic_istream<char>::__istream_type {aka std::basic_istream<char>} In file included from /usr/include/c++/14/iostream:42: /usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed: a.cc:14:34: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'double (*)(double) noexcept' 14 | cin>>x1>>y1>>z1>>w1>>x2>>y2>>z2>>w2; | ^~ /usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed: a.cc:14:34: error: invalid conversion from 'double (*)(double) noexcept' to 'short int' [-fpermissive] 14 | cin>>x1>>y1>>z1>>w1>>x2>>y2>>z2>>w2; | ^~ | | | double (*)(double) noexcept a.cc:14:34: error: cannot bind rvalue '(short int)y1' to 'short int&' /usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed: a.cc:14:34: error: invalid conversion from 'double (*)(double) noexcept' to 'short unsigned int' [-fpermissive] 14 | cin>>x1>>y1>>z1>>w1>>x2>>y2>>z2>>w2; | ^~ | | | double (*)(double) noexcept a.cc:14:34: error: cannot bind rvalue '(short unsigned int)y1' to 'short unsigned int&' /usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed: a.cc:14:34: error: invalid conversion from 'double (*)(double) noexcept' to 'int' [-fpermissive] 14 | cin>>x1>>y1>>z1>>w1>>x2>>y2>>z2>>w2; | ^~ | | | double (*)(double) noexcept a.cc:14:34: error: cannot bind rvalue '(int)y1' to 'int&' /usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed: a.cc:14:34: error: invalid conversion from 'double (*)(double) noexcept' to 'unsigned int' [-fpermissive] 14 | cin>>x1>>y1>>z1>>w1>>x2>>y2>>z2>>w2; | ^~ | | | double (*)(double) noexcept a.cc:14:34: error: cannot bind rvalue '(unsigned int)y1' to 'unsigned int&' /usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed: a.cc:14:34: error: invalid conversion from 'double (*)(double) noexcept' to 'long int' [-fpermissive] 14 | cin>>x1>>y1>>z1>>w1>>x2>>y2>>z2>>w2; | ^~ | | | double (*)(double) noexcept a.cc:14:34: error: cannot bind rvalue '(long int)y1' to 'long int&' /usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed: a.cc:14:34: error: invalid conversion from 'double (*)(double) noexcept' to 'long unsigned int' [-fpermissive] 14 | cin>>x1>>y1>>z1>>w1>>x2>>y2>>z2>>w2; | ^~ | | | double (*)(double) noexcept a.cc:14:34: error: cannot bind rvalue '(long unsigned int)y1' to 'long unsigned int&' /usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed: a.cc:14:34: error: invalid conversion from 'double (*)(double) noexcept' to 'long long int' [-fpermissive] 14 | cin>>x1>>y1>>z1>>w1>>x2>>y2>>z2>>w2; | ^~ | | | double (*)(double) noexcept a.cc:14:34: error: cannot bind rvalue '(long long int)y1' to 'long long int&' /usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed: a.cc:14:34: error: invalid conversion from 'double (*)(double) noexcept' to 'long long unsigned int' [-fpermissive] 14 | cin>>x1>>y1>>z1>>w1>>x2>>y2>>z2>>w2; | ^~ | | | double (*)(double) noexcept a.cc:14:34: error: cannot bind rvalue '(long long unsigned int)y1' to 'long long unsigned int&' /usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed: a.cc:14:34: error: invalid conversion from 'double (*)(double) noexcept' to 'void*' [-fpermissive] 14 | cin>>x1>>y1>>z1>>w1>>x2>>y2>>z2>>w2; | ^~ | | | double (*)(double) noexcept a.cc:14:34: error: cannot bind rvalue '(void*)y1' to 'void*&' /usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:122:7: note: conversion of argument 1 would be ill-formed: a.cc:14:34: error: invalid conversion from 'double (*)(double) noexcept' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} [-fpermissive]
s295783876
p00241
C++
#include<iostream> #include<cmath> #include<algorithm> #include<string> using namespace std; int x1,y1,z1,w1,x2,y2,z2,w2,n; int main(){ while(1){ cin>>n; if(n==0){break;} for(int i=0;i<n;i++){ cin>>x1>>y1>>z1>>w1>>x2>>y2>>z2>>w2; cout<<x1*x2-y1*y2-z1*z2-w1*w2; cout<<" "; cout<<x2*y1+x1*y2+z1*w2-w1*z2; cout<<" "; cout<<x1*z2+z1*x2+w1*y2-y1*z2; cout<<" "; cout<<w1*x2-z1*y2+y1*z2+x1*w2; cout<<endl; } } return 0; }
a.cc:7:8: error: 'int y1' redeclared as different kind of entity 7 | int x1,y1,z1,w1,x2,y2,z2,w2,n; | ^~ In file included from /usr/include/features.h:523, from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683, from /usr/include/c++/14/bits/requires_hosted.h:31, from /usr/include/c++/14/iostream:38, from a.cc:1: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:257:1: note: previous declaration 'double y1(double)' 257 | __MATHCALL (y1,, (_Mdouble_)); | ^~~~~~~~~~ a.cc: In function 'int main()': a.cc:14:32: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'double(double) noexcept') 14 | cin>>x1>>y1>>z1>>w1>>x2>>y2>>z2>>w2; | ~~~~~~~^~~~ | | | | | double(double) noexcept | std::basic_istream<char>::__istream_type {aka std::basic_istream<char>} In file included from /usr/include/c++/14/iostream:42: /usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed: a.cc:14:34: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'double (*)(double) noexcept' 14 | cin>>x1>>y1>>z1>>w1>>x2>>y2>>z2>>w2; | ^~ /usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed: a.cc:14:34: error: invalid conversion from 'double (*)(double) noexcept' to 'short int' [-fpermissive] 14 | cin>>x1>>y1>>z1>>w1>>x2>>y2>>z2>>w2; | ^~ | | | double (*)(double) noexcept a.cc:14:34: error: cannot bind rvalue '(short int)y1' to 'short int&' /usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed: a.cc:14:34: error: invalid conversion from 'double (*)(double) noexcept' to 'short unsigned int' [-fpermissive] 14 | cin>>x1>>y1>>z1>>w1>>x2>>y2>>z2>>w2; | ^~ | | | double (*)(double) noexcept a.cc:14:34: error: cannot bind rvalue '(short unsigned int)y1' to 'short unsigned int&' /usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed: a.cc:14:34: error: invalid conversion from 'double (*)(double) noexcept' to 'int' [-fpermissive] 14 | cin>>x1>>y1>>z1>>w1>>x2>>y2>>z2>>w2; | ^~ | | | double (*)(double) noexcept a.cc:14:34: error: cannot bind rvalue '(int)y1' to 'int&' /usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed: a.cc:14:34: error: invalid conversion from 'double (*)(double) noexcept' to 'unsigned int' [-fpermissive] 14 | cin>>x1>>y1>>z1>>w1>>x2>>y2>>z2>>w2; | ^~ | | | double (*)(double) noexcept a.cc:14:34: error: cannot bind rvalue '(unsigned int)y1' to 'unsigned int&' /usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed: a.cc:14:34: error: invalid conversion from 'double (*)(double) noexcept' to 'long int' [-fpermissive] 14 | cin>>x1>>y1>>z1>>w1>>x2>>y2>>z2>>w2; | ^~ | | | double (*)(double) noexcept a.cc:14:34: error: cannot bind rvalue '(long int)y1' to 'long int&' /usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed: a.cc:14:34: error: invalid conversion from 'double (*)(double) noexcept' to 'long unsigned int' [-fpermissive] 14 | cin>>x1>>y1>>z1>>w1>>x2>>y2>>z2>>w2; | ^~ | | | double (*)(double) noexcept a.cc:14:34: error: cannot bind rvalue '(long unsigned int)y1' to 'long unsigned int&' /usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed: a.cc:14:34: error: invalid conversion from 'double (*)(double) noexcept' to 'long long int' [-fpermissive] 14 | cin>>x1>>y1>>z1>>w1>>x2>>y2>>z2>>w2; | ^~ | | | double (*)(double) noexcept a.cc:14:34: error: cannot bind rvalue '(long long int)y1' to 'long long int&' /usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed: a.cc:14:34: error: invalid conversion from 'double (*)(double) noexcept' to 'long long unsigned int' [-fpermissive] 14 | cin>>x1>>y1>>z1>>w1>>x2>>y2>>z2>>w2; | ^~ | | | double (*)(double) noexcept a.cc:14:34: error: cannot bind rvalue '(long long unsigned int)y1' to 'long long unsigned int&' /usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed: a.cc:14:34: error: invalid conversion from 'double (*)(double) noexcept' to 'void*' [-fpermissive] 14 | cin>>x1>>y1>>z1>>w1>>x2>>y2>>z2>>w2; | ^~ | | | double (*)(double) noexcept a.cc:14:34: error: cannot bind rvalue '(void*)y1' to 'void*&' /usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:122:7: note: conversion of argument 1 would be ill-formed: a.cc:14:34: error: invalid conversion from 'double (*)(double) noexcept' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} [-fpermissive] 14 | cin>>x1>>y1>>z1>>w1>>x2>>y2>>z2>>w2; | ^~ | | |
s412094531
p00241
C++
#include<iostream> #include<algorithm> #include<string> #include<cmath> #include<iostream> #include<vector> using namespace std ; template <typename T> T Out(vector < T > v,int n) { if(n == 1) { for(int i = 0; i < v.size(); i++) { cout << v[i] << endl ; } } else if(n == 2) { for(int i = 0; i < v.size(); i++) { cout << v[i] ; } cout << endl ; } else { for(int i = 0; i < v.size(); i++) { cout << v[i] << " " ; } cout << endl ; } } int main() { int N ; vector<int> a, b, ans ; while(1) { cin >> N ; if(N == 0) { break ; } for(int h = 0; h < N ;++h) { a.resize(4) ; b.resize(4) ; ans.clear() ; ans.resize(4) ; for(int i = 0; i < 4; ++i) { cin >> a[i] ; } for(int i = 0; i < 4; ++i) { cin >> b[i] ; } for(int i = 0; i < 4;++i) { for(int j = 0; j < 4; ++j) { if(i == j && i != 0) { ans[0] -= a[i] * b[j] ; } else if(i == j && i == 0) { ans[0] += a[i] * b[j] ; } else if(i == 0) { ans[j] += a[i] * b[j] ; } else if(j == 0) { ans[i] += a[i] * b[j] ; }// else if(i == 1 && j == 2) { ans[3] += a[i] * b[j] ; } else if(i == 1 && j == 3) { ans[2] -= a[i] * b[j] ; } else if(i == 2 && j == 1) { ans[3] -= a[i] * b[j] ; } else if(i == 2 && j == 3) { ans[1] += a[i] * b[j] ; } else if(i == 3 && j == 1) { ans[2] += a[i] * b[j] ; } else if(i == 3 && j == 2) { ans[1] -= a[i] * b[j] ; } } } for(int i = 0; i < 4;++i){ if(i){ cout << " "; } cout << v[i]; } cout << endl; } } return 0 ; }
a.cc: In function 'int main()': a.cc:113:17: error: 'v' was not declared in this scope 113 | cout << v[i]; | ^
s610319705
p00241
C++
#include<stdio.h> int main(void) { int n,a,b,c,d,e,f,g,h,X[1000],Z[1000],W[1000],P[1000]; while(1){ scnaf("%d",&n); if(n==0)break; for(i=0;i<n;i++){ scanf("%d %d %d %d %d %d %d %d",&a,&b,&c,&d,&e,&f,&g,&h); X[i]=(a*e)+(-1*f*b)+(-1*g*c)+(-1*h*d); Z[i]=(a*f)+(e*b)+(h*c)+(-1*g*d); W[i]=(a*g)+(-1*h*b)+(e*c)+(f*d); P[i]=(a*h)+(g*b)+(-1*f*c)+(d*e); } for(i=0;i<n;i++){ printf("%d %d %d %d\n",X[i],Z[i],W[i],P[i]); } return 0; }
a.cc: In function 'int main()': a.cc:6:9: error: 'scnaf' was not declared in this scope; did you mean 'scanf'? 6 | scnaf("%d",&n); | ^~~~~ | scanf a.cc:8:13: error: 'i' was not declared in this scope 8 | for(i=0;i<n;i++){ | ^ a.cc:15:13: error: 'i' was not declared in this scope 15 | for(i=0;i<n;i++){ | ^ a.cc:19:2: error: expected '}' at end of input 19 | } | ^ a.cc:3:1: note: to match this '{' 3 | { | ^
s377447293
p00241
C++
#include<stdio.h> int main(void) { int n,a,b,c,d,e,f,g,h,X[1000],Z[1000],W[1000],P[1000]; while(1){ scanf("%d",&n); if(n==0)break; for(i=0;i<n;i++){ scanf("%d %d %d %d %d %d %d %d",&a,&b,&c,&d,&e,&f,&g,&h); X[i]=(a*e)+(-1*f*b)+(-1*g*c)+(-1*h*d); Z[i]=(a*f)+(e*b)+(h*c)+(-1*g*d); W[i]=(a*g)+(-1*h*b)+(e*c)+(f*d); P[i]=(a*h)+(g*b)+(-1*f*c)+(d*e); } for(i=0;i<n;i++){ printf("%d %d %d %d\n",X[i],Z[i],W[i],P[i]); } } return 0; }
a.cc: In function 'int main()': a.cc:8:13: error: 'i' was not declared in this scope 8 | for(i=0;i<n;i++){ | ^ a.cc:15:13: error: 'i' was not declared in this scope 15 | for(i=0;i<n;i++){ | ^
s715468347
p00241
C++
#include <iostream> using namespace std; int main(){ int n; while(cin>>n,n){ int a,b,c,d,e,f,g,h; while(n--){ cin>>a>>b>>c>>d; cin>>e>>f>>g>>h;???? cout<<a*e-b*f-c*g-d*h<< " " << a*f+b*e+c*h-d*g<< " " << a*g-b*h+c*e+d*f<< " " << a*h+b*g-c*f+d*e<< endl; } } }
a.cc: In function 'int main()': a.cc:9:23: error: expected primary-expression before '?' token 9 | cin>>e>>f>>g>>h;???? | ^ a.cc:9:24: error: expected primary-expression before '?' token 9 | cin>>e>>f>>g>>h;???? | ^ a.cc:9:25: error: expected primary-expression before '?' token 9 | cin>>e>>f>>g>>h;???? | ^ a.cc:9:26: error: expected primary-expression before '?' token 9 | cin>>e>>f>>g>>h;???? | ^ a.cc:13:29: error: expected ':' before ';' token 13 | a*h+b*g-c*f+d*e<< endl; | ^ | : a.cc:13:29: error: expected primary-expression before ';' token a.cc:13:29: error: expected ':' before ';' token 13 | a*h+b*g-c*f+d*e<< endl; | ^ | : a.cc:13:29: error: expected primary-expression before ';' token a.cc:13:29: error: expected ':' before ';' token 13 | a*h+b*g-c*f+d*e<< endl; | ^ | : a.cc:13:29: error: expected primary-expression before ';' token a.cc:13:29: error: expected ':' before ';' token 13 | a*h+b*g-c*f+d*e<< endl; | ^ | : a.cc:13:29: error: expected primary-expression before ';' token
s010875108
p00241
C++
#include<iostream> using namespace std; int main() { &#160; int n; &#160; int x1,x2,y1,y2,z1,z2,w1,w2; &#160; int x,y,z,w; &#160; while(cin>>n,n){ &#160; &#160; for(int i=0;i<n;i++){ &#160; &#160; &#160; cin>>x1>>y1>>z1>>w1>>x2>>y2>>z2>>w2; &#160; &#160; &#160; x = x1*x2 - y1*y2 - z1*z2 - w1*w2; &#160; &#160; &#160; y = x1*y2 + y1*x2 + z1*w2 - w1*z2; &#160; &#160; &#160; z = x1*z2 - y1*w2 + z1*x2 + w1*y2; &#160; &#160; &#160; w = x1*w2 + y1*z2 - z1*y2 + w1*x2; &#160; &#160; &#160; printf("%d %d %d %d\n",x,y,z,w); &#160; &#160; } &#160; } }
a.cc:9:2: error: stray '#' in program 9 | &#160; int n; | ^ a.cc:10:2: error: stray '#' in program 10 | &#160; int x1,x2,y1,y2,z1,z2,w1,w2; | ^ a.cc:11:2: error: stray '#' in program 11 | &#160; int x,y,z,w; | ^ a.cc:12:2: error: stray '#' in program 12 | &#160; while(cin>>n,n){ | ^ a.cc:13:2: error: stray '#' in program 13 | &#160; &#160; for(int i=0;i<n;i++){ | ^ a.cc:13:9: error: stray '#' in program 13 | &#160; &#160; for(int i=0;i<n;i++){ | ^ a.cc:14:2: error: stray '#' in program 14 | &#160; &#160; &#160; cin>>x1>>y1>>z1>>w1>>x2>>y2>>z2>>w2; | ^ a.cc:14:9: error: stray '#' in program 14 | &#160; &#160; &#160; cin>>x1>>y1>>z1>>w1>>x2>>y2>>z2>>w2; | ^ a.cc:14:16: error: stray '#' in program 14 | &#160; &#160; &#160; cin>>x1>>y1>>z1>>w1>>x2>>y2>>z2>>w2; | ^ a.cc:15:2: error: stray '#' in program 15 | &#160; &#160; &#160; x = x1*x2 - y1*y2 - z1*z2 - w1*w2; | ^ a.cc:15:9: error: stray '#' in program 15 | &#160; &#160; &#160; x = x1*x2 - y1*y2 - z1*z2 - w1*w2; | ^ a.cc:15:16: error: stray '#' in program 15 | &#160; &#160; &#160; x = x1*x2 - y1*y2 - z1*z2 - w1*w2; | ^ a.cc:16:2: error: stray '#' in program 16 | &#160; &#160; &#160; y = x1*y2 + y1*x2 + z1*w2 - w1*z2; | ^ a.cc:16:9: error: stray '#' in program 16 | &#160; &#160; &#160; y = x1*y2 + y1*x2 + z1*w2 - w1*z2; | ^ a.cc:16:16: error: stray '#' in program 16 | &#160; &#160; &#160; y = x1*y2 + y1*x2 + z1*w2 - w1*z2; | ^ a.cc:17:2: error: stray '#' in program 17 | &#160; &#160; &#160; z = x1*z2 - y1*w2 + z1*x2 + w1*y2; | ^ a.cc:17:9: error: stray '#' in program 17 | &#160; &#160; &#160; z = x1*z2 - y1*w2 + z1*x2 + w1*y2; | ^ a.cc:17:16: error: stray '#' in program 17 | &#160; &#160; &#160; z = x1*z2 - y1*w2 + z1*x2 + w1*y2; | ^ a.cc:18:2: error: stray '#' in program 18 | &#160; &#160; &#160; w = x1*w2 + y1*z2 - z1*y2 + w1*x2; | ^ a.cc:18:9: error: stray '#' in program 18 | &#160; &#160; &#160; w = x1*w2 + y1*z2 - z1*y2 + w1*x2; | ^ a.cc:18:16: error: stray '#' in program 18 | &#160; &#160; &#160; w = x1*w2 + y1*z2 - z1*y2 + w1*x2; | ^ a.cc:19:2: error: stray '#' in program 19 | &#160; &#160; &#160; printf("%d %d %d %d\n",x,y,z,w); | ^ a.cc:19:9: error: stray '#' in program 19 | &#160; &#160; &#160; printf("%d %d %d %d\n",x,y,z,w); | ^ a.cc:19:16: error: stray '#' in program 19 | &#160; &#160; &#160; printf("%d %d %d %d\n",x,y,z,w); | ^ a.cc:20:2: error: stray '#' in program 20 | &#160; &#160; } | ^ a.cc:20:9: error: stray '#' in program 20 | &#160; &#160; } | ^ a.cc:21:2: error: stray '#' in program 21 | &#160; } | ^ a.cc: In function 'int main()': a.cc:9:3: error: lvalue required as unary '&' operand 9 | &#160; int n; | ^~~ a.cc:10:3: error: lvalue required as unary '&' operand 10 | &#160; int x1,x2,y1,y2,z1,z2,w1,w2; | ^~~ a.cc:11:3: error: lvalue required as unary '&' operand 11 | &#160; int x,y,z,w; | ^~~ a.cc:12:3: error: lvalue required as unary '&' operand 12 | &#160; while(cin>>n,n){ | ^~~ a.cc:13:3: error: lvalue required as unary '&' operand 13 | &#160; &#160; for(int i=0;i<n;i++){ | ^~~ a.cc:13:10: error: lvalue required as unary '&' operand 13 | &#160; &#160; for(int i=0;i<n;i++){ | ^~~ a.cc:14:3: error: lvalue required as unary '&' operand 14 | &#160; &#160; &#160; cin>>x1>>y1>>z1>>w1>>x2>>y2>>z2>>w2; | ^~~ a.cc:14:10: error: lvalue required as unary '&' operand 14 | &#160; &#160; &#160; cin>>x1>>y1>>z1>>w1>>x2>>y2>>z2>>w2; | ^~~ a.cc:14:17: error: lvalue required as unary '&' operand 14 | &#160; &#160; &#160; cin>>x1>>y1>>z1>>w1>>x2>>y2>>z2>>w2; | ^~~ a.cc:15:3: error: lvalue required as unary '&' operand 15 | &#160; &#160; &#160; x = x1*x2 - y1*y2 - z1*z2 - w1*w2; | ^~~ a.cc:15:10: error: lvalue required as unary '&' operand 15 | &#160; &#160; &#160; x = x1*x2 - y1*y2 - z1*z2 - w1*w2; | ^~~ a.cc:15:17: error: lvalue required as unary '&' operand 15 | &#160; &#160; &#160; x = x1*x2 - y1*y2 - z1*z2 - w1*w2; | ^~~ a.cc:16:3: error: lvalue required as unary '&' operand 16 | &#160; &#160; &#160; y = x1*y2 + y1*x2 + z1*w2 - w1*z2; | ^~~ a.cc:16:10: error: lvalue required as unary '&' operand 16 | &#160; &#160; &#160; y = x1*y2 + y1*x2 + z1*w2 - w1*z2; | ^~~ a.cc:16:17: error: lvalue required as unary '&' operand 16 | &#160; &#160; &#160; y = x1*y2 + y1*x2 + z1*w2 - w1*z2; | ^~~ a.cc:17:3: error: lvalue required as unary '&' operand 17 | &#160; &#160; &#160; z = x1*z2 - y1*w2 + z1*x2 + w1*y2; | ^~~ a.cc:17:10: error: lvalue required as unary '&' operand 17 | &#160; &#160; &#160; z = x1*z2 - y1*w2 + z1*x2 + w1*y2; | ^~~ a.cc:17:17: error: lvalue required as unary '&' operand 17 | &#160; &#160; &#160; z = x1*z2 - y1*w2 + z1*x2 + w1*y2; | ^~~ a.cc:18:3: error: lvalue required as unary '&' operand 18 | &#160; &#160; &#160; w = x1*w2 + y1*z2 - z1*y2 + w1*x2; | ^~~ a.cc:18:10: error: lvalue required as unary '&' operand 18 | &#160; &#160; &#160; w = x1*w2 + y1*z2 - z1*y2 + w1*x2; | ^~~ a.cc:18:17: error: lvalue required as unary '&' operand 18 | &#160; &#160; &#160; w = x1*w2 + y1*z2 - z1*y2 + w1*x2; | ^~~ a.cc:19:3: error: lvalue required as unary '&' operand 19 | &#160; &#160; &#160; printf("%d %d %d %d\n",x,y,z,w); | ^~~ a.cc:19:10: error: lvalue required as unary '&' operand 19 | &#160; &#160; &#160; printf("%d %d %d %d\n",x,y,z,w); | ^~~ a.cc:19:17: error: lvalue required as unary '&' operand 19 | &#160; &#160; &#160; printf("%d %d %d %d\n",x,y,z,w); | ^~~ a.cc:20:3: error: lvalue required as unary '&' operand 20 | &#160; &#160; } | ^~~ a.cc:20:10: error: lvalue required as unary '&' operand 20 | &#160; &#160; } | ^~~ a.cc:21:3: error: lvalue required as unary '&' operand 21 | &#160; } | ^~~
s449983255
p00242
Java
package nofill_nosubmit; import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class AOJ2_42 { public static void main(String arg[]) { Scanner in=new Scanner(System.in); for(;;) { int n=in.nextInt(); String t=in.nextLine(); ArrayList<String> AL=new ArrayList<String>(); if(n==0) return; for(int i=0;i<n;i++) { String s[]=in.nextLine().split(" "); for(int j=0;j<s.length;j++) AL.add(s[j]); } String se=in.next(); for(int i=0;i<AL.size();i++) if(se.charAt(0)!=AL.get(i).charAt(0)) { AL.remove(i); i--; } if(AL.isEmpty()) { System.out.println("NA"); continue; } Collections.sort(AL); int count[]=new int[AL.size()]; for(int i=0;i<AL.size()-1;i++) { while(i+1<AL.size()&&AL.get(i).equals(AL.get(i+1))) { count[i]++; AL.remove(i); } } ArrayList<Integer> cou=new ArrayList<Integer>(); for(int i=0;i<count.length;i++) cou.add(count[i]); ArrayList<String> ANS=new ArrayList<String>(); while(!AL.isEmpty()) { int m=0; for(int j=0;j<cou.size();j++) { if(cou.get(m)<cou.get(j)) m=j; } ANS.add(AL.get(m)); AL.remove(m); cou.remove(m); } int p=0; for(int i=0;i<ANS.size();i++) { if(p==0) System.out.print(ANS.get(i)); else System.out.print(" "+ANS.get(i)); if(i>3) break; p=1; } System.out.println(); } } }
Main.java:5: error: class AOJ2_42 is public, should be declared in a file named AOJ2_42.java public class AOJ2_42 ^ 1 error
s986634332
p00242
C
/* ??????????????????????????\???????£? ??????????????? ?????? ???????????±??????????????????????????????????????????????????\????????????????????\???????£??????¨?????? ????????????????????????????????????????????????????????????????????????????????????????¨??????????????????? ??\??????????????????????????????????????????????????\???????£???¨??????????????????????????§???????????? ??°????????????computer?????¨???????????????????????\???????????????????????????c?????¨??\????????? ????????§????£???¨?????????computer??????????????????????????? ???????????????????????????????????????????????????????????¬??¨?????¨??????????¨????????????????????????? ?????????????????????????????????????????????????????????????????????????????°??????????????????????????? ????????°????????????????????????????????? ?¨???????????????????????????? k???????§???±???????????\?????¨?????????????????? k ?????????????????? ????????????????????°?????????????????????????????°?????????????????????????????????????????????????¨???? ??????????????????????§???±?°?????????¨????§??????????????????????????????°??? 1 ????????\??? 1024 ????????\?????¨??????????????????????????£??????????????????????????? 1 ????????\?????? 20 ????????\ ?????§???????????????????????? 2 ?????\?????£?¶?????????\?????????????????¨??????????????????????????? ??°???????????????????????°????????´???????????¢???????????????????????????????????\????????????????????? ???????????????????????????????????????????????????????????§ 5 ????????§??¨??????????????????????????? ???????????¨???????????´?????????NA?????¨??????????????????????????? ??\??? ?????°???????????????????????????????????\?????¨?????????????????????????????\??????????????????????????? ??¨?????§??¨?????????????????????????????????????????\????????¨????????§?????? 1 ?????? ?????????????§???±?°?????????????????§???????????????? 2 ?????? ????????? k ???????§???±?????? ?????? ??\??????????????????????????¨??????????????????????????????????????????????????????????????????NA?????¨ ?????????????????? */ #include <stdio.h> #define NUM 1024 #define WORD 20 int main( void ) { char b[ NUM + 1 ]; // ?????????????§???±?°?????????????????§???????????????? char k; // ????????? k ???????§???±?????? char w[ 5 ][ NUM + 1 ]; // ????£???¨??????????????? int wn[ 5 ]; // ????£???¨???????????????????????????????????° int wi[ 5 ]; // ????£???¨??????????????????????´??????? int i; int idx; while ( 1 ) { scanf( "%s", d ); // ???????????\??? if ( ( b[ 0 ] == '0' ) && ( b[ 1 ] == '\0' ) ) { break; } scanf( "%s", d ); // ??????????????\??? for ( i = 0 ; i < 5 ; i++ ) { wn[ i ] = 0; // ???????????°???????????¢ wi[ i ] = i; // ??????????????????????????????????????????????¨???? } idx = 0; for ( i = 0 ; b[ i ] != '\0' ; i++ ) { if ( b[ i ] != c ) { // ???????????¨?????°?????? while ( b[ i ] != ' ' ) { // ?¬???????????????§???????£???°??? if ( b[ i ] == '\0' ) { // ?????????????????£??????... i--; // ?????????????????? break; // ???????????? } i++; } } else { j = 0; while ( b[ i ] != ' ' ) { // ?¬???????????????§???????£???°??? w[ idx ][ j ] = b[ i ]; if ( b[ i ] == '\0' ) { // ?????????????????£??????... i--; // ?????????????????? break; // ???????????? } i++; j++; } w[ idx ][ j ] = '\n'; idx++; } } for ( i = 0 ; i < idx ; i++ ) { printf( "%d : %s\n", i, w[ i ] ); } } return (0); }
main.c: In function 'main': main.c:56:30: error: 'd' undeclared (first use in this function) 56 | scanf( "%s", d ); // ???????????\??? | ^ main.c:56:30: note: each undeclared identifier is reported only once for each function it appears in main.c:71:40: error: 'c' undeclared (first use in this function) 71 | if ( b[ i ] != c ) { // ???????????¨?????°?????? | ^ main.c:81:33: error: 'j' undeclared (first use in this function) 81 | j = 0; | ^
s942618901
p00242
C
/* ??????????????????????????\???????£? ??????????????? ?????? ???????????±??????????????????????????????????????????????????\????????????????????\???????£??????¨?????? ????????????????????????????????????????????????????????????????????????????????????????¨??????????????????? ??\??????????????????????????????????????????????????\???????£???¨??????????????????????????§???????????? ??°????????????computer?????¨???????????????????????\???????????????????????????c?????¨??\????????? ????????§????£???¨?????????computer??????????????????????????? ???????????????????????????????????????????????????????????¬??¨?????¨??????????¨????????????????????????? ?????????????????????????????????????????????????????????????????????????????°??????????????????????????? ????????°????????????????????????????????? ?¨???????????????????????????? k???????§???±???????????\?????¨?????????????????? k ?????????????????? ????????????????????°?????????????????????????????°?????????????????????????????????????????????????¨???? ??????????????????????§???±?°?????????¨????§??????????????????????????????°??? 1 ????????\??? 1024 ????????\?????¨??????????????????????????£??????????????????????????? 1 ????????\?????? 20 ????????\ ?????§???????????????????????? 2 ?????\?????£?¶?????????\?????????????????¨??????????????????????????? ??°???????????????????????°????????´???????????¢???????????????????????????????????\????????????????????? ???????????????????????????????????????????????????????????§ 5 ????????§??¨??????????????????????????? ???????????¨???????????´?????????NA?????¨??????????????????????????? ??\??? ?????°???????????????????????????????????\?????¨?????????????????????????????\??????????????????????????? ??¨?????§??¨?????????????????????????????????????????\????????¨????????§?????? 1 ?????? ?????????????§???±?°?????????????????§???????????????? 2 ?????? ????????? k ???????§???±?????? ?????? ??\??????????????????????????¨??????????????????????????????????????????????????????????????????NA?????¨ ?????????????????? */ #include <stdio.h> #define NUM 1024 #define WORD 20 int main( void ) { char b[ NUM + 1 ]; // ?????????????§???±?°?????????????????§???????????????? char k; // ????????? k ???????§???±?????? char w[ 5 ][ NUM + 1 ]; // ????£???¨??????????????? int wn[ 5 ]; // ????£???¨???????????????????????????????????° int wi[ 5 ]; // ????£???¨??????????????????????´??????? int i; int idx; while ( 1 ) { scanf( "%s", b ); // ???????????\??? if ( ( b[ 0 ] == '0' ) && ( b[ 1 ] == '\0' ) ) { break; } scanf( "%s", d ); // ??????????????\??? for ( i = 0 ; i < 5 ; i++ ) { wn[ i ] = 0; // ???????????°???????????¢ wi[ i ] = i; // ??????????????????????????????????????????????¨???? } idx = 0; for ( i = 0 ; b[ i ] != '\0' ; i++ ) { if ( b[ i ] != c ) { // ???????????¨?????°?????? while ( b[ i ] != ' ' ) { // ?¬???????????????§???????£???°??? if ( b[ i ] == '\0' ) { // ?????????????????£??????... i--; // ?????????????????? break; // ???????????? } i++; } } else { j = 0; while ( b[ i ] != ' ' ) { // ?¬???????????????§???????£???°??? w[ idx ][ j ] = b[ i ]; if ( b[ i ] == '\0' ) { // ?????????????????£??????... i--; // ?????????????????? break; // ???????????? } i++; j++; } w[ idx ][ j ] = '\n'; idx++; } } for ( i = 0 ; i < idx ; i++ ) { printf( "%d : %s\n", i, w[ i ] ); } } return (0); }
main.c: In function 'main': main.c:62:30: error: 'd' undeclared (first use in this function) 62 | scanf( "%s", d ); // ??????????????\??? | ^ main.c:62:30: note: each undeclared identifier is reported only once for each function it appears in main.c:71:40: error: 'c' undeclared (first use in this function) 71 | if ( b[ i ] != c ) { // ???????????¨?????°?????? | ^ main.c:81:33: error: 'j' undeclared (first use in this function) 81 | j = 0; | ^
s212656282
p00242
C
/* ??????????????????????????\???????£? ??????????????? ?????? ???????????±??????????????????????????????????????????????????\????????????????????\???????£??????¨?????? ????????????????????????????????????????????????????????????????????????????????????????¨??????????????????? ??\??????????????????????????????????????????????????\???????£???¨??????????????????????????§???????????? ??°????????????computer?????¨???????????????????????\???????????????????????????c?????¨??\????????? ????????§????£???¨?????????computer??????????????????????????? ???????????????????????????????????????????????????????????¬??¨?????¨??????????¨????????????????????????? ?????????????????????????????????????????????????????????????????????????????°??????????????????????????? ????????°????????????????????????????????? ?¨???????????????????????????? k???????§???±???????????\?????¨?????????????????? k ?????????????????? ????????????????????°?????????????????????????????°?????????????????????????????????????????????????¨???? ??????????????????????§???±?°?????????¨????§??????????????????????????????°??? 1 ????????\??? 1024 ????????\?????¨??????????????????????????£??????????????????????????? 1 ????????\?????? 20 ????????\ ?????§???????????????????????? 2 ?????\?????£?¶?????????\?????????????????¨??????????????????????????? ??°???????????????????????°????????´???????????¢???????????????????????????????????\????????????????????? ???????????????????????????????????????????????????????????§ 5 ????????§??¨??????????????????????????? ???????????¨???????????´?????????NA?????¨??????????????????????????? ??\??? ?????°???????????????????????????????????\?????¨?????????????????????????????\??????????????????????????? ??¨?????§??¨?????????????????????????????????????????\????????¨????????§?????? 1 ?????? ?????????????§???±?°?????????????????§???????????????? 2 ?????? ????????? k ???????§???±?????? ?????? ??\??????????????????????????¨??????????????????????????????????????????????????????????????????NA?????¨ ?????????????????? */ #include <stdio.h> #define NUM 1024 #define WORD 20 int main( void ) { char b[ NUM + 1 ]; // ?????????????§???±?°?????????????????§???????????????? char k; // ????????? k ???????§???±?????? char w[ 5 ][ NUM + 1 ]; // ????£???¨??????????????? int wn[ 5 ]; // ????£???¨???????????????????????????????????° int wi[ 5 ]; // ????£???¨??????????????????????´??????? int i; int idx; while ( 1 ) { scanf( "%s", b ); // ???????????\??? if ( ( b[ 0 ] == '0' ) && ( b[ 1 ] == '\0' ) ) { break; } scanf( "%s", c ); // ??????????????\??? for ( i = 0 ; i < 5 ; i++ ) { wn[ i ] = 0; // ???????????°???????????¢ wi[ i ] = i; // ??????????????????????????????????????????????¨???? } idx = 0; for ( i = 0 ; b[ i ] != '\0' ; i++ ) { if ( b[ i ] != c ) { // ???????????¨?????°?????? while ( b[ i ] != ' ' ) { // ?¬???????????????§???????£???°??? if ( b[ i ] == '\0' ) { // ?????????????????£??????... i--; // ?????????????????? break; // ???????????? } i++; } } else { j = 0; while ( b[ i ] != ' ' ) { // ?¬???????????????§???????£???°??? w[ idx ][ j ] = b[ i ]; if ( b[ i ] == '\0' ) { // ?????????????????£??????... i--; // ?????????????????? break; // ???????????? } i++; j++; } w[ idx ][ j ] = '\n'; idx++; } } for ( i = 0 ; i < idx ; i++ ) { printf( "%d : %s\n", i, w[ i ] ); } } return (0); }
main.c: In function 'main': main.c:62:30: error: 'c' undeclared (first use in this function) 62 | scanf( "%s", c ); // ??????????????\??? | ^ main.c:62:30: note: each undeclared identifier is reported only once for each function it appears in main.c:81:33: error: 'j' undeclared (first use in this function) 81 | j = 0; | ^
s846420165
p00242
C
/* ??????????????????????????\???????£? ??????????????? ?????? ???????????±??????????????????????????????????????????????????\????????????????????\???????£??????¨?????? ????????????????????????????????????????????????????????????????????????????????????????¨??????????????????? ??\??????????????????????????????????????????????????\???????£???¨??????????????????????????§???????????? ??°????????????computer?????¨???????????????????????\???????????????????????????c?????¨??\????????? ????????§????£???¨?????????computer??????????????????????????? ???????????????????????????????????????????????????????????¬??¨?????¨??????????¨????????????????????????? ?????????????????????????????????????????????????????????????????????????????°??????????????????????????? ????????°????????????????????????????????? ?¨???????????????????????????? k???????§???±???????????\?????¨?????????????????? k ?????????????????? ????????????????????°?????????????????????????????°?????????????????????????????????????????????????¨???? ??????????????????????§???±?°?????????¨????§??????????????????????????????°??? 1 ????????\??? 1024 ????????\?????¨??????????????????????????£??????????????????????????? 1 ????????\?????? 20 ????????\ ?????§???????????????????????? 2 ?????\?????£?¶?????????\?????????????????¨??????????????????????????? ??°???????????????????????°????????´???????????¢???????????????????????????????????\????????????????????? ???????????????????????????????????????????????????????????§ 5 ????????§??¨??????????????????????????? ???????????¨???????????´?????????NA?????¨??????????????????????????? ??\??? ?????°???????????????????????????????????\?????¨?????????????????????????????\??????????????????????????? ??¨?????§??¨?????????????????????????????????????????\????????¨????????§?????? 1 ?????? ?????????????§???±?°?????????????????§???????????????? 2 ?????? ????????? k ???????§???±?????? ?????? ??\??????????????????????????¨??????????????????????????????????????????????????????????????????NA?????¨ ?????????????????? */ #include <stdio.h> #define NUM 1024 #define WORD 20 int main( void ) { char b[ NUM + 1 ]; // ?????????????§???±?°?????????????????§???????????????? char k; // ????????? k ???????§???±?????? char w[ 5 ][ NUM + 1 ]; // ????£???¨??????????????? int wn[ 5 ]; // ????£???¨???????????????????????????????????° int wi[ 5 ]; // ????£???¨??????????????????????´??????? int i, j; int idx; while ( 1 ) { scanf( "%s", b ); // ???????????\??? if ( ( b[ 0 ] == '0' ) && ( b[ 1 ] == '\0' ) ) { break; } scanf( "%s", k ); // ??????????????\??? for ( i = 0 ; i < 5 ; i++ ) { wn[ i ] = 0; // ???????????°???????????¢ wi[ i ] = i; // ??????????????????????????????????????????????¨???? } idx = 0; for ( i = 0 ; b[ i ] != '\0' ; i++ ) { if ( b[ i ] != c ) { // ???????????¨?????°?????? while ( b[ i ] != ' ' ) { // ?¬???????????????§???????£???°??? if ( b[ i ] == '\0' ) { // ?????????????????£??????... i--; // ?????????????????? break; // ???????????? } i++; } } else { j = 0; while ( b[ i ] != ' ' ) { // ?¬???????????????§???????£???°??? w[ idx ][ j ] = b[ i ]; if ( b[ i ] == '\0' ) { // ?????????????????£??????... i--; // ?????????????????? break; // ???????????? } i++; j++; } w[ idx ][ j ] = '\n'; idx++; } } for ( i = 0 ; i < idx ; i++ ) { printf( "%d : %s\n", i, w[ i ] ); } } return (0); }
main.c: In function 'main': main.c:71:40: error: 'c' undeclared (first use in this function) 71 | if ( b[ i ] != c ) { // ???????????¨?????°?????? | ^ main.c:71:40: note: each undeclared identifier is reported only once for each function it appears in
s671098343
p00242
C
#include<cstdio> #include<cstdlib> #include<cstring> #include<sstream> using namespace std; #define Min(x,y) ((x<y)?x:y) typedef struct word{ int n; char s[25]; }WORD; WORD x[30][1000]; int comp(const void *p,const void *q){ WORD *a=(WORD*)p,*b=(WORD*)q; if(a->n==b->n)return strcmp(a->s,b->s); else return b->n - a->n; } int main(){ int i,j,n,wn[30],a; char sen[1030],str[25],k; while(1){ scanf("%d\n",&n); if(n==0)break; memset(wn,0,sizeof(wn)); while(n--){ memset(sen,0,sizeof(sen)); memset(str,0,sizeof(str)); fgets(sen,1025,stdin); //printf("A:%s",sen); istringstream ss(sen); while(ss>>str){ //printf("%s\n",str); a=str[0]-'a'; for(i=0;i<wn[a];i++){ if(strcmp(str,x[a][i].s)==0){ x[a][i].n++; break; } } if(i==wn[a]){ x[a][wn[a]].n=1; strcpy(x[a][wn[a]++].s,str); memset(str,0,sizeof(str)); } } /*while(sscanf(sen,"%s",str)!='\0'){ printf("%s\n",str); a=str[0]-'a'; strcpy(x[a][wn[a]++].s,str); memset(str,0,sizeof(str)); }*/ } scanf("%c\n",&k); a=k-'a'; if(wn[a]==0){ printf("NA\n"); continue; } qsort(x[a],wn[a],sizeof(WORD),comp); n=Min(5,wn[a]); for(i=0;i<n;i++){ printf("%s%s",x[a][i].s,(i==n-1)?"\n":" "); } } return 0; }
main.c:1:9: fatal error: cstdio: No such file or directory 1 | #include<cstdio> | ^~~~~~~~ compilation terminated.
s372613503
p00242
C++
#include<iostream> #include<sstream> #include<vector> #include<map> using namespace std; typedef pair<int,string> P; vector<string> t; vector<P> u; int n,c; string str,tmp; int main(){ while(cin>>n&&n){ t.clear(); u.clear(); cin.ignore(); for(int i=0;i<n;i++){ getline(cin,str); stringstream ss(str); while(ss>>tmp){ t.push_back(tmp); } } sort(t.begin(),t.end()); c=1; for(int i=1;i<(int)t.size();i++){ if(t[i-1]==t[i])c++; else{ c=1; u.push_back(P(c,t[i-1])); } } u.push_back(P(c,t[t.size()-1])); sort(u.begin(),u.end()); cin>>str; int len=str.size(); c=0; for(int i=0;i<(int)u.size();i++){ if(len>(int)u[i].second.size())continue; if(str==u[i].second.substr(0,len)){ if(c)cout<<' '; cout<<u[i].second; c++; } if(c==5)break; } if(c==0)cout<<"NA"<<endl; else cout<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:24:5: error: 'sort' was not declared in this scope; did you mean 'short'? 24 | sort(t.begin(),t.end()); | ^~~~ | short
s609361456
p00242
C++
include <iostream> #include <vector> #include <string> #include <cstdio> #include <map> using namespace std; int main(){ int n; while(cin >> n, n){ char c; vector <string> v; map<string, int> d; for(int i = 0; i < n; i++){ bool first = false; while(true){ string s; if(first && getchar() == '\n') break; first = true; cin >> s; if(!d[s]) v.push_back(s); d[s]--; } } vector <string> ans; cin >> c; for(map<string, int>::iterator it = d.begin(); it != d.end(); it++){ if(it->first[0] == c) ans.push_back(it->first); if(ans.size() == 5) break; } if(!ans.size()) cout << "NA" << endl; for(int i = 0; i < ans.size(); i++) printf("%s%c", ans[i].c_str(), (i == ans.size()-1 ? '\n' : ' ')); } }
a.cc:1:1: error: 'include' does not name a type 1 | include <iostream> | ^~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/vector:62, from a.cc:2: /usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity 164 | __is_null_pointer(std::nullptr_t) | ^ /usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)' 159 | __is_null_pointer(_Type) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std' 164 | __is_null_pointer(std::nullptr_t) | ^~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/type_traits:295:27: error: 'size_t' has not been declared 295 | template <typename _Tp, size_t = sizeof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std' 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:984:26: error: 'size_t' has not been declared 984 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std' 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std' 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std' 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std' 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1451:32: error: 'size_t' was not declared in this scope 1451 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 63 | #include <bits/version.h> +++ |+#include <cstddef> 64 | /usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid 1451 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared 1453 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope 1454 | struct extent<_Tp[_Size], 0> | ^~~~~ /usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid 1454 | struct extent<_Tp[_Size], 0> | ^ /usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~ /usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid 1455 | : public integral_constant<size_t, _Size> { }; | ^ /usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid /usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared 1457 | template<typename _Tp, unsigned _Uint, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope 1458 | struct extent<_Tp[_Size], _Uint> | ^~~~~ /usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid 1458 | struct extent<_Tp[_Size], _Uint> | ^ /usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope 1463 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid 1463 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type 1857 | { static constexpr size_t __size = sizeof(_Tp); }; | ^~~~~~ /usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~~~~ /usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~ /usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp' 1860 | struct __select; | ^~~~~~~~ /usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared 1862 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^~~ /usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^ /usr/include/c++/14/type_traits:1866:14: error: 'size_t' has not been declared 1866 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1867:23: error: '_Sz' was not declared in this scope 1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false> | ^~~ /usr/include/c++/14/type_traits:1867:58: error: template argument 1 is invalid 1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false> |
s920436048
p00242
C++
#include <iostream> #include <vector> #include <string> #include <cstdio> #include <map> using namespace std; int main(){ int n; while(cin >> n, n){ char c; vector <string> v; map<string, int> d; for(int i = 0; i < n; i++){ bool first = false; while(true){ string s; if(first && getchar() == '\n') break; first = true; cin >> s; if(!d[s]) v.push_back(s); d[s]--; } } cin >> c; vector <pair<int, string> > ans; for(int i = 0; i < v.size(); i++){ if(v[i][0] == c) ans.push_back(make_pair(d[v[i]], v[i])); } sort(ans.begin(), ans.end()); if(!ans.size()) cout << "NA" << endl; for(int i = 0; i < ans.size() && i < 5; i++) printf("%s%c", ans[i].second.c_str(), (i == ans.size()-1 || i == 4 ? '\n' : ' ')); } }
a.cc: In function 'int main()': a.cc:33:5: error: 'sort' was not declared in this scope; did you mean 'short'? 33 | sort(ans.begin(), ans.end()); | ^~~~ | short
s078965657
p00242
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef tuple<int, string> duo; #define TT template<typename T> #define TTF template<typename T, typename F> #define ET(T) typename T::value_type TT inline T sq(T x){return x*x;} TT inline T In(){T x;cin>>x;return x;} TT inline void Out(T&x){cout<<x;} TT inline void sort(T&v){sort(begin(v),end(v));} TT inline void revs(T&v){reverse(begin(v),end(v));} TT inline void uniq(T&v){sort(v);v.erase(unique(begin(v),end(v)),end(v));} TT inline int ubnd(T&v,ET(T)&x){return upper_bound(begin(v),end(v),x)-begin(v);} TT inline int lbnd(T&v,ET(T)&x){return lower_bound(begin(v),end(v),x)-begin(v);} TTF inline void inpt(T&v,int n,F f){for(v.reserve(n);n--;v.emplace_back(f()));} TTF inline void show(T&v,F f,string d=" ",string e="\n"){int i=0;for(auto&x:v)i++&&(cout<<d),f(x);cout<<e;} #undef TT #undef TTF #undef ET inline void fast_io(){ios::sync_with_stdio(0);cin.tie(0);} inline int in(){int x;scanf("%d",&x);return x;} inline ll pow_mod(ll a,ll k,ll m){ll r=1;for(;k>0;a=a*a%m,k>>=1)if(k&1)r=r*a%m;return r;} inline ll mod_inv(ll a,ll p){return pow_mod(a,p-2,p);} const int dx[] = {0, 0, 1, -1, 1, 1, -1, -1}; const int dy[] = {1, -1, 0, 0, 1, -1, 1, -1}; const int Mod = 1000000000; int main() { int n; while (cin >> n, n){ map<string, int> cnt; for (int i = 0; i < n; i++){ string line; cin.ignore(); getline(cin, line); stringstream ss(line); for (string tkn; getline(ss, tkn, ' '); cnt[tkn]++); } string c = In<string>(); vector<duo> out; for (const auto& si : cnt){ if (si.first[0] == c[0]){ out.push_back(duo(-si.second, si.first)); } } if (!out.size()) puts("NA"); else { sort(out); if (out.size() > 5u) out.erase(begin(out) + 5, end(out)); for (int i = 0; i < (int)out.size(); i++){ printf("%s%c", get<1>(out).c_str(), " \n"[i == (int)out.size() - 1]); } } } return (0); } // priority_queue queue deque front stringstream max_element min_element insert count make_tuple
a.cc: In function 'int main()': a.cc:59:30: error: no matching function for call to 'get<1>(std::vector<std::tuple<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&)' 59 | printf("%s%c", get<1>(out).c_str(), " \n"[i == (int)out.size() - 1]); | ~~~~~~^~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_pair.h:1250:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(pair<_Tp1, _Tp2>&)' 1250 | get(pair<_Tp1, _Tp2>& __in) noexcept | ^~~ /usr/include/c++/14/bits/stl_pair.h:1250:5: note: template argument deduction/substitution failed: a.cc:59:30: note: 'std::vector<std::tuple<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >' is not derived from 'std::pair<_Tp1, _Tp2>' 59 | printf("%s%c", get<1>(out).c_str(), " \n"[i == (int)out.size() - 1]); | ~~~~~~^~~~~ /usr/include/c++/14/bits/stl_pair.h:1255:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&& std::get(pair<_Tp1, _Tp2>&&)' 1255 | get(pair<_Tp1, _Tp2>&& __in) noexcept | ^~~ /usr/include/c++/14/bits/stl_pair.h:1255:5: note: template argument deduction/substitution failed: a.cc:59:30: note: 'std::vector<std::tuple<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >' is not derived from 'std::pair<_Tp1, _Tp2>' 59 | printf("%s%c", get<1>(out).c_str(), " \n"[i == (int)out.size() - 1]); | ~~~~~~^~~~~ /usr/include/c++/14/bits/stl_pair.h:1260:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr const typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(const pair<_Tp1, _Tp2>&)' 1260 | get(const pair<_Tp1, _Tp2>& __in) noexcept | ^~~ /usr/include/c++/14/bits/stl_pair.h:1260:5: note: template argument deduction/substitution failed: a.cc:59:30: note: 'std::vector<std::tuple<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >' is not derived from 'const std::pair<_Tp1, _Tp2>' 59 | printf("%s%c", get<1>(out).c_str(), " \n"[i == (int)out.size() - 1]); | ~~~~~~^~~~~ /usr/include/c++/14/bits/stl_pair.h:1265:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr const typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&& std::get(const pair<_Tp1, _Tp2>&&)' 1265 | get(const pair<_Tp1, _Tp2>&& __in) noexcept | ^~~ /usr/include/c++/14/bits/stl_pair.h:1265:5: note: template argument deduction/substitution failed: a.cc:59:30: note: 'std::vector<std::tuple<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >' is not derived from 'const std::pair<_Tp1, _Tp2>' 59 | printf("%s%c", get<1>(out).c_str(), " \n"[i == (int)out.size() - 1]); | ~~~~~~^~~~~ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/tuple:2445:5: note: candidate: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >& std::get(tuple<_Elements ...>&)' 2445 | get(tuple<_Elements...>& __t) noexcept | ^~~ /usr/include/c++/14/tuple:2445:5: note: template argument deduction/substitution failed: a.cc:59:30: note: 'std::vector<std::tuple<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >' is not derived from 'std::tuple<_Elements ...>' 59 | printf("%s%c", get<1>(out).c_str(), " \n"[i == (int)out.size() - 1]); | ~~~~~~^~~~~ /usr/include/c++/14/tuple:2451:5: note: candidate: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >& std::get(const tuple<_Elements ...>&)' 2451 | get(const tuple<_Elements...>& __t) noexcept | ^~~ /usr/include/c++/14/tuple:2451:5: note: template argument deduction/substitution failed: a.cc:59:30: note: 'std::vector<std::tuple<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >' is not derived from 'const std::tuple<_Elements ...>' 59 | printf("%s%c", get<1>(out).c_str(), " \n"[i == (int)out.size() - 1]); | ~~~~~~^~~~~ /usr/include/c++/14/tuple:2457:5: note: candidate: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >&& std::get(tuple<_Elements ...>&&)' 2457 | get(tuple<_Elements...>&& __t) noexcept | ^~~ /usr/include/c++/14/tuple:2457:5: note: template argument deduction/substitution failed: a.cc:59:30: note: 'std::vector<std::tuple<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >' is not derived from 'std::tuple<_Elements ...>' 59 | printf("%s%c", get<1>(out).c_str(), " \n"[i == (int)out.size() - 1]); | ~~~~~~^~~~~ /usr/include/c++/14/tuple:2466:5: note: candidate: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >&& std::get(const tuple<_Elements ...>&&)' 2466 | get(const tuple<_Elements...>&& __t) noexcept | ^~~ /usr/include/c++/14/tuple:2466:5: note: template argument deduction/substitution failed: a.cc:59:30: note: 'std::vector<std::tuple<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >' is not derived from 'const std::tuple<_Elements ...>' 59 | printf("%s%c", get<1>(out).c_str(), " \n"[i == (int)out.size() - 1]); | ~~~~~~^~~~~ In file included from /usr/include/c++/14/functional:65, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53: /usr/include/c++/14/array:390:5: note: candidate: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr _Tp& std::get(array<_Tp, _Nm>&)' 390 | get(array<_Tp, _Nm>& __arr) noexcept | ^~~ /usr/include/c++/14/array:390:5: note: template argument deduction/substitution failed: a.cc:59:30: note: 'std::vector<std::tuple<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >' is not derived from 'std::array<_Tp, _Nm>' 59 | printf("%s%c", get<1>(out).c_str(), " \n"[i == (int)out.size() - 1]); | ~~~~~~^~~~~ /usr/include/c++/14/array:399:5: note: candidate: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr _Tp&& std::get(array<_Tp, _Nm>&&)' 399 | get(array<_Tp, _Nm>&& __arr) noexcept | ^~~ /usr/include/c++/14/array:399:5: note: template argument deduction/substitution failed: a.cc:59:30: note: 'std::vector<std::tuple<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >' is not derived from 'std::array<_Tp, _Nm>' 59 | printf("%s%c", get<1>(out).c_str(), " \n"[i == (int)out.size() - 1]); | ~~~~~~^~~~~ /usr/include/c++/14/array:408:5: note: candidate: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr const _Tp& std::get(const array<_Tp, _Nm>&)' 408 | get(const array<_Tp, _Nm>& __arr) noexcept | ^~~ /usr/include/c++/14/array:408:5: note: template argument deduction/substitution failed: a.cc:59:30: note: 'std::vector<std::tuple<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >' is not derived from 'const std::array<_Tp, _Nm>' 59 | printf("%s%c", get<1>(out).c_str(), " \n"[i == (int)out.size() - 1]); | ~~~~~~^~~~~ /usr/include/c++/14/array:417:5: note: candidate: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr const _Tp&& std::get(const array<_Tp, _Nm>&&)' 417 | get(const array<_Tp, _Nm>&& __arr) noexcept | ^~~ /usr/include/c++/14/array:417:5: note: template argument deduction/substitution failed: a.cc:59:30: note: 'std::vector<std::tuple<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >' is not derived from 'const std::array<_Tp, _Nm>' 59 | printf("%s%c", get<1>(out).c_str(), " \n"[i == (int)out.size() - 1]); | ~~~~~~^~~~~ /usr/include/c++/14/bits/stl_pair.h:1272:5: note: candidate: 'template<class _Tp, class _Up> constexpr _Tp& std::get(pair<_T1, _T2>&)' 1272 | get(pair<_Tp, _Up>& __p) noexcept | ^~~ /usr/include/c++/14/bits/stl_pair.h:1272:5: note: template argument deduction/substitution failed: a.cc:59:30: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Tp, class _Up> constexpr _Tp& std::get(pair<_T1, _T2>&)' 59 | printf("%s%c", get<1>(out).c_str(), " \n"[i == (int)out.size() - 1]); | ~~~~~~^~~~~ a.cc:59:30: note: expected a type, got '1' /usr/include/c++/14/bits/stl_pair.h:1277:5: note: candidate: 'template<class _Tp, class _Up> constexpr const _Tp& std::get(const pair<_T1, _T2>&)' 1277 | get(const pair<_Tp, _Up>& __p) noexcept | ^~~ /usr/include/c++/14/bits/stl_pair.h:1277:5: note: template argument deduction/substitution failed: a.cc:59:30: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Tp, class _Up> constexpr const _Tp& std::get(const pair<_T1, _T2>&)' 59 | printf("%s%c", get<1>(out).c_str(), " \n
s128891111
p00242
C++
#include<iostream> #include<string> #include<map> #include<vector> #include<functional> #include<cmath> #include<algorithm> using namespace std; int main(){ int n; char k; vector< pair<string,int> >m;//stringを出てきた回数順に並べるための連想配列 vector<string>words;//まずは出てきた単語をすべて格納 while(cin>>n,n){//13と入力された場合、13がnに入り、次の改行は、getlineに行ってしまう cin.ignore();// for(int i=0;i<n;i++){ string now,tmp; now.clear();tmp.clear(); getline(cin,now); for(int j=0;j<now.size();j++){ if(now[j]!=' ')tmp+=now[j]; else { words.push_back(tmp); tmp.clear(); } if(j==now.size()-1)words.push_back(tmp); } } cin>>k; for(int i=0;i<words.size();i++){ if(words[i][0]==k){ bool flag=false; for(int j=0;j<m.size();j++){ if(m[j].first==words[i]){ m[j].second--; flag=true; } } if(flag==false)m.push_back(pair<string,int>(words[i],-1)); } } //sort(m.begin(),m.end(),greater<pair< string,int> >()); for(int i=0;i<m.size();i++){ for(int j=0;j<m.size();j++){ if(m[i].second<m[j].second)swap(m[i],m[j]); } } //for(int i=0;i<m.size();i++)cout<<m[i].first<<" "<<m[i].second<<endl; for(int i=0;i<m.size();i++){ for(int j=0;j<m.size();j++){ if(m[i].first<m[j].first&&m[i].second==m[j].second)swap(m[i],m[j]); } } unsigned int x=5; if(m.size()==0)cout<<"NA"<<endl; else{ for(int i=0;i<std::min(m.size(),x);i++){ if(i!=std::min(m.size(),x)-1)cout<<m[i].first<<" "; else cout<<m[i].first<<endl; } } m.clear();words.clear(); } }
a.cc: In function 'int main()': a.cc:59:39: error: no matching function for call to 'min(std::vector<std::pair<std::__cxx11::basic_string<char>, int> >::size_type, unsigned int&)' 59 | for(int i=0;i<std::min(m.size(),x);i++){ | ~~~~~~~~^~~~~~~~~~~~ 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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:59:39: note: deduced conflicting types for parameter 'const _Tp' ('long unsigned int' and 'unsigned int') 59 | for(int i=0;i<std::min(m.size(),x);i++){ | ~~~~~~~~^~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:7: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:59:39: note: mismatched types 'std::initializer_list<_Tp>' and 'long unsigned int' 59 | for(int i=0;i<std::min(m.size(),x);i++){ | ~~~~~~~~^~~~~~~~~~~~ a.cc:60:39: error: no matching function for call to 'min(std::vector<std::pair<std::__cxx11::basic_string<char>, int> >::size_type, unsigned int&)' 60 | if(i!=std::min(m.size(),x)-1)cout<<m[i].first<<" "; | ~~~~~~~~^~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:60:39: note: deduced conflicting types for parameter 'const _Tp' ('long unsigned int' and 'unsigned int') 60 | if(i!=std::min(m.size(),x)-1)cout<<m[i].first<<" "; | ~~~~~~~~^~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:60:39: note: mismatched types 'std::initializer_list<_Tp>' and 'long unsigned int' 60 | if(i!=std::min(m.size(),x)-1)cout<<m[i].first<<" "; | ~~~~~~~~^~~~~~~~~~~~
s322416827
p00242
C++
#include<iostream> #include<string> #include<map> #include<vector> #include<functional> #include<cmath> #include<algorithm> using namespace std; int main(){ int n; char k; vector< pair<string,int> >m;//stringを出てきた回数順に並べるための連想配列 vector<string>words;//まずは出てきた単語をすべて格納 while(cin>>n,n){//13と入力された場合、13がnに入り、次の改行は、getlineに行ってしまう cin.ignore();// for(int i=0;i<n;i++){ string now,tmp; now.clear();tmp.clear(); getline(cin,now); for(int j=0;j<now.size();j++){ if(now[j]!=' ')tmp+=now[j]; else { words.push_back(tmp); tmp.clear(); } if(j==now.size()-1)words.push_back(tmp); } } cin>>k; for(int i=0;i<words.size();i++){ if(words[i][0]==k){ bool flag=false; for(int j=0;j<m.size();j++){ if(m[j].first==words[i]){ m[j].second--; flag=true; } } if(flag==false)m.push_back(pair<string,int>(words[i],-1)); } } //sort(m.begin(),m.end(),greater<pair< string,int> >()); for(int i=0;i<m.size();i++){ for(int j=0;j<m.size();j++){ if(m[i].second<m[j].second)swap(m[i],m[j]); } } //for(int i=0;i<m.size();i++)cout<<m[i].first<<" "<<m[i].second<<endl; for(int i=0;i<m.size();i++){ for(int j=0;j<m.size();j++){ if(m[i].first<m[j].first&&m[i].second==m[j].second)swap(m[i],m[j]); } } unsigned int x=5; if(m.size()==0)cout<<"NA"<<endl; else{ for(int i=0;i<std::min(m.size(),x);i++){ if(i!=std::min(m.size(),x)-1)cout<<m[i].first<<" "; else cout<<m[i].first<<endl; } } m.clear();words.clear(); } }
a.cc: In function 'int main()': a.cc:59:39: error: no matching function for call to 'min(std::vector<std::pair<std::__cxx11::basic_string<char>, int> >::size_type, unsigned int&)' 59 | for(int i=0;i<std::min(m.size(),x);i++){ | ~~~~~~~~^~~~~~~~~~~~ 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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:59:39: note: deduced conflicting types for parameter 'const _Tp' ('long unsigned int' and 'unsigned int') 59 | for(int i=0;i<std::min(m.size(),x);i++){ | ~~~~~~~~^~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:7: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:59:39: note: mismatched types 'std::initializer_list<_Tp>' and 'long unsigned int' 59 | for(int i=0;i<std::min(m.size(),x);i++){ | ~~~~~~~~^~~~~~~~~~~~ a.cc:60:39: error: no matching function for call to 'min(std::vector<std::pair<std::__cxx11::basic_string<char>, int> >::size_type, unsigned int&)' 60 | if(i!=std::min(m.size(),x)-1)cout<<m[i].first<<" "; | ~~~~~~~~^~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:60:39: note: deduced conflicting types for parameter 'const _Tp' ('long unsigned int' and 'unsigned int') 60 | if(i!=std::min(m.size(),x)-1)cout<<m[i].first<<" "; | ~~~~~~~~^~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:60:39: note: mismatched types 'std::initializer_list<_Tp>' and 'long unsigned int' 60 | if(i!=std::min(m.size(),x)-1)cout<<m[i].first<<" "; | ~~~~~~~~^~~~~~~~~~~~
s767733412
p00242
C++
#include<iostream> #include<string> #include<vector> #include<algorithm> #include<utility> using namespace std; typedef pair<int, string> PIS; typedef vector<PIS> VP; typedef VP::iterator VPI; void bsort(VP word){ VPI p1, p2; for (p1 = word.begin(); p1 != word.end(); p1++){ for (p2 = word.begin(); p2 != word.end() - 1; p2++){ if (p2->first < (p2 + 1)->first) swap(p2, p2 + 1); else if (p2->first == (p2 + 1)->first && p2->second > (p2 + 1)->second) swap(p2, p2 + 1); } } return; } int main() { while (true){ int n; cin >> n; if (!n) break; VP word; VPI p; string s = ""; char sample; cin.ignore(); for (int i = 0; i < n; i++){ string in; getline(cin, in); in += ' '; s += in; } cin >> sample; string hoge = ""; for (int i = 0; i < s.size(); i++){ if (s[i] == ' '){ if (hoge[0] == sample) word.push_back(make_pair(1, hoge)); hoge = ""; } else hoge += s[i]; } if (word.empty()){ cout << "NA" << endl; continue; } sort(word.begin(), word.end()); for (p = word.begin(); p != word.end() - 1; p++){ if (*p == *(p + 1)){ p->first++; word.erase(p + 1); } } bsort(word); p = word.begin(); for (int i = 0; p != word.end() && i < 5; i++, p++){ cout << p->second; if (p == word.end() - 1 || i == 4) cout << endl; else cout << " "; } } return 0; }
a.cc: In function 'void bsort(VP)': a.cc:15:62: error: no matching function for call to 'swap(VPI&, __gnu_cxx::__normal_iterator<std::pair<int, std::__cxx11::basic_string<char> >*, std::vector<std::pair<int, std::__cxx11::basic_string<char> > > >)' 15 | if (p2->first < (p2 + 1)->first) swap(p2, p2 + 1); | ~~~~^~~~~~~~~~~~ In file included from /usr/include/c++/14/bits/exception_ptr.h:41, from /usr/include/c++/14/exception:166, from /usr/include/c++/14/ios:41, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/move.h:226:5: note: candidate: 'std::_Require<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&) [with _Tp = __gnu_cxx::__normal_iterator<pair<int, __cxx11::basic_string<char> >*, vector<pair<int, __cxx11::basic_string<char> > > >; _Require<__not_<__is_tuple_like<_Tp> >, is_move_constructible<_Tp>, is_move_assignable<_Tp> > = void]' (near match) 226 | swap(_Tp& __a, _Tp& __b) | ^~~~ /usr/include/c++/14/bits/move.h:226:5: note: conversion of argument 2 would be ill-formed: a.cc:15:70: error: cannot bind non-const lvalue reference of type '__gnu_cxx::__normal_iterator<std::pair<int, std::__cxx11::basic_string<char> >*, std::vector<std::pair<int, std::__cxx11::basic_string<char> > > >&' to an rvalue of type '__gnu_cxx::__normal_iterator<std::pair<int, std::__cxx11::basic_string<char> >*, std::vector<std::pair<int, std::__cxx11::basic_string<char> > > >' 15 | if (p2->first < (p2 + 1)->first) swap(p2, p2 + 1); | ~~~^~~ /usr/include/c++/14/bits/exception_ptr.h:229:5: note: candidate: 'void std::__exception_ptr::swap(exception_ptr&, exception_ptr&)' 229 | swap(exception_ptr& __lhs, exception_ptr& __rhs) | ^~~~ /usr/include/c++/14/bits/exception_ptr.h:229:25: note: no known conversion for argument 1 from 'VPI' {aka 'std::vector<std::pair<int, std::__cxx11::basic_string<char> > >::iterator'} to 'std::__exception_ptr::exception_ptr&' 229 | swap(exception_ptr& __lhs, exception_ptr& __rhs) | ~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/14/bits/move.h:250:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> std::__enable_if_t<((bool)std::__is_swappable<_Tp>::value)> std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm])' 250 | swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]) | ^~~~ /usr/include/c++/14/bits/move.h:250:5: note: template argument deduction/substitution failed: a.cc:15:62: note: mismatched types '_Tp [_Nm]' and 'VPI' {aka 'std::vector<std::pair<int, std::__cxx11::basic_string<char> > >::iterator'} 15 | if (p2->first < (p2 + 1)->first) swap(p2, p2 + 1); | ~~~~^~~~~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, 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: /usr/include/c++/14/bits/stl_pair.h:1089:5: note: candidate: 'template<class _T1, class _T2> typename std::enable_if<std::__and_<std::__is_swappable<_T1>, std::__is_swappable<_T2> >::value>::type std::swap(pair<_T1, _T2>&, pair<_T1, _T2>&)' 1089 | swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y) | ^~~~ /usr/include/c++/14/bits/stl_pair.h:1089:5: note: template argument deduction/substitution failed: a.cc:15:62: note: 'VPI' {aka 'std::vector<std::pair<int, std::__cxx11::basic_string<char> > >::iterator'} is not derived from 'std::pair<_T1, _T2>' 15 | if (p2->first < (p2 + 1)->first) swap(p2, p2 + 1); | ~~~~^~~~~~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1106:5: note: candidate: 'template<class _T1, class _T2> typename std::enable_if<(! std::__and_<std::__is_swappable<_T1>, std::__is_swappable<_T2> >::value)>::type std::swap(pair<_T1, _T2>&, pair<_T1, _T2>&)' (deleted) 1106 | swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete; | ^~~~ /usr/include/c++/14/bits/stl_pair.h:1106:5: note: template argument deduction/substitution failed: a.cc:15:62: note: 'VPI' {aka 'std::vector<std::pair<int, std::__cxx11::basic_string<char> > >::iterator'} is not derived from 'std::pair<_T1, _T2>' 15 | if (p2->first < (p2 + 1)->first) swap(p2, p2 + 1); | ~~~~^~~~~~~~~~~~ In file included from /usr/include/c++/14/string:54: /usr/include/c++/14/bits/basic_string.h:4039:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> void std::swap(__cxx11::basic_string<_CharT, _Traits, _Allocator>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 4039 | swap(basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~ /usr/include/c++/14/bits/basic_string.h:4039:5: note: template argument deduction/substitution failed: a.cc:15:62: note: 'VPI' {aka 'std::vector<std::pair<int, std::__cxx11::basic_string<char> > >::iterator'} is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 15 | if (p2->first < (p2 + 1)->first) swap(p2, p2 + 1); | ~~~~^~~~~~~~~~~~ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2805:5: note: candidate: 'template<class ... _Elements> typename std::enable_if<std::__and_<std::__is_swappable<_Elements>...>::value>::type std::swap(tuple<_UTypes ...>&, tuple<_UTypes ...>&)' 2805 | swap(tuple<_Elements...>& __x, tuple<_Elements...>& __y) | ^~~~ /usr/include/c++/14/tuple:2805:5: note: template argument deduction/substitution failed: a.cc:15:62: note: 'VPI' {aka 'std::vector<std::pair<int, std::__cxx11::basic_string<char> > >::iterator'} is not derived from 'std::tuple<_UTypes ...>' 15 | if (p2->first < (p2 + 1)->first) swap(p2, p2 + 1); | ~~~~^~~~~~~~~~~~ /usr/include/c++/14/tuple:2823:5: note: candidate: 'template<class ... _Elements> typename std::enable_if<(! std::__and_<std::__is_swappable<_Elements>...>::value)>::type std::swap(tuple<_UTypes ...>&, tuple<_UTypes ...>&)' (deleted) 2823 | swap(tuple<_Elements...>&, tuple<_Elements...>&) = delete; | ^~~~ /usr/include/c++/14/tuple:2823:5: note: template argument deduction/substitution failed: a.cc:15:62: note: 'VPI' {aka 'std::vector<std::pair<int, std::__cxx11::basic_string<char> > >::iterator'} is not derived from 'std::tuple<_UTypes ...>' 15 | if (p2->first < (p2 + 1)->first) swap(p2, p2 + 1); | ~~~~^~~~~~~~~~~~ In file included from /usr/include/c++/14/vector:66, from a.cc:3: /usr/include/c++/14/bits/stl_vector.h:2122:5: note: candidate: 'template<class _Tp, class _Alloc> void std::swap(vector<_Tp, _Alloc>&, vector<_Tp, _Alloc>&)' 2122 | swap(vector<_Tp, _Alloc>& __x, vector<_Tp, _Alloc>& __y) | ^~~~ /usr/include/c++/14/bits/stl_vector.h:2122:5: note: template argument deduction/substitution failed: a.cc:15:62: note: 'VPI' {aka 'std::vector<std::pair<int, std::__cxx11::basic_string<char> > >::iterator'} is not derived from 'std::vector<_Tp, _Alloc>' 15 | if (p2->first < (p2 + 1)->first) swap(p2, p2 + 1); | ~~~~^~~~~~~~~~~~ a.cc:16:101: error: no matching function for call to 'swap(VPI&, __gnu_cxx::__normal_iterator<std::pair<int, std::__cxx11::basic_string<char> >*, std::vector<std::pair<int, std::__cxx11::basic_string<char> > > >)' 16 | else if (p2->first == (p2 + 1)->first && p2->second > (p2 + 1)->second) swap(p2, p2 + 1); | ~~~~^~~~~~~~~~~~ /usr/include/c++/14/bits/move.h:226:5: note: candidate: 'std::_Require<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&) [with _Tp = __gnu_cxx::__normal_iterator<pair<int, __cxx11::basic_string<char> >*, vector<pair<int, __cxx11::basic_string<char> > > >; _Require<__not_<__is_tuple_like<_Tp> >, is_move_constructible<_Tp>, is_move_assignable<_Tp> > = void]' (near match) 226 | swap(_Tp& __a, _Tp& __b) | ^~~~ /usr/include/c++/14/bits/move.h:226:5: note: conversion of argument 2 would be ill-formed: a.cc:16:109: error: cannot bind non-const lvalue reference of type '__gnu_cxx::__normal_iterator<std::pair<int, std::__cxx11::basic_string<char> >*, std::vector<std::pair<int, std::__cxx11::basic_string<char> > > >&' to an rvalue of type '__gnu_cxx::__normal_iterator<std::pair<int, std::__cxx11::basic_string<char> >*, std::vector<std::pair<int, std::__cxx11::basic_string<char> > > >' 16 | else if (p2->first == (p2 + 1)->first && p2->second > (p2 + 1)->second) swap(p2, p2 + 1); | ~~~^~~ /usr/include/c++/14/bits/exception_ptr.h:229:5: note: candidate: 'void std::__exception_ptr::swap(exception_ptr&, exception_ptr&)' 229 | swap(exception_ptr& __lhs, exception_ptr& __rhs) | ^~~~ /usr/include/c++/14/bits/exception_ptr.h:229:25: note: no known conversion for argument 1 from 'VPI' {aka 'std::vector<std::pair<int, std::__cxx11::basic_string<char> > >::iterator'} to 'std::__exception_ptr::exception_ptr&' 229 | swap(exception_ptr& __lhs, exception_ptr& __rhs) | ~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/
s984932277
p00242
C++
#include<bits/stdc++.h> using namespace std; typedef pair<int, string> PIS; typedef vector<PIS> VP; typedef VP::iterator VPI; void bsort(VP word){ VPI p1, p2; for (p1 = word.begin(); p1 != word.end(); p1++){ for (p2 = word.begin(); p2 != word.end() - 1; p2++){ if (p2->first < (p2 + 1)->first) swap(p2, p2 + 1); else if (p2->first == (p2 + 1)->first && p2->second > (p2 + 1)->second) swap(p2, p2 + 1); } } return; } int main() { while (true){ int n; cin >> n; if (!n) break; VP word; VPI p; string s = ""; char sample; cin.ignore(); for (int i = 0; i < n; i++){ string in; getline(cin, in); in += ' '; s += in; } cin >> sample; string hoge = ""; for (int i = 0; i < s.size(); i++){ if (s[i] == ' '){ if (hoge[0] == sample) word.push_back(make_pair(1, hoge)); hoge = ""; } else hoge += s[i]; } if (word.empty()){ cout << "NA" << endl; continue; } sort(word.begin(), word.end()); for (p = word.begin(); p != word.end() - 1; p++){ if (*p == *(p + 1)){ p->first++; word.erase(p + 1); } } bsort(word); p = word.begin(); for (int i = 0; p != word.end() && i < 5; i++, p++){ cout << p->second; if (p == word.end() - 1 || i == 4) cout << endl; else cout << " "; } } return 0; }
a.cc: In function 'void bsort(VP)': a.cc:11:62: error: no matching function for call to 'swap(VPI&, __gnu_cxx::__normal_iterator<std::pair<int, std::__cxx11::basic_string<char> >*, std::vector<std::pair<int, std::__cxx11::basic_string<char> > > >)' 11 | if (p2->first < (p2 + 1)->first) swap(p2, p2 + 1); | ~~~~^~~~~~~~~~~~ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:77, from a.cc:1: /usr/include/c++/14/any:430:15: note: candidate: 'void std::swap(any&, any&)' (near match) 430 | inline void swap(any& __x, any& __y) noexcept { __x.swap(__y); } | ^~~~ /usr/include/c++/14/any:430:15: note: conversion of argument 2 would be ill-formed: a.cc:11:70: error: cannot bind non-const lvalue reference of type 'std::any&' to an rvalue of type 'std::any' 11 | if (p2->first < (p2 + 1)->first) swap(p2, p2 + 1); | ~~~^~~ /usr/include/c++/14/any:191:7: note: after user-defined conversion: 'std::any::any(_Tp&&) [with _Tp = __gnu_cxx::__normal_iterator<std::pair<int, std::__cxx11::basic_string<char> >*, std::vector<std::pair<int, std::__cxx11::basic_string<char> > > >; _VTp = __gnu_cxx::__normal_iterator<std::pair<int, std::__cxx11::basic_string<char> >*, std::vector<std::pair<int, std::__cxx11::basic_string<char> > > >; _Mgr = _Manager_internal<__gnu_cxx::__normal_iterator<std::pair<int, std::__cxx11::basic_string<char> >*, std::vector<std::pair<int, std::__cxx11::basic_string<char> > > > >; typename std::enable_if<(is_copy_constructible_v<_VTp> && (! __is_in_place_type_v<_VTp>)), bool>::type <anonymous> = true]' 191 | any(_Tp&& __value) | ^~~ In file included from /usr/include/c++/14/bits/stl_pair.h:61, from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/bits/move.h:226:5: note: candidate: 'std::_Require<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&) [with _Tp = __gnu_cxx::__normal_iterator<pair<int, __cxx11::basic_string<char> >*, vector<pair<int, __cxx11::basic_string<char> > > >; _Require<__not_<__is_tuple_like<_Tp> >, is_move_constructible<_Tp>, is_move_assignable<_Tp> > = void]' (near match) 226 | swap(_Tp& __a, _Tp& __b) | ^~~~ /usr/include/c++/14/bits/move.h:226:5: note: conversion of argument 2 would be ill-formed: a.cc:11:70: error: cannot bind non-const lvalue reference of type '__gnu_cxx::__normal_iterator<std::pair<int, std::__cxx11::basic_string<char> >*, std::vector<std::pair<int, std::__cxx11::basic_string<char> > > >&' to an rvalue of type '__gnu_cxx::__normal_iterator<std::pair<int, std::__cxx11::basic_string<char> >*, std::vector<std::pair<int, std::__cxx11::basic_string<char> > > >' 11 | if (p2->first < (p2 + 1)->first) swap(p2, p2 + 1); | ~~~^~~ In file included from /usr/include/c++/14/exception:166, from /usr/include/c++/14/stdexcept:38, from /usr/include/c++/14/system_error:43, from /usr/include/c++/14/bits/ios_base.h:46, from /usr/include/c++/14/streambuf:43, from /usr/include/c++/14/bits/streambuf_iterator.h:35, from /usr/include/c++/14/iterator:66, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54: /usr/include/c++/14/bits/exception_ptr.h:229:5: note: candidate: 'void std::__exception_ptr::swap(exception_ptr&, exception_ptr&)' 229 | swap(exception_ptr& __lhs, exception_ptr& __rhs) | ^~~~ /usr/include/c++/14/bits/exception_ptr.h:229:25: note: no known conversion for argument 1 from 'VPI' {aka 'std::vector<std::pair<int, std::__cxx11::basic_string<char> > >::iterator'} to 'std::__exception_ptr::exception_ptr&' 229 | swap(exception_ptr& __lhs, exception_ptr& __rhs) | ~~~~~~~~~~~~~~~^~~~~ In file included from /usr/include/c++/14/future:51, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:176: /usr/include/c++/14/bits/std_thread.h:328:3: note: candidate: 'void std::swap(thread&, thread&)' 328 | swap(thread& __x, thread& __y) noexcept | ^~~~ /usr/include/c++/14/bits/std_thread.h:328:16: note: no known conversion for argument 1 from 'VPI' {aka 'std::vector<std::pair<int, std::__cxx11::basic_string<char> > >::iterator'} to 'std::thread&' 328 | swap(thread& __x, thread& __y) noexcept | ~~~~~~~~^~~ In file included from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/sstream:1204:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(basic_stringbuf<_CharT, _Traits, _Alloc>&, basic_stringbuf<_CharT, _Traits, _Alloc>&)' 1204 | swap(basic_stringbuf<_CharT, _Traits, _Allocator>& __x, | ^~~~ /usr/include/c++/14/sstream:1204:5: note: template argument deduction/substitution failed: a.cc:11:62: note: 'VPI' {aka 'std::vector<std::pair<int, std::__cxx11::basic_string<char> > >::iterator'} is not derived from 'std::__cxx11::basic_stringbuf<_CharT, _Traits, _Alloc>' 11 | if (p2->first < (p2 + 1)->first) swap(p2, p2 + 1); | ~~~~^~~~~~~~~~~~ /usr/include/c++/14/sstream:1212:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(basic_istringstream<_CharT, _Traits, _Allocator>&, basic_istringstream<_CharT, _Traits, _Allocator>&)' 1212 | swap(basic_istringstream<_CharT, _Traits, _Allocator>& __x, | ^~~~ /usr/include/c++/14/sstream:1212:5: note: template argument deduction/substitution failed: a.cc:11:62: note: 'VPI' {aka 'std::vector<std::pair<int, std::__cxx11::basic_string<char> > >::iterator'} is not derived from 'std::__cxx11::basic_istringstream<_CharT, _Traits, _Allocator>' 11 | if (p2->first < (p2 + 1)->first) swap(p2, p2 + 1); | ~~~~^~~~~~~~~~~~ /usr/include/c++/14/sstream:1219:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(basic_ostringstream<_CharT, _Traits, _Allocator>&, basic_ostringstream<_CharT, _Traits, _Allocator>&)' 1219 | swap(basic_ostringstream<_CharT, _Traits, _Allocator>& __x, | ^~~~ /usr/include/c++/14/sstream:1219:5: note: template argument deduction/substitution failed: a.cc:11:62: note: 'VPI' {aka 'std::vector<std::pair<int, std::__cxx11::basic_string<char> > >::iterator'} is not derived from 'std::__cxx11::basic_ostringstream<_CharT, _Traits, _Allocator>' 11 | if (p2->first < (p2 + 1)->first) swap(p2, p2 + 1); | ~~~~^~~~~~~~~~~~ /usr/include/c++/14/sstream:1226:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(basic_stringstream<_CharT, _Traits, _Allocator>&, basic_stringstream<_CharT, _Traits, _Allocator>&)' 1226 | swap(basic_stringstream<_CharT, _Traits, _Allocator>& __x, | ^~~~ /usr/include/c++/14/sstream:1226:5: note: template argument deduction/substitution failed: a.cc:11:62: note: 'VPI' {aka 'std::vector<std::pair<int, std::__cxx11::basic_string<char> > >::iterator'} is not derived from 'std::__cxx11::basic_stringstream<_CharT, _Traits, _Allocator>' 11 | if (p2->first < (p2 + 1)->first) swap(p2, p2 + 1); | ~~~~^~~~~~~~~~~~ In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181: /usr/include/c++/14/bits/regex.h:896:5: note: candidate: 'template<class _Ch_type, class _Rx_traits> void std::__cxx11::swap(basic_regex<_Ch_type, _Rx_traits>&, basic_regex<_Ch_type, _Rx_traits>&)' 896 | swap(basic_regex<_Ch_type, _Rx_traits>& __lhs, | ^~~~ /usr/include/c++/14/bits/regex.h:896:5: note: template argument deduction/substitution failed: a.cc:11:62: note: 'VPI' {aka 'std::vector<std::pair<int, std::__cxx11::basic_string<char> > >::iterator'} is not derived from 'std::__cxx11::basic_regex<_Ch_type, _Rx_traits>' 11 | if (p2->first < (p2 + 1)->first) swap(p2, p2 + 1); | ~~~~^~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2230:5: note: candidate: 'template<class _Bi_iter, class _Alloc> void std::__cxx11::swap(match_results<_BiIter, _Alloc>&, match_results<_BiIter, _Alloc>&)' 2230 | swap(match_results<_Bi_iter, _Alloc>& __lhs, | ^~~~ /usr/include/c++/14/bits/regex.h:2230:5: note: template argument deduction/substitution failed: a.cc:11:62: note: 'VPI' {aka 'std::vector<std::pair<int, std::__cxx11::basic_string<char> > >::iterator'} is not derived from 'std::__cxx11::match_results<_BiIter, _Alloc>' 11 | if (p2->first < (p2 + 1)->first) swap(p2, p2 + 1); | ~~~~^~~~~~~~~~~~ /usr/include/c++/14/bits/move.h:250:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> std::__enable_if_t<((bool)std::__is_swappable<_Tp>::value)> std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm])' 250 | swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]) | ^~~~ /usr/include/c++/14/bits/move.h:250:5: note: template argument deduction/substitution failed: a.cc:11:62: note: mismatched types '_Tp [_Nm]' and 'VPI' {aka 'std::vector<std::pair<int, std::__cxx11::basic_string<char> > >::iterator'} 11 | if (p2->first < (p2 + 1)->first) swap(p2, p2 + 1); |
s088900924
p00242
C++
#include<bits/stdc++.h> using namespace std; typedef pair<int, string> PIS; typedef vector<PIS> VP; typedef VP::iterator VPI; void swap(PIS *d1, PIS *d2) { PIS hoge; hoge = d1; d1 = d2; d2 = hoge; return; } void bsort(VP word) { VPI p1, p2; for (p1 = word.begin(); p1 != word.end(); p1++){ for (p2 = word.begin(); p2 != word.end() - 1; p2++){ if (p2->first < (p2 + 1)->first) swap(p2, p2 + 1); else if (p2->first == (p2 + 1)->first && p2->second > (p2 + 1)->second) swap(p2, p2 + 1); } } return; } int main() { while (true){ int n; cin >> n; if (!n) break; VP word; VPI p; string s = ""; char sample; cin.ignore(); for (int i = 0; i < n; i++){ string in; getline(cin, in); in += ' '; s += in; } cin >> sample; string hoge = ""; for (int i = 0; i < s.size(); i++){ if (s[i] == ' '){ if (hoge[0] == sample) word.push_back(make_pair(1, hoge)); hoge = ""; } else hoge += s[i]; } if (word.empty()){ cout << "NA" << endl; continue; } sort(word.begin(), word.end()); for (p = word.begin(); p != word.end() - 1; p++){ if (*p == *(p + 1)){ p->first++; word.erase(p + 1); } } bsort(word); p = word.begin(); for (int i = 0; p != word.end() && i < 5; i++, p++){ cout << p->second; if (p == word.end() - 1 || i == 4) cout << endl; else cout << " "; } } return 0; }
a.cc: In function 'void swap(PIS*, PIS*)': a.cc:11:16: error: no match for 'operator=' (operand types are 'PIS' {aka 'std::pair<int, std::__cxx11::basic_string<char> >'} and 'PIS*' {aka 'std::pair<int, std::__cxx11::basic_string<char> >*'}) 11 | hoge = d1; | ^~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_pair.h:946:9: note: candidate: 'template<class _U1, class _U2> typename std::enable_if<std::__and_<std::is_assignable<_T1&, const _U1&>, std::is_assignable<_T2&, const _U2&> >::value, std::pair<_T1, _T2>&>::type std::pair<_T1, _T2>::operator=(const std::pair<_U1, _U2>&) [with _U2 = _U1; _T1 = int; _T2 = std::__cxx11::basic_string<char>]' 946 | operator=(const pair<_U1, _U2>& __p) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:946:9: note: template argument deduction/substitution failed: a.cc:11:16: note: mismatched types 'const std::pair<_T1, _T2>' and 'PIS*' {aka 'std::pair<int, std::__cxx11::basic_string<char> >*'} 11 | hoge = d1; | ^~ /usr/include/c++/14/bits/stl_pair.h:957:9: note: candidate: 'template<class _U1, class _U2> typename std::enable_if<std::__and_<std::is_assignable<_T1&, _U1&&>, std::is_assignable<_T2&, _U2&&> >::value, std::pair<_T1, _T2>&>::type std::pair<_T1, _T2>::operator=(std::pair<_U1, _U2>&&) [with _U2 = _U1; _T1 = int; _T2 = std::__cxx11::basic_string<char>]' 957 | operator=(pair<_U1, _U2>&& __p) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:957:9: note: template argument deduction/substitution failed: a.cc:11:16: note: mismatched types 'std::pair<_T1, _T2>' and 'PIS*' {aka 'std::pair<int, std::__cxx11::basic_string<char> >*'} 11 | hoge = d1; | ^~ /usr/include/c++/14/bits/stl_pair.h:921:7: note: candidate: 'std::pair<_T1, _T2>& std::pair<_T1, _T2>::operator=(std::__conditional_t<((bool)std::__and_<std::is_copy_assignable<_T1>, std::is_copy_assignable<_T2> >::value), const std::pair<_T1, _T2>&, const std::__nonesuch&>) [with _T1 = int; _T2 = std::__cxx11::basic_string<char>; std::__conditional_t<((bool)std::__and_<std::is_copy_assignable<_T1>, std::is_copy_assignable<_T2> >::value), const std::pair<_T1, _T2>&, const std::__nonesuch&> = const std::pair<int, std::__cxx11::basic_string<char> >&]' 921 | operator=(__conditional_t<__and_<is_copy_assignable<_T1>, | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:923:65: note: no known conversion for argument 1 from 'PIS*' {aka 'std::pair<int, std::__cxx11::basic_string<char> >*'} to 'std::__conditional_t<true, const std::pair<int, std::__cxx11::basic_string<char> >&, const std::__nonesuch&>' {aka 'const std::pair<int, std::__cxx11::basic_string<char> >&'} 921 | operator=(__conditional_t<__and_<is_copy_assignable<_T1>, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 922 | is_copy_assignable<_T2>>::value, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 923 | const pair&, const __nonesuch&> __p) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_pair.h:931:7: note: candidate: 'std::pair<_T1, _T2>& std::pair<_T1, _T2>::operator=(std::__conditional_t<((bool)std::__and_<std::is_move_assignable<_Tp>, std::is_move_assignable<_T2> >::value), std::pair<_T1, _T2>&&, std::__nonesuch&&>) [with _T1 = int; _T2 = std::__cxx11::basic_string<char>; std::__conditional_t<((bool)std::__and_<std::is_move_assignable<_Tp>, std::is_move_assignable<_T2> >::value), std::pair<_T1, _T2>&&, std::__nonesuch&&> = std::pair<int, std::__cxx11::basic_string<char> >&&]' 931 | operator=(__conditional_t<__and_<is_move_assignable<_T1>, | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:933:55: note: no known conversion for argument 1 from 'PIS*' {aka 'std::pair<int, std::__cxx11::basic_string<char> >*'} to 'std::__conditional_t<true, std::pair<int, std::__cxx11::basic_string<char> >&&, std::__nonesuch&&>' {aka 'std::pair<int, std::__cxx11::basic_string<char> >&&'} 931 | operator=(__conditional_t<__and_<is_move_assignable<_T1>, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 932 | is_move_assignable<_T2>>::value, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 933 | pair&&, __nonesuch&&> __p) | ~~~~~~~~~~~~~~~~~~~~~~^~~ a.cc:13:14: error: cannot convert 'PIS' {aka 'std::pair<int, std::__cxx11::basic_string<char> >'} to 'PIS*' {aka 'std::pair<int, std::__cxx11::basic_string<char> >*'} in assignment 13 | d2 = hoge; | ^~~~ | | | PIS {aka std::pair<int, std::__cxx11::basic_string<char> >} a.cc: In function 'void bsort(VP)': a.cc:22:62: error: no matching function for call to 'swap(VPI&, __gnu_cxx::__normal_iterator<std::pair<int, std::__cxx11::basic_string<char> >*, std::vector<std::pair<int, std::__cxx11::basic_string<char> > > >)' 22 | if (p2->first < (p2 + 1)->first) swap(p2, p2 + 1); | ~~~~^~~~~~~~~~~~ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:77: /usr/include/c++/14/any:430:15: note: candidate: 'void std::swap(any&, any&)' (near match) 430 | inline void swap(any& __x, any& __y) noexcept { __x.swap(__y); } | ^~~~ /usr/include/c++/14/any:430:15: note: conversion of argument 2 would be ill-formed: a.cc:22:70: error: cannot bind non-const lvalue reference of type 'std::any&' to an rvalue of type 'std::any' 22 | if (p2->first < (p2 + 1)->first) swap(p2, p2 + 1); | ~~~^~~ /usr/include/c++/14/any:191:7: note: after user-defined conversion: 'std::any::any(_Tp&&) [with _Tp = __gnu_cxx::__normal_iterator<std::pair<int, std::__cxx11::basic_string<char> >*, std::vector<std::pair<int, std::__cxx11::basic_string<char> > > >; _VTp = __gnu_cxx::__normal_iterator<std::pair<int, std::__cxx11::basic_string<char> >*, std::vector<std::pair<int, std::__cxx11::basic_string<char> > > >; _Mgr = _Manager_internal<__gnu_cxx::__normal_iterator<std::pair<int, std::__cxx11::basic_string<char> >*, std::vector<std::pair<int, std::__cxx11::basic_string<char> > > > >; typename std::enable_if<(is_copy_constructible_v<_VTp> && (! __is_in_place_type_v<_VTp>)), bool>::type <anonymous> = true]' 191 | any(_Tp&& __value) | ^~~ In file included from /usr/include/c++/14/bits/stl_pair.h:61: /usr/include/c++/14/bits/move.h:226:5: note: candidate: 'std::_Require<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&) [with _Tp = __gnu_cxx::__normal_iterator<pair<int, __cxx11::basic_string<char> >*, vector<pair<int, __cxx11::basic_string<char> > > >; _Require<__not_<__is_tuple_like<_Tp> >, is_move_constructible<_Tp>, is_move_assignable<_Tp> > = void]' (near match) 226 | swap(_Tp& __a, _Tp& __b) | ^~~~ /usr/include/c++/14/bits/move.h:226:5: note: conversion of argument 2 would be ill-formed: a.cc:22:70: error: cannot bind non-const lvalue reference of type '__gnu_cxx::__normal_iterator<std::pair<int, std::__cxx11::basic_string<char> >*, std::vector<std::pair<int, std::__cxx11::basic_string<char> > > >&' to an rvalue of type '__gnu_cxx::__normal_iterator<std::pair<int, std::__cxx11::basic_string<char> >*, std::vector<std::pair<int, std::__cxx11::basic_string<char> > > >' 22 | if (p2->first < (p2 + 1)->first) swap(p2, p2 + 1); | ~~~^~~ In file included from /usr/include/c++/14/exception:166, from /usr/include/c++/14/stdexcept:38, from /usr/include/c++/14/system_error:43, from /usr/include/c++/14/bits/ios_base.h:46, from /usr/include/c++/14/streambuf:43, from /usr/include/c++/14/bits/streambuf_iterator.h:35, from /usr/include/c++/14/iterator:66, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54: /usr/include/c++/14/bits/exception_ptr.h:229:5: note: candidate: 'void std::__exception_ptr::swap(exception_ptr&, exception_ptr&)' 229 | swap(exception_ptr& __lhs, exception_ptr& __rhs) | ^~~~ /usr/include/c++/14/bits/exception_ptr.h:229:25: note: no known conversion for argument 1 from 'VPI' {aka 'std::vector<std::pair<int, std::__cxx11::basic_string<char> > >::iterator'} to 'std::__exception_ptr::exception_ptr&' 229 | swap(exception_ptr& __lhs, exception_ptr& __rhs) | ~~~~~~~~~~~~~~~^~~~~ In file included from /usr/include/c++/14/future:51, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:176: /usr/include/c++/14/bits/std_thread.h:328:3: note: candidate: 'void std::swap(thread&, thread&)' 328 | swap(thread& __x, thread& __y) noexcept | ^~~~ /usr/include/c++/14/bits/std_thread.h:328:16: note: no known conversion for argument 1 from 'VPI' {aka 'std::vector<std::pair<int, std::__cxx11::basic_string<char> > >::iterator'} to 'std::thread&' 328 | swap(thread& __x, thread& __y) noexcept | ~~~~~~~~^~~ In file included from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/sstream:1204:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(basic_stringbuf<_CharT, _Traits, _Alloc>&, basic_stringbuf<_CharT, _Traits, _Alloc>&)' 1204 | swap(basic_stringbuf<_CharT, _Traits, _Allocator>& __x, | ^~~~ /us
s100808736
p00242
C++
#include<bits/stdc++.h> using namespace std; typedef pair<int, string> PIS; typedef vector<PIS> VP; typedef VP::iterator VPI; void swap(PIS *d1, PIS *d2) { PIS hoge; hoge = *d1; *d1 = *d2; *d2 = hoge; return; } void bsort(VP word) { VPI p1, p2; for (p1 = word.begin(); p1 != word.end(); p1++){ for (p2 = word.begin(); p2 != word.end() - 1; p2++){ if (p2->first < (p2 + 1)->first) swap(p2, p2 + 1); else if (p2->first == (p2 + 1)->first && p2->second > (p2 + 1)->second) swap(p2, p2 + 1); } } return; } int main() { while (true){ int n; cin >> n; if (!n) break; VP word; VPI p; string s = ""; char sample; cin.ignore(); for (int i = 0; i < n; i++){ string in; getline(cin, in); in += ' '; s += in; } cin >> sample; string hoge = ""; for (int i = 0; i < s.size(); i++){ if (s[i] == ' '){ if (hoge[0] == sample) word.push_back(make_pair(1, hoge)); hoge = ""; } else hoge += s[i]; } if (word.empty()){ cout << "NA" << endl; continue; } sort(word.begin(), word.end()); for (p = word.begin(); p != word.end() - 1; p++){ if (*p == *(p + 1)){ p->first++; word.erase(p + 1); } } bsort(word); p = word.begin(); for (int i = 0; p != word.end() && i < 5; i++, p++){ cout << p->second; if (p == word.end() - 1 || i == 4) cout << endl; else cout << " "; } } return 0; }
a.cc: In function 'void bsort(VP)': a.cc:22:62: error: no matching function for call to 'swap(VPI&, __gnu_cxx::__normal_iterator<std::pair<int, std::__cxx11::basic_string<char> >*, std::vector<std::pair<int, std::__cxx11::basic_string<char> > > >)' 22 | if (p2->first < (p2 + 1)->first) swap(p2, p2 + 1); | ~~~~^~~~~~~~~~~~ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:77, from a.cc:1: /usr/include/c++/14/any:430:15: note: candidate: 'void std::swap(any&, any&)' (near match) 430 | inline void swap(any& __x, any& __y) noexcept { __x.swap(__y); } | ^~~~ /usr/include/c++/14/any:430:15: note: conversion of argument 2 would be ill-formed: a.cc:22:70: error: cannot bind non-const lvalue reference of type 'std::any&' to an rvalue of type 'std::any' 22 | if (p2->first < (p2 + 1)->first) swap(p2, p2 + 1); | ~~~^~~ /usr/include/c++/14/any:191:7: note: after user-defined conversion: 'std::any::any(_Tp&&) [with _Tp = __gnu_cxx::__normal_iterator<std::pair<int, std::__cxx11::basic_string<char> >*, std::vector<std::pair<int, std::__cxx11::basic_string<char> > > >; _VTp = __gnu_cxx::__normal_iterator<std::pair<int, std::__cxx11::basic_string<char> >*, std::vector<std::pair<int, std::__cxx11::basic_string<char> > > >; _Mgr = _Manager_internal<__gnu_cxx::__normal_iterator<std::pair<int, std::__cxx11::basic_string<char> >*, std::vector<std::pair<int, std::__cxx11::basic_string<char> > > > >; typename std::enable_if<(is_copy_constructible_v<_VTp> && (! __is_in_place_type_v<_VTp>)), bool>::type <anonymous> = true]' 191 | any(_Tp&& __value) | ^~~ In file included from /usr/include/c++/14/bits/stl_pair.h:61, from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/bits/move.h:226:5: note: candidate: 'std::_Require<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&) [with _Tp = __gnu_cxx::__normal_iterator<pair<int, __cxx11::basic_string<char> >*, vector<pair<int, __cxx11::basic_string<char> > > >; _Require<__not_<__is_tuple_like<_Tp> >, is_move_constructible<_Tp>, is_move_assignable<_Tp> > = void]' (near match) 226 | swap(_Tp& __a, _Tp& __b) | ^~~~ /usr/include/c++/14/bits/move.h:226:5: note: conversion of argument 2 would be ill-formed: a.cc:22:70: error: cannot bind non-const lvalue reference of type '__gnu_cxx::__normal_iterator<std::pair<int, std::__cxx11::basic_string<char> >*, std::vector<std::pair<int, std::__cxx11::basic_string<char> > > >&' to an rvalue of type '__gnu_cxx::__normal_iterator<std::pair<int, std::__cxx11::basic_string<char> >*, std::vector<std::pair<int, std::__cxx11::basic_string<char> > > >' 22 | if (p2->first < (p2 + 1)->first) swap(p2, p2 + 1); | ~~~^~~ In file included from /usr/include/c++/14/exception:166, from /usr/include/c++/14/stdexcept:38, from /usr/include/c++/14/system_error:43, from /usr/include/c++/14/bits/ios_base.h:46, from /usr/include/c++/14/streambuf:43, from /usr/include/c++/14/bits/streambuf_iterator.h:35, from /usr/include/c++/14/iterator:66, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54: /usr/include/c++/14/bits/exception_ptr.h:229:5: note: candidate: 'void std::__exception_ptr::swap(exception_ptr&, exception_ptr&)' 229 | swap(exception_ptr& __lhs, exception_ptr& __rhs) | ^~~~ /usr/include/c++/14/bits/exception_ptr.h:229:25: note: no known conversion for argument 1 from 'VPI' {aka 'std::vector<std::pair<int, std::__cxx11::basic_string<char> > >::iterator'} to 'std::__exception_ptr::exception_ptr&' 229 | swap(exception_ptr& __lhs, exception_ptr& __rhs) | ~~~~~~~~~~~~~~~^~~~~ In file included from /usr/include/c++/14/future:51, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:176: /usr/include/c++/14/bits/std_thread.h:328:3: note: candidate: 'void std::swap(thread&, thread&)' 328 | swap(thread& __x, thread& __y) noexcept | ^~~~ /usr/include/c++/14/bits/std_thread.h:328:16: note: no known conversion for argument 1 from 'VPI' {aka 'std::vector<std::pair<int, std::__cxx11::basic_string<char> > >::iterator'} to 'std::thread&' 328 | swap(thread& __x, thread& __y) noexcept | ~~~~~~~~^~~ In file included from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/sstream:1204:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(basic_stringbuf<_CharT, _Traits, _Alloc>&, basic_stringbuf<_CharT, _Traits, _Alloc>&)' 1204 | swap(basic_stringbuf<_CharT, _Traits, _Allocator>& __x, | ^~~~ /usr/include/c++/14/sstream:1204:5: note: template argument deduction/substitution failed: a.cc:22:62: note: 'VPI' {aka 'std::vector<std::pair<int, std::__cxx11::basic_string<char> > >::iterator'} is not derived from 'std::__cxx11::basic_stringbuf<_CharT, _Traits, _Alloc>' 22 | if (p2->first < (p2 + 1)->first) swap(p2, p2 + 1); | ~~~~^~~~~~~~~~~~ /usr/include/c++/14/sstream:1212:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(basic_istringstream<_CharT, _Traits, _Allocator>&, basic_istringstream<_CharT, _Traits, _Allocator>&)' 1212 | swap(basic_istringstream<_CharT, _Traits, _Allocator>& __x, | ^~~~ /usr/include/c++/14/sstream:1212:5: note: template argument deduction/substitution failed: a.cc:22:62: note: 'VPI' {aka 'std::vector<std::pair<int, std::__cxx11::basic_string<char> > >::iterator'} is not derived from 'std::__cxx11::basic_istringstream<_CharT, _Traits, _Allocator>' 22 | if (p2->first < (p2 + 1)->first) swap(p2, p2 + 1); | ~~~~^~~~~~~~~~~~ /usr/include/c++/14/sstream:1219:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(basic_ostringstream<_CharT, _Traits, _Allocator>&, basic_ostringstream<_CharT, _Traits, _Allocator>&)' 1219 | swap(basic_ostringstream<_CharT, _Traits, _Allocator>& __x, | ^~~~ /usr/include/c++/14/sstream:1219:5: note: template argument deduction/substitution failed: a.cc:22:62: note: 'VPI' {aka 'std::vector<std::pair<int, std::__cxx11::basic_string<char> > >::iterator'} is not derived from 'std::__cxx11::basic_ostringstream<_CharT, _Traits, _Allocator>' 22 | if (p2->first < (p2 + 1)->first) swap(p2, p2 + 1); | ~~~~^~~~~~~~~~~~ /usr/include/c++/14/sstream:1226:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(basic_stringstream<_CharT, _Traits, _Allocator>&, basic_stringstream<_CharT, _Traits, _Allocator>&)' 1226 | swap(basic_stringstream<_CharT, _Traits, _Allocator>& __x, | ^~~~ /usr/include/c++/14/sstream:1226:5: note: template argument deduction/substitution failed: a.cc:22:62: note: 'VPI' {aka 'std::vector<std::pair<int, std::__cxx11::basic_string<char> > >::iterator'} is not derived from 'std::__cxx11::basic_stringstream<_CharT, _Traits, _Allocator>' 22 | if (p2->first < (p2 + 1)->first) swap(p2, p2 + 1); | ~~~~^~~~~~~~~~~~ In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181: /usr/include/c++/14/bits/regex.h:896:5: note: candidate: 'template<class _Ch_type, class _Rx_traits> void std::__cxx11::swap(basic_regex<_Ch_type, _Rx_traits>&, basic_regex<_Ch_type, _Rx_traits>&)' 896 | swap(basic_regex<_Ch_type, _Rx_traits>& __lhs, | ^~~~ /usr/include/c++/14/bits/regex.h:896:5: note: template argument deduction/substitution failed: a.cc:22:62: note: 'VPI' {aka 'std::vector<std::pair<int, std::__cxx11::basic_string<char> > >::iterator'} is not derived from 'std::__cxx11::basic_regex<_Ch_type, _Rx_traits>' 22 | if (p2->first < (p2 + 1)->first) swap(p2, p2 + 1); | ~~~~^~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2230:5: note: candidate: 'template<class _Bi_iter, class _Alloc> void std::__cxx11::swap(match_results<_BiIter, _Alloc>&, match_results<_BiIter, _Alloc>&)' 2230 | swap(match_results<_Bi_iter, _Alloc>& __lhs, | ^~~~ /usr/include/c++/14/bits/regex.h:2230:5: note: template argument deduction/substitution failed: a.cc:22:62: note: 'VPI' {aka 'std::vector<std::pair<int, std::__cxx11::basic_string<char> > >::iterator'} is not derived from 'std::__cxx11::match_results<_BiIter, _Alloc>' 22 | if (p2->first < (p2 + 1)->first) swap(p2, p2 + 1); | ~~~~^~~~~~~~~~~~ /usr/include/c++/14/bits/move.h:250:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> std::__enable_if_t<((bool)std::__is_swappable<_Tp>::value)> std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm])' 250 | swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]) | ^~~~ /usr/include/c++/14/bits/move.h:250:5: note: template argument deduction/substitution failed: a.cc:22:62: note: mismatched types '_Tp [_Nm]' and 'VPI' {aka 'std::vector<std::pair<int, std::__cxx11::basic_string<char> > >::iterator'} 22 | if (p2->first < (p2 + 1)->first) swap(p2, p2 + 1); |
s233698978
p00242
C++
#include<iostream> #include<string> #include<sstream> #include<map> #include<vector> using namespace std; typedef pair<int,string> P; int main(){ int n; while(1){ cin >> n; if(n == 0) break; string word[1025]; int cou = 0; for(int i=0;i<n;i++){ string str; cin.ignore(); getline(cin,str); stringstream ss(str); while(!ss.eof()){ ss >> word[cou]; cou++; } } char key; cin >> key; map<string,int> count; for(int i=0;i<cou;i++){ if(word[i][0] == key){ count[word[i]]--; } } P ans[1024]; int num = 0; for(int i=0;i<cou;i++){ if(word[i][0] == key && count[word[i]] != 0){ P p; p.first = count[word[i]]; p.second = word[i]; ans[num] = p; num++; count[word[i]] = 0; } } sort(ans,ans+num); bool flg = false; for(int i=0;i<5;i++){ if(num == 0) cout << "NA" << endl; if(i == num) break; if(flg) cout << " "; cout << ans[i].second; flg = true; } cout << endl; } }
a.cc: In function 'int main()': a.cc:47:17: error: 'sort' was not declared in this scope; did you mean 'short'? 47 | sort(ans,ans+num); | ^~~~ | short
s671664407
p00242
C++
#include <iostream> #include <cstdio> #include <vector> #include <string> #include <map> #include <algorithm> using namespace std; typedef pair<int, string> P; void solve() { int n; while (scanf_s("%d\n", &n), n) { string str; map<string, int> Map; while (n--) { getline(cin, str); str += " "; string s; for (int i = 0; i < str.size(); ++i) { if (str[i] == ' ') { Map[s]++; s.clear(); } else { s += str[i]; } } } char c; cin >> c; vector<P> word; map<string, int>::iterator it = Map.begin(); while (it != Map.end()) { if (it->first[0] == c) { word.push_back(P(it->second, it->first)); } ++it; } if (word.empty()) { cout << "NA" << endl; continue; } int displaySize = min((int)word.size(), 5); bool isFirst = true; for (int i = 0; i < displaySize; ++i) { if (!isFirst) { cout << " "; } isFirst = false; cout << word[i].second; } cout << endl; } } int main() { solve(); return(0); }
a.cc: In function 'void solve()': a.cc:15:16: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 15 | while (scanf_s("%d\n", &n), n) | ^~~~~~~ | scanf
s972240411
p00242
C++
#include <iostream> #include <cstdio> #include <vector> #include <string> #include <map> #include <algorithm> #include <functional> using namespace std; typedef pair<int, string> P; void solve() { int n; while (scanf_s("%d\n", &n), n) { string str; map<string, int> Map; while (n--) { getline(cin, str); str += " "; string s; for (int i = 0; i < str.size(); ++i) { if (str[i] == ' ') { Map[s]++; s.clear(); } else { s += str[i]; } } } char c; cin >> c; vector<P> word; map<string, int>::iterator it = Map.begin(); while (it != Map.end()) { if (it->first[0] == c) { word.push_back(P(-it->second, it->first)); } ++it; } if (word.empty()) { cout << "NA" << endl; continue; } sort(word.begin(), word.end()); int displaySize = min((int)word.size(), 5); bool isFirst = true; for (int i = 0; i < displaySize; ++i) { if (!isFirst) { cout << " "; } isFirst = false; cout << word[i].second; } cout << endl; } } int main() { solve(); return(0); }
a.cc: In function 'void solve()': a.cc:16:16: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 16 | while (scanf_s("%d\n", &n), n) | ^~~~~~~ | scanf
s076100615
p00242
C++
#include <string> #include <vector> #include <iostream> using namespace std; int n; string s; char c; vector<string> parse(string str) { vector<string> ret = 0; string t; for(int i = 0; i < str.size(); i++) { if(str[i] == ' ') ret.push_back(t), t = ""; else t += str[i]; } return ret; } int main() { while(cin >> n, n) { vector<string> r; for(int i = 0; i < n; i++) { s = ""; getline(cin, s)); vector<string> v = parse(s); r.insert(r.end(), v.begin(), v.end()); } sort(r.begin(), r.end()); for(int i = 0; i < r.size() && i < 5; i++) { if(i) cout << ' '; cout << r[i]; } cout << endl; } }
a.cc: In function 'std::vector<std::__cxx11::basic_string<char> > parse(std::string)': a.cc:7:30: error: conversion from 'int' to non-scalar type 'std::vector<std::__cxx11::basic_string<char> >' requested 7 | vector<string> ret = 0; string t; | ^ a.cc: In function 'int main()': a.cc:18:48: error: expected ';' before ')' token 18 | s = ""; getline(cin, s)); | ^ | ; a.cc:22:17: error: 'sort' was not declared in this scope; did you mean 'short'? 22 | sort(r.begin(), r.end()); | ^~~~ | short
s756301767
p00242
C++
#include<bits/stdc++.h> using namespace std; string S; int main(){ int n; while(true){ cin>>n;vector<string>vec,w; for(int i=0;i<n;i++){ S=""; while(S=""){ getline(cin,S); } S+=" ";string T; for(int i=0;i<S.size();i++){ if(S[i]==' '){vec.push_back(T);T="";} else{T+=S[i];} } } char c;cin>>c; sort(vec.begin(),vec.end()); if(vec[0][0]==c){w.push_back(vec[0]);} for(int i=1;i<vec.size();i++){ if(vec[i][0]==c && vec[i-1]!=vec[i]){ w.push_back(vec[i]); } } for(int i=0;i<w.size();i++){ if(i)cout<<' '; cout<<w[i]; } if(w.size()==0){cout<<"NA";} cout<<endl; } }
a.cc: In function 'int main()': a.cc:10:32: error: could not convert 'S.std::__cxx11::basic_string<char>::operator=(((const char*)""))' from 'std::__cxx11::basic_string<char>' to 'bool' 10 | while(S=""){ | ~^~~ | | | std::__cxx11::basic_string<char>
s618204259
p00242
C++
#include<bits/stdc++.h> using namespace std; string S; int main(){ int n; while(true){ cin>>n;vector<string>vec; vector<pair<int,string> >w; if(n==0){break;} for(int i=0;i<n;i++){ S=""; while(S==""){ getline(cin,S); } S+=" ";string T; for(int i=0;i<S.size();i++){ if(S[i]==' '){vec.push_back(T);T="";} else{T+=S[i];} } } char c;cin>>c;sort(vec.begin(),vec.end()); if(vec[0][0]==c)w.push_back(make_pair(-1,vec[0])); for(int i=1;i<vec.size();i++){ if(vec[i][0]==c){ if(vec[i]==vec[i-1]){vec[vec.size()-1].first--;} else{vec.push_back(make_pair(-1,vec[i]));} } } sort(w.begin(),w.end()); if(w.size()==0){cout<<"NA";} else{ for(int i=0;i<w.size();i++){ if(i>=5){break;} if(i){cout<<' ';} cout<<w[i].second; } } cout<<endl; } }
a.cc: In function 'int main()': a.cc:25:72: error: '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'first' 25 | if(vec[i]==vec[i-1]){vec[vec.size()-1].first--;} | ^~~~~ a.cc:26:51: error: no matching function for call to 'std::vector<std::__cxx11::basic_string<char> >::push_back(std::pair<int, std::__cxx11::basic_string<char> >)' 26 | else{vec.push_back(make_pair(-1,vec[i]));} | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/vector:66, from /usr/include/c++/14/functional:64, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53, from a.cc:1: /usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; value_type = std::__cxx11::basic_string<char>]' 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<int, std::__cxx11::basic_string<char> >' to 'const std::vector<std::__cxx11::basic_string<char> >::value_type&' {aka 'const std::__cxx11::basic_string<char>&'} 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 = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; value_type = std::__cxx11::basic_string<char>]' 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<int, std::__cxx11::basic_string<char> >' to 'std::vector<std::__cxx11::basic_string<char> >::value_type&&' {aka 'std::__cxx11::basic_string<char>&&'} 1300 | push_back(value_type&& __x) | ~~~~~~~~~~~~~^~~
s804678043
p00242
C++
nclude<bits/stdc++.h> using namespace std; main(){ int n; while(cin>>n,n){ string s[n+1]; getline(cin,s[0]); for(int i=0;i<n;i++)getline(cin,s[i]); cin>>s[n]; int pp=0; map<string,int>m; for(int i=0;i<n;i++){ string t; for(int j=0;j<s[i].size();j++){ if(s[i][j]!=' ')t+=s[i][j]; else{ if(t[0]==s[n][0]){ pp=max(pp,(int)t.size()); m[t]++; t=""; } t=""; } if(j==s[i].size()-2){ if(t[0]==s[n][0]){ pp=max(pp,(int)t.size()); m[t]++; t=""; } } } } vector<pair<string,int> >v; for(map<string,int>::iterator i=m.begin();i!=m.end();i++){ string t=(*i).first,tt; int r=(*i).second,o=(int)t.size()-pp; while(o<=0)t=t+'~',o++; v.push_back(make_pair(t,-r)); } sort(v.begin(),v.end(),greater<pair<string,int> >()); //stable_sort(v1.begin(),v1.end()); if(v.size()==0)cout<<"NA"; else for(int i=v.size()-1,k=0;i>=0;i--,k++){ if(k==5)break; if(i!=v.size()-1)cout<<' '; for(int j=0;j<v[i].first.size();j++) if(v[i].first[j]!='~')cout<<v[i].first[j]; } cout<<endl; } }
a.cc:1:1: error: 'nclude' does not name a type 1 | nclude<bits/stdc++.h> | ^~~~~~ a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 3 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:5:9: error: 'cin' was not declared in this scope 5 | while(cin>>n,n){ | ^~~ a.cc:6:5: error: 'string' was not declared in this scope 6 | string s[n+1]; | ^~~~~~ a.cc:7:17: error: 's' was not declared in this scope 7 | getline(cin,s[0]); | ^ a.cc:7:5: error: 'getline' was not declared in this scope 7 | getline(cin,s[0]); | ^~~~~~~ a.cc:11:5: error: 'map' was not declared in this scope 11 | map<string,int>m; | ^~~ a.cc:11:16: error: expected primary-expression before 'int' 11 | map<string,int>m; | ^~~ a.cc:13:13: error: expected ';' before 't' 13 | string t; | ^~ | ; a.cc:15:25: error: 't' was not declared in this scope 15 | if(s[i][j]!=' ')t+=s[i][j]; | ^ a.cc:17:14: error: 't' was not declared in this scope 17 | if(t[0]==s[n][0]){ | ^ a.cc:18:16: error: 'max' was not declared in this scope 18 | pp=max(pp,(int)t.size()); | ^~~ a.cc:19:13: error: 'm' was not declared in this scope 19 | m[t]++; | ^ a.cc:22:11: error: 't' was not declared in this scope 22 | t=""; | ^ a.cc:25:16: error: 't' was not declared in this scope 25 | if(t[0]==s[n][0]){ | ^ a.cc:26:16: error: 'max' was not declared in this scope 26 | pp=max(pp,(int)t.size()); | ^~~ a.cc:27:13: error: 'm' was not declared in this scope 27 | m[t]++; | ^ a.cc:33:5: error: 'vector' was not declared in this scope 33 | vector<pair<string,int> >v; | ^~~~~~ a.cc:33:12: error: 'pair' was not declared in this scope 33 | vector<pair<string,int> >v; | ^~~~ a.cc:33:24: error: expected primary-expression before 'int' 33 | vector<pair<string,int> >v; | ^~~ a.cc:34:20: error: expected primary-expression before 'int' 34 | for(map<string,int>::iterator i=m.begin();i!=m.end();i++){ | ^~~ a.cc:34:47: error: 'i' was not declared in this scope 34 | for(map<string,int>::iterator i=m.begin();i!=m.end();i++){ | ^ a.cc:34:50: error: 'm' was not declared in this scope 34 | for(map<string,int>::iterator i=m.begin();i!=m.end();i++){ | ^ a.cc:35:13: error: expected ';' before 't' 35 | string t=(*i).first,tt; | ^~ | ; a.cc:37:13: error: 'o' was not declared in this scope 37 | while(o<=0)t=t+'~',o++; | ^ a.cc:37:18: error: 't' was not declared in this scope 37 | while(o<=0)t=t+'~',o++; | ^ a.cc:38:7: error: 'v' was not declared in this scope 38 | v.push_back(make_pair(t,-r)); | ^ a.cc:38:29: error: 't' was not declared in this scope 38 | v.push_back(make_pair(t,-r)); | ^ a.cc:38:19: error: 'make_pair' was not declared in this scope 38 | v.push_back(make_pair(t,-r)); | ^~~~~~~~~ a.cc:40:10: error: 'v' was not declared in this scope 40 | sort(v.begin(),v.end(),greater<pair<string,int> >()); | ^ a.cc:40:28: error: 'greater' was not declared in this scope 40 | sort(v.begin(),v.end(),greater<pair<string,int> >()); | ^~~~~~~ a.cc:40:48: error: expected primary-expression before 'int' 40 | sort(v.begin(),v.end(),greater<pair<string,int> >()); | ^~~ a.cc:40:5: error: 'sort' was not declared in this scope; did you mean 'short'? 40 | sort(v.begin(),v.end(),greater<pair<string,int> >()); | ^~~~ | short a.cc:43:20: error: 'cout' was not declared in this scope 43 | if(v.size()==0)cout<<"NA"; | ^~~~ a.cc:44:44: error: 'k' was not declared in this scope 44 | else for(int i=v.size()-1,k=0;i>=0;i--,k++){ | ^ a.cc:46:24: error: 'cout' was not declared in this scope 46 | if(i!=v.size()-1)cout<<' '; | ^~~~ a.cc:48:31: error: 'cout' was not declared in this scope 48 | if(v[i].first[j]!='~')cout<<v[i].first[j]; | ^~~~ a.cc:50:5: error: 'cout' was not declared in this scope 50 | cout<<endl; | ^~~~ a.cc:50:11: error: 'endl' was not declared in this scope 50 | cout<<endl; | ^~~~
s416818364
p00242
C++
import std.stdio; import std.array; import std.conv; import std.algorithm; import std.range; import std.string; import std.typecons; alias Tuple!(int, string) P; void main() { for(int n; (n = to!int(chomp(readln()))) != 0; ){ int[string] hash; foreach(i; 0..n){ foreach(word; split(chomp(readln()))){ hash[word]++; } } char k = to!char(chomp(readln())); P array[]; foreach(word, count ; hash){ if(word[0] == k){ array ~= tuple(count, word); } } sort!((P a, P b){ return a[1] < b[1] || (a[1] == b[1] && a[0] > b[0]); })(array\ ); bool flag = true; int up = min(cast(int)array.length, 5); foreach(i; 0..up){ writef("%s%c", array[i][1], (i + 1 == up ? '\n' : ' ')); flag = false; } if(flag) writeln("NA"); } } int min(int a, int b) { return a > b ? b : a; }
a.cc:17:16: error: too many decimal points in number 17 | foreach(i; 0..n){ | ^~~~ a.cc:37:16: error: too many decimal points in number 37 | foreach(i; 0..up){ | ^~~~~ a.cc:1:1: error: 'import' does not name a type 1 | import std.stdio; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:2:1: error: 'import' does not name a type 2 | import std.array; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: 'import' does not name a type 3 | import std.conv; | ^~~~~~ a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:4:1: error: 'import' does not name a type 4 | import std.algorithm; | ^~~~~~ a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:5:1: error: 'import' does not name a type 5 | import std.range; | ^~~~~~ a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:6:1: error: 'import' does not name a type 6 | import std.string; | ^~~~~~ a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:7:1: error: 'import' does not name a type 7 | import std.typecons; | ^~~~~~ a.cc:7:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:10:1: error: 'alias' does not name a type 10 | alias Tuple!(int, string) P; | ^~~~~ a.cc:12:1: error: '::main' must return 'int' 12 | void main() | ^~~~ a.cc: In function 'int main()': a.cc:14:19: error: 'to' was not declared in this scope 14 | for(int n; (n = to!int(chomp(readln()))) != 0; ){ | ^~ a.cc:14:21: error: expected ')' before '!' token 14 | for(int n; (n = to!int(chomp(readln()))) != 0; ){ | ~ ^ | ) a.cc:15:8: error: structured binding declaration cannot have type 'int' 15 | int[string] hash; | ^~~~~~~~ a.cc:15:8: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto' a.cc:15:17: error: expected initializer before 'hash' 15 | int[string] hash; | ^~~~ a.cc:15:17: error: expected ';' before 'hash' a.cc:17:13: error: 'i' was not declared in this scope 17 | foreach(i; 0..n){ | ^ a.cc:24:5: error: 'P' was not declared in this scope 24 | P array[]; | ^ a.cc:26:13: error: 'word' was not declared in this scope 26 | foreach(word, count ; hash){ | ^~~~ a.cc:26:19: error: 'count' was not declared in this scope 26 | foreach(word, count ; hash){ | ^~~~~ a.cc:26:27: error: 'hash' was not declared in this scope 26 | foreach(word, count ; hash){ | ^~~~ a.cc:32:5: error: 'sort' was not declared in this scope; did you mean 'short'? 32 | sort!((P a, P b){ return a[1] < b[1] || (a[1] == b[1] && a[0] > b[0]); })(array\ | ^~~~ | short a.cc:32:77: error: expected primary-expression before ')' token 32 | sort!((P a, P b){ return a[1] < b[1] || (a[1] == b[1] && a[0] > b[0]); })(array\ | ^ a.cc:36:23: error: expected primary-expression before 'int' 36 | int up = min(cast(int)array.length, 5); | ^~~ a.cc:36:18: error: 'cast' was not declared in this scope 36 | int up = min(cast(int)array.length, 5); | ^~~~ a.cc:36:14: error: 'min' was not declared in this scope; did you mean 'main'? 36 | int up = min(cast(int)array.length, 5); | ^~~ | main a.cc:37:14: error: expected ')' before ';' token 37 | foreach(i; 0..up){ | ~ ^ | ) a.cc:42:14: error: 'writeln' was not declared in this scope 42 | if(flag) writeln("NA"); | ^~~~~~~
s796588552
p00242
C++
#include <iostream> #include <sstream> #include <string> #include <map> using namespace std; typedef struct { string s; int n; } S; int main(void) { int n, m, f; string s; char d; while (cin >> n && n) { map<string, int> w; getline(cin, s); for (int i = m = 0; i < n; ++i) { getline(cin, s); istringstream iss(s); string k; while (iss >> k) { if (w.find(k) == w.end()) w[k] = 1, ++m; else ++w[k]; } } cin >> d; S* v = new S[m]; int i = f = 0; for (map<string, int>::iterator itr = w.begin(); itr != w.end(); ++itr, ++i) { const char *c = itr->first.c_str(); if (c[0] == d) v[i].s = itr->first, v[i].n = itr->second, f = 1; } if (f) { for (int i = 0; i < m; ++i) { for (int j = i+1; j < m; j++) { if (v[i].n < v[j].n) swap(v[i], v[j]); } } for (int i = 0; i < 5; ++i) { if (i > 0) cout << " "; cout << v[i].s; } } delete v; else cout << "NA"; cout << endl; } return 0; }
a.cc: In function 'int main()': a.cc:54:17: error: 'else' without a previous 'if' 54 | else cout << "NA"; | ^~~~
s525705939
p00242
C++
#include <iostream> #include <sstream> #include <algorithm> #include <set> #include <map> using namespace std; #define foreach(i,c) for(__typeof__((c).begin()) i=(c).begin();i!=(c).end();++i) int main() { for(int n;cin>>n,n;){ cin.ignore(); vector<string> words; while(n--){ string line; getline(cin,line); istringstream iss(line); for(string w;iss>>w;) words.push_back(w); } char c; cin>>c; map<string,int> m; for(int i=0;i<words.size();i++) m[words[i]]++; set<pair<int,string> > s; foreach(i,m) if(i->first[0]==c) s.insert(make_pair(-i->second,i->first)); if(s.empty()) cout<<"NA"<<endl; else{ int cnt=0; foreach(i,s){ cout<<(i==s.begin()?"":" ")<<i->second; if(++cnt==5) break; } cout<<endl; } } return 0; }
a.cc: In function 'int main()': a.cc:15:17: error: 'vector' was not declared in this scope 15 | vector<string> words; | ^~~~~~ a.cc:6:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 5 | #include <map> +++ |+#include <vector> 6 | a.cc:15:30: error: expected primary-expression before '>' token 15 | vector<string> words; | ^ a.cc:15:32: error: 'words' was not declared in this scope 15 | vector<string> words; | ^~~~~
s759926374
p00242
C++
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <pair> using namespace std; pair<string, int> str[30]; vector<pair<string, int>> v; int maxarray; void f(string in)//入力関数 { for(int i=0;i<20;++i) { if(str[i].first == in) { ++str[i].second; return; } if(str[i].first.empty()) { str[i].first = in; str[i].second = 1; maxarray = i; return; } } } void insert(int index) { if(v.empty()) { v.push_back(str[index]); return; } for(int i=0;i<v.size();++i) { if(v[i].second < str[index].second) { v.insert(v.begin()+i,str[index]); return; } } v.push_back(str[index]); } int main(void) { string input; string in; char k; int n; while(cin >> n , n) { v.clear(); for(int i=0;i<20;++i) { str[i].first = ""; str[i].second = 0; } getline(cin,input); for(int num=0;num<n;++num) { getline(cin,input); string::size_type index=0; string::size_type nextindex = input.find(" ");//次のスペースの場所 while(1) { f(input.substr(index,nextindex-index)); index = nextindex+1; nextindex = input.find(" " ,nextindex+1); if(nextindex == string::npos) { f(input.substr(index)); break; } } } sort(str,str+maxarray+1); cin >> k;//頭文字の入力 bool flag = false; for(int i=0;i<=maxarray;++i) { if(str[i].first.at(0) == k) { insert(i); } } if(v.empty()) cout << "NA" << endl; for(int i=0;i<5 && i<v.size();++i) { if(i==4 || i==v.size()-1) { cout << v[i].first << endl; break; } cout << v[i].first << ' '; } } return 0; }
a.cc:5:10: fatal error: pair: No such file or directory 5 | #include <pair> | ^~~~~~ compilation terminated.
s495906330
p00242
C++
#include<iostream> #include<sstream> #include<map> #include<vector> #include<algorithm> using namespace std; int main() { &#160; int n; &#160; string s; &#160; char k; &#160; while(cin>>n,n){ &#160; &#160; map<string,int>used; &#160; &#160; for(int i=0;i<n;i++){ &#160; &#160; &#160; cin.ignore(); &#160; &#160; &#160; getline(cin,s); &#160; &#160; &#160; stringstream ss(s); &#160; &#160; &#160; string word; &#160; &#160; &#160; while(ss>>word){ &#160; &#160; &#160; &#160; if(used.find(word)==used.end())used.insert(make_pair(word,1)); &#160; &#160; &#160; &#160; else used[word]++; &#160; &#160; &#160; } &#160; &#160; } &#160; &#160; cin>>k; &#160; &#160; map<string,int>::iterator it; &#160; &#160; vector<string>v; &#160; &#160; for(it=used.begin();it!=used.end();it++){ &#160; &#160; &#160; if(it->first[0]!=k)continue; &#160; &#160; &#160; v.push_back(it->first); &#160; &#160; } &#160; &#160; sort(v.begin(),v.end()); &#160; &#160; if(v.empty()){ &#160; &#160; &#160; puts("NA"); &#160; &#160; }else{ &#160; &#160; &#160; int cnt=0; &#160; &#160; &#160; for(int i=0;i<v.size();i++){ &#160; &#160; &#160; &#160; if(++cnt>5)break; &#160; &#160; &#160; &#160; if(i!=0)cout<<" "; &#160; &#160; &#160; &#160; cout<<v[i]; &#160; &#160; &#160; } &#160; &#160; &#160; cout<<endl; &#160; &#160; } &#160; } }
a.cc:17:2: error: stray '#' in program 17 | &#160; int n; | ^ a.cc:18:2: error: stray '#' in program 18 | &#160; string s; | ^ a.cc:19:2: error: stray '#' in program 19 | &#160; char k; | ^ a.cc:20:2: error: stray '#' in program 20 | &#160; while(cin>>n,n){ | ^ a.cc:21:2: error: stray '#' in program 21 | &#160; &#160; map<string,int>used; | ^ a.cc:21:9: error: stray '#' in program 21 | &#160; &#160; map<string,int>used; | ^ a.cc:22:2: error: stray '#' in program 22 | &#160; &#160; for(int i=0;i<n;i++){ | ^ a.cc:22:9: error: stray '#' in program 22 | &#160; &#160; for(int i=0;i<n;i++){ | ^ a.cc:23:2: error: stray '#' in program 23 | &#160; &#160; &#160; cin.ignore(); | ^ a.cc:23:9: error: stray '#' in program 23 | &#160; &#160; &#160; cin.ignore(); | ^ a.cc:23:16: error: stray '#' in program 23 | &#160; &#160; &#160; cin.ignore(); | ^ a.cc:24:2: error: stray '#' in program 24 | &#160; &#160; &#160; getline(cin,s); | ^ a.cc:24:9: error: stray '#' in program 24 | &#160; &#160; &#160; getline(cin,s); | ^ a.cc:24:16: error: stray '#' in program 24 | &#160; &#160; &#160; getline(cin,s); | ^ a.cc:25:2: error: stray '#' in program 25 | &#160; &#160; &#160; stringstream ss(s); | ^ a.cc:25:9: error: stray '#' in program 25 | &#160; &#160; &#160; stringstream ss(s); | ^ a.cc:25:16: error: stray '#' in program 25 | &#160; &#160; &#160; stringstream ss(s); | ^ a.cc:26:2: error: stray '#' in program 26 | &#160; &#160; &#160; string word; | ^ a.cc:26:9: error: stray '#' in program 26 | &#160; &#160; &#160; string word; | ^ a.cc:26:16: error: stray '#' in program 26 | &#160; &#160; &#160; string word; | ^ a.cc:27:2: error: stray '#' in program 27 | &#160; &#160; &#160; while(ss>>word){ | ^ a.cc:27:9: error: stray '#' in program 27 | &#160; &#160; &#160; while(ss>>word){ | ^ a.cc:27:16: error: stray '#' in program 27 | &#160; &#160; &#160; while(ss>>word){ | ^ a.cc:28:2: error: stray '#' in program 28 | &#160; &#160; &#160; &#160; if(used.find(word)==used.end())used.insert(make_pair(word,1)); | ^ a.cc:28:9: error: stray '#' in program 28 | &#160; &#160; &#160; &#160; if(used.find(word)==used.end())used.insert(make_pair(word,1)); | ^ a.cc:28:16: error: stray '#' in program 28 | &#160; &#160; &#160; &#160; if(used.find(word)==used.end())used.insert(make_pair(word,1)); | ^ a.cc:28:23: error: stray '#' in program 28 | &#160; &#160; &#160; &#160; if(used.find(word)==used.end())used.insert(make_pair(word,1)); | ^ a.cc:29:2: error: stray '#' in program 29 | &#160; &#160; &#160; &#160; else used[word]++; | ^ a.cc:29:9: error: stray '#' in program 29 | &#160; &#160; &#160; &#160; else used[word]++; | ^ a.cc:29:16: error: stray '#' in program 29 | &#160; &#160; &#160; &#160; else used[word]++; | ^ a.cc:29:23: error: stray '#' in program 29 | &#160; &#160; &#160; &#160; else used[word]++; | ^ a.cc:30:2: error: stray '#' in program 30 | &#160; &#160; &#160; } | ^ a.cc:30:9: error: stray '#' in program 30 | &#160; &#160; &#160; } | ^ a.cc:30:16: error: stray '#' in program 30 | &#160; &#160; &#160; } | ^ a.cc:31:2: error: stray '#' in program 31 | &#160; &#160; } | ^ a.cc:31:9: error: stray '#' in program 31 | &#160; &#160; } | ^ a.cc:32:2: error: stray '#' in program 32 | &#160; &#160; cin>>k; | ^ a.cc:32:9: error: stray '#' in program 32 | &#160; &#160; cin>>k; | ^ a.cc:33:2: error: stray '#' in program 33 | &#160; &#160; map<string,int>::iterator it; | ^ a.cc:33:9: error: stray '#' in program 33 | &#160; &#160; map<string,int>::iterator it; | ^ a.cc:34:2: error: stray '#' in program 34 | &#160; &#160; vector<string>v; | ^ a.cc:34:9: error: stray '#' in program 34 | &#160; &#160; vector<string>v; | ^ a.cc:35:2: error: stray '#' in program 35 | &#160; &#160; for(it=used.begin();it!=used.end();it++){ | ^ a.cc:35:9: error: stray '#' in program 35 | &#160; &#160; for(it=used.begin();it!=used.end();it++){ | ^ a.cc:36:2: error: stray '#' in program 36 | &#160; &#160; &#160; if(it->first[0]!=k)continue; | ^ a.cc:36:9: error: stray '#' in program 36 | &#160; &#160; &#160; if(it->first[0]!=k)continue; | ^ a.cc:36:16: error: stray '#' in program 36 | &#160; &#160; &#160; if(it->first[0]!=k)continue; | ^ a.cc:37:2: error: stray '#' in program 37 | &#160; &#160; &#160; v.push_back(it->first); | ^ a.cc:37:9: error: stray '#' in program 37 | &#160; &#160; &#160; v.push_back(it->first); | ^ a.cc:37:16: error: stray '#' in program 37 | &#160; &#160; &#160; v.push_back(it->first); | ^ a.cc:38:2: error: stray '#' in program 38 | &#160; &#160; } | ^ a.cc:38:9: error: stray '#' in program 38 | &#160; &#160; } | ^ a.cc:39:2: error: stray '#' in program 39 | &#160; &#160; sort(v.begin(),v.end()); | ^ a.cc:39:9: error: stray '#' in program 39 | &#160; &#160; sort(v.begin(),v.end()); | ^ a.cc:40:2: error: stray '#' in program 40 | &#160; &#160; if(v.empty()){ | ^ a.cc:40:9: error: stray '#' in program 40 | &#160; &#160; if(v.empty()){ | ^ a.cc:41:2: error: stray '#' in program 41 | &#160; &#160; &#160; puts("NA"); | ^ a.cc:41:9: error: stray '#' in program 41 | &#160; &#160; &#160; puts("NA"); | ^ a.cc:41:16: error: stray '#' in program 41 | &#160; &#160; &#160; puts("NA"); | ^ a.cc:42:2: error: stray '#' in program 42 | &#160; &#160; }else{ | ^ a.cc:42:9: error: stray '#' in program 42 | &#160; &#160; }else{ | ^ a.cc:43:2: error: stray '#' in program 43 | &#160; &#160; &#160; int cnt=0; | ^ a.cc:43:9: error: stray '#' in program 43 | &#160; &#160; &#160; int cnt=0; | ^ a.cc:43:16: error: stray '#' in program 43 | &#160; &#160; &#160; int cnt=0; | ^ a.cc:44:2: error: stray '#' in program 44 | &#160; &#160; &#160; for(int i=0;i<v.size();i++){ | ^ a.cc:44:9: error: stray '#' in program 44 | &#160; &#160; &#160; for(int i=0;i<v.size();i++){ | ^ a.cc:44:16: error: stray '#' in program 44 | &#160; &#160; &#160; for(int i=0;i<v.size();i++){ | ^ a.cc:45:2: error: stray '#' in program 45 | &#160; &#160; &#160; &#160; if(++cnt>5)break; | ^ a.cc:45:9: error: stray '#' in program 45 | &#160; &#160; &#160; &#160; if(++cnt>5)break; | ^ a.cc:45:16: error: stray '#' in program 45 | &#160; &#160; &#160; &#160; if(++cnt>5)break; | ^ a.cc:45:23: error: stray '#' in program 45 | &#160; &#160; &#160; &#160; if(++cnt>5)break; | ^ a.cc:46:2: error: stray '#' in program 46 | &#160; &#160; &#160; &#160; if(i!=0)cout<<" "; | ^ a.cc:46:9: error: stray '#' in program 46 | &#160; &#160; &#160; &#160; if(i!=0)cout<<" "; | ^ a.cc:46:16: error: stray '#' in program 46 | &#160; &#160; &#160; &#160; if(i!=0)cout<<" "; | ^ a.cc:46:23: error: stray '#' in program 46 | &#160; &#160; &#160; &#160; if(i!=0)cout<<" "; | ^ a.cc:47:2: error: stray '#' in program 47 | &#160; &#160; &#160; &#160; cout<<v[i]; | ^ a.cc:47:9: error: stray '#' in program 47 | &#160; &#160; &#160; &#160; cout<<v[i]; | ^ a.cc:47:16: error: stray '#' in program 47 | &#160; &#160; &#160; &#160; cout<<v[i]; | ^ a.cc:47:23: error: stray '#' in program 47 | &#160; &#160; &#160; &#160; cout<<v[i]; | ^ a.cc:48:2: error: stray '#' in program 48 | &#160; &#160; &#160; } | ^ a.cc:48:9: error: stray '#' in program 48 | &#160; &#160; &#160; } | ^ a.cc:48:16: error: stray '#' in program 48 | &#160; &#160; &#160; } | ^ a.cc:49:2: error: stray '#' in program 49 | &#160; &#160; &#160; cout<<endl; | ^ a.cc:49:9: error: stray '#' in program 49 | &#160; &#160; &#160; cout<<endl; | ^ a.cc:49:16: error: stray '#' in program 49 | &#160; &#160; &#160; cout<<endl; | ^ a.cc:50:2: error: stray '#' in program 50 | &#160; &#160; } | ^ a.cc:50:9: error: stray '#' in program 50 | &#160; &#160; } | ^ a.cc:51:2: error: stray '#' in program 51 | &#160; } | ^ a.cc: In function 'int main()': a.cc:17:3: error: lvalue required as unary '&' operand 17 | &#160; int n; | ^~~ a.cc:18:3: error: lvalue required as unary '&' operand 18 | &#160; string s; | ^~~ a.cc:19:3: error: lvalue required as unary '&' operand 19 | &#160; char k; | ^~~ a.cc:20:3: error: lvalue required as unary '&' operand 20 | &#160; while(cin>>n,n){ | ^~~ a.cc:21:3: error: lvalue required as unary '&' operand 21 | &#160; &#160; map<string,int>used; | ^~~ a.cc:21:10: error: lvalue required as unary '&' operand 21 | &#160; &#160; map<string,int>used; | ^~~ a.cc:22:3: error: lvalue required as unary '&' operand 22 | &#160; &#160; for(int i=0;i<n;i++){ | ^~~ a.cc:22:10: error: lvalue required as unary '&' operand 22 | &#160; &#160; for(int i=0;i<n;i++){ | ^~~ a.cc:23:3: error: lvalue required as unary '&' operand 23 | &#160; &#160; &#160; cin.ignore(); | ^~~ a.cc:23:10: error: lvalue required as unary '&' operand 23 | &#160; &#160; &#160; cin.ignore(); | ^~~ a.cc:23:17: error: lvalue required as unary '&' operand 23 | &#160; &#160; &#160; cin.ignore(); | ^~~ a.cc:
s811585455
p00242
C++
#include<iostream> #include<sstream> #include<map> #include<vector> #include<algorithm> using namespace std; int main() { &#160; int n; &#160; string s; &#160; char k; &#160; while(cin>>n,n){ &#160; &#160; map<string,int>used; &#160; &#160; for(int i=0;i<n;i++){ &#160; &#160; &#160; cin.ignore(); &#160; &#160; &#160; getline(cin,s); &#160; &#160; &#160; stringstream ss(s); &#160; &#160; &#160; string word; &#160; &#160; &#160; while(ss>>word){ &#160; &#160; &#160; &#160; if(used.find(word)==used.end())used.insert(make_pair(word,1)); &#160; &#160; &#160; &#160; else used[word]++; &#160; &#160; &#160; } &#160; &#160; } &#160; &#160; cin>>k; &#160; &#160; map<string,int>::iterator it; &#160; &#160; vector<string>v; &#160; &#160; for(it=used.begin();it!=used.end();it++){ &#160; &#160; &#160; if(it->first[0]!=k)continue; &#160; &#160; &#160; v.push_back(it->first); &#160; &#160; } &#160; &#160; sort(v.begin(),v.end()); &#160; &#160; if(v.empty()){ &#160; &#160; &#160; puts("NA"); &#160; &#160; }else{ &#160; &#160; &#160; int cnt=0; &#160; &#160; &#160; for(int i=0;i<v.size();i++){ &#160; &#160; &#160; &#160; if(++cnt>5)break; &#160; &#160; &#160; &#160; if(i!=0)cout<<" "; &#160; &#160; &#160; &#160; cout<<v[i]; &#160; &#160; &#160; } &#160; &#160; &#160; cout<<endl; &#160; &#160; } &#160; } }
a.cc:13:2: error: stray '#' in program 13 | &#160; int n; | ^ a.cc:14:2: error: stray '#' in program 14 | &#160; string s; | ^ a.cc:15:2: error: stray '#' in program 15 | &#160; char k; | ^ a.cc:16:2: error: stray '#' in program 16 | &#160; while(cin>>n,n){ | ^ a.cc:17:2: error: stray '#' in program 17 | &#160; &#160; map<string,int>used; | ^ a.cc:17:9: error: stray '#' in program 17 | &#160; &#160; map<string,int>used; | ^ a.cc:18:2: error: stray '#' in program 18 | &#160; &#160; for(int i=0;i<n;i++){ | ^ a.cc:18:9: error: stray '#' in program 18 | &#160; &#160; for(int i=0;i<n;i++){ | ^ a.cc:19:2: error: stray '#' in program 19 | &#160; &#160; &#160; cin.ignore(); | ^ a.cc:19:9: error: stray '#' in program 19 | &#160; &#160; &#160; cin.ignore(); | ^ a.cc:19:16: error: stray '#' in program 19 | &#160; &#160; &#160; cin.ignore(); | ^ a.cc:20:2: error: stray '#' in program 20 | &#160; &#160; &#160; getline(cin,s); | ^ a.cc:20:9: error: stray '#' in program 20 | &#160; &#160; &#160; getline(cin,s); | ^ a.cc:20:16: error: stray '#' in program 20 | &#160; &#160; &#160; getline(cin,s); | ^ a.cc:21:2: error: stray '#' in program 21 | &#160; &#160; &#160; stringstream ss(s); | ^ a.cc:21:9: error: stray '#' in program 21 | &#160; &#160; &#160; stringstream ss(s); | ^ a.cc:21:16: error: stray '#' in program 21 | &#160; &#160; &#160; stringstream ss(s); | ^ a.cc:22:2: error: stray '#' in program 22 | &#160; &#160; &#160; string word; | ^ a.cc:22:9: error: stray '#' in program 22 | &#160; &#160; &#160; string word; | ^ a.cc:22:16: error: stray '#' in program 22 | &#160; &#160; &#160; string word; | ^ a.cc:23:2: error: stray '#' in program 23 | &#160; &#160; &#160; while(ss>>word){ | ^ a.cc:23:9: error: stray '#' in program 23 | &#160; &#160; &#160; while(ss>>word){ | ^ a.cc:23:16: error: stray '#' in program 23 | &#160; &#160; &#160; while(ss>>word){ | ^ a.cc:24:2: error: stray '#' in program 24 | &#160; &#160; &#160; &#160; if(used.find(word)==used.end())used.insert(make_pair(word,1)); | ^ a.cc:24:9: error: stray '#' in program 24 | &#160; &#160; &#160; &#160; if(used.find(word)==used.end())used.insert(make_pair(word,1)); | ^ a.cc:24:16: error: stray '#' in program 24 | &#160; &#160; &#160; &#160; if(used.find(word)==used.end())used.insert(make_pair(word,1)); | ^ a.cc:24:23: error: stray '#' in program 24 | &#160; &#160; &#160; &#160; if(used.find(word)==used.end())used.insert(make_pair(word,1)); | ^ a.cc:25:2: error: stray '#' in program 25 | &#160; &#160; &#160; &#160; else used[word]++; | ^ a.cc:25:9: error: stray '#' in program 25 | &#160; &#160; &#160; &#160; else used[word]++; | ^ a.cc:25:16: error: stray '#' in program 25 | &#160; &#160; &#160; &#160; else used[word]++; | ^ a.cc:25:23: error: stray '#' in program 25 | &#160; &#160; &#160; &#160; else used[word]++; | ^ a.cc:26:2: error: stray '#' in program 26 | &#160; &#160; &#160; } | ^ a.cc:26:9: error: stray '#' in program 26 | &#160; &#160; &#160; } | ^ a.cc:26:16: error: stray '#' in program 26 | &#160; &#160; &#160; } | ^ a.cc:27:2: error: stray '#' in program 27 | &#160; &#160; } | ^ a.cc:27:9: error: stray '#' in program 27 | &#160; &#160; } | ^ a.cc:28:2: error: stray '#' in program 28 | &#160; &#160; cin>>k; | ^ a.cc:28:9: error: stray '#' in program 28 | &#160; &#160; cin>>k; | ^ a.cc:29:2: error: stray '#' in program 29 | &#160; &#160; map<string,int>::iterator it; | ^ a.cc:29:9: error: stray '#' in program 29 | &#160; &#160; map<string,int>::iterator it; | ^ a.cc:30:2: error: stray '#' in program 30 | &#160; &#160; vector<string>v; | ^ a.cc:30:9: error: stray '#' in program 30 | &#160; &#160; vector<string>v; | ^ a.cc:31:2: error: stray '#' in program 31 | &#160; &#160; for(it=used.begin();it!=used.end();it++){ | ^ a.cc:31:9: error: stray '#' in program 31 | &#160; &#160; for(it=used.begin();it!=used.end();it++){ | ^ a.cc:32:2: error: stray '#' in program 32 | &#160; &#160; &#160; if(it->first[0]!=k)continue; | ^ a.cc:32:9: error: stray '#' in program 32 | &#160; &#160; &#160; if(it->first[0]!=k)continue; | ^ a.cc:32:16: error: stray '#' in program 32 | &#160; &#160; &#160; if(it->first[0]!=k)continue; | ^ a.cc:33:2: error: stray '#' in program 33 | &#160; &#160; &#160; v.push_back(it->first); | ^ a.cc:33:9: error: stray '#' in program 33 | &#160; &#160; &#160; v.push_back(it->first); | ^ a.cc:33:16: error: stray '#' in program 33 | &#160; &#160; &#160; v.push_back(it->first); | ^ a.cc:34:2: error: stray '#' in program 34 | &#160; &#160; } | ^ a.cc:34:9: error: stray '#' in program 34 | &#160; &#160; } | ^ a.cc:35:2: error: stray '#' in program 35 | &#160; &#160; sort(v.begin(),v.end()); | ^ a.cc:35:9: error: stray '#' in program 35 | &#160; &#160; sort(v.begin(),v.end()); | ^ a.cc:36:2: error: stray '#' in program 36 | &#160; &#160; if(v.empty()){ | ^ a.cc:36:9: error: stray '#' in program 36 | &#160; &#160; if(v.empty()){ | ^ a.cc:37:2: error: stray '#' in program 37 | &#160; &#160; &#160; puts("NA"); | ^ a.cc:37:9: error: stray '#' in program 37 | &#160; &#160; &#160; puts("NA"); | ^ a.cc:37:16: error: stray '#' in program 37 | &#160; &#160; &#160; puts("NA"); | ^ a.cc:38:2: error: stray '#' in program 38 | &#160; &#160; }else{ | ^ a.cc:38:9: error: stray '#' in program 38 | &#160; &#160; }else{ | ^ a.cc:39:2: error: stray '#' in program 39 | &#160; &#160; &#160; int cnt=0; | ^ a.cc:39:9: error: stray '#' in program 39 | &#160; &#160; &#160; int cnt=0; | ^ a.cc:39:16: error: stray '#' in program 39 | &#160; &#160; &#160; int cnt=0; | ^ a.cc:40:2: error: stray '#' in program 40 | &#160; &#160; &#160; for(int i=0;i<v.size();i++){ | ^ a.cc:40:9: error: stray '#' in program 40 | &#160; &#160; &#160; for(int i=0;i<v.size();i++){ | ^ a.cc:40:16: error: stray '#' in program 40 | &#160; &#160; &#160; for(int i=0;i<v.size();i++){ | ^ a.cc:41:2: error: stray '#' in program 41 | &#160; &#160; &#160; &#160; if(++cnt>5)break; | ^ a.cc:41:9: error: stray '#' in program 41 | &#160; &#160; &#160; &#160; if(++cnt>5)break; | ^ a.cc:41:16: error: stray '#' in program 41 | &#160; &#160; &#160; &#160; if(++cnt>5)break; | ^ a.cc:41:23: error: stray '#' in program 41 | &#160; &#160; &#160; &#160; if(++cnt>5)break; | ^ a.cc:42:2: error: stray '#' in program 42 | &#160; &#160; &#160; &#160; if(i!=0)cout<<" "; | ^ a.cc:42:9: error: stray '#' in program 42 | &#160; &#160; &#160; &#160; if(i!=0)cout<<" "; | ^ a.cc:42:16: error: stray '#' in program 42 | &#160; &#160; &#160; &#160; if(i!=0)cout<<" "; | ^ a.cc:42:23: error: stray '#' in program 42 | &#160; &#160; &#160; &#160; if(i!=0)cout<<" "; | ^ a.cc:43:2: error: stray '#' in program 43 | &#160; &#160; &#160; &#160; cout<<v[i]; | ^ a.cc:43:9: error: stray '#' in program 43 | &#160; &#160; &#160; &#160; cout<<v[i]; | ^ a.cc:43:16: error: stray '#' in program 43 | &#160; &#160; &#160; &#160; cout<<v[i]; | ^ a.cc:43:23: error: stray '#' in program 43 | &#160; &#160; &#160; &#160; cout<<v[i]; | ^ a.cc:44:2: error: stray '#' in program 44 | &#160; &#160; &#160; } | ^ a.cc:44:9: error: stray '#' in program 44 | &#160; &#160; &#160; } | ^ a.cc:44:16: error: stray '#' in program 44 | &#160; &#160; &#160; } | ^ a.cc:45:2: error: stray '#' in program 45 | &#160; &#160; &#160; cout<<endl; | ^ a.cc:45:9: error: stray '#' in program 45 | &#160; &#160; &#160; cout<<endl; | ^ a.cc:45:16: error: stray '#' in program 45 | &#160; &#160; &#160; cout<<endl; | ^ a.cc:46:2: error: stray '#' in program 46 | &#160; &#160; } | ^ a.cc:46:9: error: stray '#' in program 46 | &#160; &#160; } | ^ a.cc:47:2: error: stray '#' in program 47 | &#160; } | ^ a.cc: In function 'int main()': a.cc:13:3: error: lvalue required as unary '&' operand 13 | &#160; int n; | ^~~ a.cc:14:3: error: lvalue required as unary '&' operand 14 | &#160; string s; | ^~~ a.cc:15:3: error: lvalue required as unary '&' operand 15 | &#160; char k; | ^~~ a.cc:16:3: error: lvalue required as unary '&' operand 16 | &#160; while(cin>>n,n){ | ^~~ a.cc:17:3: error: lvalue required as unary '&' operand 17 | &#160; &#160; map<string,int>used; | ^~~ a.cc:17:10: error: lvalue required as unary '&' operand 17 | &#160; &#160; map<string,int>used; | ^~~ a.cc:18:3: error: lvalue required as unary '&' operand 18 | &#160; &#160; for(int i=0;i<n;i++){ | ^~~ a.cc:18:10: error: lvalue required as unary '&' operand 18 | &#160; &#160; for(int i=0;i<n;i++){ | ^~~ a.cc:19:3: error: lvalue required as unary '&' operand 19 | &#160; &#160; &#160; cin.ignore(); | ^~~ a.cc:19:10: error: lvalue required as unary '&' operand 19 | &#160; &#160; &#160; cin.ignore(); | ^~~ a.cc:19:17: error: lvalue required as unary '&' operand 19 | &#160; &#160; &#160; cin.ignore(); | ^~~ a.cc:
s427988987
p00242
C++
#include<iostream> #include<vector> #include<map> #include<sstream> #include<algorithm> using namespace std; typedef pair<int,string> P; bool compare(P a, P b){ &#160; if(a.first==b.first)return a.second<b.second; &#160; return a.first>b.first; } int main() { &#160; int n; &#160; string line; &#160; char k; &#160; while(cin>>n,n){ &#160; &#160; map<string,int>word; &#160; &#160; vector<P>ans; &#160; &#160; for(int i=0;i<n;i++){ &#160; &#160; &#160; cin.ignore(); &#160; &#160; &#160; getline(cin,line); &#160; &#160; &#160; stringstream ss(line); &#160; &#160; &#160; string w; &#160; &#160; &#160; while(ss>>w)word[w]++;; &#160; &#160; } &#160; &#160; cin>>k; &#160; &#160; for(map<string,int>::iterator it=word.begin();it!=word.end();it++)if(it->first[0]==k)ans.push_back(P(it->second,it->first)); &#160; &#160; sort(ans.begin(),ans.end(),compare); &#160; &#160; int cnt=0; &#160; &#160; for(int i=0;i<ans.size();i++){ &#160; &#160; &#160; if(i)cout<<" "; &#160; &#160; &#160; cout<<ans[i].second; &#160; &#160; &#160; cnt++; &#160; &#160; } &#160; &#160; if(!cnt)cout<<"NA"; &#160; &#160; cout<<endl; &#160; } }
a.cc:17:2: error: stray '#' in program 17 | &#160; if(a.first==b.first)return a.second<b.second; | ^ a.cc:18:2: error: stray '#' in program 18 | &#160; return a.first>b.first; | ^ a.cc:26:2: error: stray '#' in program 26 | &#160; int n; | ^ a.cc:27:2: error: stray '#' in program 27 | &#160; string line; | ^ a.cc:28:2: error: stray '#' in program 28 | &#160; char k; | ^ a.cc:29:2: error: stray '#' in program 29 | &#160; while(cin>>n,n){ | ^ a.cc:30:2: error: stray '#' in program 30 | &#160; &#160; map<string,int>word; | ^ a.cc:30:9: error: stray '#' in program 30 | &#160; &#160; map<string,int>word; | ^ a.cc:31:2: error: stray '#' in program 31 | &#160; &#160; vector<P>ans; | ^ a.cc:31:9: error: stray '#' in program 31 | &#160; &#160; vector<P>ans; | ^ a.cc:32:2: error: stray '#' in program 32 | &#160; &#160; for(int i=0;i<n;i++){ | ^ a.cc:32:9: error: stray '#' in program 32 | &#160; &#160; for(int i=0;i<n;i++){ | ^ a.cc:33:2: error: stray '#' in program 33 | &#160; &#160; &#160; cin.ignore(); | ^ a.cc:33:9: error: stray '#' in program 33 | &#160; &#160; &#160; cin.ignore(); | ^ a.cc:33:16: error: stray '#' in program 33 | &#160; &#160; &#160; cin.ignore(); | ^ a.cc:34:2: error: stray '#' in program 34 | &#160; &#160; &#160; getline(cin,line); | ^ a.cc:34:9: error: stray '#' in program 34 | &#160; &#160; &#160; getline(cin,line); | ^ a.cc:34:16: error: stray '#' in program 34 | &#160; &#160; &#160; getline(cin,line); | ^ a.cc:35:2: error: stray '#' in program 35 | &#160; &#160; &#160; stringstream ss(line); | ^ a.cc:35:9: error: stray '#' in program 35 | &#160; &#160; &#160; stringstream ss(line); | ^ a.cc:35:16: error: stray '#' in program 35 | &#160; &#160; &#160; stringstream ss(line); | ^ a.cc:36:2: error: stray '#' in program 36 | &#160; &#160; &#160; string w; | ^ a.cc:36:9: error: stray '#' in program 36 | &#160; &#160; &#160; string w; | ^ a.cc:36:16: error: stray '#' in program 36 | &#160; &#160; &#160; string w; | ^ a.cc:37:2: error: stray '#' in program 37 | &#160; &#160; &#160; while(ss>>w)word[w]++;; | ^ a.cc:37:9: error: stray '#' in program 37 | &#160; &#160; &#160; while(ss>>w)word[w]++;; | ^ a.cc:37:16: error: stray '#' in program 37 | &#160; &#160; &#160; while(ss>>w)word[w]++;; | ^ a.cc:38:2: error: stray '#' in program 38 | &#160; &#160; } | ^ a.cc:38:9: error: stray '#' in program 38 | &#160; &#160; } | ^ a.cc:39:2: error: stray '#' in program 39 | &#160; &#160; cin>>k; | ^ a.cc:39:9: error: stray '#' in program 39 | &#160; &#160; cin>>k; | ^ a.cc:40:2: error: stray '#' in program 40 | &#160; &#160; for(map<string,int>::iterator it=word.begin();it!=word.end();it++)if(it->first[0]==k)ans.push_back(P(it->second,it->first)); | ^ a.cc:40:9: error: stray '#' in program 40 | &#160; &#160; for(map<string,int>::iterator it=word.begin();it!=word.end();it++)if(it->first[0]==k)ans.push_back(P(it->second,it->first)); | ^ a.cc:41:2: error: stray '#' in program 41 | &#160; &#160; sort(ans.begin(),ans.end(),compare); | ^ a.cc:41:9: error: stray '#' in program 41 | &#160; &#160; sort(ans.begin(),ans.end(),compare); | ^ a.cc:42:2: error: stray '#' in program 42 | &#160; &#160; int cnt=0; | ^ a.cc:42:9: error: stray '#' in program 42 | &#160; &#160; int cnt=0; | ^ a.cc:43:2: error: stray '#' in program 43 | &#160; &#160; for(int i=0;i<ans.size();i++){ | ^ a.cc:43:9: error: stray '#' in program 43 | &#160; &#160; for(int i=0;i<ans.size();i++){ | ^ a.cc:44:2: error: stray '#' in program 44 | &#160; &#160; &#160; if(i)cout<<" "; | ^ a.cc:44:9: error: stray '#' in program 44 | &#160; &#160; &#160; if(i)cout<<" "; | ^ a.cc:44:16: error: stray '#' in program 44 | &#160; &#160; &#160; if(i)cout<<" "; | ^ a.cc:45:2: error: stray '#' in program 45 | &#160; &#160; &#160; cout<<ans[i].second; | ^ a.cc:45:9: error: stray '#' in program 45 | &#160; &#160; &#160; cout<<ans[i].second; | ^ a.cc:45:16: error: stray '#' in program 45 | &#160; &#160; &#160; cout<<ans[i].second; | ^ a.cc:46:2: error: stray '#' in program 46 | &#160; &#160; &#160; cnt++; | ^ a.cc:46:9: error: stray '#' in program 46 | &#160; &#160; &#160; cnt++; | ^ a.cc:46:16: error: stray '#' in program 46 | &#160; &#160; &#160; cnt++; | ^ a.cc:47:2: error: stray '#' in program 47 | &#160; &#160; } | ^ a.cc:47:9: error: stray '#' in program 47 | &#160; &#160; } | ^ a.cc:48:2: error: stray '#' in program 48 | &#160; &#160; if(!cnt)cout<<"NA"; | ^ a.cc:48:9: error: stray '#' in program 48 | &#160; &#160; if(!cnt)cout<<"NA"; | ^ a.cc:49:2: error: stray '#' in program 49 | &#160; &#160; cout<<endl; | ^ a.cc:49:9: error: stray '#' in program 49 | &#160; &#160; cout<<endl; | ^ a.cc:50:2: error: stray '#' in program 50 | &#160; } | ^ a.cc: In function 'bool compare(P, P)': a.cc:17:3: error: lvalue required as unary '&' operand 17 | &#160; if(a.first==b.first)return a.second<b.second; | ^~~ a.cc:18:3: error: lvalue required as unary '&' operand 18 | &#160; return a.first>b.first; | ^~~ a.cc: In function 'int main()': a.cc:26:3: error: lvalue required as unary '&' operand 26 | &#160; int n; | ^~~ a.cc:27:3: error: lvalue required as unary '&' operand 27 | &#160; string line; | ^~~ a.cc:28:3: error: lvalue required as unary '&' operand 28 | &#160; char k; | ^~~ a.cc:29:3: error: lvalue required as unary '&' operand 29 | &#160; while(cin>>n,n){ | ^~~ a.cc:30:3: error: lvalue required as unary '&' operand 30 | &#160; &#160; map<string,int>word; | ^~~ a.cc:30:10: error: lvalue required as unary '&' operand 30 | &#160; &#160; map<string,int>word; | ^~~ a.cc:31:3: error: lvalue required as unary '&' operand 31 | &#160; &#160; vector<P>ans; | ^~~ a.cc:31:10: error: lvalue required as unary '&' operand 31 | &#160; &#160; vector<P>ans; | ^~~ a.cc:32:3: error: lvalue required as unary '&' operand 32 | &#160; &#160; for(int i=0;i<n;i++){ | ^~~ a.cc:32:10: error: lvalue required as unary '&' operand 32 | &#160; &#160; for(int i=0;i<n;i++){ | ^~~ a.cc:33:3: error: lvalue required as unary '&' operand 33 | &#160; &#160; &#160; cin.ignore(); | ^~~ a.cc:33:10: error: lvalue required as unary '&' operand 33 | &#160; &#160; &#160; cin.ignore(); | ^~~ a.cc:33:17: error: lvalue required as unary '&' operand 33 | &#160; &#160; &#160; cin.ignore(); | ^~~ a.cc:34:3: error: lvalue required as unary '&' operand 34 | &#160; &#160; &#160; getline(cin,line); | ^~~ a.cc:34:10: error: lvalue required as unary '&' operand 34 | &#160; &#160; &#160; getline(cin,line); | ^~~ a.cc:34:17: error: lvalue required as unary '&' operand 34 | &#160; &#160; &#160; getline(cin,line); | ^~~ a.cc:35:3: error: lvalue required as unary '&' operand 35 | &#160; &#160; &#160; stringstream ss(line); | ^~~ a.cc:35:10: error: lvalue required as unary '&' operand 35 | &#160; &#160; &#160; stringstream ss(line); | ^~~ a.cc:35:17: error: lvalue required as unary '&' operand 35 | &#160; &#160; &#160; stringstream ss(line); | ^~~ a.cc:36:3: error: lvalue required as unary '&' operand 36 | &#160; &#160; &#160; string w; | ^~~ a.cc:36:10: error: lvalue required as unary '&' operand 36 | &#160; &#160; &#160; string w; | ^~~ a.cc:36:17: error: lvalue required as unary '&' operand 36 | &#160; &#160; &#160; string w; | ^~~ a.cc:37:3: error: lvalue required as unary '&' operand 37 | &#160; &#160; &#160; while(ss>>w)word[w]++;; | ^~~ a.cc:37:10: error: lvalue required as unary '&' operand 37 | &#160; &#160; &#160; while(ss>>w)word[w]++;; | ^~~ a.cc:37:17: error: lvalue required as unary '&' operand 37 | &#160; &#160; &#160; while(ss>>w)word[w]++;; | ^~~ a.cc:38:3: error: lvalue required as unary '&' operand 38 | &#160; &#160; } | ^~~ a.cc:38:10: error: lvalue required as unary '&' operand 38 | &#160; &#160; } | ^~~ a.cc:39:3: error: lvalue required as unary '&' operand 39 | &#160; &#160; cin>>k; | ^~~ a.cc:39:10: error: lvalue required as unary '&' operand 39 | &#160; &#160; cin>>k; | ^~~ a.cc:40:3: error: lvalue required as unary '&' operand 40 | &#160; &#160; for(map<string,int>::iterator it=word.begin();it!=word.end();it++)if(it->first[0]==k)ans.push_back(P(it->second,it->first)); | ^~~ a.cc:40:10: error: lvalue required as unary '&' operand 40 | &#160; &#160; for(map<string,int>::iterator it=word.begin();it!=word.end();it++)if(it->first[0]==k)ans.push_back(P(it->second,it->first)); | ^~~ a.cc:41:3: error: lvalue required as unary '&' operand 41 | &#160; &#160; sort(ans.begin(),ans.end(),compare); | ^~~ a.cc:41:10: error: lvalue required as unary '&' operand 41 | &#160; &#160; sort(ans.begin(),ans.end(),compare); | ^~~ a.cc:42:3: error: lvalue required as unary '&' operand 42 | &#160; &#160; int cnt=0; | ^~~ a.cc:42:10: error: lvalue required as unary '&' operand 42 | &#160; &#160; int cnt=0; | ^~~ a.cc:43:3: error: lvalue required as unary '&' operand 43 | &#160; &#160; for(int i=0;i<ans.size();i++){ | ^~~ a.cc:43:10: error: lvalue required as unary '&' operand 43 | &#160; &#160; for(int i=0;i<ans.size();i+
s151647354
p00242
C++
#include<map> #include<vector> #include<algorithm> #include<string> #include<cstdio> using namespace std; bool pr(const pair<string,int>& p,const pair<string,int>& q){ if(false){ }else if(p.second>q.second){ return true; }else if(p.second<q.second){ return false; }else{ return p.first<q.first; } } int main(){ int i,j,k; int n; while(scanf("%d\n",&n),n){ map<string,int> a[26]; for(i=0;i<n;++i){ char s[1026]; fgets(s,1025,stdin); s[strlen(s)-1]='\0'; for(j=0;s[j];j=k){ for(;s[j]&&s[j]==' ';++j); for(k=j+1;s[k]&&s[k]!=' ';++k); if(k-j>0){ char t[21]; strncpy(t,s+j,k-j); t[k-j]='\0'; ++a[t[0]-'a'][t]; } } } char c; scanf("%c",&c); vector<pair<string,int> > b; map<string,int>::iterator it; for(it=a[c-'a'].begin();it!=a[c-'a'].end();++it) b.push_back(*it); sort(b.begin(),b.end(),pr); if(b.size()){ for(i=0;i<min(5,(int)b.size())-1;++i) printf("%s ",b[i].first.c_str()); printf("%s\n",b[i].first.c_str()); }else{ puts("NA"); } } return 0; }
a.cc: In function 'int main()': a.cc:25:27: error: 'strlen' was not declared in this scope 25 | s[strlen(s)-1]='\0'; | ^~~~~~ a.cc:6:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 5 | #include<cstdio> +++ |+#include <cstring> 6 | using namespace std; a.cc:31:41: error: 'strncpy' was not declared in this scope 31 | strncpy(t,s+j,k-j); | ^~~~~~~ a.cc:31:41: note: 'strncpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
s117556773
p00242
C++
#include<iostream> #include<string> #include<map> #include<vector> #include<algorithm> using namespace std; vector<string> Split(const string &s) { vector<string> v; int i=0, j; while((j=s.find_first_of(' ',i)) !=string::npos) { v.push_back(s.substr(i,j-i)); i=j+1; } if(i!=s.size()-1) v.push_back(s.substr(i)); return v; } int main() { int n; string s; vector<string>v; map<string,int>m; cin.tie(0); ios::sync_with_stdio(false); while(scanf("%d",&n),n) { getline(cin,s); m.clear(); while(n--) { getline(cin,s); v=Split(s); for(int i=0;i<v.size();++i) ++m[v[i]]; } getline(cin,s); vector<pair<int,string> >vp; for(map<string,int>::iterator ite=m.begin();ite!=m.end();++ite) { if(ite->first[0]!=s[0])continue; vp.push_back(make_pair(-ite->second,ite->first)); } if(vp.empty())cout<<"NA"<<endl; else { sort(vp.begin(),vp.end()); int end=min(5U,vp.size()); for(int i=0; i<end; ++i) cout<<vp[i].second<<(i+1==end?"\n":" "); } } return 0; }
a.cc: In function 'int main()': a.cc:50:36: error: no matching function for call to 'min(unsigned int, std::vector<std::pair<int, std::__cxx11::basic_string<char> > >::size_type)' 50 | int end=min(5U,vp.size()); | ~~~^~~~~~~~~~~~~~ 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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:50:36: note: deduced conflicting types for parameter 'const _Tp' ('unsigned int' and 'std::vector<std::pair<int, std::__cxx11::basic_string<char> > >::size_type' {aka 'long unsigned int'}) 50 | int end=min(5U,vp.size()); | ~~~^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:5: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:50:36: note: mismatched types 'std::initializer_list<_Tp>' and 'unsigned int' 50 | int end=min(5U,vp.size()); | ~~~^~~~~~~~~~~~~~
s203203572
p00242
C++
#include<iostream> #include<string> #include<map> #include<vector> #include<algorithm> using namespace std; vector<string> Split(const string &s) { vector<string> v; int i=0, j; while((j=s.find_first_of(' ',i)) !=string::npos) { v.push_back(s.substr(i,j-i)); i=j+1; } if(i!=s.size()-1) v.push_back(s.substr(i)); return v; } int main() { int n; string s; vector<string>v; map<string,int>m; cin.tie(0); ios::sync_with_stdio(false); while(cin>>n,n) { getline(cin,s); m.clear(); while(n--) { getline(cin,s); v=Split(s); for(int i=0;i<v.size();++i) ++m[v[i]]; } getline(cin,s); vector<pair<int,string> >vp; for(map<string,int>::iterator ite=m.begin();ite!=m.end();++ite) { if(ite->first[0]!=s[0])continue; vp.push_back(make_pair(-ite->second,ite->first)); } if(vp.empty())cout<<"NA"<<endl; else { sort(vp.begin(),vp.end()); int end=min(5U,vp.size()); for(int i=0; i<end; ++i) cout<<vp[i].second<<(i+1==end?"\n":" "); } } return 0; }
a.cc: In function 'int main()': a.cc:50:36: error: no matching function for call to 'min(unsigned int, std::vector<std::pair<int, std::__cxx11::basic_string<char> > >::size_type)' 50 | int end=min(5U,vp.size()); | ~~~^~~~~~~~~~~~~~ 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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:50:36: note: deduced conflicting types for parameter 'const _Tp' ('unsigned int' and 'std::vector<std::pair<int, std::__cxx11::basic_string<char> > >::size_type' {aka 'long unsigned int'}) 50 | int end=min(5U,vp.size()); | ~~~^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:5: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:50:36: note: mismatched types 'std::initializer_list<_Tp>' and 'unsigned int' 50 | int end=min(5U,vp.size()); | ~~~^~~~~~~~~~~~~~