submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s073288134
p00045
C
#include<stdio.h> int main(void){ int price=0; int number=0; int psum=0,nsum=0,count=0; while(scanf("%d,%d",&price,&number)!=EOF){ psum += price*number; nsum += number; count++; } printf("%d\n",psum); double = nsum/count; if((nsum*10%)5>=5){nsum++;} printf("%d\n",nsum); return 0; }
main.c: In function 'main': main.c:12:10: error: expected identifier or '(' before '=' token 12 | double = nsum/count; | ^ main.c:13:15: error: expected expression before ')' token 13 | if((nsum*10%)5>=5){nsum++;} | ^
s473815884
p00045
C
#include <stdio.h> #include <math.h> int main(){ int mono=0,kane=0,tmono,tkane,t=0; while(0<=scanf("%d,%d",&tkane,&tmono)){ mono+=tmono; kane+=(tmono*tkane); if(tmono!=0) t++; } printf("%d\n%d\n",kane,int(((double)mono)/((double)t)+0.5)); return 0; }
main.c: In function 'main': main.c:14:24: error: expected expression before 'int' 14 | printf("%d\n%d\n",kane,int(((double)mono)/((double)t)+0.5)); return 0; | ^~~
s033755627
p00045
C
#include <stdio.h> #include <math.h> int main(){ int mono=0,kane=0,tmono,tkane,t=0; while(0<=scanf("%d,%d",&tkane,&tmono)){ mono+=tmono; kane+=(tmono*tkane); if(tmono!=0) t++; } printf("%d\n%d\n",kane,int(((double)mono)/((double)t)+0.5)); return 0; }
main.c: In function 'main': main.c:14:24: error: expected expression before 'int' 14 | printf("%d\n%d\n",kane,int(((double)mono)/((double)t)+0.5)); | ^~~
s169763452
p00045
C
include<stdio.h> a[100],b[100],s,c;int main(){ int i,j,as=0; for(i=0;scanf("%d,%d",&a[i],&b[i])!=EOF;i++){ s+=a[i]*b[i];as+=b[i];c++; } printf("%d\n%d\n",s,(int)((double)((double)as/(double)c)+0.5));exit(0); }
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token 1 | include<stdio.h> | ^ main.c: In function 'main': main.c:4:17: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 4 | for(i=0;scanf("%d,%d",&a[i],&b[i])!=EOF;i++){ | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | include<stdio.h> main.c:4:17: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 4 | for(i=0;scanf("%d,%d",&a[i],&b[i])!=EOF;i++){ | ^~~~~ main.c:4:17: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:4:32: error: 'a' undeclared (first use in this function); did you mean 'as'? 4 | for(i=0;scanf("%d,%d",&a[i],&b[i])!=EOF;i++){ | ^ | as main.c:4:32: note: each undeclared identifier is reported only once for each function it appears in main.c:4:38: error: 'b' undeclared (first use in this function) 4 | for(i=0;scanf("%d,%d",&a[i],&b[i])!=EOF;i++){ | ^ main.c:4:45: error: 'EOF' undeclared (first use in this function) 4 | for(i=0;scanf("%d,%d",&a[i],&b[i])!=EOF;i++){ | ^~~ main.c:4:45: note: 'EOF' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>' main.c:5:17: error: 's' undeclared (first use in this function); did you mean 'as'? 5 | s+=a[i]*b[i];as+=b[i];c++; | ^ | as main.c:5:39: error: 'c' undeclared (first use in this function) 5 | s+=a[i]*b[i];as+=b[i];c++; | ^ main.c:7:9: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 7 | printf("%d\n%d\n",s,(int)((double)((double)as/(double)c)+0.5));exit(0); | ^~~~~~ main.c:7:9: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:7:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:7:9: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:7:72: error: implicit declaration of function 'exit' [-Wimplicit-function-declaration] 7 | printf("%d\n%d\n",s,(int)((double)((double)as/(double)c)+0.5));exit(0); | ^~~~ main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'exit' +++ |+#include <stdlib.h> 1 | include<stdio.h> main.c:7:72: warning: incompatible implicit declaration of built-in function 'exit' [-Wbuiltin-declaration-mismatch] 7 | printf("%d\n%d\n",s,(int)((double)((double)as/(double)c)+0.5));exit(0); | ^~~~ main.c:7:72: note: include '<stdlib.h>' or provide a declaration of 'exit'
s139949233
p00045
C
#include<stdio.h> int main() { int sum = 0 , ave = 0 , count; while ( scanf("%d,%d",&m,&n),m != EOF ) { sum += m * n; count++; } ave = (int)(( sum / count ) +0.5); printf("%d\n%d\n",sum,ave); return 0; }
main.c: In function 'main': main.c:5:32: error: 'm' undeclared (first use in this function) 5 | while ( scanf("%d,%d",&m,&n),m != EOF ) { | ^ main.c:5:32: note: each undeclared identifier is reported only once for each function it appears in main.c:5:35: error: 'n' undeclared (first use in this function) 5 | while ( scanf("%d,%d",&m,&n),m != EOF ) { | ^
s617517758
p00045
C
main(){ int t[99]; int r[99]; int sum=0; int i=0; double n=0; while(scanf("%d,%d",&t[i],&r[i])!=EOF){ sum=sum+t[i]*r[i]; n=n+r[i++]; } printf("%d\n%.0f\n",sum,round(n/i)); }
main.c:1:1: error: return type defaults to 'int' [-Wimplicit-int] 1 | main(){ | ^~~~ main.c: In function 'main': main.c:8:9: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 8 | while(scanf("%d,%d",&t[i],&r[i])!=EOF){ | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | main(){ main.c:8:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 8 | while(scanf("%d,%d",&t[i],&r[i])!=EOF){ | ^~~~~ main.c:8:9: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:8:37: error: 'EOF' undeclared (first use in this function) 8 | while(scanf("%d,%d",&t[i],&r[i])!=EOF){ | ^~~ main.c:8:37: note: 'EOF' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>' main.c:8:37: note: each undeclared identifier is reported only once for each function it appears in main.c:12:3: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 12 | printf("%d\n%.0f\n",sum,round(n/i)); | ^~~~~~ main.c:12:3: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:12:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:12:3: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:12:27: error: implicit declaration of function 'round' [-Wimplicit-function-declaration] 12 | printf("%d\n%.0f\n",sum,round(n/i)); | ^~~~~ main.c:1:1: note: include '<math.h>' or provide a declaration of 'round' +++ |+#include <math.h> 1 | main(){ main.c:12:27: warning: incompatible implicit declaration of built-in function 'round' [-Wbuiltin-declaration-mismatch] 12 | printf("%d\n%.0f\n",sum,round(n/i)); | ^~~~~ main.c:12:27: note: include '<math.h>' or provide a declaration of 'round'
s886128553
p00045
C
int main(){int t[99];int r[99];int sum=0;int i=0;double n=0;while(scanf("%d,%d",&t[i],&r[i])!=EOF){sum=sum+t[i]*r[i];n=n+r[i++];}printf("%d\n%.0f\n",sum,round(n/i));return 0;}
main.c: In function 'main': main.c:1:67: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 1 | int main(){int t[99];int r[99];int sum=0;int i=0;double n=0;while(scanf("%d,%d",&t[i],&r[i])!=EOF){sum=sum+t[i]*r[i];n=n+r[i++];}printf("%d\n%.0f\n",sum,round(n/i));return 0;} | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | int main(){int t[99];int r[99];int sum=0;int i=0;double n=0;while(scanf("%d,%d",&t[i],&r[i])!=EOF){sum=sum+t[i]*r[i];n=n+r[i++];}printf("%d\n%.0f\n",sum,round(n/i));return 0;} main.c:1:67: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 1 | int main(){int t[99];int r[99];int sum=0;int i=0;double n=0;while(scanf("%d,%d",&t[i],&r[i])!=EOF){sum=sum+t[i]*r[i];n=n+r[i++];}printf("%d\n%.0f\n",sum,round(n/i));return 0;} | ^~~~~ main.c:1:67: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:1:95: error: 'EOF' undeclared (first use in this function) 1 | int main(){int t[99];int r[99];int sum=0;int i=0;double n=0;while(scanf("%d,%d",&t[i],&r[i])!=EOF){sum=sum+t[i]*r[i];n=n+r[i++];}printf("%d\n%.0f\n",sum,round(n/i));return 0;} | ^~~ main.c:1:95: note: 'EOF' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>' main.c:1:95: note: each undeclared identifier is reported only once for each function it appears in main.c:1:130: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 1 | int main(){int t[99];int r[99];int sum=0;int i=0;double n=0;while(scanf("%d,%d",&t[i],&r[i])!=EOF){sum=sum+t[i]*r[i];n=n+r[i++];}printf("%d\n%.0f\n",sum,round(n/i));return 0;} | ^~~~~~ main.c:1:130: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:1:130: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:1:130: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:1:154: error: implicit declaration of function 'round' [-Wimplicit-function-declaration] 1 | int main(){int t[99];int r[99];int sum=0;int i=0;double n=0;while(scanf("%d,%d",&t[i],&r[i])!=EOF){sum=sum+t[i]*r[i];n=n+r[i++];}printf("%d\n%.0f\n",sum,round(n/i));return 0;} | ^~~~~ main.c:1:1: note: include '<math.h>' or provide a declaration of 'round' +++ |+#include <math.h> 1 | int main(){int t[99];int r[99];int sum=0;int i=0;double n=0;while(scanf("%d,%d",&t[i],&r[i])!=EOF){sum=sum+t[i]*r[i];n=n+r[i++];}printf("%d\n%.0f\n",sum,round(n/i));return 0;} main.c:1:154: warning: incompatible implicit declaration of built-in function 'round' [-Wbuiltin-declaration-mismatch] 1 | int main(){int t[99];int r[99];int sum=0;int i=0;double n=0;while(scanf("%d,%d",&t[i],&r[i])!=EOF){sum=sum+t[i]*r[i];n=n+r[i++];}printf("%d\n%.0f\n",sum,round(n/i));return 0;} | ^~~~~ main.c:1:154: note: include '<math.h>' or provide a declaration of 'round'
s150051149
p00045
C
#include<stdio.h> int main(){ int a,b,sum=0,nsum=0,n for(n=0;;n++){ if(scanf("%d,%d",a,b) == EOF){break;} sum+=a*b; nsum+=b; } printf("%d\n%d\n",sum,nsum/n); }
main.c: In function 'main': main.c:4:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'for' 4 | for(n=0;;n++){ | ^~~ main.c:4:18: error: 'n' undeclared (first use in this function) 4 | for(n=0;;n++){ | ^ main.c:4:18: note: each undeclared identifier is reported only once for each function it appears in main.c:4:21: error: expected ';' before ')' token 4 | for(n=0;;n++){ | ^ | ; main.c:4:21: error: expected statement before ')' token main.c:5:47: error: break statement not within loop or switch 5 | if(scanf("%d,%d",a,b) == EOF){break;} | ^~~~~
s956237121
p00045
C
#include<stdio.h> int main(){ int a,b,sum=0,nsum=0,n for(n=0;;n++){ if(scanf("%d,%d",a,b) == EOF){break;} sum+=a*b; nsum+=b; } printf("%d\n%d\n",sum,nsum/n); return 0; }
main.c: In function 'main': main.c:4:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'for' 4 | for(n=0;;n++){ | ^~~ main.c:4:18: error: 'n' undeclared (first use in this function) 4 | for(n=0;;n++){ | ^ main.c:4:18: note: each undeclared identifier is reported only once for each function it appears in main.c:4:21: error: expected ';' before ')' token 4 | for(n=0;;n++){ | ^ | ; main.c:4:21: error: expected statement before ')' token main.c:5:47: error: break statement not within loop or switch 5 | if(scanf("%d,%d",a,b) == EOF){break;} | ^~~~~
s385698436
p00045
C
#define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #include<stdio.h> #include<math.h> #include<string.h> #include<stdlib.h> #include<stdarg.h> #include<malloc.h> int round(double x) { if(x>=0) x = floor(x + 0.5); else x = -1.0 * floor(fabs(x) + 0.5); return (int)x; } int main() { int a, b, sum=0, ave=0, n=0; while(scanf("%d,%d", &a, &b) != EOF){ sum += a * b; ave += b; n++; } ave = round((double)ave / n); printf("%d\n%d\n", sum, ave); return 0; }
main.c:11:5: error: conflicting types for 'round'; have 'int(double)' 11 | int round(double x) | ^~~~~ In file included from /usr/include/features.h:523, from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33, from /usr/include/stdio.h:28, from main.c:4: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:334:1: note: previous declaration of 'round' with type 'double(double)' 334 | __MATHCALLX (round,, (_Mdouble_ __x), (__const__)); | ^~~~~~~~~~~
s504770549
p00045
C
#define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #include<stdio.h> #include<math.h> #include<string.h> #include<stdlib.h> #include<stdarg.h> #include<malloc.h> int round(double x) { if(x>=0) x = floor(x + 0.5); else x = -1.0 * floor(fabs(x) + 0.5); return (int)x; } int main() { int a, b, sum=0, ave=0, n=0; while(scanf("%d,%d", &a, &b) != EOF){ sum += a * b; ave += b; n++; } ave = round((double)ave / n); printf("%d\n%d\n", sum, ave); return 0; }
main.c:11:5: error: conflicting types for 'round'; have 'int(double)' 11 | int round(double x) | ^~~~~ In file included from /usr/include/features.h:523, from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33, from /usr/include/stdio.h:28, from main.c:4: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:334:1: note: previous declaration of 'round' with type 'double(double)' 334 | __MATHCALLX (round,, (_Mdouble_ __x), (__const__)); | ^~~~~~~~~~~
s667322995
p00045
C
#define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #include<stdio.h> #include<math.h> #include<string.h> #include<stdlib.h> #include<stdarg.h> #include<malloc.h> int round(double x) { if(x>=0) x = floor(x + 0.5); else x = -1.0 * floor(fabs(x) + 0.5); return x; } int main() { int a, b, sum=0, ave=0, n=0; while(scanf("%d,%d", &a, &b) != EOF){ sum += a * b; ave += b; n++; } ave = round((double)ave / n); printf("%d\n%d\n", sum, ave); return 0; }
main.c:11:5: error: conflicting types for 'round'; have 'int(double)' 11 | int round(double x) | ^~~~~ In file included from /usr/include/features.h:523, from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33, from /usr/include/stdio.h:28, from main.c:4: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:334:1: note: previous declaration of 'round' with type 'double(double)' 334 | __MATHCALLX (round,, (_Mdouble_ __x), (__const__)); | ^~~~~~~~~~~
s762559522
p00045
C
#define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #include<stdio.h> #include<math.h> #include<string.h> #include<stdlib.h> #include<stdarg.h> #include<malloc.h> int round(double x); int main() { int a, b, sum=0, ave=0, n=0; while(scanf("%d,%d", &a, &b) != EOF){ sum += a * b; ave += b; n++; } ave = round((double)ave / n); printf("%d\n%d\n", sum, ave); return 0; } int round(double x) { if(x>=0) x = floor(x + 0.5); else x = -1.0 * floor(fabs(x) + 0.5); return (int)x; }
main.c:11:5: error: conflicting types for 'round'; have 'int(double)' 11 | int round(double x); | ^~~~~ In file included from /usr/include/features.h:523, from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33, from /usr/include/stdio.h:28, from main.c:4: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:334:1: note: previous declaration of 'round' with type 'double(double)' 334 | __MATHCALLX (round,, (_Mdouble_ __x), (__const__)); | ^~~~~~~~~~~ main.c:31:5: error: conflicting types for 'round'; have 'int(double)' 31 | int round(double x) | ^~~~~ /usr/include/x86_64-linux-gnu/bits/mathcalls.h:334:1: note: previous declaration of 'round' with type 'double(double)' 334 | __MATHCALLX (round,, (_Mdouble_ __x), (__const__)); | ^~~~~~~~~~~
s999511073
p00045
C
#define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #include<stdio.h> #include<math.h> #include<string.h> #include<stdlib.h> #include<stdarg.h> #include<malloc.h> int round(double x); int main() { int a, b, sum=0, ave=0, n=0; while(scanf("%d,%d", &a, &b) != EOF){ sum += a * b; ave += b; n++; } ave = round((double)ave / n); printf("%d\n%d\n", sum, ave); return 0; } int round(double x) { int buf; if(x>=0) x = floor(x + 0.5); else x = -1.0 * floor(fabs(x) + 0.5); buf = (int)x; return buf; }
main.c:11:5: error: conflicting types for 'round'; have 'int(double)' 11 | int round(double x); | ^~~~~ In file included from /usr/include/features.h:523, from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33, from /usr/include/stdio.h:28, from main.c:4: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:334:1: note: previous declaration of 'round' with type 'double(double)' 334 | __MATHCALLX (round,, (_Mdouble_ __x), (__const__)); | ^~~~~~~~~~~ main.c:31:5: error: conflicting types for 'round'; have 'int(double)' 31 | int round(double x) | ^~~~~ /usr/include/x86_64-linux-gnu/bits/mathcalls.h:334:1: note: previous declaration of 'round' with type 'double(double)' 334 | __MATHCALLX (round,, (_Mdouble_ __x), (__const__)); | ^~~~~~~~~~~
s580753710
p00045
C
s,n,i;main(x,y){fesetround(FE_TONEAREST);for(;~scanf("%d,%d",&x,&y)?s+=x*y:!printf("%d\n%.f\n",s,nearbyint(1.*n/i));i++)n+=y;}////
main.c:1:1: warning: data definition has no type or storage class 1 | s,n,i;main(x,y){fesetround(FE_TONEAREST);for(;~scanf("%d,%d",&x,&y)?s+=x*y:!printf("%d\n%.f\n",s,nearbyint(1.*n/i));i++)n+=y;}//// | ^ main.c:1:1: error: type defaults to 'int' in declaration of 's' [-Wimplicit-int] main.c:1:3: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int] 1 | s,n,i;main(x,y){fesetround(FE_TONEAREST);for(;~scanf("%d,%d",&x,&y)?s+=x*y:!printf("%d\n%.f\n",s,nearbyint(1.*n/i));i++)n+=y;}//// | ^ main.c:1:5: error: type defaults to 'int' in declaration of 'i' [-Wimplicit-int] 1 | s,n,i;main(x,y){fesetround(FE_TONEAREST);for(;~scanf("%d,%d",&x,&y)?s+=x*y:!printf("%d\n%.f\n",s,nearbyint(1.*n/i));i++)n+=y;}//// | ^ main.c:1:7: error: return type defaults to 'int' [-Wimplicit-int] 1 | s,n,i;main(x,y){fesetround(FE_TONEAREST);for(;~scanf("%d,%d",&x,&y)?s+=x*y:!printf("%d\n%.f\n",s,nearbyint(1.*n/i));i++)n+=y;}//// | ^~~~ main.c: In function 'main': main.c:1:7: error: type of 'x' defaults to 'int' [-Wimplicit-int] main.c:1:7: error: type of 'y' defaults to 'int' [-Wimplicit-int] main.c:1:17: error: implicit declaration of function 'fesetround' [-Wimplicit-function-declaration] 1 | s,n,i;main(x,y){fesetround(FE_TONEAREST);for(;~scanf("%d,%d",&x,&y)?s+=x*y:!printf("%d\n%.f\n",s,nearbyint(1.*n/i));i++)n+=y;}//// | ^~~~~~~~~~ main.c:1:28: error: 'FE_TONEAREST' undeclared (first use in this function) 1 | s,n,i;main(x,y){fesetround(FE_TONEAREST);for(;~scanf("%d,%d",&x,&y)?s+=x*y:!printf("%d\n%.f\n",s,nearbyint(1.*n/i));i++)n+=y;}//// | ^~~~~~~~~~~~ main.c:1:28: note: each undeclared identifier is reported only once for each function it appears in main.c:1:48: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 1 | s,n,i;main(x,y){fesetround(FE_TONEAREST);for(;~scanf("%d,%d",&x,&y)?s+=x*y:!printf("%d\n%.f\n",s,nearbyint(1.*n/i));i++)n+=y;}//// | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | s,n,i;main(x,y){fesetround(FE_TONEAREST);for(;~scanf("%d,%d",&x,&y)?s+=x*y:!printf("%d\n%.f\n",s,nearbyint(1.*n/i));i++)n+=y;}//// main.c:1:48: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 1 | s,n,i;main(x,y){fesetround(FE_TONEAREST);for(;~scanf("%d,%d",&x,&y)?s+=x*y:!printf("%d\n%.f\n",s,nearbyint(1.*n/i));i++)n+=y;}//// | ^~~~~ main.c:1:48: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:1:77: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 1 | s,n,i;main(x,y){fesetround(FE_TONEAREST);for(;~scanf("%d,%d",&x,&y)?s+=x*y:!printf("%d\n%.f\n",s,nearbyint(1.*n/i));i++)n+=y;}//// | ^~~~~~ main.c:1:77: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:1:77: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:1:77: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:1:98: error: implicit declaration of function 'nearbyint' [-Wimplicit-function-declaration] 1 | s,n,i;main(x,y){fesetround(FE_TONEAREST);for(;~scanf("%d,%d",&x,&y)?s+=x*y:!printf("%d\n%.f\n",s,nearbyint(1.*n/i));i++)n+=y;}//// | ^~~~~~~~~ main.c:1:1: note: include '<math.h>' or provide a declaration of 'nearbyint' +++ |+#include <math.h> 1 | s,n,i;main(x,y){fesetround(FE_TONEAREST);for(;~scanf("%d,%d",&x,&y)?s+=x*y:!printf("%d\n%.f\n",s,nearbyint(1.*n/i));i++)n+=y;}//// main.c:1:98: warning: incompatible implicit declaration of built-in function 'nearbyint' [-Wbuiltin-declaration-mismatch] 1 | s,n,i;main(x,y){fesetround(FE_TONEAREST);for(;~scanf("%d,%d",&x,&y)?s+=x*y:!printf("%d\n%.f\n",s,nearbyint(1.*n/i));i++)n+=y;}//// | ^~~~~~~~~ main.c:1:98: note: include '<math.h>' or provide a declaration of 'nearbyint'
s105195043
p00045
C
#include<stdio.h> int main(){ int x,y,a,b,count; x=0; y=0; count=0; while(scanf("%d,%d",&a,&b)=EOF){ x=x+a*b; y+=b; count++; } y=y/count+0.5; printf("%d\n%d\n",x,y); return 0; }
main.c: In function 'main': main.c:7:35: error: lvalue required as left operand of assignment 7 | while(scanf("%d,%d",&a,&b)=EOF){ | ^
s306392951
p00045
C
#include<stdio.h> int main(void){ int g=0,c=0,a,b; char z; while(scanf("%d %c %d",&a,&z,&b)!=EOF){ g+=a*b;c+=a; } printf("%d\n%d\n",g,(int)((1.0*g/c+0.5)); return 0; }
main.c: In function 'main': main.c:9:43: error: expected ')' before ';' token 9 | printf("%d\n%d\n",g,(int)((1.0*g/c+0.5)); | ~ ^ | ) main.c:10:12: error: expected ';' before '}' token 10 | return 0; | ^ | ; 11 | } | ~
s662734583
p00045
C++
#include<cstdio> using namespace std; int main() { int m, n; int ans = 0, cnt = 0; double a = 0; while (scanf("%d,%d", &m, &n) != EOF) { ans += m*n; a += n; cnt++; } a = a / cnt + 0.5; printf("%d\n%d\n", ans, (int)a);
a.cc: In function 'int main()': a.cc:14:41: error: expected '}' at end of input 14 | printf("%d\n%d\n", ans, (int)a); | ^ a.cc:4:1: note: to match this '{' 4 | { | ^
s667363684
p00045
C++
#include<iostream> using namespace std; int main(){ int x = 0, y = 0, s = 0, sy = 0, a = 0, i = 0; while(cin >> x >> y){ s = s + x * y; sy = sy + y; a = sy / i++; a+=0.5; a=int(a) } return 0; }
a.cc: In function 'int main()': a.cc:13:9: error: expected ';' before '}' token 13 | a=int(a) | ^ | ; 14 | } | ~
s040947346
p00045
C++
#include<iostream> using namespace std; int main(){ int x = 0, y = 0, s = 0, sy = 0, a = 0, i = 0; while(cin >> x >> y){ s = s + x * y; sy = sy + y; a = sy / i++; a+=0.5; a=int(a) } return 0; }
a.cc: In function 'int main()': a.cc:13:9: error: expected ';' before '}' token 13 | a=int(a) | ^ | ; 14 | } | ~
s223634493
p00045
C++
#include<iostream> #include<stdio.h> using namespace std; int main(){ int x = 0, y = 0, s = 0, a = 0; double sy = 0 , i = 0; while(scanf("%d,%d",&x,&y)+1){ s = s + x * y; sy = sy + y; i++; } a=int(sy / i + 0.5); cout >> s >> endl >> a >> endl; return 0; }
a.cc: In function 'int main()': a.cc:17:6: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int') 17 | cout >> s >> endl >> a >> endl; | ~~~~ ^~ ~ | | | | | int | std::ostream {aka std::basic_ostream<char>} a.cc:17:6: note: candidate: 'operator>>(int, int)' (built-in) 17 | cout >> s >> endl >> a >> endl; | ~~~~~^~~~ a.cc:17:6: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int' In file included from /usr/include/c++/14/string:55, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 835 | operator>>(basic_istream<_CharT, _Traits>& __in, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed: a.cc:17:9: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 17 | cout >> s >> endl >> a >> endl; | ^ In file included from /usr/include/c++/14/bits/memory_resource.h:38, from /usr/include/c++/14/string:68: /usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)' 131 | operator>>(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed: a.cc:17:1: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte' 17 | cout >> s >> endl >> a >> endl; | ^~~~ In file included from /usr/include/c++/14/istream:1109, from /usr/include/c++/14/iostream:42: /usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)' 978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c) | ^~~~~~~~ /usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed: a.cc:17:9: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 17 | cout >> s >> endl >> a >> endl; | ^ /usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)' 849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed: a.cc:17:9: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 17 | cout >> s >> endl >> a >> endl; | ^ /usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)' 854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed: a.cc:17:9: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 17 | cout >> s >> endl >> a >> endl; | ^ /usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)' 896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed: a.cc:17:9: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 17 | cout >> s >> endl >> a >> endl; | ^ /usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)' 939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed: a.cc:17:9: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 17 | cout >> s >> endl >> a >> endl; | ^ /usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)' 945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed: a.cc:17:9: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 17 | cout >> s >> endl >> a >> endl; | ^ /usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed: /usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = int&]': a.cc:17:9: required from here 17 | cout >> s >> endl >> a >> endl; | ^ /usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~
s427858862
p00045
C++
#include<iostream> using namespace std; int main(void) { char c; int a, b, sum, ave, i; sum = ave = i = 0; while (cin >> a >> c >> b) { sum += a*b; ave += b; i++ } cout << sum << endl; cout << (int)(((double)ave / i) + 0.5) << endl; }
a.cc: In function 'int main()': a.cc:11:20: error: expected ';' before '}' token 11 | i++ | ^ | ; 12 | } | ~
s805241157
p00045
C++
#include <iostream> #include <cstdio> using namespace std; int main() { int one, all, i; double many, heikin; all = 0; i = 0; while(cin >> one >> "," >> many){ all += one * many; heikin += many; i++; printf("%d\n%.f\n", all, (heikin / i + 0.5)); } return 0; }
a.cc: In function 'int main()': a.cc:15:26: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'const char [2]') 15 | while(cin >> one >> "," >> many){ | ~~~~~~~~~~ ^~ ~~~ | | | | | const char [2] | std::basic_istream<char>::__istream_type {aka std::basic_istream<char>} In file included from /usr/include/c++/14/iostream:42, from a.cc:1: /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:15:29: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'const char*' 15 | while(cin >> one >> "," >> many){ | ^~~ /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:15:29: error: invalid conversion from 'const char*' to 'short int' [-fpermissive] 15 | while(cin >> one >> "," >> many){ | ^~~ | | | const char* a.cc:15:29: error: cannot bind rvalue '(short int)((const char*)",")' 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:15:29: error: invalid conversion from 'const char*' to 'short unsigned int' [-fpermissive] 15 | while(cin >> one >> "," >> many){ | ^~~ | | | const char* a.cc:15:29: error: cannot bind rvalue '(short unsigned int)((const char*)",")' 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:15:29: error: invalid conversion from 'const char*' to 'int' [-fpermissive] 15 | while(cin >> one >> "," >> many){ | ^~~ | | | const char* a.cc:15:29: error: cannot bind rvalue '(int)((const char*)",")' 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:15:29: error: invalid conversion from 'const char*' to 'unsigned int' [-fpermissive] 15 | while(cin >> one >> "," >> many){ | ^~~ | | | const char* a.cc:15:29: error: cannot bind rvalue '(unsigned int)((const char*)",")' 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:15:29: error: invalid conversion from 'const char*' to 'long int' [-fpermissive] 15 | while(cin >> one >> "," >> many){ | ^~~ | | | const char* a.cc:15:29: error: cannot bind rvalue '(long int)((const char*)",")' 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:15:29: error: invalid conversion from 'const char*' to 'long unsigned int' [-fpermissive] 15 | while(cin >> one >> "," >> many){ | ^~~ | | | const char* a.cc:15:29: error: cannot bind rvalue '(long unsigned int)((const char*)",")' 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:15:29: error: invalid conversion from 'const char*' to 'long long int' [-fpermissive] 15 | while(cin >> one >> "," >> many){ | ^~~ | | | const char* a.cc:15:29: error: cannot bind rvalue '(long long int)((const char*)",")' 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:15:29: error: invalid conversion from 'const char*' to 'long long unsigned int' [-fpermissive] 15 | while(cin >> one >> "," >> many){ | ^~~ | | | const char* a.cc:15:29: error: cannot bind rvalue '(long long unsigned int)((const char*)",")' 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:15:29: error: invalid conversion from 'const void*' to 'void*' [-fpermissive] 15 | while(cin >> one >> "," >> many){ | ^~~ | | | const void* a.cc:15:29: error: cannot bind rvalue '(void*)((const void*)((const char*)","))' to 'void*&' /usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 219 | operator>>(float& __f) | ^~~~~~~~ /usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'const char [2]' to 'float&' 219 | operator>>(float& __f) | ~~~~~~~^~~ /usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 223 | operator>>(double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'const char [2]' to 'double&' 223 | operator>>(double& __f) | ~~~~~~~~^~~ /usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 227 | operator>>(long double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from 'const char [2]' to 'long double&' 227 | operator>>(long double& __f) | ~~~~~~~~~~~~~^~~ /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>]' 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from 'const char [2]' to '
s871400227
p00045
C++
#include <iostream> #include <cstdio> #include <cmarh> using namespace std; int main() { int a, b, sum = 0, i = 0, c = 0; while (scanf("%d,%d", &a, &b) != EOF){ sum += a * b; i++; c += b; } cout << sum << endl << round(c / i) << endl; return (0); }
a.cc:3:10: fatal error: cmarh: No such file or directory 3 | #include <cmarh> | ^~~~~~~ compilation terminated.
s191903157
p00045
C++
#include <iostream> #include <cstdio> using namespace std; int main(void){ // Here your code ! int n,d,sum=0,D=0,cout=0; char c; while(cin>>n>>c>>d){ sum+=(n*d); D=D+d; cout++; } D=(double)D/cout+0.5; cout << sum << "\n" << D << endl; }
a.cc: In function 'int main()': a.cc:17:14: error: invalid operands of types 'int' and 'const char [2]' to binary 'operator<<' 17 | cout << sum << "\n" << D << endl; | ~~~~~~~~~~~ ^~ ~~~~ | | | | int const char [2]
s664046121
p00045
C++
#include <iostream> #include <cstdio> using namespace std; int main(void){ // Here your code ! int n,d,sum=0,D=0,cout=0; char c; while(cin>>n>>c>>d){ sum+=(n*d); D=D+d; cout++; } D=(double)D/cout+0.5; cout << sum << "\n" << D << endl; }
a.cc: In function 'int main()': a.cc:17:14: error: invalid operands of types 'int' and 'const char [2]' to binary 'operator<<' 17 | cout << sum << "\n" << D << endl; | ~~~~~~~~~~~ ^~ ~~~~ | | | | int const char [2]
s828150496
p00045
C++
//#define scanf_s scanf //#define gets_s gets #include <stdio.h> #include <string> #include <iostream> #include <math.h> using namespace std; #define MAX 101 #define MIN -100001 #define ABC 26 int main(void) { double ave; int sum = 0, sum2 = 0, cou = 0, a, b; while (scanf_s("%d,%d", &a, &b) != EOF) { if (a == b && a == 0) break; sum += a * b; sum2 += b; ++cou; } ave = (double)sum2 / cou; printf("%d %.0f\n", sum,ave); }
a.cc: In function 'int main()': a.cc:16:16: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 16 | while (scanf_s("%d,%d", &a, &b) != EOF) { | ^~~~~~~ | scanf
s946313134
p00045
C++
//#define scanf_s scanf //#define gets_s gets #include <stdio.h> #include <string> #include <iostream> #include <math.h> using namespace std; #define MAX 101 #define MIN -100001 #define ABC 26 int main(void) { double ave; int sum = 0, sum2 = 0, cou = 0, a, b; while (1) { if (scanf_s("%d,%d", &a, &b) == EOF) { ave = (double)sum2 / cou; printf("%d\n%.0f", sum, ave); break; } sum += a * b; sum2 += b; ++cou; } }
a.cc: In function 'int main()': a.cc:17:21: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 17 | if (scanf_s("%d,%d", &a, &b) == EOF) { | ^~~~~~~ | scanf
s175312748
p00045
C++
#include<iostream> #include<cmath> using namespace std; int main(){[ int price, mount; char c; int sum_price, sum_mount ,cnt; while(cin >> price >> c >> mount){ sum_price += price * mount; sum_mount += mount; cnt++; } double average = round( sum_mount / cnt ); cout << sum_price << '?\n' << average << '?\n'; }
a.cc:14:30: warning: multi-character character constant [-Wmultichar] 14 | cout << sum_price << '?\n' << average << '?\n'; | ^~~~~ a.cc:14:50: warning: multi-character character constant [-Wmultichar] 14 | cout << sum_price << '?\n' << average << '?\n'; | ^~~~~ a.cc: In function 'int main()': a.cc:5:9: error: expected identifier before 'int' 5 | int price, mount; | ^~~ a.cc:5:18: error: expected ']' before ',' token 5 | int price, mount; | ^ | ] a.cc: In lambda function: a.cc:5:18: error: expected '{' before ',' token a.cc: In function 'int main()': a.cc:5:20: error: 'mount' was not declared in this scope 5 | int price, mount; | ^~~~~ a.cc:8:22: error: 'price' was not declared in this scope 8 | while(cin >> price >> c >> mount){ | ^~~~~
s341398664
p00045
C++
#include<iostream> #include<cmath> using namespace std; int main() { int price, mount; char c; int sum_price, sum_mount ,cnt; while(cin >> price >> c >> mount){ sum_price += price * mount; sum_mount += mount; cnt++; } int average = sum_mount / cnt; cout << sum_price << endl cout << average << endl; }
a.cc: In function 'int main()': a.cc:14:34: error: expected ';' before 'cout' 14 | cout << sum_price << endl | ^ | ; 15 | cout << average << endl; | ~~~~
s202177631
p00045
C++
#include <stdio.h> int main(void){ int sum=0; double mean=0; int x,y; int i=0; while(scanf("%d,%d",&x,&y)!=EOF){ sum+=x*y; mean+=y; i++; } printf("%d\n%d\n",sum,(int)(mean/(double)(i)+0.5));
a.cc: In function 'int main()': a.cc:13:52: error: expected '}' at end of input 13 | printf("%d\n%d\n",sum,(int)(mean/(double)(i)+0.5)); | ^ a.cc:3:15: note: to match this '{' 3 | int main(void){ | ^
s189823133
p00045
C++
#include<iostream> #include<stdio.h> using namespace std; int main() { int price, num,total_price=0,total_num=0,avarage,i=0; while (scanf("%d,%d", &price, &num)!=EOF) { total_price = total_price + price*num; total_num = total_num + num; i++; } avarage = round(total_num / i); cout << total_price << endl << avarage ; }
a.cc: In function 'int main()': a.cc:12:19: error: 'round' was not declared in this scope 12 | avarage = round(total_num / i); | ^~~~~
s588773315
p00045
C++
import sys s=[list(map(int,e.split(',')))for e in sys.stdin] print(sum(a*n for a,n in s)) print(int([sum(x)for x in zip(*s)][1]/len(s)+.5))
a.cc:1:1: error: 'import' does not name a type 1 | import sys | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
s597878188
p00045
C++
#include <iostream> #include<stdio.h> using namespace std; int main() { double p, q; double price = 0, quantity = 0, amount = 0; while (scanf_s("%lf,%lf", &p, &q) != EOF) { price += (p * q); quantity += q; amount++; } cout << (int)price << endl; cout << (int)(quantity / amount + 0.5) << endl; return 0; }
a.cc: In function 'int main()': a.cc:10:16: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 10 | while (scanf_s("%lf,%lf", &p, &q) != EOF) { | ^~~~~~~ | scanf
s011126522
p00045
C++
long p,c,t,z,n;main(){for(;~scanf("%ld,%dl\n",&p,&c);t+=p*c,z+=c,n++);printf("%ld\n%ld\n",t,lround(1.0*z/n));}
a.cc:1:16: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 1 | long p,c,t,z,n;main(){for(;~scanf("%ld,%dl\n",&p,&c);t+=p*c,z+=c,n++);printf("%ld\n%ld\n",t,lround(1.0*z/n));} | ^~~~ a.cc: In function 'int main()': a.cc:1:29: error: 'scanf' was not declared in this scope 1 | long p,c,t,z,n;main(){for(;~scanf("%ld,%dl\n",&p,&c);t+=p*c,z+=c,n++);printf("%ld\n%ld\n",t,lround(1.0*z/n));} | ^~~~~ a.cc:1:93: error: 'lround' was not declared in this scope 1 | long p,c,t,z,n;main(){for(;~scanf("%ld,%dl\n",&p,&c);t+=p*c,z+=c,n++);printf("%ld\n%ld\n",t,lround(1.0*z/n));} | ^~~~~~ a.cc:1:71: error: 'printf' was not declared in this scope 1 | long p,c,t,z,n;main(){for(;~scanf("%ld,%dl\n",&p,&c);t+=p*c,z+=c,n++);printf("%ld\n%ld\n",t,lround(1.0*z/n));} | ^~~~~~ a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | long p,c,t,z,n;main(){for(;~scanf("%ld,%dl\n",&p,&c);t+=p*c,z+=c,n++);printf("%ld\n%ld\n",t,lround(1.0*z/n));}
s685704876
p00045
C++
#include <cstdio> using namespace std; int main() { int amt=0,qut=0,cnt=0,a,b; while (scanf("%d,%d",&a,&b)!=EOF) { amt += a*b; qut += b; cnt++; } int res = qut/cnt; double dec = qut/cnt-n; if (dec/0.1>=5) res++; printf("%d\n%d\n",amt,res); }
a.cc: In function 'int main()': a.cc:11:30: error: 'n' was not declared in this scope 11 | double dec = qut/cnt-n; | ^
s955588343
p00045
C++
int i,n,m,t,v; int main(){ for(;~scanf("%d,%d",&n,&m);i++) t+=n*m,v+=m; printf("%d\n%d\n",t,(int)(v/(double)i+0.5)); return 0; }
a.cc: In function 'int main()': a.cc:3:15: error: 'scanf' was not declared in this scope 3 | for(;~scanf("%d,%d",&n,&m);i++) | ^~~~~ a.cc:5:9: error: 'printf' was not declared in this scope 5 | printf("%d\n%d\n",t,(int)(v/(double)i+0.5)); | ^~~~~~ a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | int i,n,m,t,v;
s154272256
p00045
C++
#include <cstdio> int main(){ int m, n; int total = 0, num = 0, row = 0; while( scanf("%d,%d\n", &m, &n) != EOF ){ total += m * n; //”Ì”„‹àŠz‚̍‡Œv‚ɉÁŽZ num += n; //”Ì”„‚̐”—ʂ̐”‚ɉÁŽZ row++; //“ü—͂̍s”‚𑝂₷ } int ans = (int)(ave / (double)row + 0.5); //”Ì”„”—ʂ̕½‹Ï(ŽlŽÌŒÜ“ü‚·‚é) printf("%d\n%d\n", total, ans ); }
a.cc: In function 'int main()': a.cc:11:21: error: 'ave' was not declared in this scope 11 | int ans = (int)(ave / (double)row + 0.5); //”Ì”„”—ʂ̕½‹Ï(ŽlŽÌŒÜ“ü‚·‚é) | ^~~
s739060095
p00045
C++
#include<cstdio> 2 using namespace std; 3 4 int main(){ 5 int a,b; 6 int total=0,num=0,row=0; 7 8 while(scanf("%d,%d",&a,&b)!=EOF){ 9 total=total+a*b; 10 num=num+a; 11 row++; 12 } 13 int ans=(int)(num/(double)row+0.5); 14 printf("%d\n%d\n",total,ans); 15 return 0; 16 }
a.cc:2:3: error: expected unqualified-id before numeric constant 2 | 2 using namespace std; | ^ a.cc:3:3: error: expected unqualified-id before numeric constant 3 | 3 | ^
s057006894
p00045
C++
#include <string> #include <cstdio> #include <cstring> #include <vector> #include <queue> #include <set> #include <utility> #include <algorithm> #include <numeric> #include <iostream> using namespace std; template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; } int main() { int a,b,c = 0,d = 0,n = 0; while(scanf("%d,%d",&a,&b)) c+=a*b, d+=b,n++; printf("%d\n%d\n",c,(int)floor((double)d/n + 0.5)); return 0; }
a.cc: In function 'int main()': a.cc:19:34: error: 'floor' was not declared in this scope 19 | printf("%d\n%d\n",c,(int)floor((double)d/n + 0.5)); | ^~~~~
s508922013
p00045
C++
#include <iostream> using namespace std; /** Problem0045 : Sum and Average **/ int main() { unsigned inputNum=0, soldNum=0, value=0; unsigned tValue=0, tNum=0, out; char camma; while (cin >> tValue >> camma >> tNum) { inputNum++; soldNum += tNum; value += tValue*tNum; } out = (round)((double)soldNum/inputNum); cout << value << endl; cout << out << endl; return 0; }
a.cc: In function 'int main()': a.cc:17:16: error: 'round' was not declared in this scope 17 | out = (round)((double)soldNum/inputNum); | ^~~~~
s363891401
p00045
C++
int main() { int x,y; int sum,i; int tmp; char c; sum=i=0; tmp=0; while(cin>>x>>c>>y){ sum+=x*y; tmp+=y; i++; } cout<<sum<<endl; cout<<(int)(1.0*tmp/i+0.5)<<endl; return 0; }
a.cc: In function 'int main()': a.cc:10:15: error: 'cin' was not declared in this scope 10 | while(cin>>x>>c>>y){ | ^~~ a.cc:16:9: error: 'cout' was not declared in this scope 16 | cout<<sum<<endl; | ^~~~ a.cc:16:20: error: 'endl' was not declared in this scope 16 | cout<<sum<<endl; | ^~~~
s098907998
p00046
Java
package test; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class AOJ0046 { public static void main(String[] args) throws IOException { BufferedReader read = new BufferedReader(new InputStreamReader(System.in)); double now_read,max=Integer.MIN_VALUE,min=Integer.MAX_VALUE; String line = ""; while(true){ line = read.readLine(); if(line.equals(null)){ break; } try{ now_read = Double.valueOf(line); } catch(Exception e){ break; } max = (max<now_read)?now_read:max; min = (min>now_read)?now_read:min; } System.out.println(max-min); } }
Main.java:7: error: class AOJ0046 is public, should be declared in a file named AOJ0046.java public class AOJ0046 { ^ 1 error
s122219621
p00046
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args){ BufferedReader read = new BufferedReader(new InputStreamReader(System.in)); double now_read,max=Integer.MIN_VALUE,min=Integer.MAX_VALUE; String line = ""; while(true){ line = read.readLine(); if(line.equals(null)){ break; } try{ now_read = Double.valueOf(line); } catch(Exception e){ break; } max = (max<now_read)?now_read:max; min = (min>now_read)?now_read:min; } System.out.println(max-min); } }
Main.java:12: error: unreported exception IOException; must be caught or declared to be thrown line = read.readLine(); ^ 1 error
s098958012
p00046
Java
package aoj; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; public class main { public static void main(String[] args){ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String tes = null; ArrayList<Double> al = new ArrayList(); try { tes = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } double a = Double.parseDouble(tes); al.add(a); while(true){ try { tes = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } try{ a = Double.parseDouble(tes); }catch(NumberFormatException e){ break; } al.add(a); } for(int i=0;i<al.size();i++){ for(int j=i+1;j<al.size();j++){ if(al.get(i) < al.get(j)){ double tmp = al.get(i); al.set(i, al.get(j)); al.set(j, tmp); } } } System.out.println(al.get(0) - al.get(al.size() - 1)); } }
Main.java:8: error: class main is public, should be declared in a file named main.java public class main { ^ Note: Main.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 1 error
s481811998
p00046
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; public class main { public static void main(String[] args){ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String tes = null; ArrayList<Double> al = new ArrayList(); try { tes = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } double a = Double.parseDouble(tes); al.add(a); while(true){ try { tes = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } try{ a = Double.parseDouble(tes); }catch(NumberFormatException e){ break; } al.add(a); } for(int i=0;i<al.size();i++){ for(int j=i+1;j<al.size();j++){ if(al.get(i) < al.get(j)){ double tmp = al.get(i); al.set(i, al.get(j)); al.set(j, tmp); } } } System.out.println(al.get(0) - al.get(al.size() - 1)); } }
Main.java:6: error: class main is public, should be declared in a file named main.java public class main { ^ Note: Main.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 1 error
s869388913
p00046
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; public class main { public static void main(String[] args){ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String tes = null; ArrayList<Double> al = new ArrayList(); try { tes = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } double a = Double.parseDouble(tes); al.add(a); while(true){ try { tes = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } try{ a = Double.parseDouble(tes); }catch(NumberFormatException e){ break; } al.add(a); } for(int i=0;i<al.size();i++){ for(int j=i+1;j<al.size();j++){ if(al.get(i) < al.get(j)){ double tmp = al.get(i); al.set(i, al.get(j)); al.set(j, tmp); } } } System.out.println(al.get(0) - al.get(al.size() - 1)); } }
Main.java:6: error: class main is public, should be declared in a file named main.java public class main { ^ Note: Main.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 1 error
s908616532
p00046
Java
package aoj; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; public class Main { public static void main(String[] args){ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String tes = null; List<Double> al = new ArrayList(); try { tes = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } double a = Double.parseDouble(tes); al.add(a); while(true){ try { tes = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } try{ a = Double.parseDouble(tes); }catch(NumberFormatException e){ break; } al.add(a); } for(int i=0;i<al.size();i++){ for(int j=i+1;j<al.size();j++){ if(al.get(i) < al.get(j)){ double tmp = al.get(i); al.set(i, al.get(j)); al.set(j, tmp); } } } System.out.println(al.get(0) - al.get(al.size() - 1)); } }
Main.java:13: error: cannot find symbol List<Double> al = new ArrayList(); ^ symbol: class List location: class Main 1 error
s268086193
p00046
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; public class Main { public static void main(String[] args){ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String tes = null; List<Double> al = new ArrayList<Double>(); try { tes = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } double a = Double.parseDouble(tes); al.add(a); while(true){ try { tes = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } if(tes.equals(null)){ break; } try{ a = Double.parseDouble(tes); }catch(NumberFormatException e){ break; } al.add(a); } for(int i=0;i<al.size();i++){ for(int j=i+1;j<al.size();j++){ if(al.get(i) < al.get(j)){ double tmp = al.get(i); al.set(i, al.get(j)); al.set(j, tmp); } } } System.out.println(al.get(0) - al.get(al.size() - 1)); } }
Main.java:11: error: cannot find symbol List<Double> al = new ArrayList<Double>(); ^ symbol: class List location: class Main 1 error
s437878528
p00046
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; public class Main { public static void main(String[] args){ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String tes = null; List<Double> al = new ArrayList<Double>(); try { tes = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } double a = Double.parseDouble(tes); al.add(a); while(true){ try { tes = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } /*if(tes.equals(null)){ break; } try{ a = Double.parseDouble(tes); }catch(NumberFormatException e){ break; } al.add(a);*/ } for(int i=0;i<al.size();i++){ for(int j=i+1;j<al.size();j++){ if(al.get(i) < al.get(j)){ double tmp = al.get(i); al.set(i, al.get(j)); al.set(j, tmp); } } } System.out.println(al.get(0) - al.get(al.size() - 1)); } }
Main.java:44: error: unreachable statement for(int i=0;i<al.size();i++){ ^ 1 error
s970229078
p00046
Java
import java.io.*; class Main{ public static void main(String[] args) throws IOException{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String line=""; double height; double max=Double.parseDouble(br.readLine); double min=max; while((line=br.readLine())!=null){ height=Double.parseDouble(line); max=Math.max(max,height); min=Math.min(min,height); } System.out.println(max-min); } }
Main.java:8: error: cannot find symbol double max=Double.parseDouble(br.readLine); ^ symbol: variable readLine location: variable br of type BufferedReader 1 error
s236018115
p00046
Java
import java.io.InputStreamReader; import java.io.BufferedReader; import java.io.IOException; public class Main { public static void main(String args[] ) throws IOException { BufferedReader br; br = InputFile.load(); Float f = Float.parseFloat(br.readLine()); float high = f, low = f; String line; while( ( line = br.readLine() ) != null ) { f = Float.parseFloat(line); if ( f > high ) { high = f; } else if ( f < low) { low = f; } } System.out.println( high - low ); } }
Main.java:8: error: cannot find symbol br = InputFile.load(); ^ symbol: variable InputFile location: class Main 1 error
s694441487
p00046
Java
import java.util.Scanner; import java.util.*; import java.util.ArrayList; public class Differential { public static void main(String[] args){ Scanner sc = new Scanner(System.in); List<Double> list = new ArrayList<>(); while(sc.hasNext()){ double x = sc.nextDouble(); list.add(x); } Double max = list.get(0); Double min = list.get(0); for (int i = 1; i < list.size(); i++){ Double v = list.get(i); if(v > max){ max = v; } if(v < min){ min = v; } } System.out.println(max); System.out.println(min); System.out.println(max-min); } }
Main.java:6: error: class Differential is public, should be declared in a file named Differential.java public class Differential { ^ 1 error
s369892448
p00046
Java
public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); List<Double> list = new ArrayList<>(); while(sc.hasNext()){ double x = sc.nextDouble(); list.add(x); } Double max = list.get(0); Double min = list.get(0); for (int i = 1; i < list.size(); i++){ Double v = list.get(i); if(v > max){ max = v; } if(v < min){ min = v; } } System.out.println(max); System.out.println(min); System.out.println(max-min); } }
Main.java:3: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:3: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:4: error: cannot find symbol List<Double> list = new ArrayList<>(); ^ symbol: class List location: class Main Main.java:4: error: cannot find symbol List<Double> list = new ArrayList<>(); ^ symbol: class ArrayList location: class Main 4 errors
s177819183
p00046
Java
mport java.util.Collections; import java.util.LinkedList; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); LinkedList<Double> list = new LinkedList<Double>(); while(s.hasNext()){ list.add(s.nextDouble()); } Collections.sort(list); System.out.println(list.get(list.size()-1)-list.get(0)); } }
Main.java:1: error: class, interface, enum, or record expected mport java.util.Collections; ^ Main.java:2: error: class, interface, enum, or record expected import java.util.LinkedList; ^ Main.java:3: error: class, interface, enum, or record expected import java.util.Scanner; ^ 3 errors
s480648338
p00046
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; public class AOJ_0046 { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); ArrayList<Float> inputList = new ArrayList<>(); while (input.ready()) { inputList.add(Float.parseFloat(input.readLine())); } final float ans = getDiffHight(inputList); System.out.println(ans); } private static float getDiffHight(ArrayList<Float> list) { float maxHight = Float.MIN_VALUE; float minHight = Float.MAX_VALUE; for (Float each : list) { if (each > maxHight) { maxHight = each; } else if (each < minHight) { minHight = each; } } return maxHight - minHight; } }
Main.java:6: error: class AOJ_0046 is public, should be declared in a file named AOJ_0046.java public class AOJ_0046 ^ 1 error
s700062871
p00046
Java
public class Main { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); double tall,max,min; tall = max = min = sc.nextDouble(); while(sc.hasNextDouble()){ tall = sc.nextDouble(); if(max < tall) max = tall; if(min > tall) min = tall; } System.out.println(max - min); } }
Main.java:8: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:8: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors
s539884920
p00046
Java
import java.util.Scanner; class Main { public static void main(String args[]) { Scanner scan=new Scanner(System.in); float high=0,low=0,x,ans; int i=0; while(scan.hasNext()) { x=scan.nextFloat(); if(i==0) { low=x; } if(high<x)high=low; if(low>x)low=x; ans=high-low; i++; } System.out.println(ans); } }
Main.java:23: error: variable ans might not have been initialized System.out.println(ans); ^ 1 error
s871617200
p00046
Java
public class Differential { public static void main(String[] args) throws NumberFormatException, IOException { List<Double> hList = new ArrayList<Double>(); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); for (int i = 0; i < 5; i++) { double h = Double.parseDouble(br.readLine()); hList.add(h); } Collections.sort(hList); double hMin = (Double) hList.get(0); double hMax = (Double) hList.get(hList.size() - 1); System.out.println(hMax - hMin); } }
Main.java:1: error: class Differential is public, should be declared in a file named Differential.java public class Differential { ^ Main.java:3: error: cannot find symbol public static void main(String[] args) throws NumberFormatException, IOException { ^ symbol: class IOException location: class Differential Main.java:4: error: cannot find symbol List<Double> hList = new ArrayList<Double>(); ^ symbol: class List location: class Differential Main.java:4: error: cannot find symbol List<Double> hList = new ArrayList<Double>(); ^ symbol: class ArrayList location: class Differential Main.java:5: error: cannot find symbol BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class BufferedReader location: class Differential Main.java:5: error: cannot find symbol BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class BufferedReader location: class Differential Main.java:5: error: cannot find symbol BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class InputStreamReader location: class Differential Main.java:10: error: cannot find symbol Collections.sort(hList); ^ symbol: variable Collections location: class Differential 8 errors
s277320920
p00046
Java
import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { private static double x; private static double max; private static double min; private static String val; public static void main(String args[]) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); while((val = br.readLine()) != null){ x = Double.parseDouble(val); if(i==0){ max=x; min=x; } else{ if(x > max){ max=x; } if(x < min){ min=x; } } } System.out.println(max-min); } }
Main.java:14: error: cannot find symbol if(i==0){ ^ symbol: variable i location: class Main 1 error
s514878814
p00046
C
#include <stdio.h> int main(void) { double high,max,min,d; scanf("%f",&high); max = high; min = high; while(scanf("%f",&high) != EOF){{ if(max<high){ max = high; }else if(min>high){ min = high; } } d = max - min; printf("%.1f",d); return 0; }
main.c: In function 'main': main.c:21:1: error: expected declaration or statement at end of input 21 | } | ^
s781177595
p00046
C
#define _USE_MATH_DEFINES #include<stdio.h> int main() { double max, min,d; scanf_s("%lf", &d); max = min = d; while (~scanf_s("%lf", &d)) { if (d > max)max = d; else if (d < min) min = d; } printf_s("%lf\n", max - min); return 0; }
main.c: In function 'main': main.c:5:9: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration] 5 | scanf_s("%lf", &d); | ^~~~~~~ | scanf main.c:11:9: error: implicit declaration of function 'printf_s'; did you mean 'printf'? [-Wimplicit-function-declaration] 11 | printf_s("%lf\n", max - min); | ^~~~~~~~ | printf
s237452748
p00046
C
#define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #include<stdio.h> int main() { double max, min,d; scanf("%lf", &d); max = min = d; while (~scanf_s("%lf", &d)) { if (d > max)max = d; else if (d < min) min = d; } printf("%lf\n", max - min); return 0; }
main.c: In function 'main': main.c:8:17: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration] 8 | while (~scanf_s("%lf", &d)) { | ^~~~~~~ | scanf
s499954958
p00046
C
#include <stdio.h> int main(void) { double max; double min; double height; min=0; max=0 int i; for(i=0;i>=50;i++){ if(height>max)max=height; if(height>min)min=height; } printf("%.1f\n",max-min); return 0; }
main.c: In function 'main': main.c:9:14: error: expected ';' before 'int' 9 | max=0 | ^ | ; 10 | int i; | ~~~ main.c:11:13: error: 'i' undeclared (first use in this function) 11 | for(i=0;i>=50;i++){ | ^ main.c:11:13: note: each undeclared identifier is reported only once for each function it appears in
s854596757
p00046
C
#include<stdio.h> int main(void){ double h[1000], Max, Min; int i = 1; scanf("%lf", &h[0]); Max = Min = h[0]; while ( scanf(%lf", &h[i] ) != EOF ) { if ( h[i] <= Max ) Max = h[i]; if ( h[i] >= Min ) Min = h[i]; i++; } printf("%.1lf", Max - Min); return 0; }
main.c: In function 'main': main.c:7:18: error: expected expression before '%' token 7 | while ( scanf(%lf", &h[i] ) != EOF ) { | ^ main.c:7:21: warning: missing terminating " character 7 | while ( scanf(%lf", &h[i] ) != EOF ) { | ^ main.c:7:21: error: missing terminating " character 7 | while ( scanf(%lf", &h[i] ) != EOF ) { | ^~~~~~~~~~~~~~~~~~~~~ main.c:10:11: error: expected ')' before '}' token 10 | i++; | ^ | ) 11 | } | ~ main.c:7:10: note: to match this '(' 7 | while ( scanf(%lf", &h[i] ) != EOF ) { | ^ main.c:11:4: error: expected expression before '}' token 11 | } | ^ main.c: At top level: main.c:12:11: error: expected declaration specifiers or '...' before string constant 12 | printf("%.1lf", Max - Min); | ^~~~~~~ main.c:12:20: error: unknown type name 'Max' 12 | printf("%.1lf", Max - Min); | ^~~ main.c:13:4: error: expected identifier or '(' before 'return' 13 | return 0; | ^~~~~~ main.c:14:1: error: expected identifier or '(' before '}' token 14 | } | ^
s384204346
p00046
C
#include <stdio.h> int main(void) { int i,j; double max=0,min=0,a[50]; for(i=0;i<n;i++) scanf("%lf",&a[i]); for(i=0;i<n;i++) if(max<a[i]) min=max=a[i]; for(i=0;i<n;i++) if(min>a[i]) min=a[i]; printf("%.1f",max-min); return 0; }
main.c: In function 'main': main.c:8:19: error: 'n' undeclared (first use in this function) 8 | for(i=0;i<n;i++) scanf("%lf",&a[i]); | ^ main.c:8:19: note: each undeclared identifier is reported only once for each function it appears in
s963513564
p00046
C
#include <stdio.h> main(){ double a,max=0,min=10000; while(scanf("%lf",&a) !=EOF){ if(max<a) max=a; else if(min>a) min=a } printf("%g",max-min); return 0; }
main.c:2:1: error: return type defaults to 'int' [-Wimplicit-int] 2 | main(){ | ^~~~ main.c: In function 'main': main.c:6:25: error: expected ';' before '}' token 6 | else if(min>a) min=a | ^ | ; 7 | } | ~
s397927533
p00046
C
float x,n=1e9,h;main(){for(;~scanf("%f",&h);n=n>h?h:n)x=x<h?h:x;exit(printf("%f\n",max-min));}
main.c:1:17: error: return type defaults to 'int' [-Wimplicit-int] 1 | float x,n=1e9,h;main(){for(;~scanf("%f",&h);n=n>h?h:n)x=x<h?h:x;exit(printf("%f\n",max-min));} | ^~~~ main.c: In function 'main': main.c:1:30: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 1 | float x,n=1e9,h;main(){for(;~scanf("%f",&h);n=n>h?h:n)x=x<h?h:x;exit(printf("%f\n",max-min));} | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | float x,n=1e9,h;main(){for(;~scanf("%f",&h);n=n>h?h:n)x=x<h?h:x;exit(printf("%f\n",max-min));} main.c:1:30: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 1 | float x,n=1e9,h;main(){for(;~scanf("%f",&h);n=n>h?h:n)x=x<h?h:x;exit(printf("%f\n",max-min));} | ^~~~~ main.c:1:30: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:1:65: error: implicit declaration of function 'exit' [-Wimplicit-function-declaration] 1 | float x,n=1e9,h;main(){for(;~scanf("%f",&h);n=n>h?h:n)x=x<h?h:x;exit(printf("%f\n",max-min));} | ^~~~ main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'exit' +++ |+#include <stdlib.h> 1 | float x,n=1e9,h;main(){for(;~scanf("%f",&h);n=n>h?h:n)x=x<h?h:x;exit(printf("%f\n",max-min));} main.c:1:65: warning: incompatible implicit declaration of built-in function 'exit' [-Wbuiltin-declaration-mismatch] 1 | float x,n=1e9,h;main(){for(;~scanf("%f",&h);n=n>h?h:n)x=x<h?h:x;exit(printf("%f\n",max-min));} | ^~~~ main.c:1:65: note: include '<stdlib.h>' or provide a declaration of 'exit' main.c:1:70: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 1 | float x,n=1e9,h;main(){for(;~scanf("%f",&h);n=n>h?h:n)x=x<h?h:x;exit(printf("%f\n",max-min));} | ^~~~~~ main.c:1:70: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:1:70: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:1:70: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:1:84: error: 'max' undeclared (first use in this function) 1 | float x,n=1e9,h;main(){for(;~scanf("%f",&h);n=n>h?h:n)x=x<h?h:x;exit(printf("%f\n",max-min));} | ^~~ main.c:1:84: note: each undeclared identifier is reported only once for each function it appears in main.c:1:88: error: 'min' undeclared (first use in this function); did you mean 'main'? 1 | float x,n=1e9,h;main(){for(;~scanf("%f",&h);n=n>h?h:n)x=x<h?h:x;exit(printf("%f\n",max-min));} | ^~~ | main
s990274973
p00046
C
#include<stdio.h> int main(void){ double a; double max; double min; max = 0.0; min = DBL_MAX; while(scanf("%lf ",&a)!=EOF){ if(max < a)max = a; if(min > a)min = a; } printf("%.1lf\n",max - min); return 0; }
main.c: In function 'main': main.c:9:9: error: 'DBL_MAX' undeclared (first use in this function) 9 | min = DBL_MAX; | ^~~~~~~ main.c:2:1: note: 'DBL_MAX' is defined in header '<float.h>'; this is probably fixable by adding '#include <float.h>' 1 | #include<stdio.h> +++ |+#include <float.h> 2 | main.c:9:9: note: each undeclared identifier is reported only once for each function it appears in 9 | min = DBL_MAX; | ^~~~~~~
s289209522
p00046
C
#include <stdio.h> int main(int argc,char* argv[]){ double tmp; double max=-1.0,min = 999999999.0; while(scanf("%lf",&tmp) != EOF){ if(tmp > max){ max = tmp; } if(tmp < min){ min = tmp; } } printf("%.1lf\n",max-min); } printf("%.1lf\n",max-min); }
main.c:22:10: error: expected declaration specifiers or '...' before string constant 22 | printf("%.1lf\n",max-min); | ^~~~~~~~~ main.c:22:20: error: unknown type name 'max' 22 | printf("%.1lf\n",max-min); | ^~~ main.c:24:1: error: expected identifier or '(' before '}' token 24 | } | ^
s624393793
p00046
C
k="%f\n";float a,y,x=k;main(){for(;~scanf(k,&a);y=a>y?a:y)x=a<x?a:x;a=!printf(k,y-x);}
main.c:1:1: warning: data definition has no type or storage class 1 | k="%f\n";float a,y,x=k;main(){for(;~scanf(k,&a);y=a>y?a:y)x=a<x?a:x;a=!printf(k,y-x);} | ^ main.c:1:1: error: type defaults to 'int' in declaration of 'k' [-Wimplicit-int] main.c:1:3: error: initialization of 'int' from 'char *' makes integer from pointer without a cast [-Wint-conversion] 1 | k="%f\n";float a,y,x=k;main(){for(;~scanf(k,&a);y=a>y?a:y)x=a<x?a:x;a=!printf(k,y-x);} | ^~~~~~ main.c:1:3: error: initializer element is not computable at load time main.c:1:22: error: initializer element is not constant 1 | k="%f\n";float a,y,x=k;main(){for(;~scanf(k,&a);y=a>y?a:y)x=a<x?a:x;a=!printf(k,y-x);} | ^ main.c:1:24: error: return type defaults to 'int' [-Wimplicit-int] 1 | k="%f\n";float a,y,x=k;main(){for(;~scanf(k,&a);y=a>y?a:y)x=a<x?a:x;a=!printf(k,y-x);} | ^~~~ main.c: In function 'main': main.c:1:37: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 1 | k="%f\n";float a,y,x=k;main(){for(;~scanf(k,&a);y=a>y?a:y)x=a<x?a:x;a=!printf(k,y-x);} | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | k="%f\n";float a,y,x=k;main(){for(;~scanf(k,&a);y=a>y?a:y)x=a<x?a:x;a=!printf(k,y-x);} main.c:1:37: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 1 | k="%f\n";float a,y,x=k;main(){for(;~scanf(k,&a);y=a>y?a:y)x=a<x?a:x;a=!printf(k,y-x);} | ^~~~~ main.c:1:37: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:1:43: error: passing argument 1 of 'scanf' makes pointer from integer without a cast [-Wint-conversion] 1 | k="%f\n";float a,y,x=k;main(){for(;~scanf(k,&a);y=a>y?a:y)x=a<x?a:x;a=!printf(k,y-x);} | ^ | | | int main.c:1:43: note: expected 'const char *' but argument is of type 'int' main.c:1:72: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 1 | k="%f\n";float a,y,x=k;main(){for(;~scanf(k,&a);y=a>y?a:y)x=a<x?a:x;a=!printf(k,y-x);} | ^~~~~~ main.c:1:72: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:1:72: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:1:72: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:1:79: error: passing argument 1 of 'printf' makes pointer from integer without a cast [-Wint-conversion] 1 | k="%f\n";float a,y,x=k;main(){for(;~scanf(k,&a);y=a>y?a:y)x=a<x?a:x;a=!printf(k,y-x);} | ^ | | | int main.c:1:79: note: expected 'const char *' but argument is of type 'int'
s090753243
p00046
C
main(){float q=0,r=10000,a;while(scanf("%lf",&a)!=EOF){if(max<a){max=a; }if(min>a){min=a;}}printf("%f\n",max-min);return 0;}
main.c:1:1: error: return type defaults to 'int' [-Wimplicit-int] 1 | main(){float q=0,r=10000,a;while(scanf("%lf",&a)!=EOF){if(max<a){max=a; }if(min>a){min=a;}}printf("%f\n",max-min);return 0;} | ^~~~ main.c: In function 'main': main.c:1:34: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 1 | main(){float q=0,r=10000,a;while(scanf("%lf",&a)!=EOF){if(max<a){max=a; }if(min>a){min=a;}}printf("%f\n",max-min);return 0;} | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | main(){float q=0,r=10000,a;while(scanf("%lf",&a)!=EOF){if(max<a){max=a; }if(min>a){min=a;}}printf("%f\n",max-min);return 0;} main.c:1:34: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 1 | main(){float q=0,r=10000,a;while(scanf("%lf",&a)!=EOF){if(max<a){max=a; }if(min>a){min=a;}}printf("%f\n",max-min);return 0;} | ^~~~~ main.c:1:34: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:1:51: error: 'EOF' undeclared (first use in this function) 1 | main(){float q=0,r=10000,a;while(scanf("%lf",&a)!=EOF){if(max<a){max=a; }if(min>a){min=a;}}printf("%f\n",max-min);return 0;} | ^~~ main.c:1:51: note: 'EOF' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>' main.c:1:51: note: each undeclared identifier is reported only once for each function it appears in main.c:1:59: error: 'max' undeclared (first use in this function) 1 | main(){float q=0,r=10000,a;while(scanf("%lf",&a)!=EOF){if(max<a){max=a; }if(min>a){min=a;}}printf("%f\n",max-min);return 0;} | ^~~ main.c:1:77: error: 'min' undeclared (first use in this function); did you mean 'main'? 1 | main(){float q=0,r=10000,a;while(scanf("%lf",&a)!=EOF){if(max<a){max=a; }if(min>a){min=a;}}printf("%f\n",max-min);return 0;} | ^~~ | main main.c:1:92: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 1 | main(){float q=0,r=10000,a;while(scanf("%lf",&a)!=EOF){if(max<a){max=a; }if(min>a){min=a;}}printf("%f\n",max-min);return 0;} | ^~~~~~ main.c:1:92: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:1:92: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:1:92: note: include '<stdio.h>' or provide a declaration of 'printf'
s165552905
p00046
C
float q=0,r=10000,a;int main(){while(scanf("%lf",&a)!=EOF){if(max<a){max=a;}if(min>a){min=a;}}printf("%f\n",max-min);return 0;}
main.c: In function 'main': main.c:1:38: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 1 | float q=0,r=10000,a;int main(){while(scanf("%lf",&a)!=EOF){if(max<a){max=a;}if(min>a){min=a;}}printf("%f\n",max-min);return 0;} | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | float q=0,r=10000,a;int main(){while(scanf("%lf",&a)!=EOF){if(max<a){max=a;}if(min>a){min=a;}}printf("%f\n",max-min);return 0;} main.c:1:38: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 1 | float q=0,r=10000,a;int main(){while(scanf("%lf",&a)!=EOF){if(max<a){max=a;}if(min>a){min=a;}}printf("%f\n",max-min);return 0;} | ^~~~~ main.c:1:38: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:1:55: error: 'EOF' undeclared (first use in this function) 1 | float q=0,r=10000,a;int main(){while(scanf("%lf",&a)!=EOF){if(max<a){max=a;}if(min>a){min=a;}}printf("%f\n",max-min);return 0;} | ^~~ main.c:1:55: note: 'EOF' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>' main.c:1:55: note: each undeclared identifier is reported only once for each function it appears in main.c:1:63: error: 'max' undeclared (first use in this function) 1 | float q=0,r=10000,a;int main(){while(scanf("%lf",&a)!=EOF){if(max<a){max=a;}if(min>a){min=a;}}printf("%f\n",max-min);return 0;} | ^~~ main.c:1:80: error: 'min' undeclared (first use in this function); did you mean 'main'? 1 | float q=0,r=10000,a;int main(){while(scanf("%lf",&a)!=EOF){if(max<a){max=a;}if(min>a){min=a;}}printf("%f\n",max-min);return 0;} | ^~~ | main main.c:1:95: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 1 | float q=0,r=10000,a;int main(){while(scanf("%lf",&a)!=EOF){if(max<a){max=a;}if(min>a){min=a;}}printf("%f\n",max-min);return 0;} | ^~~~~~ main.c:1:95: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:1:95: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:1:95: note: include '<stdio.h>' or provide a declaration of 'printf'
s927616306
p00046
C
#include<stdio.h> int main(void){ double t,ans,max,min; int i; max=-1.0; min=-1.0; while((scanf("%lf",&t))!=EOF){ if(t>max || max<0)max=t; if(tminmax || max<0)max=t; } printf("%lf\n",max-min); return 0; }
main.c: In function 'main': main.c:12:20: error: 'tminmax' undeclared (first use in this function) 12 | if(tminmax || max<0)max=t; | ^~~~~~~ main.c:12:20: note: each undeclared identifier is reported only once for each function it appears in
s245109554
p00046
C
#include<stdio.h> int main(void){ double h,l,i,j; printf("%lf%lf",&h,&l); if(h<l){ d=h; h=l; l=d; } while(scanf("%lf",&i)!=EOF){ if(h<i){ d=h; h=i; i=d; } if(l>i){ d=l; l=i; i=d; } } printf("%f\n",h-l); return 0; }
main.c: In function 'main': main.c:6:9: error: 'd' undeclared (first use in this function) 6 | d=h; | ^ main.c:6:9: note: each undeclared identifier is reported only once for each function it appears in
s203855943
p00046
C++
#include<iostream> using namespace std; int main() { long float syo, dai, c; dai = -1; syo = 1999999; while (cin >> c) { if (dai <= c) { dai = c; } if (syo >= c) { syo = c; } } cout << dai - syo << endl; }
a.cc: In function 'int main()': a.cc:4:9: error: 'long' specified with 'float' 4 | long float syo, dai, c; | ^~~~ a.cc:4:9: error: 'long' specified with 'float' a.cc:4:9: error: 'long' specified with 'float'
s608708980
p00046
C++
#include<iostream> using namespace std; int main() { long float syo, dai, c; dai = -1; syo = 1999999; while (cin >> c) { if (dai <= c) { dai = c; } if (syo >= c) { syo = c; } } cout << dai - syo << endl; }
a.cc: In function 'int main()': a.cc:4:9: error: 'long' specified with 'float' 4 | long float syo, dai, c; | ^~~~ a.cc:4:9: error: 'long' specified with 'float' a.cc:4:9: error: 'long' specified with 'float'
s757098210
p00046
C++
#include <iostream> #include <vector> int main() { double input; std::vector<double> height; while (std::cin >> input) { height.push_back(input); } std::sort(height.begin(), height.end()); std::cout << *(height.end()-1) - *(height.begin()) << std::endl; }
a.cc: In function 'int main()': a.cc:10:14: error: 'sort' is not a member of 'std'; did you mean 'qsort'? 10 | std::sort(height.begin(), height.end()); | ^~~~ | qsort
s370489750
p00046
C++
#include <iostream> #include <vector> int main() { double input; std::vector<double> height; while (std::cin >> input) { height.push_back(input); } sort(height.begin(), height.end()); std::cout << *(height.end()-1) - *(height.begin()) << std::endl; }
a.cc: In function 'int main()': a.cc:10:9: error: 'sort' was not declared in this scope; did you mean 'short'? 10 | sort(height.begin(), height.end()); | ^~~~ | short
s586852676
p00046
C++
#include<iostream> #include<cmath> using namespace std; int main(){ double mountain[1111],ans; int i=0; while(cin >> mountain[i]){ i++; } sort(mountain,mountain+i); ans = mountain[i-1] - mountain[0]; cout << ans << endl; }
a.cc: In function 'int main()': a.cc:11:3: error: 'sort' was not declared in this scope; did you mean 'sqrt'? 11 | sort(mountain,mountain+i); | ^~~~ | sqrt
s807692956
p00046
C++
#include<iostream> #include<cmath> using namespace std; int main(){ double mountain[1111],ans; int i=0; while(cin >> mountain[i]){ i++; } sort(mountain,mountain+i); ans = mountain[i-1] - mountain[0]; cout << ans << endl; }
a.cc: In function 'int main()': a.cc:11:3: error: 'sort' was not declared in this scope; did you mean 'sqrt'? 11 | sort(mountain,mountain+i); | ^~~~ | sqrt
s921817817
p00046
C++
#include <cstdio> #include <cmath> using namespace std; double m,h,l; int main() { while(~scanf("%lf",&m) { h=max(m,h); l=min(m,l); } printf("%f\n",fabs(h-l)); return 0; }
a.cc: In function 'int main()': a.cc:7:27: error: expected ')' before '{' token 7 | while(~scanf("%lf",&m) { | ~ ^~ | )
s195739835
p00046
C++
#include <cstdio> #include <cstdlib> #include <cmath> using namespace std; double m,h,l; int main() { while(~scanf("%lf",&m) { h=max(m,h); l=min(m,l); } printf("%f\n",fabs(h-l)); return 0; }
a.cc: In function 'int main()': a.cc:8:27: error: expected ')' before '{' token 8 | while(~scanf("%lf",&m) { | ~ ^~ | )
s039576150
p00046
C++
#include <cstdio> #include <cmath> #include <climits> #include <algorithm> using namespace std; double m,h,l; int main() { while(~scanf("%lf",&m)) { h=max(m,h); l=min(m,INT_MAX); } printf("%f\n",fabs(h-l)); return 0; }
a.cc: In function 'int main()': a.cc:14:14: error: no matching function for call to 'min(double&, int)' 14 | l=min(m,INT_MAX); | ~~~^~~~~~~~~~~ In file included from /usr/include/c++/14/bits/specfun.h:43, from /usr/include/c++/14/cmath:3906, from a.cc:2: /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:14:14: note: deduced conflicting types for parameter 'const _Tp' ('double' and 'int') 14 | l=min(m,INT_MAX); | ~~~^~~~~~~~~~~ /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:4: /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:14:14: note: mismatched types 'std::initializer_list<_Tp>' and 'double' 14 | l=min(m,INT_MAX); | ~~~^~~~~~~~~~~
s282228525
p00046
C++
3776.0 1819.0 645.2 2004.1 1208.6
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 3776.0 | ^~~~~~
s257297632
p00046
C++
#include <iostream> #include <cstdio> using namespace std; #define rep2(x,from,to) for(int x = (from); x < (to); ++(x)) #define rep(x,to) rep2(x,0,to) int main() { double h; double highest = 0; double lowest = INT_MAX; while(cin >> h) { if(highest < h) highest = h; if(lowest > h) lowest = h; } cout << highest - lowest << endl; return 0; }
a.cc: In function 'int main()': a.cc:11:25: error: 'INT_MAX' was not declared in this scope 11 | double lowest = INT_MAX; | ^~~~~~~ a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 2 | #include <cstdio> +++ |+#include <climits> 3 |
s932812298
p00046
C++
#include <iostream> #include <algorithm> using namespace std; int main(void) { ios::sync_with_stdio(false); double max = 114514810, min = -1; double h; while(cin >> h) { max = max(max, h); min = min(min, h); } cout << max - min << endl; return 0; }
a.cc: In function 'int main()': a.cc:12:18: error: 'max' cannot be used as a function 12 | max = max(max, h); | ~~~^~~~~~~~ a.cc:13:18: error: 'min' cannot be used as a function 13 | min = min(min, h); | ~~~^~~~~~~~
s208570468
p00046
C++
#include <cstdio> int main() { double n, h = 0.0, l = 999999999.0; int i = 5; while (i--){ scanf("%f", &n); h = max(h, n); l = min(l, n); } printf("%.1f\n", h - l); }
a.cc: In function 'int main()': a.cc:10:9: error: 'max' was not declared in this scope 10 | h = max(h, n); | ^~~ a.cc:11:9: error: 'min' was not declared in this scope; did you mean 'main'? 11 | l = min(l, n); | ^~~ | main
s043064835
p00046
C++
#include <cstdio> using namespace std; int main() { double n, h = 0.0, l = 999999.0; while (scanf("%lf", &n)){ h = max(h, n); l = min(l, n); } printf("%.1lf\n", h - l); }
a.cc: In function 'int main()': a.cc:10:9: error: 'max' was not declared in this scope 10 | h = max(h, n); | ^~~ a.cc:11:9: error: 'min' was not declared in this scope; did you mean 'main'? 11 | l = min(l, n); | ^~~ | main
s476356295
p00046
C++
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define REP(i, n) for (int i = 0; i < (n); i++) int main() { int i; vector<double> a; for (i = 0; cin >> a[i]; i++); sort(a, a + i); cout << a[i - 1] - a[0] << endl; }
a.cc: In function 'int main()': a.cc:12:13: error: no match for 'operator+' (operand types are 'std::vector<double>' and 'int') 12 | sort(a, a + i); | ~ ^ ~ | | | | | int | std::vector<double> In file included from /usr/include/c++/14/bits/stl_algobase.h:67, 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_iterator.h:627:5: note: candidate: 'template<class _Iterator> constexpr std::reverse_iterator<_Iterator> std::operator+(typename reverse_iterator<_Iterator>::difference_type, const reverse_iterator<_Iterator>&)' 627 | operator+(typename reverse_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:627:5: note: template argument deduction/substitution failed: a.cc:12:15: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int' 12 | sort(a, a + i); | ^ /usr/include/c++/14/bits/stl_iterator.h:1798:5: note: candidate: 'template<class _Iterator> constexpr std::move_iterator<_IteratorL> std::operator+(typename move_iterator<_IteratorL>::difference_type, const move_iterator<_IteratorL>&)' 1798 | operator+(typename move_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1798:5: note: template argument deduction/substitution failed: a.cc:12:15: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int' 12 | sort(a, a + i); | ^ In file included from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/basic_string.h:3598:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3598 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3598:5: note: template argument deduction/substitution failed: a.cc:12:15: note: 'std::vector<double>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 12 | sort(a, a + i); | ^ /usr/include/c++/14/bits/basic_string.h:3616:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3616 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3616:5: note: template argument deduction/substitution failed: a.cc:12:15: note: mismatched types 'const _CharT*' and 'std::vector<double>' 12 | sort(a, a + i); | ^ /usr/include/c++/14/bits/basic_string.h:3635:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3635 | operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3635:5: note: template argument deduction/substitution failed: a.cc:12:15: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 12 | sort(a, a + i); | ^ /usr/include/c++/14/bits/basic_string.h:3652:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3652 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3652:5: note: template argument deduction/substitution failed: a.cc:12:15: note: 'std::vector<double>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 12 | sort(a, a + i); | ^ /usr/include/c++/14/bits/basic_string.h:3670:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT)' 3670 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3670:5: note: template argument deduction/substitution failed: a.cc:12:15: note: 'std::vector<double>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 12 | sort(a, a + i); | ^ /usr/include/c++/14/bits/basic_string.h:3682:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3682 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3682:5: note: template argument deduction/substitution failed: a.cc:12:15: note: 'std::vector<double>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 12 | sort(a, a + i); | ^ /usr/include/c++/14/bits/basic_string.h:3689:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3689 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3689:5: note: template argument deduction/substitution failed: a.cc:12:15: note: 'std::vector<double>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 12 | sort(a, a + i); | ^ /usr/include/c++/14/bits/basic_string.h:3696:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3696 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3696:5: note: template argument deduction/substitution failed: a.cc:12:15: note: 'std::vector<double>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 12 | sort(a, a + i); | ^ /usr/include/c++/14/bits/basic_string.h:3719:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3719 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3719:5: note: template argument deduction/substitution failed: a.cc:12:15: note: mismatched types 'const _CharT*' and 'std::vector<double>' 12 | sort(a, a + i); | ^ /usr/include/c++/14/bits/basic_string.h:3726:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3726 | operator+(_CharT __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3726:5: note: template argument deduction/substitution failed: a.cc:12:15: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 12 | sort(a, a + i); | ^ /usr/include/c++/14/bits/basic_string.h:3733:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const _CharT*)' 3733 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3733:5: note: template argument deduction/substitution failed: a.cc:12:15: note: 'std::vector<double>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 12 | sort(a, a + i); | ^ /usr/include/c++/14/bits/basic_string.h:3740:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, _CharT)' 3740 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3740:5: note: template argument deduction/substitution failed: a.cc:12:15: note: 'std::vector<double>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 12 | sort(a, a + i); | ^ 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:340:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator+(const complex<_Tp>&, const complex<_Tp>&)' 340 | operator+(const complex<_Tp>& __x, const complex<_Tp>& __y) | ^~~~~~~~ /usr/include/c++/14/complex:340:5: note: template argument deduction/substitution failed: a.cc:12:15: note: 'std::vector<double>' is not derived from 'const std::complex<_Tp>' 12 | sort(a, a + i); | ^ /usr/include/c++/14/complex:349:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator+(const complex<_Tp>&, const _Tp&)' 349 | operator+(const complex<_Tp>& __x, const _Tp& __y) | ^~~~~~~~ /usr/include/c++/14/complex:349:5
s796779354
p00046
C++
#define _CRT_SECURE_NO_WARNINGS 1 #include <iostream> #include <string> #include <vector> #include <algorithm> #include <cstdlib> #include <cstdio> #include <cstring> #include <cstdlib> #include <queue> #include <climits> #include <map> #include <stack> using namespace std; #define M_PI 3.141592 #define toRad 2.0*M_PI/360.0 #define inin(x) int x;cin>>x; #define all(x) x.begin(),x.end() #define debug(x) cout<<#x<<" "<<x<<endl; #define rep(i,n) for(int i=0;i<(int)n;i++) typedef pair<int, int> pii; int main() { double mi, ma, x; ma = DBL_MIN; mi = DBL_MAX; while (cin >> x) { ma = max(ma, x); mi = min(mi, x); } printf("%lf\n", ma - mi); }
a.cc: In function 'int main()': a.cc:26:14: error: 'DBL_MIN' was not declared in this scope 26 | ma = DBL_MIN; mi = DBL_MAX; | ^~~~~~~ a.cc:14:1: note: 'DBL_MIN' is defined in header '<cfloat>'; this is probably fixable by adding '#include <cfloat>' 13 | #include <stack> +++ |+#include <cfloat> 14 | using namespace std; a.cc:26:28: error: 'DBL_MAX' was not declared in this scope 26 | ma = DBL_MIN; mi = DBL_MAX; | ^~~~~~~ a.cc:26:28: note: 'DBL_MAX' is defined in header '<cfloat>'; this is probably fixable by adding '#include <cfloat>'
s008762461
p00046
C++
#include <iostream> #include <cstdio> #include <vector> #include <list> #include <algorithm> #include <cmath> #include <stack> #include <map> using namespace std; #define REP(i,n) for(int (i)=0; (i)<(n); (i)++) #define FOR(i,a,b) for(int (i)=(a); (i)<(b); (i)++) #define PUSH(n,v) for(int i=0; i<(n); i++) {int j; cin >> j; v.push_back(j);} #define ALL(v) v.begin(), v.end() int main() { double highest = INT_MIN; double lowest = INT_MAX; double h; while(cin >> h) { highest = max(highest, h); lowest = min(lowest, h); } printf("%.3f\n", highest- lowest); return 0; }
a.cc: In function 'int main()': a.cc:17:22: error: 'INT_MIN' was not declared in this scope 17 | double highest = INT_MIN; | ^~~~~~~ a.cc:9:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 8 | #include <map> +++ |+#include <climits> 9 | using namespace std; a.cc:18:21: error: 'INT_MAX' was not declared in this scope 18 | double lowest = INT_MAX; | ^~~~~~~ a.cc:18:21: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
s053180686
p00046
C++
#include <iostream> #include <cstdio> #include <vector> #include <list> #include <algorithm> #include <cmath> #include <stack> #include <map> using namespace std; #define REP(i,n) for(int (i)=0; (i)<(n); (i)++) #define FOR(i,a,b) for(int (i)=(a); (i)<(b); (i)++) #define PUSH(n,v) for(int i=0; i<(n); i++) {int j; cin >> j; v.push_back(j);} #define ALL(v) v.begin(), v.end() int main() { double highest = INT_MIN; double lowest = INT_MAX; double h; while(cin >> h) { highest = max(highest, h); lowest = min(lowest, h); } printf("%.3f\n", highest- lowest); return 0; }
a.cc: In function 'int main()': a.cc:17:22: error: 'INT_MIN' was not declared in this scope 17 | double highest = INT_MIN; | ^~~~~~~ a.cc:9:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 8 | #include <map> +++ |+#include <climits> 9 | using namespace std; a.cc:18:21: error: 'INT_MAX' was not declared in this scope 18 | double lowest = INT_MAX; | ^~~~~~~ a.cc:18:21: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
s069525365
p00046
C++
#include <iostream> #include <cstdio> #include <vector> #include <list> #include <algorithm> #include <cmath> #include <stack> #include <map> using namespace std; #define REP(i,n) for(int (i)=0; (i)<(n); (i)++) #define FOR(i,a,b) for(int (i)=(a); (i)<(b); (i)++) #define PUSH(n,v) for(int i=0; i<(n); i++) {int j; cin >> j; v.push_back(j);} #define ALL(v) v.begin(), v.end() int main() { double highest = INT_MIN; double lowest = INT_MAX; double h; while(cin >> h) { highest = max(highest, h); lowest = min(lowest, h); } printf("%.3f\n", highest- lowest); return 0; }
a.cc: In function 'int main()': a.cc:17:22: error: 'INT_MIN' was not declared in this scope 17 | double highest = INT_MIN; | ^~~~~~~ a.cc:9:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 8 | #include <map> +++ |+#include <climits> 9 | using namespace std; a.cc:18:21: error: 'INT_MAX' was not declared in this scope 18 | double lowest = INT_MAX; | ^~~~~~~ a.cc:18:21: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
s694604399
p00046
C++
#include<iostream> using namespace std; int main(){ double h, min = 0.0, max = 0.0; while(cin >> h){ if( h > max ) max = h; else if( h < min ) min = h; } cout << fixed << setprecision(1) << max - min << endl; }
a.cc: In function 'int main()': a.cc:9:26: error: 'setprecision' was not declared in this scope 9 | cout << fixed << setprecision(1) << max - min << endl; | ^~~~~~~~~~~~ a.cc:2:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>' 1 | #include<iostream> +++ |+#include <iomanip> 2 | using namespace std;
s141176196
p00046
C++
#include<bits/stdc++.h> using namespace std; int main(){ double h; vector<double>vh; vector<double>::iterator pvh=vh.begin(); while(cin>>h){ vh.push_back(h); } sort(vh.begin(),vh.end()); double a,b,c; double a=*pvh; pvh=vh.end(); double b=*pvh; double c=b-a; cout<<c<<endl; return 0; }
a.cc: In function 'int main()': a.cc:13:24: error: redeclaration of 'double a' 13 | double a=*pvh; | ^ a.cc:12:24: note: 'double a' previously declared here 12 | double a,b,c; | ^ a.cc:15:24: error: redeclaration of 'double b' 15 | double b=*pvh; | ^ a.cc:12:26: note: 'double b' previously declared here 12 | double a,b,c; | ^ a.cc:16:24: error: redeclaration of 'double c' 16 | double c=b-a; | ^ a.cc:12:28: note: 'double c' previously declared here 12 | double a,b,c; | ^
s845928066
p00046
C++
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication26 { class Program { static void Main(string[] args) { double b, c; c=0;b=1<<29; string line; while((line=Console.ReadLine())!=null) { double a = double.Parse(line); if (b < a) b = a; if (c > a) c = a; } Console.WriteLine(b - c); } } }
a.cc:1:7: error: expected nested-name-specifier before 'System' 1 | using System; | ^~~~~~ a.cc:2:7: error: expected nested-name-specifier before 'System' 2 | using System.Collections.Generic; | ^~~~~~ a.cc:3:7: error: expected nested-name-specifier before 'System' 3 | using System.Linq; | ^~~~~~ a.cc:4:7: error: expected nested-name-specifier before 'System' 4 | using System.Text; | ^~~~~~ a.cc:10:26: error: 'string' has not been declared 10 | static void Main(string[] args) | ^~~~~~ a.cc:10:35: error: expected ',' or '...' before 'args' 10 | static void Main(string[] args) | ^~~~ a.cc:25:6: error: expected ';' after class definition 25 | } | ^ | ; a.cc: In static member function 'static void ConsoleApplication26::Program::Main(int*)': a.cc:14:13: error: 'string' was not declared in this scope 14 | string line; | ^~~~~~ a.cc:15:20: error: 'line' was not declared in this scope 15 | while((line=Console.ReadLine())!=null) | ^~~~ a.cc:15:25: error: 'Console' was not declared in this scope 15 | while((line=Console.ReadLine())!=null) | ^~~~~~~ a.cc:15:46: error: 'null' was not declared in this scope 15 | while((line=Console.ReadLine())!=null) | ^~~~ a.cc:17:28: error: expected primary-expression before 'double' 17 | double a = double.Parse(line); | ^~~~~~ a.cc:23:13: error: 'Console' was not declared in this scope 23 | Console.WriteLine(b - c); | ^~~~~~~
s169022669
p00046
C++
#include<iostream> #include<cstdio> using namespace std; int main() { double heights[50]; int i = 0; while(cin >> heights[i]) { i++; } double min_f = *min_element(heights, heights + i); double max_f = *max_element(heights, heights + i); printf("%.6lf\n", max_f - min_f); return 0; }
a.cc: In function 'int main()': a.cc:14:19: error: 'min_element' was not declared in this scope 14 | double min_f = *min_element(heights, heights + i); | ^~~~~~~~~~~ a.cc:15:19: error: 'max_element' was not declared in this scope 15 | double max_f = *max_element(heights, heights + i); | ^~~~~~~~~~~
s735161786
p00046
C++
#include <iostream> #include <fstream> #include <cstdio> #include <cmath> #include <vector> #include <cstring> #include <string> #include <set> #include <map> #include <stack> #include <queue> #include <algorithm> using namespace std; #define REP(i,n) for(int i=0; i<n; ++i) #define FOR(i,a,b) for(int i=a; i<=b; ++i) #define FORR(i,a,b) for (int i=a; i>=b; --i) typedef long long ll; typedef vector<int> VI; typedef vector<ll> VL; typedef vector<VI> VVI; typedef pair<int,int> P; typedef pair<ll,ll> PL; int main() { vector<double> a; double x; while (~scanf("%f", &x)){ a.push_back(x); } double mi = 1e9; ma = 0; REP(i,a.size()){ mi = fmin(mi, a[i]); ma = fmax(ma, a[i]); } cout << ma - mi << endl; return 0; }
a.cc: In function 'int main()': a.cc:32:22: error: 'ma' was not declared in this scope; did you mean 'mi'? 32 | double mi = 1e9; ma = 0; | ^~ | mi
s456208398
p00046
C++
#include <iostream> using namespace std float a; float min = 1000000; float max = 0; int main(){ while(cin >> a){ if(a < min) min = a; if(a > max) max = a; count++; } cout << max - min << endl; }
a.cc:2:20: error: expected ';' before 'float' 2 | using namespace std | ^ | ; 3 | 4 | float a; | ~~~~~ a.cc: In function 'int main()': a.cc:10:16: error: reference to 'min' is ambiguous 10 | if(a < min) min = a; | ^~~ 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:281:5: note: candidates are: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ a.cc:5:7: note: 'float min' 5 | float min = 1000000; | ^~~ a.cc:10:21: error: reference to 'min' is ambiguous 10 | if(a < min) min = a; | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ a.cc:5:7: note: 'float min' 5 | float min = 1000000; | ^~~ a.cc:11:16: error: reference to 'max' is ambiguous 11 | if(a > max) max = a; | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ a.cc:6:7: note: 'float max' 6 | float max = 0; | ^~~ a.cc:11:21: error: reference to 'max' is ambiguous 11 | if(a > max) max = a; | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ a.cc:6:7: note: 'float max' 6 | float max = 0; | ^~~ a.cc:12:9: error: 'count' was not declared in this scope 12 | count++; | ^~~~~ a.cc:14:13: error: reference to 'max' is ambiguous 14 | cout << max - min << endl; | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ a.cc:6:7: note: 'float max' 6 | float max = 0; | ^~~ a.cc:14:19: error: reference to 'min' is ambiguous 14 | cout << max - min << endl; | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ a.cc:5:7: note: 'float min' 5 | float min = 1000000; | ^~~