submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3
values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s106603318 | p00022 | C | #include <stdio.h>
int main()
{
int n;
int a[5001];
while(1){
scanf("%d",&n);
if(n==0) break;
for(i=0;i<n;i++){
scanf("%d",a+i);
}
p=a[0];
for(i=0;i<n;i++){
t=m=a[i];
for(j=i+1;j<n;j++){
t+=a[j];
if(t>m) m=t;
}
if(m>p) p=m;
}
printf("%d\n",p);
}
return 0;
} | main.c: In function 'main':
main.c:11:21: error: 'i' undeclared (first use in this function)
11 | for(i=0;i<n;i++){
| ^
main.c:11:21: note: each undeclared identifier is reported only once for each function it appears in
main.c:14:17: error: 'p' undeclared (first use in this function)
14 | p=a[0];
| ^
main.c:16:25: error: 't' undeclared (first use in this function)
16 | t=m=a[i];
| ^
main.c:16:27: error: 'm' undeclared (first use in this function)
16 | t=m=a[i];
| ^
main.c:17:29: error: 'j' undeclared (first use in this function)
17 | for(j=i+1;j<n;j++){
| ^
|
s825280146 | p00022 | C | include <stdio.h>
#include <string.h>
int main()
{
int n, i, j;
int a[5000] = {};
int s[5000] = {};
int p;
int ans = -10000;
for(;;)
{
int a[5000] = {};
int s[5000] = {};
int p;
int ans = -10000;
scanf("%d", &n);
if(n == 0)
break;
for(i = 0; i < n; i++)
scanf("%d", &a[i]);
s[0] = a[0];
for(i = 1; i < n; i++)
{
for(j = 0; j <= i; j++)
s[i] += a[j];
if(ans < s[i])
{
ans = s[i];
p = i;
}
}
memset(s, 0, sizeof(int)*5000);
s[p] = a[p];
for(i = p - 1; i >= 0; i--)
{
for(j = p; j >= i; j--)
s[i] += a[j];
if(ans < s[i])
ans = s[i];
}
printf("%d\n", ans);
}
return 0;
} | main.c:1:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
1 | include <stdio.h>
| ^
In file included from main.c:2:
/usr/include/string.h:44:22: error: unknown type name 'size_t'
44 | size_t __n) __THROW __nonnull ((1, 2));
| ^~~~~~
/usr/include/string.h:34:1: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
33 | #include <stddef.h>
+++ |+#include <stddef.h>
34 |
/usr/include/string.h:47:56: error: unknown type name 'size_t'
47 | extern void *memmove (void *__dest, const void *__src, size_t __n)
| ^~~~~~
/usr/include/string.h:47:56: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/string.h:55:32: error: unknown type name 'size_t'
55 | int __c, size_t __n)
| ^~~~~~
/usr/include/string.h:55:32: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/string.h:61:42: error: unknown type name 'size_t'
61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
| ^~~~~~
/usr/include/string.h:61:42: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/string.h:64:56: error: unknown type name 'size_t'
64 | extern int memcmp (const void *__s1, const void *__s2, size_t __n)
| ^~~~~~
/usr/include/string.h:64:56: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/string.h:80:60: error: unknown type name 'size_t'
80 | extern int __memcmpeq (const void *__s1, const void *__s2, size_t __n)
| ^~~~~~
/usr/include/string.h:80:60: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/string.h:107:48: error: unknown type name 'size_t'
107 | extern void *memchr (const void *__s, int __c, size_t __n)
| ^~~~~~
/usr/include/string.h:107:48: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/string.h:145:53: error: unknown type name 'size_t'
145 | const char *__restrict __src, size_t __n)
| ^~~~~~
/usr/include/string.h:145:53: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/string.h:153:23: error: unknown type name 'size_t'
153 | size_t __n) __THROW __nonnull ((1, 2));
| ^~~~~~
/usr/include/string.h:153:23: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/string.h:159:57: error: unknown type name 'size_t'
159 | extern int strncmp (const char *__s1, const char *__s2, size_t __n)
| ^~~~~~
/usr/include/string.h:159:57: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/string.h:166:8: error: unknown type name 'size_t'
166 | extern size_t strxfrm (char *__restrict __dest,
| ^~~~~~
/usr/include/string.h:166:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/string.h:167:54: error: unknown type name 'size_t'
167 | const char *__restrict __src, size_t __n)
| ^~~~~~
/usr/include/string.h:167:54: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/string.h:179:8: error: unknown type name 'size_t'
179 | extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n,
| ^~~~~~
/usr/include/string.h:179:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/string.h:179:59: error: unknown type name 'size_t'
179 | extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n,
| ^~~~~~
/usr/include/string.h:179:59: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/string.h:195:45: error: unknown type name 'size_t'
195 | extern char *strndup (const char *__string, size_t __n)
| ^~~~~~
/usr/include/string.h:195:45: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/string.h:293:8: error: unknown type name 'size_t'
293 | extern size_t strcspn (const char *__s, const char *__reject)
| ^~~~~~
/usr/include/string.h:293:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/string.h:297:8: error: unknown type name 'size_t'
297 | extern size_t strspn (const char *__s, const char *__accept)
| ^~~~~~
/usr/include/string.h:297:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/string.h:389:46: error: unknown type name 'size_t'
389 | extern void *memmem (const void *__haystack, size_t __haystacklen,
| ^~~~~~
/usr/include/string.h:389:46: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/string.h:390:44: error: unknown type name 'size_t'
390 | const void *__needle, size_t __needlelen)
| ^~~~~~
/usr/include/string.h:390:44: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/string.h:398:55: error: unknown type name 'size_t'
398 | const void *__restrict __src, size_t __n)
| ^~~~~~
/usr/include/string.h:398:55: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/string.h:401:53: error: unknown type name 'size_t'
401 | const void *__restrict __src, size_t __n)
| ^~~~~~
/usr/include/string.h:401:53: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/string.h:407:8: error: unknown type name 'size_t'
407 | extern size_t strlen (const char *__s)
| ^~~~~~
/usr/include/string.h:407:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/string.h:413:8: error: unknown type name 'size_t'
413 | extern size_t strnlen (const char *__string, size_t __maxlen)
| ^~~~~~
/usr/include/string.h:413:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/string.h:413:46: error: unknown type name 'size_t'
413 | extern size_t strnlen (const char *__string, size_t __maxlen)
| ^~~~~~
/usr/include/string.h:413:46: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
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/string.h:26:
/usr/include/string.h:432:12: error: unknown type name 'size_t'
432 | extern int __REDIRECT_NTH (strerror_r,
| ^~~~~~~~~~~~~~
/usr/include/string.h:432:12: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
In file included from /usr/include/string.h:462:
/usr/include/strings.h:34:54: error: unknown type name 'size_t'
34 | extern int bcmp (const void *__s1, const void *__s2, size_t __n)
| ^~~~~~
/usr/include/strings.h:24:1: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
23 | #include <stddef.h>
+++ |+#include <stddef.h>
24 |
/usr/include/strings.h:38:53: error: unknown type name 'size_t'
38 | extern void bcopy (const void *__src, void *__dest, size_t __n)
| ^~~~~~
/usr/include/strings.h:38:53: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/strings.h:42:31: error: unknown type name 'size_t'
42 | extern void bzero (void *__s, size_t __n) __THROW __nonnull ((1));
| ^~~~~~
/usr/include/strings.h:42:31: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/strings.h:120:61: error: unknown type name 'size_t'
120 | extern int strncasecmp (const char *__s1, const char *__s2, size_t __n)
| ^~~~~~
/usr/include/strings.h:120:61: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/strings.h:134:27: error: unknown type name 'size_t'
134 | size_t __n, locale_t __loc)
| ^~~~~~
/usr/include/strings.h:134:27: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/string.h:466:40: error: unknown type na |
s745750908 | p00022 | C | #include<stdio.h>
int main(){
int a[6000],n,i,j,total=0,amax=1E-10;
while(1){
scanf("%d",&n);
if(!n) break;
amax=0;
for(i=0;i<n;i++) scanf("%d",&a[i]);
for(i=0;i<n;i++){
for(j=i;j<n;j++){
total+=a[j];
if(amax<total) amax=total;
}
total=0;
}
printf("%d\n",amax);
}
return 0;
}
scanf("%d",&n);
if(!n) break;
amax=0;
for(i=0;i<n;i++) scanf("%d",&a[i]);
for(i=0,k=0;i<n;i++){
for(j=i+1;j<=n;j++){
for(l=i;l<j;l++) total+=a[l];
if(amax<total) amax=total;
total=0;
}
}
printf("%d\n",amax);
}
return 0;
} | main.c:21:23: error: expected declaration specifiers or '...' before string constant
21 | scanf("%d",&n);
| ^~~~
main.c:21:28: error: expected declaration specifiers or '...' before '&' token
21 | scanf("%d",&n);
| ^
main.c:22:17: error: expected identifier or '(' before 'if'
22 | if(!n) break;
| ^~
main.c:23:17: warning: data definition has no type or storage class
23 | amax=0;
| ^~~~
main.c:23:17: error: type defaults to 'int' in declaration of 'amax' [-Wimplicit-int]
main.c:24:17: error: expected identifier or '(' before 'for'
24 | for(i=0;i<n;i++) scanf("%d",&a[i]);
| ^~~
main.c:24:26: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
24 | for(i=0;i<n;i++) scanf("%d",&a[i]);
| ^
main.c:24:30: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
24 | for(i=0;i<n;i++) scanf("%d",&a[i]);
| ^~
main.c:25:17: error: expected identifier or '(' before 'for'
25 | for(i=0,k=0;i<n;i++){
| ^~~
main.c:25:30: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
25 | for(i=0,k=0;i<n;i++){
| ^
main.c:25:34: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
25 | for(i=0,k=0;i<n;i++){
| ^~
main.c:32:24: error: expected declaration specifiers or '...' before string constant
32 | printf("%d\n",amax);
| ^~~~~~
main.c:32:31: error: expected declaration specifiers or '...' before 'amax'
32 | printf("%d\n",amax);
| ^~~~
main.c:33:9: error: expected identifier or '(' before '}' token
33 | }
| ^
main.c:34:9: error: expected identifier or '(' before 'return'
34 | return 0;
| ^~~~~~
main.c:35:1: error: expected identifier or '(' before '}' token
35 | }
| ^
|
s224393625 | p00022 | C | #include<stdio.h>
int main(){
int a[6000],n,i,j,total=0,amax=-99999999;
while(1){
scanf("%d",&n);
if(!n) break;
amax=-99999999;
for(i=0;i<n;i++) scanf("%d",&a[i]);
for(i=0;i<n;i++){
for(j=i;j<n;j++){
total+=a[j];
if(amax<total) amax=total;
}
total=0;
}
printf("%d\n",amax);
}
return 0;
}
amax=0;
for(i=0;i<n;i++) scanf("%d",&a[i]);
for(i=0;i<n;i++){
for(j=i;j<n;j++){
total+=a[j];
if(amax<total) amax=total;
}
total=0;
}
printf("%d\n",amax);
}
return 0;
} | main.c:21:17: warning: data definition has no type or storage class
21 | amax=0;
| ^~~~
main.c:21:17: error: type defaults to 'int' in declaration of 'amax' [-Wimplicit-int]
main.c:22:17: error: expected identifier or '(' before 'for'
22 | for(i=0;i<n;i++) scanf("%d",&a[i]);
| ^~~
main.c:22:26: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
22 | for(i=0;i<n;i++) scanf("%d",&a[i]);
| ^
main.c:22:30: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
22 | for(i=0;i<n;i++) scanf("%d",&a[i]);
| ^~
main.c:23:17: error: expected identifier or '(' before 'for'
23 | for(i=0;i<n;i++){
| ^~~
main.c:23:26: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
23 | for(i=0;i<n;i++){
| ^
main.c:23:30: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
23 | for(i=0;i<n;i++){
| ^~
main.c:30:24: error: expected declaration specifiers or '...' before string constant
30 | printf("%d\n",amax);
| ^~~~~~
main.c:30:31: error: expected declaration specifiers or '...' before 'amax'
30 | printf("%d\n",amax);
| ^~~~
main.c:31:9: error: expected identifier or '(' before '}' token
31 | }
| ^
main.c:32:9: error: expected identifier or '(' before 'return'
32 | return 0;
| ^~~~~~
main.c:33:1: error: expected identifier or '(' before '}' token
33 | }
| ^
|
s484808496 | p00022 | C | n = int(raw_input())
while n > 0:
a = []
for i in range(n):
a.append(int(raw_input()))
print max(a)
n = int(raw_input()) | main.c:1:1: warning: data definition has no type or storage class
1 | n = int(raw_input())
| ^
main.c:1:1: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
main.c:1:5: error: expected expression before 'int'
1 | n = int(raw_input())
| ^~~
|
s765799294 | p00022 | C | i,n,t;main(m){for(;scanf("%d",&i),n|i;n?:printf("%d\n",m))n--?t*=t>0,t+=i,m=t>m?t:m:(t=m=-"",n=i);} | main.c:1:1: warning: data definition has no type or storage class
1 | i,n,t;main(m){for(;scanf("%d",&i),n|i;n?:printf("%d\n",m))n--?t*=t>0,t+=i,m=t>m?t:m:(t=m=-"",n=i);}
| ^
main.c:1:1: error: type defaults to 'int' in declaration of 'i' [-Wimplicit-int]
main.c:1:3: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
1 | i,n,t;main(m){for(;scanf("%d",&i),n|i;n?:printf("%d\n",m))n--?t*=t>0,t+=i,m=t>m?t:m:(t=m=-"",n=i);}
| ^
main.c:1:5: error: type defaults to 'int' in declaration of 't' [-Wimplicit-int]
1 | i,n,t;main(m){for(;scanf("%d",&i),n|i;n?:printf("%d\n",m))n--?t*=t>0,t+=i,m=t>m?t:m:(t=m=-"",n=i);}
| ^
main.c:1:7: error: return type defaults to 'int' [-Wimplicit-int]
1 | i,n,t;main(m){for(;scanf("%d",&i),n|i;n?:printf("%d\n",m))n--?t*=t>0,t+=i,m=t>m?t:m:(t=m=-"",n=i);}
| ^~~~
main.c: In function 'main':
main.c:1:7: error: type of 'm' defaults to 'int' [-Wimplicit-int]
main.c:1:20: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
1 | i,n,t;main(m){for(;scanf("%d",&i),n|i;n?:printf("%d\n",m))n--?t*=t>0,t+=i,m=t>m?t:m:(t=m=-"",n=i);}
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | i,n,t;main(m){for(;scanf("%d",&i),n|i;n?:printf("%d\n",m))n--?t*=t>0,t+=i,m=t>m?t:m:(t=m=-"",n=i);}
main.c:1:20: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
1 | i,n,t;main(m){for(;scanf("%d",&i),n|i;n?:printf("%d\n",m))n--?t*=t>0,t+=i,m=t>m?t:m:(t=m=-"",n=i);}
| ^~~~~
main.c:1:20: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:42: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
1 | i,n,t;main(m){for(;scanf("%d",&i),n|i;n?:printf("%d\n",m))n--?t*=t>0,t+=i,m=t>m?t:m:(t=m=-"",n=i);}
| ^~~~~~
main.c:1:42: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:42: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:1:42: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:90: error: wrong type argument to unary minus
1 | i,n,t;main(m){for(;scanf("%d",&i),n|i;n?:printf("%d\n",m))n--?t*=t>0,t+=i,m=t>m?t:m:(t=m=-"",n=i);}
| ^
|
s316666469 | p00022 | C | #include <stdio.h>
int main(void)
{
int number,value,i,sum = 0;
while(1)
{
scanf_s("%d",&number);
if(number == 0) break;
for(i = 0; i < number ; i++)
{
scanf_s("%d",&value);
sum += value;
}
printf("%d\n",sum);
sum = 0;
}
} | main.c: In function 'main':
main.c:9:17: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
9 | scanf_s("%d",&number);
| ^~~~~~~
| scanf
|
s779421367 | p00022 | C | #include <stdio.h>
int main(void)
{
int number,value,i,sum = 0;
while(1)
{
scanf("%d",&number);
if(number == 0) break;
for(i = 0; i < number ; i++)
{
scanf_s("%d",&value);
sum += value;
}
printf("%d\n",sum);
sum = 0;
}
} | main.c: In function 'main':
main.c:15:25: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
15 | scanf_s("%d",&value);
| ^~~~~~~
| scanf
|
s149210086 | p00022 | C | #include <stdio.h>
int main(void)
{
int number,value,i,sum = 0;
while(1)
{
scanf("%d",&number);
if(number == 0) break;
for(i = 0; i < number ; i++)
{
scanf_s("%d",&value);
sum += value;
}
printf("%d\n",sum);
sum = 0;
}
return 0;
} | main.c: In function 'main':
main.c:15:25: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
15 | scanf_s("%d",&value);
| ^~~~~~~
| scanf
|
s029617394 | p00022 | C | #include<stdio.h>
main(){
int i,j,n,a[5000];
int sum = 0,max = 0;
while(1){
max = 0;
scanf("%d",&n);
if(n==0) break;
for(i=0;i<n;i++){
scanf("%d",&a[i]);
}
for(i = n - 1; (i >= 0)&&(a[i] <= 0); i--);
n = i;
for(i = 0; (i <= n)&&(a[i] <= 0); i++);
for( ;i <= n; i++){
sum = 0;
for(j = i; j <= n; j++) sum += a[j];
if(sum > max) max = sum;
for(j = n; j >= i; j--){
sum -= a[j];
if(sum > max) max = sum;
}
if(max > ans ) ans = max;
}
printf("%d\n",max);
sum = 0;
max = 0;
}
return 0;
} | main.c:2:1: error: return type defaults to 'int' [-Wimplicit-int]
2 | main(){
| ^~~~
main.c: In function 'main':
main.c:43:34: error: 'ans' undeclared (first use in this function)
43 | if(max > ans ) ans = max;
| ^~~
main.c:43:34: note: each undeclared identifier is reported only once for each function it appears in
|
s479458750 | p00022 | C++ | #include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000
using namespace std;
int main() {
int n;
while (cin >> n,n) {
int ans = -INF, cnt = 0;
rep(i, n) {
int a;
cin >> a;
if (cnt < 0) cnt = a;
else cnt += a;
ans = max(Max, cnt);
}
cout << ans << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:14:35: error: 'Max' was not declared in this scope
14 | ans = max(Max, cnt);
| ^~~
|
s996492579 | p00022 | C++ | #include <iostream>
#include <set>
#include <string>
#include <algorithm>
#include <vector>
#define MAX 1000000001
using namespace std;
#define ll long long
#define dbg if(0)
int main(){
while(true){
int n,t;
ll ans= - INT_MAX;
cin>>n;
if (n==0)break;
ll rui[n+1];
rui[0]=0;
for(int i=1;i<=n;i++){
cin >>rui[i];
rui[i]+=rui[i-1];
dbg cout <<rui[i]<<" ";
}
//次を見る
//今までの最小値を更新したか?
//したなら暫定解を確定しansと比較。最大値=最小値=発見した最小値にする
//してなければ最大値の更新をする
//見る場所が一番後ろまで行ったら終了。
ll nmin=MAX,nmax=0;
for(int i=0;i<=n;i++){
if (rui[i]<nmin){
ans=max(nmax-nmin,ans);
nmax=rui[i];
nmin=rui[i];
}else{
if(rui[i]>nmax){
nmax=rui[i];
}
}
dbg cout <<nmax<<" "<<nmin<<endl;
}
ans=max(nmax-nmin,ans);
dbg cout << endl;
cout<<ans<<endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:17:19: error: 'INT_MAX' was not declared in this scope
17 | ll ans= - INT_MAX;
| ^~~~~~~
a.cc:6:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
5 | #include <vector>
+++ |+#include <climits>
6 | #define MAX 1000000001
|
s730113330 | p00022 | C++ | #include <iostream>
#include <set>
#include <string>
#include <algorithm>
#include <vector>
#define MAX 1000000001
using namespace std;
#define ll long long
#define dbg if(0)
int main(){
while(true){
int n;
ll ans= LLONG_MIN;
cin>>n;
if (n==0)break;
ll rui[n+1];
rui[0]=0;
for(int i=1;i<=n;i++){
cin >>rui[i];
rui[i]+=rui[i-1];
dbg cout <<rui[i]<<" ";
}
dbg cout <<endl;
//次を見る
//今までの最小値を更新したか?
//したなら暫定解を確定しansと比較。最大値=最小値=発見した最小値にする
//してなければ最大値の更新をする
//見る場所が一番後ろまで行ったら終了。
// rui[0]=min(rui[0],rui[1]);
// ll nmin=rui[0],nmax=rui[0];
// bool nmflag=false;
for(int i=1;i<=n;i++){
for(int j=i;j<=n;j++){
ans=max(rui[j]-rui[i-1],ans);
}
}
/* for(int i=0;i<=n;i++){
if (rui[i]<nmin){
ans=max(nmax-nmin,ans);
nm=max(rui[i]-nmin,nm);
nmax=rui[i];
nmin=rui[i];
}else{
if(rui[i]>nmax){
nmax=rui[i];
nmflag=true;
}
}
dbg cout <<nmax<<" "<<nmin<<" "<<nm<<endl;
}
ans=max(nmax-nmin,ans);
dbg cout << endl;
if(nmflag)cout<<ans<<endl;
else cout<<nm<<endl;*/
cout <<ans<<endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:17:17: error: 'LLONG_MIN' was not declared in this scope
17 | ll ans= LLONG_MIN;
| ^~~~~~~~~
a.cc:6:1: note: 'LLONG_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
5 | #include <vector>
+++ |+#include <climits>
6 | #define MAX 1000000001
|
s330089122 | p00022 | C++ | /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
| |
s940387797 | p00022 | C++ | /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
| |
s329821436 | p00022 | C++ | 7
-5
-1
6
4
9
-6
-7
13
1
2
3
2
-2
-1
1
2
3
2
1
-2
1
3
1000
-200
201
0
| a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 7
| ^
|
s612443274 | p00022 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int n,ans;
cin >> n;
while(n!=0){
int a[5001];
for(int i=0;i<n;++i){
cin >> a[i];
}
ans=a[1]+a[0];
for(int i=0;i<n-2;++i){
ans=max(ans,a[i+2]+a[i+1]);
}
cout << ans << endl;
cin >> n;
}
}
7
-5
-1
6
4
9
-6
-7
13
1
2
3
2
-2
-1
1
2
3
2
1
-2
1
3
1000
-200
201
0
| a.cc:20:1: error: expected unqualified-id before numeric constant
20 | 7
| ^
|
s295354824 | p00022 | C++ | #include<iostream>
#include<cstdio>
#include<string>
#include<cmath>
#include<vector>
#include <algorithm>
using namespace std;
int main(){
int n;
int max1;
int maxS;
int sum=0;
int sumS=0;
int raw[5000];
int ans;
while(cin>>n,n!=0){
sum=0;
maxS=0;
sumS=0;
cin >> raw[0];
max1=raw[0];
sum += raw[0];
if(sum<0)sum=0;
for(int i=1;i<n;i++){
cin >> raw[i];
if(max1<raw[i]) max1 = raw[i];
if(raw[i]<0){
if(sumS<sum) sumS=sum;
}
sum += raw[i];
if(sum<0){
if(maxS<sum)maxS=sum;
sum=0;
}
}
ans=max(sum,max(sumS,max1),maxS);
cout<<ans<<endl;
}
return 0;
} | 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: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:39:10: required from here
39 | ans=max(sum,max(sumS,max1),maxS);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
306 | if (__comp(__a, __b))
| ~~~~~~^~~~~~~~~~
|
s914061662 | p00022 | C++ |
class Max
def solve
loop do
n = get.chomp.to_i
break if n == 0
max = -100000
sum = 0
n.times do
a = gets.chomp.to_i
sum += a
if max < sum
max = sum
end
if sum < 0 then
sum = 0
end
end
puts max
end
end
end
max.new.solve | a.cc:3:7: error: expected initializer before 'solve'
3 | def solve
| ^~~~~
|
s496836732 | p00022 | C++ |
class Max
def solve
loop do
n = gets.chomp.to_i
break if n == 0
max = -100000
sum = 0
n.times do
a = gets.chomp.to_i
sum += a
if max < sum
max = sum
end
if sum < 0 then
sum = 0
end
end
puts max
end
end
end
Max.new.solve | a.cc:3:7: error: expected initializer before 'solve'
3 | def solve
| ^~~~~
|
s552132696 | p00022 | C++ | #include <iostream>
#include <vector>
using namespace std;
vector<int> num;
int main(void){
while(true){
int maximum = 0, n;
cin >> n;
if(!n) break;
num.clear();
for(int i = 0; i < n; i++){
int tmp;
cin >> tmp;
num.push_back(tmp);
}
for(int i = 0; i < num.size(); i++){
int sum = num[i];
for(int j = i + 1; j < num.size(); j++){
sum += num[j];
if(sum > maximum) maximuma = sum;
}
}
cout << maximum << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:22:27: error: 'maximuma' was not declared in this scope; did you mean 'maximum'?
22 | if(sum > maximum) maximuma = sum;
| ^~~~~~~~
| maximum
|
s127503355 | p00022 | C++ | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
int N;
while(cin>>N && N){
vector<int> n(N), dp(N);
for(int i=0;i<N;i++){
cin>>n[i];
}
int ans = -1<<29;
int dp[5000];
for(int i=0;i<a;i++){
if(i-1 >= 0 && dp[i-1]>0){
dp[i] += dp[i-1] + n[i];
}else{
dp[i] = n[i];
}
ans = max(ans, dp[i]);
}
cout<<max_ret<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:16:21: error: conflicting declaration 'int dp [5000]'
16 | int dp[5000];
| ^~
a.cc:11:35: note: previous declaration as 'std::vector<int> dp'
11 | vector<int> n(N), dp(N);
| ^~
a.cc:17:31: error: 'a' was not declared in this scope
17 | for(int i=0;i<a;i++){
| ^
a.cc:26:23: error: 'max_ret' was not declared in this scope
26 | cout<<max_ret<<endl;
| ^~~~~~~
|
s214696247 | p00022 | C++ | #include <iostream>
#include <vector>
#include <limits.h>
using namespace std;
int main()
{
int n, k, p, m;#include <iostream>
#include <vector>
#include <limits.h>
using namespace std;
int main()
{
int n, k, p, m;
bool isPlus = true;
while (cin >> n){
if (0 == n) break;
vector<int> A(n, 0);
m = INT_MIN;
p = 0;
for (int i = 0; i < n; ++i){
cin >> k;
if (m < k) m = k;
if (0 == i){
A[p] = k;
isPlus = (k > 0);
}
else {
if (isPlus == (k > 0)){
A[p] += k;
}else{
++p;
A[p] = k;
isPlus = !isPlus;
}
}
}
int sum = 0;
for (int i = 0; i <= p; ++i){
sum += A[i];
if (sum > m) m = sum;
if (sum < 0) sum = 0;
}
cout << m << "\n";
}
return 0;
}
bool isPlus = true;
while (cin >> n){
if (0 == n) break;
vector<int> A(n, 0);
m = INT_MIN;
p = 0;
for (int i = 0; i < n; ++i){
cin >> k;
if (m < k) m = k;
if (0 == i){
A[p] = k;
isPlus = (k > 0);
}
else {
if (isPlus == (k > 0)){
A[p] += k;
}else{
++p;
A[p] = k;
isPlus = !isPlus;
}
}
}
int sum = 0;
for (int i = 0; i <= p; ++i){
sum += A[i];
if (sum < 0) sum = 0;
if (sum > m) m = sum;
}
cout << m << "\n";
}
return 0;
} | a.cc:7:24: error: stray '#' in program
7 | int n, k, p, m;#include <iostream>
| ^
a.cc: In function 'int main()':
a.cc:7:25: error: 'include' was not declared in this scope
7 | int n, k, p, m;#include <iostream>
| ^~~~~~~
a.cc:7:42: error: expected primary-expression before '>' token
7 | int n, k, p, m;#include <iostream>
| ^
a.cc:10:1: error: expected primary-expression before 'using'
10 | using namespace std;
| ^~~~~
a.cc:11:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
11 | int main()
| ^~
a.cc:11:9: note: remove parentheses to default-initialize a variable
11 | int main()
| ^~
| --
a.cc:11:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:12:1: error: a function-definition is not allowed here before '{' token
12 | {
| ^
|
s882600825 | p00022 | C++ | 7
-5
-1
6
4
9
-6
-7
13
1
2
3
2
-2
-1
1
2
3
2
1
-2
1
3
1000
-200
201
1
-1
0 | a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 7
| ^
|
s186247148 | p00022 | C++ | # Kadane
module Kadane
def self.max_subarray(a)
max_so_far = max_ending_here = 0
a.each do |i|
max_ending_here = [0, max_ending_here + i].max
max_so_far = [max_so_far, max_ending_here].max
end
max_so_far
end
end
answers = []
while n = gets.to_i
break if n == 0
a = []
n.times { a << gets.to_i }
answers << Kadane.max_subarray(a)
end
puts answers | a.cc:1:3: error: invalid preprocessing directive #Kadane
1 | # Kadane
| ^~~~~~
a.cc:2:1: error: 'module' does not name a type
2 | module Kadane
| ^~~~~~
a.cc:2:1: note: C++20 'module' only available with '-fmodules-ts'
a.cc:19:3: error: 'answers' does not name a type
19 | answers << Kadane.max_subarray(a)
| ^~~~~~~
|
s082125800 | p00022 | C++ | GNU nano 2.2.6 ファイル: Maximum Sum Sequence.cpp 変更済み
#include<iostream>
#include<algorithm>
#define MAX_N 5000
int main(){
int n, ans = 0, in, before;
while(std::cin >> n, n){
ans = before;
for(int i = 1; i <= n; ++i){
std::cin >> in;
before = std::max(in, before + in);
ans = std::max(before, ans);
}
std::cout << ans << std::endl;
ans = 0, before = 0;
}
return 0;
} | a.cc:1:12: error: too many decimal points in number
1 | GNU nano 2.2.6 ファイル: Maximum Sum Sequence.cpp 変更済み
| ^~~~~
a.cc:1:3: error: 'GNU' does not name a type
1 | GNU nano 2.2.6 ファイル: Maximum Sum Sequence.cpp 変更済み
| ^~~
In file included from /usr/include/c++/14/iosfwd:42,
from /usr/include/c++/14/ios:40,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:3:
/usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type
68 | typedef ptrdiff_t streamsize; // Signed integral type
| ^~~~~~~~~
/usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
40 | #include <cwchar> // For mbstate_t
+++ |+#include <cstddef>
41 |
In file included from /usr/include/c++/14/bits/exception_ptr.h:38,
from /usr/include/c++/14/exception:166,
from /usr/include/c++/14/ios:41:
/usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
In file included from /usr/include/wchar.h:35,
from /usr/include/c++/14/cwchar:44,
from /usr/include/c++/14/bits/postypes.h:40:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive]
132 | __attribute__((__externally_visible__));
| ^
/usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive]
134 | __attribute__((__externally_visible__));
| ^
/usr/include/c++/14/new:140:29: error: 'std::size_t' has not been declared
140 | void operator delete(void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
| ^~~
/usr/include/c++/14/new:142:31: error: 'std::size_t' has not been declared
142 | void operator delete[](void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
| ^~~
/usr/include/c++/14/new:145:26: error: declaration of 'operator new' as non-function
145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/new:145:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:145:52: error: expected primary-expression before 'const'
145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~
/usr/include/c++/14/new:147:26: error: declaration of 'operator new []' as non-function
147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/new:147:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:147:54: error: expected primary-expression before 'const'
147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~
/usr/include/c++/14/new:154:26: error: declaration of 'operator new' as non-function
154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
| ^~~~~~~~
/usr/include/c++/14/new:154:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:154:68: error: expected primary-expression before ')' token
154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
| ^
/usr/include/c++/14/new:155:73: error: attributes after parenthesized initializer ignored [-fpermissive]
155 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__));
| ^
/usr/include/c++/14/new:156:26: error: declaration of 'operator new' as non-function
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~~~
/usr/include/c++/14/new:156:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:156:68: error: expected primary-expression before ',' token
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^
/usr/include/c++/14/new:156:70: error: expected primary-expression before 'const'
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~
/usr/include/c++/14/new:162:26: error: declaration of 'operator new []' as non-function
162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
| ^~~~~~~~
/usr/include/c++/14/new:162:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:162:70: error: expected primary-expression before ')' token
162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
| ^
/usr/include/c++/14/new:163:73: error: attributes after parenthesized initializer ignored [-fpermissive]
163 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__));
| ^
/usr/include/c++/14/new:164:26: error: declaration of 'operator new []' as non-function
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~~~
/usr/include/c++/14/new:164:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:164:70: error: expected primary-expression before ',' token
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^
/usr/include/c++/14/new:164:72: error: expected primary-expression before 'const'
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~
/usr/include/c++/14/new:171:29: error: 'std::size_t' has not been declared
171 | void operator delete(void*, std::size_t, std::align_val_t)
| ^~~
/usr/include/c++/14/new:173:31: error: 'std::size_t' has not been declared
173 | void operator delete[](void*, std::size_t, std::align_val_t)
| ^~~
/usr/include/c++/14/new:179:33: error: declaration of 'operator new' as non-function
179 | _GLIBCXX_NODISCARD inline void* operator new( |
s653889940 | p00022 | C++ | include<iostream>
#include<algorithm>
#define MAX_N 5000
int main(){
int n, ans = 0, in, before;
while(std::cin >> n, n){
std::cin >> before;
ans = before;
for(int i = 1; i < n; ++i){
std::cin >> in;
before = std::max(in, before + in);
ans = std::max(before, ans);
}
std::cout << ans << std::endl;
ans = 0, before = 0;
}
return 0;
} | a.cc:1:1: error: 'include' does not name a type
1 | include<iostream>
| ^~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:62,
from /usr/include/c++/14/algorithm:60,
from a.cc:2:
/usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity
164 | __is_null_pointer(std::nullptr_t)
| ^
/usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)'
159 | __is_null_pointer(_Type)
| ^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'
164 | __is_null_pointer(std::nullptr_t)
| ^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/type_traits:295:27: error: 'size_t' has not been declared
295 | template <typename _Tp, size_t = sizeof(_Tp)>
| ^~~~~~
/usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'
666 | struct is_null_pointer<std::nullptr_t>
| ^~~~~~~~~
/usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid
666 | struct is_null_pointer<std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid
670 | struct is_null_pointer<const std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid
674 | struct is_null_pointer<volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid
678 | struct is_null_pointer<const volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:984:26: error: 'size_t' has not been declared
984 | template<typename _Tp, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope
985 | struct __is_array_known_bounds<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid
985 | struct __is_array_known_bounds<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
/usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^
/usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid
1438 | : public integral_constant<std::size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared
1440 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope
1441 | struct rank<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid
1441 | struct rank<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1451:32: error: 'size_t' was not declared in this scope
1451 | : public integral_constant<size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
63 | #include <bits/version.h>
+++ |+#include <cstddef>
64 |
/usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid
1451 | : public integral_constant<size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared
1453 | template<typename _Tp, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope
1454 | struct extent<_Tp[_Size], 0>
| ^~~~~
/usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid
1454 | struct extent<_Tp[_Size], 0>
| ^
/usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope
1455 | : public integral_constant<size_t, _Size> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope
1455 | : public integral_constant<size_t, _Size> { };
| ^~~~~
/usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid
1455 | : public integral_constant<size_t, _Size> { };
| ^
/usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid
/usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared
1457 | template<typename _Tp, unsigned _Uint, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope
1458 | struct extent<_Tp[_Size], _Uint>
| ^~~~~
/usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid
1458 | struct extent<_Tp[_Size], _Uint>
| ^
/usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope
1463 | : public integral_constant<size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid
1463 | : public integral_constant<size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type
1857 | { static constexpr size_t __size = sizeof(_Tp); };
| ^~~~~~
/usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared
1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
| ^~~~~~
/usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope
1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
| ^~~
/usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp'
1860 | struct __select;
| ^~~~~~~~
/usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared
1862 | template<size_t _Sz, typename _Uint, typename... _UInts>
| ^~~~~~
/usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope
1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true>
| ^~~
/usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid
1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true>
| ^
/usr/include/c++/14/type_traits:1866:14: error: 'size_t' has not been declared
1866 | template<size_t _Sz, typename _Uint, typename... _UInts>
| ^~~~~~
/usr/include/c++/14/type_traits:1867:23: error: '_Sz' was not declared in this scope
1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false>
| ^~~
/usr/include/c++/14/type_traits:1867:58: error: template argument 1 is invalid
1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false>
|
s192533520 | p00022 | C++ | /*
* AOJ-Volume0-0022
*/
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
/*
* Find maximum sum.
* array: number list
*/
int findMaximumSum(vector<int> &array){
int sumValue = array[0];
int maxValue = INT_MIN;
int length = array.size();
for(int i = 1; i < length; i++){
int value = array[i];
if(sumValue < 0){
sumValue = value;
}else{
sumValue += value;
}
if(maxValue < sumValue){
maxValue = sumValue;
}
}
return maxValue;
}
void solve(int n){
vector<int> a(n);
for(int i = 0; i < n; i++){
scanf("%d", &a[i]);
}
printf("%d\n", findMaximumSum(a));
}
int main(){
int n;
while(cin >> n){
if(n == 0) break;
solve(n);
}
return 0;
} | a.cc: In function 'int findMaximumSum(std::vector<int>&)':
a.cc:17:18: error: 'INT_MIN' was not declared in this scope
17 | int maxValue = INT_MIN;
| ^~~~~~~
a.cc:6:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
5 | #include <vector>
+++ |+#include <climits>
6 |
|
s963442516 | p00022 | C++ | /*
* AOJ-Volume0-0022
*/
#include <iostream>
#include <vector>
#include <cstdio>
using namespace std;
typedef long long ll;
/*
* Find maximum sum.
* array: number list
*/
int findMaximumSum(vector<int> &array){
int sumValue = array[0];
int maxValue = INT_MIN;
int length = array.size();
for(int i = 1; i < length; i++){
int value = array[i];
if(sumValue < 0){
sumValue = value;
}else{
sumValue += value;
}
if(maxValue < sumValue){
maxValue = sumValue;
}
}
return maxValue;
}
void solve(int n){
vector<int> a(n);
for(int i = 0; i < n; i++){
scanf("%d", &a[i]);
}
printf("%d\n", findMaximumSum(a));
}
int main(){
int n;
while(cin >> n){
if(n == 0) break;
solve(n);
}
return 0;
} | a.cc: In function 'int findMaximumSum(std::vector<int>&)':
a.cc:18:18: error: 'INT_MIN' was not declared in this scope
18 | int maxValue = INT_MIN;
| ^~~~~~~
a.cc:7:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
6 | #include <cstdio>
+++ |+#include <climits>
7 |
|
s822670736 | p00022 | C++ | #include <iostream>
using namespace std;
int main(){
int n, a;
long long ing max_, tmp;
while(cin >> n){
max_=0; tmp=0; tmp=0;
for(int i=0; i<n; i++){
cin >> a;
tmp = max(0,tmp+a);
max_ = max(tmp,max_);
}
cout << max_ << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:6:17: error: expected initializer before 'max_'
6 | long long ing max_, tmp;
| ^~~~
a.cc:8:5: error: 'max_' was not declared in this scope
8 | max_=0; tmp=0; tmp=0;
| ^~~~
a.cc:8:13: error: 'tmp' was not declared in this scope; did you mean 'tm'?
8 | max_=0; tmp=0; tmp=0;
| ^~~
| tm
|
s769022843 | p00022 | C++ | #include <iostream>
using namespace std;
int main(){
int n, a;
long long int max_, tmp;
while(cin >> n){
max_=0; tmp=0; tmp=0;
for(int i=0; i<n; i++){
cin >> a;
tmp = max(0,tmp+a);
max_ = max(tmp,max_);
}
cout << max_ << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:11:16: error: no matching function for call to 'max(int, long long int)'
11 | tmp = max(0,tmp+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:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:11:16: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
11 | tmp = max(0,tmp+a);
| ~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
|
s516490622 | p00022 | C++ | #include<iostream>
#include<string>
#include<cstdio>
using namespace std;
int main()
{
long???long int n,ans = 0;
while(cin >> n){
if(n == 0)break;
long int a[n];
for(int i = 0;i < n;i++){
cin >> a[i];
ans += a[i];
}
cout << ans << endl;
}
} | a.cc: In function 'int main()':
a.cc:7:13: error: expected unqualified-id before '?' token
7 | long???long int n,ans = 0;
| ^
a.cc:8:22: error: 'n' was not declared in this scope
8 | while(cin >> n){
| ^
a.cc:14:32: error: 'a' was not declared in this scope
14 | cin >> a[i];
| ^
a.cc:15:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
15 | ans += a[i];
| ^~~
| abs
a.cc:17:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
17 | cout << ans << endl;
| ^~~
| abs
|
s815752903 | p00022 | C++ | #include<iostream>
#include<string>
#include<cstdio>
using namespace std;
int main()
{
long???long int n,ans = 0;
while(cin >> n){
if(n == 0)break;
long int a[n];
for(int i = 0;i < n;i++){
cin >> a[i];
ans += a[i];
}
cout << ans << endl;
}
} | a.cc: In function 'int main()':
a.cc:7:13: error: expected unqualified-id before '?' token
7 | long???long int n,ans = 0;
| ^
a.cc:8:22: error: 'n' was not declared in this scope
8 | while(cin >> n){
| ^
a.cc:14:32: error: 'a' was not declared in this scope
14 | cin >> a[i];
| ^
a.cc:15:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
15 | ans += a[i];
| ^~~
| abs
a.cc:17:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
17 | cout << ans << endl;
| ^~~
| abs
|
s984471259 | p00022 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
#include <sstream>
#include <string>
#include <cmath>
#include <list>
#include <set>
#include <cstdlib>
using namespace std;
int in() {int x; cin >> x; return x;}
template <typename T> class SegTree
{
public:
int n;
T T_max;
vector<T> dat;
SegTree(int n_, T t_max)
{
int n = 1;
T_max = t_max;
while (n < n_)n *= 2;
for (int i = 0; i < 2 * n - 1; i++)dat.push_back(t_max);
}
void update(int k, T a)
{
k += n - 1;
dat[k] = a;
while (k > 0)
{
k = (k - 1) / 2;
dat[k] = min(dat[k * 2 + 1], dat[k * 2 + 2]);
}
}
//[a,b)
T query(int a, int b)
{
return _query(a, b, 0, 0, n);
}
private:
T _query(int a, int b, int k, int l, int r)
{
if (r <= a || b <= l)return T_max;
if (a <= l && r <= b)return dat[k];
else
{
T vl = _query(a, b, k * 2 + 1, l, (l + r) / 2);
T vr = _query(a, b, k * 2 + 2, (l + r) / 2, r);
return min(vr, vl);
}
}
};
int main()
{
int n;
while (cin >> n && n)
{
vector<int> a;
int ans = -999999999;
for (int i = 0; i < n; i++)
{
a.push_back(in());
}
for (int i = 1; i < n; i++)
{
a[i] += a[i - 1];
}
for (int l = 0; l < n; l++)
{
for (r = l; r < n; r++)
{
ans = max(ans, a[r] - a[l]);
}
}
cout << ans << endl;
}
} | a.cc: In function 'int main()':
a.cc:126:30: error: 'r' was not declared in this scope
126 | for (r = l; r < n; r++)
| ^
|
s448557045 | p00022 | C++ | #include <iostream>
using namespace std;
template <typename Type>
long long Maximum_Sum_Sequence(Type N[], int size)
{
long long max = LLONG_MIN;
for (int i = 0; i < size; i++)
{
long long sum = 0;
for (int j = i; j < size; j++)
{
sum += N[j];
if (sum > max) { max = sum; }
}
}
return max;
}
int main()
{
const int DATASETS = 10;
int n[DATASETS], a[DATASETS][5000], c = 0;
while (true)
{
cin >> n[c];
if (n[c] == 0) { break; }
for (int i = 0; i < n[c]; i++) { cin >> a[c][i]; }
c++;
}
for (int i = 0; i < c; i++)
{
cout << Maximum_Sum_Sequence(a[i], n[i]) << endl;
}
return 0;
} | a.cc: In function 'long long int Maximum_Sum_Sequence(Type*, int)':
a.cc:8:25: error: 'LLONG_MIN' was not declared in this scope
8 | long long max = LLONG_MIN;
| ^~~~~~~~~
a.cc:2:1: note: 'LLONG_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
1 | #include <iostream>
+++ |+#include <climits>
2 |
|
s037571749 | p00022 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
int main(){
long long a, maximum;
int n;
S[0] = 0;
while (cin >> n, n){
maximum=-1000000
long long S[5010] = {};
for (int i = 1; i <= n; i++){
cin >> a;
S[i] = S[i - 1] + a;
}
for (int i = 0; i <= n; i++)
for (int j = i + 1; j <= n; j++){
maximum = max(maximum, S[j] - S[i]);
}
cout << maximum << endl;
}
} | a.cc: In function 'int main()':
a.cc:8:9: error: 'S' was not declared in this scope
8 | S[0] = 0;
| ^
a.cc:10:33: error: expected ';' before 'long'
10 | maximum=-1000000
| ^
| ;
11 | long long S[5010] = {};
| ~~~~
|
s421233111 | p00022 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
int main(){
int n, max1, max2, a[5001];
while( cin >> n , n ){
for(int i=0 ; i<n ; i++){
cin >> a[i] ;
}
max1 = a[0];
for(int i=0 ; i<n ; i++){
int sum = 0;
for(int j=i ; j<n ; j++){
sum += a[j];
max1 = max( max1 , sum );
}
}
cout << max1 << endl;
} | a.cc: In function 'int main()':
a.cc:22:10: error: expected '}' at end of input
22 | }
| ^
a.cc:5:11: note: to match this '{'
5 | int main(){
| ^
|
s013614007 | p00022 | C++ | #include <fstream>
#include <iostream>
#include <cmath>
#include <vector>
#include <queue>
#include <utility>
#include <algorithm>
using namespace std;
int main() {
// ifstream cin("../test.txt");
int n;
while (true) {
cin >> n;
if (!n) break;
vector<int> a(n);
vector<int> sub_sum(n); // a[0] + ... + a[i]
for (int i = 0; i < n; i++) {
cin >> a[i];
}
sub_sum[0] = a[0];
long long max_sum = -100000000000;
for (int i = 1; i < n; i++) {
sub_sum[i] = sub_sum[i-1] + a[i];
max_sum = max(max_sum, sub_sum[i]);
}
for (int i = 1; i < n; i++) {
for (int j = 0; j < i; j++) {
max_sum = max(max_sum, sub_sum[i] - sub_sum[j]);
}
}
cout << max_sum << endl;
}
} | a.cc: In function 'int main()':
a.cc:25:20: error: no matching function for call to 'max(long long int&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
25 | max_sum = max(max_sum, sub_sum[i]);
| ~~~^~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/istream:40,
from /usr/include/c++/14/fstream:40,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:25:20: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
25 | max_sum = max(max_sum, sub_sum[i]);
| ~~~^~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:7:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:25:20: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
25 | max_sum = max(max_sum, sub_sum[i]);
| ~~~^~~~~~~~~~~~~~~~~~~~~
a.cc:29:22: error: no matching function for call to 'max(long long int&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type)'
29 | max_sum = max(max_sum, sub_sum[i] - sub_sum[j]);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:29:22: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
29 | max_sum = max(max_sum, sub_sum[i] - sub_sum[j]);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:29:22: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
29 | max_sum = max(max_sum, sub_sum[i] - sub_sum[j]);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
s587169718 | p00022 | C++ | #include<iostream>
#include<algortihm>
using namespace std;
int main(){
long int n, m[5001] = { 0 }, max = -2147483647, temp = 0, k;
while (cin>> n && n!=0){
for (int i = 0; i < n; i++){
cin >> m[i];
}
for (int i = 0; i < n; i++){
temp = m[i];
for (int l = i + 1; l < n; l++){
temp += m[l];
if (temp > m[i]) if (max < temp) max = temp;
else if (max < m[i]) max = m[i];
}temp = 0;
}
cout << max << endl;
max = -2147483647;
}
return 0;
} | a.cc:2:9: fatal error: algortihm: No such file or directory
2 | #include<algortihm>
| ^~~~~~~~~~~
compilation terminated.
|
s248854032 | p00022 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main()
{
int n, num;
vector< int > a;
while( 1 ) {
int Max = -100000;
cin >> n;
if( n == 0 ) break;
????????????????????????a.push_back( 0 );
for( int i = 0; i < n; i++ ) {
cin >> num;
a.push_back( num );
}
for( int i = 1; i < n - 1; i++ ) {
a.at( i - 1 ) + a.at( i ) > a.at( i ) ? a.at( i ) = a.at( i - 1 ) + a.at( i ) : a.at( i ) = a.at( i );
if ( a.at( i ) > Max ) {
Max = a.at( i );
}
}
cout << Max << endl;
a.clear();
}
return 0;
} | a.cc: In function 'int main()':
a.cc:18:1: error: expected primary-expression before '?' token
18 | ????????????????????????a.push_back( 0 );
| ^
a.cc:18:2: error: expected primary-expression before '?' token
18 | ????????????????????????a.push_back( 0 );
| ^
a.cc:18:3: error: expected primary-expression before '?' token
18 | ????????????????????????a.push_back( 0 );
| ^
a.cc:18:4: error: expected primary-expression before '?' token
18 | ????????????????????????a.push_back( 0 );
| ^
a.cc:18:5: error: expected primary-expression before '?' token
18 | ????????????????????????a.push_back( 0 );
| ^
a.cc:18:6: error: expected primary-expression before '?' token
18 | ????????????????????????a.push_back( 0 );
| ^
a.cc:18:7: error: expected primary-expression before '?' token
18 | ????????????????????????a.push_back( 0 );
| ^
a.cc:18:8: error: expected primary-expression before '?' token
18 | ????????????????????????a.push_back( 0 );
| ^
a.cc:18:9: error: expected primary-expression before '?' token
18 | ????????????????????????a.push_back( 0 );
| ^
a.cc:18:10: error: expected primary-expression before '?' token
18 | ????????????????????????a.push_back( 0 );
| ^
a.cc:18:11: error: expected primary-expression before '?' token
18 | ????????????????????????a.push_back( 0 );
| ^
a.cc:18:12: error: expected primary-expression before '?' token
18 | ????????????????????????a.push_back( 0 );
| ^
a.cc:18:13: error: expected primary-expression before '?' token
18 | ????????????????????????a.push_back( 0 );
| ^
a.cc:18:14: error: expected primary-expression before '?' token
18 | ????????????????????????a.push_back( 0 );
| ^
a.cc:18:15: error: expected primary-expression before '?' token
18 | ????????????????????????a.push_back( 0 );
| ^
a.cc:18:16: error: expected primary-expression before '?' token
18 | ????????????????????????a.push_back( 0 );
| ^
a.cc:18:17: error: expected primary-expression before '?' token
18 | ????????????????????????a.push_back( 0 );
| ^
a.cc:18:18: error: expected primary-expression before '?' token
18 | ????????????????????????a.push_back( 0 );
| ^
a.cc:18:19: error: expected primary-expression before '?' token
18 | ????????????????????????a.push_back( 0 );
| ^
a.cc:18:20: error: expected primary-expression before '?' token
18 | ????????????????????????a.push_back( 0 );
| ^
a.cc:18:21: error: expected primary-expression before '?' token
18 | ????????????????????????a.push_back( 0 );
| ^
a.cc:18:22: error: expected primary-expression before '?' token
18 | ????????????????????????a.push_back( 0 );
| ^
a.cc:18:23: error: expected primary-expression before '?' token
18 | ????????????????????????a.push_back( 0 );
| ^
a.cc:18:24: error: expected primary-expression before '?' token
18 | ????????????????????????a.push_back( 0 );
| ^
a.cc:18:41: error: expected ':' before ';' token
18 | ????????????????????????a.push_back( 0 );
| ^
| :
a.cc:18:41: error: expected primary-expression before ';' token
a.cc:18:41: error: expected ':' before ';' token
18 | ????????????????????????a.push_back( 0 );
| ^
| :
a.cc:18:41: error: expected primary-expression before ';' token
a.cc:18:41: error: expected ':' before ';' token
18 | ????????????????????????a.push_back( 0 );
| ^
| :
a.cc:18:41: error: expected primary-expression before ';' token
a.cc:18:41: error: expected ':' before ';' token
18 | ????????????????????????a.push_back( 0 );
| ^
| :
a.cc:18:41: error: expected primary-expression before ';' token
a.cc:18:41: error: expected ':' before ';' token
18 | ????????????????????????a.push_back( 0 );
| ^
| :
a.cc:18:41: error: expected primary-expression before ';' token
a.cc:18:41: error: expected ':' before ';' token
18 | ????????????????????????a.push_back( 0 );
| ^
| :
a.cc:18:41: error: expected primary-expression before ';' token
a.cc:18:41: error: expected ':' before ';' token
18 | ????????????????????????a.push_back( 0 );
| ^
| :
a.cc:18:41: error: expected primary-expression before ';' token
a.cc:18:41: error: expected ':' before ';' token
18 | ????????????????????????a.push_back( 0 );
| ^
| :
a.cc:18:41: error: expected primary-expression before ';' token
a.cc:18:41: error: expected ':' before ';' token
18 | ????????????????????????a.push_back( 0 );
| ^
| :
a.cc:18:41: error: expected primary-expression before ';' token
a.cc:18:41: error: expected ':' before ';' token
18 | ????????????????????????a.push_back( 0 );
| ^
| :
a.cc:18:41: error: expected primary-expression before ';' token
a.cc:18:41: error: expected ':' before ';' token
18 | ????????????????????????a.push_back( 0 );
| ^
| :
a.cc:18:41: error: expected primary-expression before ';' token
a.cc:18:41: error: expected ':' before ';' token
18 | ????????????????????????a.push_back( 0 );
| ^
| :
a.cc:18:41: error: expected primary-expression before ';' token
a.cc:18:41: error: expected ':' before ';' token
18 | ????????????????????????a.push_back( 0 );
| ^
| :
a.cc:18:41: error: expected primary-expression before ';' token
a.cc:18:41: error: expected ':' before ';' token
18 | ????????????????????????a.push_back( 0 );
| ^
| :
a.cc:18:41: error: expected primary-expression before ';' token
a.cc:18:41: error: expected ':' before ';' token
18 | ????????????????????????a.push_back( 0 );
| ^
| :
a.cc:18:41: error: expected primary-expression before ';' token
a.cc:18:41: error: expected ':' before ';' token
18 | ????????????????????????a.push_back( 0 );
| ^
| :
a.cc:18:41: error: expected primary-expression before ';' token
a.cc:18:41: error: expected ':' before ';' token
18 | ????????????????????????a.push_back( 0 );
| ^
| :
a.cc:18:41: error: expected primary-expression before ';' token
a.cc:18:41: error: expected ':' before ';' token
18 | ????????????????????????a.push_back( 0 );
| ^
| :
a.cc:18:41: error: expected primary-expression before ';' token
a.cc:18:41: error: expected ':' before ';' token
18 | ????????????????????????a.push_back( 0 );
| ^
| :
a.cc:18:41: error: expected primary-expression before ';' token
a.cc:18:41: error: expected ':' before ';' token
18 | ????????????????????????a.push_back( 0 );
| ^
| :
a.cc:18:41: error: expected primary-expression before ';' token
a.cc:18:41: error: expected ':' before ';' token
18 | ????????????????????????a.push_back( 0 );
| ^
| :
a.cc:18:41: error: expected primary-expression before ';' token
a.cc:18:41: error: expected ':' before ';' token
18 | ????????????????????????a.push_back( 0 );
| ^
| :
a.cc:18:41: error: expected primary-expression before ';' token
a.cc:18:41: error: expected ':' before ';' token
18 | ????????????????????????a.push_back( 0 );
| ^
| :
a.cc:18:41: error: expected primary-expression before ';' token
a.cc:18:41: error: expected ':' before ';' token
18 | ????????????????????????a.push_back( 0 );
| ^
| :
a.cc:18:41: error: expected primary-expression before ';' token
|
s950648269 | p00022 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main()
{
int n, num;
vector< long int > a;
vector< long int > res;
while( 1 ) {
int Max = -INT_MAX;
cin >> n;
if( n == 0 ) break;
for( int i = 0; i < n; i++ ) {
cin >> num;
a.push_back( num );
}
//?????§???
for( int i = 1; i < n; i++ ) {
a[i - 1] + a[i] > a[i] ? a[i] = a[i - 1] + a[i] : a[i] = a[i];
if ( a[i] > Max ) {
Max = a[i];
}
}
res.push_back( Max );
a.clear();
}
for( vector< long int > :: iterator mIt = res.begin(); mIt != res.end(); ++mIt ) {
cout << *mIt << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:14:28: error: 'INT_MAX' was not declared in this scope
14 | int Max = -INT_MAX;
| ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
2 | #include <vector>
+++ |+#include <climits>
3 | using namespace std;
|
s356331110 | p00022 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main()
{
int n, num;
vector< long int > a;
vector< long int > res;
while( 1 ) {
int Max = INT_MAX * -1;
cin >> n;
if( n == 0 ) break;
for( int i = 0; i < n; i++ ) {
cin >> num;
a.push_back( num );
}
//?????§???
for( int i = 1; i < n; i++ ) {
a[i - 1] + a[i] > a[i] ? a[i] = a[i - 1] + a[i] : a[i] = a[i];
if ( a[i] > Max ) {
Max = a[i];
}
}
res.push_back( Max );
a.clear();
}
for( vector< long int > :: iterator mIt = res.begin(); mIt != res.end(); ++mIt ) {
cout << *mIt << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:14:27: error: 'INT_MAX' was not declared in this scope
14 | int Max = INT_MAX * -1;
| ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
2 | #include <vector>
+++ |+#include <climits>
3 | using namespace std;
|
s269105032 | p00022 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
int main(){
int nn[5001] = { 0 }, temp, n, max = -110000;
while (cin >> n && (n != 0)){
for (int i = 0; i < n; i++){
cin >> nn[i];
}
temp = nn[0];
for (int i = 1; i < n; i++){
temp += nn[i];
if (temp < nn[i]) temp = nn[i];
if (max < temp) max = temp;
}if (max < nn[0]) cout << nn[0] << endl;
else cout << max << endl;
max = -110000;
}
return 0; | a.cc: In function 'int main()':
a.cc:19:18: error: expected '}' at end of input
19 | return 0;
| ^
a.cc:4:11: note: to match this '{'
4 | int main(){
| ^
|
s424449688 | p00022 | C++ | #include <iostream>
using namespace std;
int main(void){
int n, max=0;
int *a;
int sum;
do{
max = -1000000;
//cout << endl;
cin >> n;
if (n == 0) break;
a = new long[n + 1];
sum = 0;
for (int i = 0; i < n; i++){
sum = 0;
cin >> a[i];
for (int j = i; j >= 0; j--){
sum += a[j];
if (max < sum) max = sum;
}
}
cout << max << endl;
} while (1);
} | a.cc: In function 'int main()':
a.cc:16:21: error: cannot convert 'long int*' to 'int*' in assignment
16 | a = new long[n + 1];
| ^~~~~~~~~~~~~~~
| |
| long int*
|
s813971724 | p00022 | C++ | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
#define FOR(a) for(int i = 0; i < a; i++)
#define FORR(a, b) for(int i = a; i < b; i++)
int main(void){
int Max, Num = -1, In, N = 0;
vector<int> Dat;
while (Num != 0){
Max = -100000;
cin >> Num;
Dat.push_back(-100000);
FOR(Num){
cin >> In;
Dat.push_back(In);
}
FORR(1, Num + 1){
Dat[i] = max(Dat[i], Dat[i - 1] + Dat[i]);
Max = max(Max, Dat[i]);
}
N = Dat.max_size;
FOR(N){
Dat.pop_back();
}
cout << Max << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:25:25: error: cannot convert 'std::vector<int>::max_size' from type 'std::vector<int>::size_type (std::vector<int>::)() const noexcept' {aka 'long unsigned int (std::vector<int>::)() const noexcept'} to type 'int'
25 | N = Dat.max_size;
| ^~~~~~~~
|
s811268907 | p00022 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
int main(){
int n;
cin >> n;
while(n != 0){
int a[n];
for(int i = 0; i < n; i++){
cin >> a[i];
}
sort(a.begin(), a.end());
int sum = 0;
for(int i = 0; i < n; i++){
if(a[n-1-i] > 0){
sum += a[n-1-i];
}else{
cout << sum << endl;
break;
}
}
cin >> n;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:14:24: error: request for member 'begin' in 'a', which is of non-class type 'int [n]'
14 | sort(a.begin(), a.end());
| ^~~~~
a.cc:14:35: error: request for member 'end' in 'a', which is of non-class type 'int [n]'
14 | sort(a.begin(), a.end());
| ^~~
|
s617349056 | p00022 | C++ | #include<iostream>
using namesapce std;
int main()
{
while(1){
int n,sum=0;
cin>>n;
int a[n];
for(i=0;i<n;i++){
cin>>a[i];
sum+=a[i];
}
cout<<sum<<endl;
}
return 0;
} | a.cc:2:7: error: expected nested-name-specifier before 'namesapce'
2 | using namesapce std;
| ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:8:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
8 | cin>>n;
| ^~~
| std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:10:13: error: 'i' was not declared in this scope
10 | for(i=0;i<n;i++){
| ^
a.cc:14:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
14 | cout<<sum<<endl;
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:14:20: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
14 | cout<<sum<<endl;
| ^~~~
| std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
|
s296974060 | p00022 | C++ |
#include<iostream>
using namespace std;
int main()
{
while(1){
int n,sum=0;
cin>>n;
int a[n];
for(i=0;i<n;i++){
cin>>a[i];
sum+=a[i];
}
cout<<sum<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:11:13: error: 'i' was not declared in this scope
11 | for(i=0;i<n;i++){
| ^
|
s498004016 | p00022 | C++ |
#include<iostream>
using namespace std;
int main()
{
while(1){
int n,sum=0;
cin>>n;
if(n==0)
break;
int a[n];
for(i=0;i<n;i++){
cin>>a[i];
sum+=a[i];
}
cout<<sum<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:13:13: error: 'i' was not declared in this scope
13 | for(i=0;i<n;i++){
| ^
|
s743876340 | p00022 | C++ | #include<iostream>
using namespace std;
int main()
{
int n;
int a[5000];
int maxsum=0;
cin>>n;
for(int i=0;i<n;++i){
cin>>a[i];
if(a[i]>0){
maxsum+=a[i];
}
cout<<maxsum<<endl;
} | a.cc: In function 'int main()':
a.cc:16:2: error: expected '}' at end of input
16 | }
| ^
a.cc:5:1: note: to match this '{'
5 | {
| ^
|
s048371859 | p00022 | C++ | #include<iostream>
using namespace std;
int main()
{
int n;
int a;
int maxsum=0;
cin>>n;
for(int i=0;i<n;++i){
cin>>a;
if(a>0){
maxsum+=a[i];
}
cout<<maxsum<<endl;
} | a.cc: In function 'int main()':
a.cc:13:19: error: invalid types 'int[int]' for array subscript
13 | maxsum+=a[i];
| ^
a.cc:16:2: error: expected '}' at end of input
16 | }
| ^
a.cc:5:1: note: to match this '{'
5 | {
| ^
|
s823206017 | p00022 | C++ | #include<iostream>
#include<string>
using namespace std;
int main(){
int n;
while(true){
cin>>n;
if(n==0)
break;
int best=0;
for(int i=0;i<n;i++)
cin>>a[i];
for(int start=0;start<n;start++){
int count=0;
for(int len=start;len<n;len++){
count+=a[len];
best=max(best,count);
}
}
cout<<best<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:12:7: error: 'a' was not declared in this scope
12 | cin>>a[i];
| ^
a.cc:17:10: error: 'a' was not declared in this scope
17 | count+=a[len];
| ^
|
s965655115 | p00022 | C++ | #include<iostream>
#include<string>
#include<vector>
using namespace std;
int main() {
int n, a;
vector<int> an;
vector<vector<int>> AN;
while (cin >> n) {
if (n == 0)break;
for (int i = 0; i < n; i++) {
cin >> a;
an.push_back(a);
}
AN.push_back(an); an.clear();
}
for (int i = 0; i < AN.size(); i++) {
long long int max = 0, min = INT_MAX, MAX = 0, MIN = 0 , counter = 0, negative = 0;
for (int j = 0; j < AN[i].size(); j++) {
if (AN[i][j] >= 0) {
max += AN[i][j];
if (MAX < max)MAX = max;
counter = 1;
negative = 1;
}
else {
if (negative == 0) {
if(min > abs(AN[i][j]))min=abs(AN[i][j]);
}
else if (counter==1){
if (AN[i][j] + max >= 0)max += AN[i][j];
else {
max = 0;
counter = 0;
}
}
}
}
if (negative == 0)cout << -1*min << endl;
else cout << MAX << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:20:46: error: 'INT_MAX' was not declared in this scope
20 | long long int max = 0, min = INT_MAX, MAX = 0, MIN = 0 , counter = 0, negative = 0;
| ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
3 | #include<vector>
+++ |+#include <climits>
4 | using namespace std;
a.cc:24:37: error: 'MAX' was not declared in this scope
24 | if (MAX < max)MAX = max;
| ^~~
a.cc:25:33: error: 'counter' was not declared in this scope
25 | counter = 1;
| ^~~~~~~
a.cc:26:33: error: 'negative' was not declared in this scope
26 | negative = 1;
| ^~~~~~~~
a.cc:30:37: error: 'negative' was not declared in this scope
30 | if (negative == 0) {
| ^~~~~~~~
a.cc:33:42: error: 'counter' was not declared in this scope
33 | else if (counter==1){
| ^~~~~~~
a.cc:42:21: error: 'negative' was not declared in this scope
42 | if (negative == 0)cout << -1*min << endl;
| ^~~~~~~~
a.cc:43:30: error: 'MAX' was not declared in this scope
43 | else cout << MAX << endl;
| ^~~
|
s433615665 | p00022 | C++ | #include <stdio.h>
int arr[] = int[5000];
int sub[] = int[5001];
int main() {
while(1) {
int n;
scanf("%d", &n);
if (n == 0) {
return 0;
}
for(int i = 0; i < n; ++i) {
scanf("%d", &arr[i]);
}
sub[0] = 0;
for(int i = 1; i < n+1; ++i) {
sub[i] = sub[i-1] + arr[i-1];
}
for(int i = 0; i < n; ++i) {
for(int j = i + 1; j < n + 1; ++j) {
m = max(m, sub[j] - arr[i]);
}
}
printf("%d", m);
}
} | a.cc:2:13: error: expected primary-expression before 'int'
2 | int arr[] = int[5000];
| ^~~
a.cc:3:13: error: expected primary-expression before 'int'
3 | int sub[] = int[5001];
| ^~~
a.cc: In function 'int main()':
a.cc:20:11: error: 'm' was not declared in this scope
20 | m = max(m, sub[j] - arr[i]);
| ^
a.cc:20:15: error: 'max' was not declared in this scope
20 | m = max(m, sub[j] - arr[i]);
| ^~~
a.cc:23:18: error: 'm' was not declared in this scope
23 | printf("%d", m);
| ^
|
s518478948 | p00022 | C++ | #include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <string>
#include <queue>
#include <algorithm>
#include <cctype>
#define shosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const double pi=acos(-1);
int n,ans;
vi dp,num;
int main(){
while(1){
cin>>n;
if(!n) break;
ans=-1
dp=vi(n);
num=vi(n);
for(int i=0;i<n;i++) cin>>num[i];
dp[0]=num[0];
for(int i=0;i<n-1;i++) dp[i+1]=max(num[i+1],num[i+1]+dp[i]);
for(int i=0;i<n;i++) ans=max(ans,dp[i]);
cout<<ans<<endl;
for(int i=0;i<n;i++) cout<<dp[i]<<' ';
cout<<endl;
}
} | a.cc: In function 'int main()':
a.cc:29:23: error: expected ';' before 'dp'
29 | ans=-1
| ^
| ;
30 | dp=vi(n);
| ~~
|
s463656397 | p00022 | C++ | #include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <string>
#include <queue>
#include <algorithm>
#include <cctype>
#define shosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const double pi=acos(-1);
int n,ans;
vi dp,num;
int main(){
while(1){
cin>>n;
if(!n) break;
ans=-1
dp=vi(n);
num=vi(n);
for(int i=0;i<n;i++) cin>>num[i];
dp[0]=num[0];
for(int i=0;i<n-1;i++) dp[i+1]=max(num[i+1],num[i+1]+dp[i]);
for(int i=0;i<n;i++) ans=max(ans,dp[i]);
cout<<ans<<endl;
}
} | a.cc: In function 'int main()':
a.cc:29:23: error: expected ';' before 'dp'
29 | ans=-1
| ^
| ;
30 | dp=vi(n);
| ~~
|
s053990808 | p00022 | C++ | #include"bits/stdc++.h"
#define INF LLONG_MAX-1
using namespace std;
typedef long long ll;
??
ll a[100001];
int main(){
ll n;
ll cnt = 0;
scanf("%lld", &n);
for (ll i = 0; i < n; i++){
scanf("%lld", &a[i]);
cnt += a[i];
}
ll Max = cnt;
ll w = 0;
for (ll i = 0; i < n; i++){
cnt -= a[i];
if (Max < cnt) {
w = i;
Max = cnt;
}
}
cnt = Max;
for (ll i = n - 1; i > w; i--){
cnt -= a[i];
Max = max(Max, cnt);
}
printf("%lld\n", Max);
return 0;
} | a.cc:5:1: error: expected unqualified-id before '?' token
5 | ??
| ^
a.cc: In function 'int main()':
a.cc:12:32: error: 'a' was not declared in this scope
12 | scanf("%lld", &a[i]);
| ^
a.cc:18:24: error: 'a' was not declared in this scope
18 | cnt -= a[i];
| ^
a.cc:26:24: error: 'a' was not declared in this scope
26 | cnt -= a[i];
| ^
|
s251336962 | p00022 | C++ | #include <iostream>
#include <vector>
using namespace std;
void main() {
int n;
while (cin >> n) {
if (n == 0) break;
vector<int> array(n);
for (int i = 0; i < n; i++) {
cin >> array.at(i);
}
long max = array.at(0);
for (int j = 0; j < n; j++) {
long total = 0;
for (int k = 0; k < n - j; k++) {
total += array.at(j + k);
if (total > max) max = total;
}
}
cout << max << endl;
}
return;
} | a.cc:5:1: error: '::main' must return 'int'
5 | void main() {
| ^~~~
a.cc: In function 'int main()':
a.cc:26:9: error: return-statement with no value, in function returning 'int' [-fpermissive]
26 | return;
| ^~~~~~
|
s388497483 | p00022 | C++ | #include <iostrem>
using namespace std;
int main(){
while(true)
{
int n;
cin >> n;
if(n == 0)return 0;
int numbers[n];
for(int i = 0;i < n;i++)
cin >> numbers[i];
int max = 0;
for ( int i = 0; i < n; i++){
int sum = 0;
for ( int j = i; j < n; j++){
sum += a[j];
if(max < sum)max = sum;
}
}
cout >> max >> endl;
}
} | a.cc:1:10: fatal error: iostrem: No such file or directory
1 | #include <iostrem>
| ^~~~~~~~~
compilation terminated.
|
s384073222 | p00022 | C++ | #include <iostream>
using namespace std;
int main(){
while(true)
{
int n;
cin >> n;
if(n == 0)return 0;
int numbers[n];
for(int i = 0;i < n;i++)
cin >> numbers[i];
int max = 0;
for ( int i = 0; i < n; i++){
int sum = 0;
for ( int j = i; j < n; j++){
sum += a[j];
if(max < sum)max = sum;
}
}
cout >> max >> endl;
}
} | a.cc: In function 'int main()':
a.cc:16:8: error: 'a' was not declared in this scope
16 | sum += a[j];
| ^
a.cc:20:6: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int')
20 | cout >> max >> endl;
| ~~~~ ^~ ~~~
| | |
| | int
| std::ostream {aka std::basic_ostream<char>}
a.cc:20:6: note: candidate: 'operator>>(int, int)' (built-in)
20 | cout >> max >> endl;
| ~~~~~^~~~~~
a.cc:20: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:20:9: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
20 | cout >> max >> 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:20:1: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte'
20 | cout >> max >> 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:20:9: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
20 | cout >> max >> 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:20:9: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
20 | cout >> max >> 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:20:9: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
20 | cout >> max >> 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:20:9: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
20 | cout >> max >> 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:20:9: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
20 | cout >> max >> 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:20:9: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
20 | cout >> max >> 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:20:9: required from here
20 | cout >> max >> 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)
| ^~~~~~~~
|
s709759821 | p00022 | C++ | #include <iostream>
using namespace std;
int main(){
while(true)
{
int n;
cin >> n;
if(n == 0)return 0;
int numbers[n];
for(int i = 0;i < n;i++)
cin >> numbers[i];
int max = 0;
for ( int i = 0; i < n; i++){
int sum = 0;
for ( int j = i; j < n; j++){
sum += numbers[j];
if(max < sum)max = sum;
}
}
cout >> max >> endl;
}
} | a.cc: In function 'int main()':
a.cc:20:6: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int')
20 | cout >> max >> endl;
| ~~~~ ^~ ~~~
| | |
| | int
| std::ostream {aka std::basic_ostream<char>}
a.cc:20:6: note: candidate: 'operator>>(int, int)' (built-in)
20 | cout >> max >> endl;
| ~~~~~^~~~~~
a.cc:20: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:20:9: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
20 | cout >> max >> 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:20:1: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte'
20 | cout >> max >> 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:20:9: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
20 | cout >> max >> 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:20:9: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
20 | cout >> max >> 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:20:9: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
20 | cout >> max >> 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:20:9: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
20 | cout >> max >> 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:20:9: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
20 | cout >> max >> 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:20:9: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
20 | cout >> max >> 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:20:9: required from here
20 | cout >> max >> 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)
| ^~~~~~~~
|
s344291250 | p00022 | C++ | #include <iostream>
using namespace std;
int main(){
while(true)
{
int n;
cin >> n;
if(n == 0)return 0;
int* numbers = new int[n];
for(int i = 0;i < n;i++)
cin >> numbers[i];
int max = 0;
for ( int i = 0; i < n; i++){
int sum = 0;
for ( int j = i; j < n; j++){
sum += numbers[j];
if(max < sum)max = sum;
}
}
cout >> max >> endl;
}
} | a.cc: In function 'int main()':
a.cc:20:6: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int')
20 | cout >> max >> endl;
| ~~~~ ^~ ~~~
| | |
| | int
| std::ostream {aka std::basic_ostream<char>}
a.cc:20:6: note: candidate: 'operator>>(int, int)' (built-in)
20 | cout >> max >> endl;
| ~~~~~^~~~~~
a.cc:20: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:20:9: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
20 | cout >> max >> 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:20:1: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte'
20 | cout >> max >> 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:20:9: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
20 | cout >> max >> 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:20:9: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
20 | cout >> max >> 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:20:9: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
20 | cout >> max >> 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:20:9: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
20 | cout >> max >> 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:20:9: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
20 | cout >> max >> 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:20:9: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
20 | cout >> max >> 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:20:9: required from here
20 | cout >> max >> 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)
| ^~~~~~~~
|
s056145232 | p00022 | C++ | //
#include <iostream>
using namespace std;
int main()
{
int n;
while(true){
int a[5000] = {0};
cin >> n;
if (n == 0 ) break;
for (int i = 0; i < n;i++)
cin >> a[i];
int sum_max = a[0];
int sum = 0;
for (int i = 0; i <n;i++){
for (int j = i; j < n; j++){
sum += a[j]; if(sum > sum_max) sum_max = sum;
}
int sum = 0;
}
}
cout << sum_max;
}
} | a.cc: In function 'int main()':
a.cc:23:11: error: 'sum_max' was not declared in this scope
23 | cout << sum_max;
| ^~~~~~~
a.cc: At global scope:
a.cc:27:1: error: expected declaration before '}' token
27 | }
| ^
|
s615228492 | p00022 | C++ | #include<iostream>
using namespace std;
int main(){
int n;
int a[10000];
long long int ans = -(1 << 50);
while(true){
cin > n;
if(n == 0) break;
for(int i = 0; i < n; i++){
cin >> a[i];
}
long long int sum;
for(int i = 0; i < n; i++){
sum = 0;
for(int j = i; j < n; j++){
sum += a[j];
if(sum > ans){
ans = 0;
}
}
}
cout << ans << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:9:25: warning: left shift count >= width of type [-Wshift-count-overflow]
9 | long long int ans = -(1 << 50);
| ~~^~~~~
a.cc:13:5: error: no match for 'operator>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int')
13 | cin > n;
| ~~~ ^ ~
| | |
| | int
| std::istream {aka std::basic_istream<char>}
a.cc:13:5: note: candidate: 'operator>(int, int)' (built-in)
13 | cin > n;
| ~~~~^~~
a.cc:13:5: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int'
In file included from /usr/include/c++/14/string:48,
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_iterator.h:462:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
462 | operator>(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:462:5: note: template argument deduction/substitution failed:
a.cc:13:7: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
13 | cin > n;
| ^
/usr/include/c++/14/bits/stl_iterator.h:507:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
507 | operator>(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:507:5: note: template argument deduction/substitution failed:
a.cc:13:7: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
13 | cin > n;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1714:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1714 | operator>(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1714:5: note: template argument deduction/substitution failed:
a.cc:13:7: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
13 | cin > n;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1774:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1774 | operator>(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1774:5: note: template argument deduction/substitution failed:
a.cc:13:7: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
13 | cin > n;
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51:
/usr/include/c++/14/bits/stl_pair.h:1058:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1058 | operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1058:5: note: template argument deduction/substitution failed:
a.cc:13:7: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::pair<_T1, _T2>'
13 | cin > n;
| ^
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54:
/usr/include/c++/14/string_view:695:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
695 | operator> (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:695:5: note: template argument deduction/substitution failed:
a.cc:13:7: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
13 | cin > n;
| ^
/usr/include/c++/14/string_view:702:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
702 | operator> (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:702:5: note: template argument deduction/substitution failed:
a.cc:13:7: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
13 | cin > n;
| ^
/usr/include/c++/14/string_view:710:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
710 | operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:710:5: note: template argument deduction/substitution failed:
a.cc:13:7: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
13 | cin > n;
| ^
/usr/include/c++/14/bits/basic_string.h:3915:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3915 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3915:5: note: template argument deduction/substitution failed:
a.cc:13:7: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
13 | cin > n;
| ^
/usr/include/c++/14/bits/basic_string.h:3929:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3929 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3929:5: note: template argument deduction/substitution failed:
a.cc:13:7: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
13 | cin > n;
| ^
/usr/include/c++/14/bits/basic_string.h:3942:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3942 | operator>(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3942:5: note: template argument deduction/substitution failed:
a.cc:13:7: note: mismatched types 'const _CharT*' and 'std::basic_istream<char>'
13 | cin > n;
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/tuple:2619:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator>(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)'
2619 | operator>(const tuple<_TElements...>& __t,
| ^~~~~~~~
/usr/include/c++/14/tuple:2619:5: note: template argument deduction/substitution failed:
a.cc:13:7: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::tuple<_UTypes ...>'
13 | cin > n;
| ^
|
s146580606 | p00022 | C++ | #include <iostream>
typedef long long ll;
using namespace std;
int main(){
int n,a[5001];
ll ans;
a[0]=0;
while(cin>>n&&n){
ans = INT_MIN;
for(int i=1;i<=n;i++){
cin>>a[i];
a[i] += a[i-1];
}
for(int i=1;i<=n;i++){
for(int j=i;j<=n;j++){
ans = max(ans,a[j]-a[i-1]);
}
}
cout<<ans<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:10:15: error: 'INT_MIN' was not declared in this scope
10 | ans = INT_MIN;
| ^~~~~~~
a.cc:2:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
1 | #include <iostream>
+++ |+#include <climits>
2 | typedef long long ll;
a.cc:17:26: error: no matching function for call to 'max(ll&, int)'
17 | ans = max(ans,a[j]-a[i-1]);
| ~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:17:26: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
17 | ans = max(ans,a[j]-a[i-1]);
| ~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
|
s140596984 | p00022 | C++ | #include <iostream>
typedef long long ll;
using namespace std;
int main(){
int n,a[5001];
ll ans;
a[0]=0;
while(cin>>n&&n){
ans = INT_MIN;
for(int i=1;i<=n;i++){
cin>>a[i];
a[i] += a[i-1];
}
for(int i=1;i<=n;i++){
for(int j=i;j<=n;j++){
ans = max(ans,a[j]-a[i-1]);
}
}
cout<<ans<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:10:15: error: 'INT_MIN' was not declared in this scope
10 | ans = INT_MIN;
| ^~~~~~~
a.cc:2:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
1 | #include <iostream>
+++ |+#include <climits>
2 | typedef long long ll;
a.cc:17:26: error: no matching function for call to 'max(ll&, int)'
17 | ans = max(ans,a[j]-a[i-1]);
| ~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:17:26: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
17 | ans = max(ans,a[j]-a[i-1]);
| ~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
|
s221865394 | p00022 | C++ | #include <iostream>
#include <climits>
typedef long long ll;
using namespace std;
int main(){
int n,a[5001];
ll ans;
a[0]=0;
while(cin>>n&&n){
ans = INT_MIN;
for(int i=1;i<=n;i++){
cin>>a[i];
a[i] += a[i-1];
}
for(int i=1;i<=n;i++){
for(int j=i;j<=n;j++){
ans = max(ans,a[j]-a[i-1]);
}
}
cout<<ans<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:18:26: error: no matching function for call to 'max(ll&, int)'
18 | ans = max(ans,a[j]-a[i-1]);
| ~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:18:26: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
18 | ans = max(ans,a[j]-a[i-1]);
| ~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
|
s591790302 | p00022 | C++ | #include <iostream>
#include <climits>
typedef long long ll;
using namespace std;
int main(){
int n,a[5001];
ll ans;
a[0]=0;
while(cin>>n&&n){
ans = INT_MIN;
for(int i=1;i<=n;i++){
cin>>a[i];
a[i] += a[i-1];
}
for(int i=1;i<=n;i++){
for(int j=i;j<=n;j++){
ans = max(ans,a[j]-a[i-1]);
}
}
cout<<ans<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:18:26: error: no matching function for call to 'max(ll&, int)'
18 | ans = max(ans,a[j]-a[i-1]);
| ~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:18:26: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
18 | ans = max(ans,a[j]-a[i-1]);
| ~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
|
s111593366 | p00022 | C++ | #include <iostream>
#include <climits>
typedef long long ll;
using namespace std;
int main(){
int n,a[5001];
long long ans;
a[0]=0;
while(cin>>n&&n){
ans = INT_MIN;
for(int i=1;i<=n;i++){
cin>>a[i];
a[i] += a[i-1];
}
for(int i=1;i<=n;i++){
for(int j=i;j<=n;j++){
ans = max(ans,a[j]-a[i-1]);
}
}
cout<<ans<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:18:26: error: no matching function for call to 'max(long long int&, int)'
18 | ans = max(ans,a[j]-a[i-1]);
| ~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:18:26: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
18 | ans = max(ans,a[j]-a[i-1]);
| ~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
|
s120998507 | p00022 | C++ | #include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <sstream>
#include <utility>
#include <cstdlib>
#include <cctype>
#include <climits>
#include <fstream>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef vector<pair<int, int> > vpii;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define foreach(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); itr++)
#define dbg(x) cout << #x"="<< (x) << endl
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back(a)
#define in(x) cin >> x;
#define all(x) (x).begin(), (x).end()
#define INF 2147483600
#define fi first
#define se second
using namespace std;
int main(){
int N;
int x;
while(cin>>N&&N){
int index=0;
int ans = 0;
vl sum(N+1);
FOR(i,1,N+1){
cin>>sum[i];
sum[i] += sum[i-1];
}
FOR(i,1,N+1){
FOR(j,i,N+1){
ans = max(ans,sum[j]-sum[i-2]);
}
}
cout<< ans <<endl;
}
} | a.cc: In function 'int main()':
a.cc:55:42: error: no matching function for call to 'max(int&, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)'
55 | ans = max(ans,sum[j]-sum[i-2]);
| ~~~^~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
from a.cc:3:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:55:42: note: deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'})
55 | ans = max(ans,sum[j]-sum[i-2]);
| ~~~^~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:7:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:55:42: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
55 | ans = max(ans,sum[j]-sum[i-2]);
| ~~~^~~~~~~~~~~~~~~~~~~~~
|
s911695644 | p00022 | C++ | #include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <sstream>
#include <utility>
#include <cstdlib>
#include <cctype>
#include <climits>
#include <fstream>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef vector<pair<int, int> > vpii;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define foreach(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); itr++)
#define dbg(x) cout << #x"="<< (x) << endl
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back(a)
#define in(x) cin >> x;
#define all(x) (x).begin(), (x).end()
#define INF 2147483600
#define fi first
#define se second
using namespace std;
int sum[5001];
int main(){
int N;
int ans = 0;
while(cin>>N&&N){
int index=0;
ans = INT_MIN
FOR(i,1,N+1){
cin>>sum[i];
sum[i] += sum[i-1];
}
FOR(i,1,N+1){
FOR(j,i,N+1){
ans = max(ans,sum[j]-sum[i-1]);
}
}
cout<< ans <<endl;
}
} | a.cc: In function 'int main()':
a.cc:29:20: error: expected ';' before 'for'
29 | #define FOR(i,a,b) for(int i=(a);i<(b);++i)
| ^~~
a.cc:48:17: note: in expansion of macro 'FOR'
48 | FOR(i,1,N+1){
| ^~~
a.cc:48:21: error: 'i' was not declared in this scope
48 | FOR(i,1,N+1){
| ^
a.cc:29:34: note: in definition of macro 'FOR'
29 | #define FOR(i,a,b) for(int i=(a);i<(b);++i)
| ^
|
s696004529 | p00022 | C++ | #include <cstdio>
#include <algorithm>
using namespace std;
int main(){
int n;
while(scanf("%d",&n) && n != 0){
int arr[n];
for(int i = 0; i < n; i++){
scanf("%d",arr[i]);
}
int max_c = 0, max_s = 0;
for(int cur = 0; cur < n; cur++){
max_e = max(a[cur], max_e + a[cur]); //max_e????????????????????´??????a[cur]???max_e?????£??\?????????
max_s = max(max_s, max_e); //
}
printf("%d\n",max_s);
}
} | a.cc: In function 'int main()':
a.cc:14:13: error: 'max_e' was not declared in this scope; did you mean 'max_s'?
14 | max_e = max(a[cur], max_e + a[cur]); //max_e????????????????????´??????a[cur]???max_e?????£??\?????????
| ^~~~~
| max_s
a.cc:14:25: error: 'a' was not declared in this scope
14 | max_e = max(a[cur], max_e + a[cur]); //max_e????????????????????´??????a[cur]???max_e?????£??\?????????
| ^
|
s619389692 | p00022 | C++ | #include<iostream>
using namespace std;
int main()
{
int n;
while(cin>>n){
if(n==0) break;
int a[n], S[n], sum=0;
for(int i=0;i<n;++i){
cin>>a[i];
sum+=a[i];
S[i]=sum;
}
long max=S[0];
for(int i=0;i<n;++i){
if(S[i]>max) max=S[i];
for(int j=0;j<i+1;++j){
if(S[i]-S[j]>max) max=S[i]-S[j];
}
}
cout<<max<<endl;
}
return 0; | a.cc: In function 'int main()':
a.cc:27:18: error: expected '}' at end of input
27 | return 0;
| ^
a.cc:5:1: note: to match this '{'
5 | {
| ^
|
s603215954 | p00022 | C++ | #include <iostream>
using namespace std;
int a[5001] = {0};
int S[5001] = {0};
int main() {
int n;
while(cin >> n) {
if(n == 0) break;
for(int i = 0; i < n; i++) {
cin >> a[i];
}
S[0] = 0;
for(int i = 1; i <= n; i++) {
S[i] = S[i-1] + a[i-1];
}
int maxsum = INT_MIN;
int sum;
for(int i = 0; i <= n-1; i++){
for(int j = i + 1; j <= n;j++) {
sum = S[j] - S[i];
if(sum > maxsum)
maxsum = sum;
}
}
cout << maxsum << endl;
}
} | a.cc: In function 'int main()':
a.cc:21:16: error: 'INT_MIN' was not declared in this scope
21 | int maxsum = INT_MIN;
| ^~~~~~~
a.cc:2:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
1 | #include <iostream>
+++ |+#include <climits>
2 | using namespace std;
|
s767491301 | p00022 | C++ | #include <iostream>
using namespace std;
int main()
{
int n;
while (cin >> n && n > 0)
{
vector<int> a = vector<int>(n);
for (int i = 0; i < n; i++)
cin >> a[i];
vector<int> s = vector<int>(1, 0);
bool f = true;
for (int i = 0; i < n; i++)
{
if (a[i] >= 0)
{
if (!f)
f = true;
s[0] += a[i];
}
else if(s[0] > a[i])
{
if (f)
{
s.push_back(s[0]);
f = false;
}
s[0] += a[i];
}
else
{
s[0] = 0;
}
}
for (int i = 1; i < s.size(); i++)
{
if (s[i] > s[0])
s[0] = s[i];
}
cout << s[0] << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:11:17: error: 'vector' was not declared in this scope
11 | vector<int> a = vector<int>(n);
| ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
1 | #include <iostream>
+++ |+#include <vector>
2 | using namespace std;
a.cc:11:24: error: expected primary-expression before 'int'
11 | vector<int> a = vector<int>(n);
| ^~~
a.cc:13:32: error: 'a' was not declared in this scope
13 | cin >> a[i];
| ^
a.cc:15:24: error: expected primary-expression before 'int'
15 | vector<int> s = vector<int>(1, 0);
| ^~~
a.cc:19:29: error: 'a' was not declared in this scope
19 | if (a[i] >= 0)
| ^
a.cc:23:33: error: 's' was not declared in this scope
23 | s[0] += a[i];
| ^
a.cc:25:33: error: 's' was not declared in this scope
25 | else if(s[0] > a[i])
| ^
a.cc:40:37: error: 's' was not declared in this scope
40 | for (int i = 1; i < s.size(); i++)
| ^
a.cc:45:25: error: 's' was not declared in this scope
45 | cout << s[0] << endl;
| ^
|
s293896182 | p00022 | C++ | loop do
n = gets.to_i
break if n == 0
max = -1_000_000
sum = 0
n.times do
m = gets.to_i
sum += m
max = sum if max < sum
sum = 0 if sum < 0
end
puts max
end | a.cc:1:1: error: 'loop' does not name a type
1 | loop do
| ^~~~
|
s595553983 | p00022 | C++ | #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include <deque>
using namespace std;
//bool state = false ;
int main()
{
int n ;
while(1)
{
cin >> n ;
if( ! n ) return 0 ;
int p[5005];
for(int i = 0 ; i < n ; i ++)
{
cin >> p[i] ;
}
int max , contain ;
max = contain = 0 ;
for(int i = 0 ; i < n ; i ++)
{
if(contain < 0) contain = 0 ;
contain += p[i] ;
if(contain > max) max = contain ;
}
if(state) cout << endl ;
state = true ;
cout << max ;
}
return 0 ;
} | a.cc: In function 'int main()':
a.cc:37:20: error: 'state' was not declared in this scope; did you mean 'static'?
37 | if(state) cout << endl ;
| ^~~~~
| static
a.cc:39:17: error: 'state' was not declared in this scope; did you mean 'static'?
39 | state = true ;
| ^~~~~
| static
|
s855082742 | p00022 | C++ | #include <iostream>
using namespace std;
int main(){
int n;
int a[5000];
while(cin >> n && n>0){
for(int i=0;i>n;i++)
cin >> a[i];
int sum=0,tmp=0,max=-100000;
bool flg=true;
for(int i=0;i<n;i++){
if(flg) max=max(max,a[i]);
if(a[i]>0){
flg=false;
sum+=a[i];
continue;
}
for(tmp=sum;a[i]<=0;i++){
tmp+=a[i];
}i--;
if(tmp>0)
sum=tmp;
else
sum=0;
}
cout << sum;
}
} | a.cc: In function 'int main()':
a.cc:13:22: error: 'max' cannot be used as a function
13 | if(flg) max=max(max,a[i]);
| ~~~^~~~~~~~~~
|
s530628570 | p00022 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
int main(){
int n;
int a[5000];
while(cin >> n && n>0){
for(int i=0;i>n;i++)
cin >> a[i];
int sum=0,tmp=0,max=-100000;
bool flg=true;
for(int i=0;i<n;i++){
if(flg) max=max(max,a[i]);
if(a[i]>0){
flg=false;
sum+=a[i];
continue;
}
for(tmp=sum;a[i]<=0;i++){
tmp+=a[i];
}i--;
if(tmp>0)
sum=tmp;
else
sum=0;
}
cout << sum;
}
} | a.cc: In function 'int main()':
a.cc:14:22: error: 'max' cannot be used as a function
14 | if(flg) max=max(max,a[i]);
| ~~~^~~~~~~~~~
|
s602426622 | p00022 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main(){
int n;
while(cin >> n, n){
vector<int> a(n,0);
for(i=0; i<n; ++i){
cin >> a[n];
}
// ????????£?¶??????????????????§??£?¶???????dp??¨?????????
vector<int> dp(n,0);
dp[0] = a[0];
int max = 0;
for(i=0; i<n; ++i){
if(dp[i-1]>0){
dp[i] = dp[i-1] + n[i];
} else {
dp[i] = n[i];
}
if(max<dp[i]){
max = dp[i];
}
}
cout << max << endl;
}
} | a.cc: In function 'int main()':
a.cc:9:13: error: 'i' was not declared in this scope
9 | for(i=0; i<n; ++i){
| ^
a.cc:16:13: error: 'i' was not declared in this scope
16 | for(i=0; i<n; ++i){
| ^
|
s505636359 | p00022 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
using namespace std;
int main(){
int n;
while(cin >> n, n){
//n++;
vector<int> dp(n), vec(n);
//t[0] = 0;
/*for(int i = 1;i < n;i++){
cin >> v[i];
t[i] = max(t[i-1]+v[i], v[i]);
}*/
for(int i=0;i<N;i++)cin >> vec[i];
dp[0]=vec[0];
for(int i=1;i<N;i++)dp[i]=max(dp[i-1]+vec[i],vec[i]);
cout << *max_element(t.begin(), t.end()) << endl;
}
return 0;
}
/*
7
-5
-1
6
4
9
-6
-7
*/ | a.cc: In function 'int main()':
a.cc:17:31: error: 'N' was not declared in this scope
17 | for(int i=0;i<N;i++)cin >> vec[i];
| ^
a.cc:19:31: error: 'N' was not declared in this scope
19 | for(int i=1;i<N;i++)dp[i]=max(dp[i-1]+vec[i],vec[i]);
| ^
a.cc:20:38: error: 't' was not declared in this scope
20 | cout << *max_element(t.begin(), t.end()) << endl;
| ^
|
s772045290 | p00022 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main(){
int n, a;
while(cin >> n, n){
n++;
vector<int> t(n);
t[0] = 0;
for(int i = 1;i < n;i++){
cin >> a;
t[i] = max(t[i-1]+a, a);
}
cout << *max_element(t.begin()+1, t.end()) << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:15:26: error: 'max_element' was not declared in this scope
15 | cout << *max_element(t.begin()+1, t.end()) << endl;
| ^~~~~~~~~~~
|
s568413780 | p00022 | C++ | a | a.cc:1:1: error: 'a' does not name a type
1 | a
| ^
|
s178884246 | p00022 | C++ | #include<iostream>
using namespace std;
int main()
{
int n;
while(cin>>n)
if(n==0)
{
break;
}
else
{
int a[n];
int A=0;
int R=-100000;
for(h=0;h<n;h++)
{
cin>>a[h];
}
for(int i=0;i<n;i++)
{
for(int j=0;j<n-i;j++)
{
for(int k=i;k<=j;k++)
{
A=A+a[k]
}
if(R<A)
{
R=A;
}
A=0
}
}
cout<<R<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:16:5: error: 'h' was not declared in this scope
16 | for(h=0;h<n;h++)
| ^
a.cc:26:25: error: expected ';' before '}' token
26 | A=A+a[k]
| ^
| ;
27 |
28 | }
| ~
a.cc:33:12: error: expected ';' before '}' token
33 | A=0
| ^
| ;
34 | }
| ~
|
s781450744 | p00022 | C++ | #include<iostream>
using namespace std;
int main()
{
int n;
while(cin>>n&&n!=0)
else
{
int a[n];
int A=0;
int R=-100000;
for(int h=0;h<n;h++)
{
cin>>a[h];
}
for(int i=0;i<n;i++)
{
for(int j=0;j<n-i;j++)
{
for(int k=i;k<=j;k++)
{
A=A+a[k];
}
if(R<A)
{
R=A;
}
A=0;
}
}
cout<<R<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:7:1: error: expected primary-expression before 'else'
7 | else
| ^~~~
|
s136559178 | p00022 | C++ | #include<iostream>
using namespace std;
int main(){
int n=0,a[5000],saidai=-100000;
while(cin>>n&&n!=0){
saidai=-100000
for(int i=0;i<n;i++){
cin>>a[i];
}
for(int i=0;n>i;i++){
int kazu=0;
for(int x=i;x<n;x++){
kazu=kazu+a[x];
cout<<kazu<<endl;
if(saidai<kazu){
}
}
}
cout<<saidai<<endl;
}
} | a.cc: In function 'int main()':
a.cc:6:15: error: expected ';' before 'for'
6 | saidai=-100000
| ^
| ;
7 | for(int i=0;i<n;i++){
| ~~~
a.cc:7:21: error: 'i' was not declared in this scope
7 | for(int i=0;i<n;i++){
| ^
|
s981250529 | p00022 | C++ | #include<stdio.h>
int main(void){
int n, a, i, max = 0, sum[100][100];
scanf("%d", &n);
for ( i = 0; i < n; i++ ) {
scanf("%d", &a);
if ( i == 0 )sum[0][0] = a;
else sum[0][i] = sum[0][i - 1] + a;
if ( max < sum[0][i]) max = sum[0][i];
printf("sum:%d max:%d\n", sum[0][i], max);
}
printf("%d", max[0]);
return 0;
} | a.cc: In function 'int main()':
a.cc:12:20: error: invalid types 'int[int]' for array subscript
12 | printf("%d", max[0]);
| ^
|
s977325896 | p00022 | C++ | include<iostream>
#include<algorithm>
using namespace std;
int main(){
while(1){
int n;
int a[5001];
cin>>n;
if(n==0)break;
int b;
a[0]=0;
cin>>a[1];
for(int i=2;i<=n;i++){
cin>>b;
a[i]=a[i+1]+b;
}
int ans=0;
for(int i=1;i<=n;i++){
for(int j=0;j<i;j++){
ans=max(ans,a[i]-a[j]);
}
}
cout<<ans<<endl;
}
}
| a.cc:1:1: error: 'include' does not name a type
1 | include<iostream>
| ^~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:62,
from /usr/include/c++/14/algorithm:60,
from a.cc:2:
/usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity
164 | __is_null_pointer(std::nullptr_t)
| ^
/usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)'
159 | __is_null_pointer(_Type)
| ^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'
164 | __is_null_pointer(std::nullptr_t)
| ^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/type_traits:295:27: error: 'size_t' has not been declared
295 | template <typename _Tp, size_t = sizeof(_Tp)>
| ^~~~~~
/usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'
666 | struct is_null_pointer<std::nullptr_t>
| ^~~~~~~~~
/usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid
666 | struct is_null_pointer<std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid
670 | struct is_null_pointer<const std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid
674 | struct is_null_pointer<volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid
678 | struct is_null_pointer<const volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:984:26: error: 'size_t' has not been declared
984 | template<typename _Tp, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope
985 | struct __is_array_known_bounds<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid
985 | struct __is_array_known_bounds<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
/usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^
/usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid
1438 | : public integral_constant<std::size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared
1440 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope
1441 | struct rank<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid
1441 | struct rank<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1451:32: error: 'size_t' was not declared in this scope
1451 | : public integral_constant<size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
63 | #include <bits/version.h>
+++ |+#include <cstddef>
64 |
/usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid
1451 | : public integral_constant<size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared
1453 | template<typename _Tp, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope
1454 | struct extent<_Tp[_Size], 0>
| ^~~~~
/usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid
1454 | struct extent<_Tp[_Size], 0>
| ^
/usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope
1455 | : public integral_constant<size_t, _Size> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope
1455 | : public integral_constant<size_t, _Size> { };
| ^~~~~
/usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid
1455 | : public integral_constant<size_t, _Size> { };
| ^
/usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid
/usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared
1457 | template<typename _Tp, unsigned _Uint, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope
1458 | struct extent<_Tp[_Size], _Uint>
| ^~~~~
/usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid
1458 | struct extent<_Tp[_Size], _Uint>
| ^
/usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope
1463 | : public integral_constant<size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid
1463 | : public integral_constant<size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type
1857 | { static constexpr size_t __size = sizeof(_Tp); };
| ^~~~~~
/usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared
1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
| ^~~~~~
/usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope
1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
| ^~~
/usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp'
1860 | struct __select;
| ^~~~~~~~
/usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared
1862 | template<size_t _Sz, typename _Uint, typename... _UInts>
| ^~~~~~
/usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope
1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true>
| ^~~
/usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid
1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true>
| ^
/usr/include/c++/14/type_traits:1866:14: error: 'size_t' has not been declared
1866 | template<size_t _Sz, typename _Uint, typename... _UInts>
| ^~~~~~
/usr/include/c++/14/type_traits:1867:23: error: '_Sz' was not declared in this scope
1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false>
| ^~~
/usr/include/c++/14/type_traits:1867:58: error: template argument 1 is invalid
1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false>
|
s782597821 | p00022 | C++ | #include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
int main_(void)
{
int n, a[5001];
cin >> n;
for (int i = 1; i <= n; i++)
cin >> a[i];
int goukei = 0, ryuta = -10000000;
for (int i = 1; i <= n; i++)
{
goukei = 0;
for (int j = 1; j <= n; j++)
{
goukei = goukei+a[j];
ryuta = max(goukei, ryuta);
}
}
cout << ryuta << endl;
return 0;
} | /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s227133441 | p00022 | C++ | #include <iostream>
#include <cstdio.h>>
using namespace std;
int main (){
while (1){
long n,dset[5000],max=-99999,temp=0;
cin>>n;
if (n==0)break;
for (int i=0;i<n;i++){
cin>>dset[i];
}
for (int i=0;i<n;i++){
for (int j=i;j<n;j++){
temp=temp+dset[j];
if (max<temp){
max=temp;
}
}
temp=0;
}
printf ("%d\n",max);
}
return 0;
} | a.cc:2:20: warning: extra tokens at end of #include directive
2 | #include <cstdio.h>>
| ^
a.cc:2:10: fatal error: cstdio.h: No such file or directory
2 | #include <cstdio.h>>
| ^~~~~~~~~~
compilation terminated.
|
s330504197 | p00022 | C++ | #include <iostream>
#include <cstdio.h>
using namespace std;
int main (){
while (1){
long n,dset[5000],max=-99999,temp=0;
cin>>n;
if (n==0)break;
for (int i=0;i<n;i++){
cin>>dset[i];
}
for (int i=0;i<n;i++){
for (int j=i;j<n;j++){
temp=temp+dset[j];
if (max<temp){
max=temp;
}
}
temp=0;
}
printf ("%d\n",max);
}
return 0;
} | a.cc:2:10: fatal error: cstdio.h: No such file or directory
2 | #include <cstdio.h>
| ^~~~~~~~~~
compilation terminated.
|
s483421574 | p00022 | C++ | #include <iostream>
using namespace std;
int main(){
seq();
return 0;
}
int seq(){
int a;
while(cin >> a,a){
int b[a];
for(int i = 0; i < a; i++){
cin >> b[i];
}
cout << max() << endl;
}
}
int max(){
int max = -10000000;
int sum = 0;
for(int len = 1; len <= a ; len++){
for(int i = 0; i < a-len; i++){
for(int j = 0, sum = 0; j < len; j++){
sum += b[i+j];
}
if (sum > max) max = sum;
}
}
return max
}
| a.cc: In function 'int main()':
a.cc:6:5: error: 'seq' was not declared in this scope
6 | seq();
| ^~~
a.cc: In function 'int seq()':
a.cc:17:20: error: no matching function for call to 'max()'
17 | cout << max() << endl;
| ~~~^~
In file included from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 0 provided
a.cc:19:1: warning: no return statement in function returning non-void [-Wreturn-type]
19 | }
| ^
a.cc: In function 'int max()':
a.cc:24:29: error: 'a' was not declared in this scope
24 | for(int len = 1; len <= a ; len++){
| ^
a.cc:27:24: error: 'b' was not declared in this scope
27 | sum += b[i+j];
| ^
a.cc:32:15: error: expected ';' before '}' token
32 | return max
| ^
| ;
33 | }
| ~
|
s228489346 | p00022 | C++ | #include <stdio.h>
int main(void) {
while( 1 ) {
long long n, ans = 0, now = 0;
scanf("%lld", &n);
if(!n) break;
int a[n];
for(i = 0; i < n; ++i) scanf("%d", &a[i]);
for(i = 0; i < n; ++i) {
now += a[i];
if(now > ans) ans -= now;
if(now < 0) now = 0;
}
if(!ans) {
int max = -1000000;
for(i = 0; i < n; ++i) if(max < a[i]) max = a[i];
ans = max;
}
printf("%lld\n", ans);
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:9:7: error: 'i' was not declared in this scope
9 | for(i = 0; i < n; ++i) scanf("%d", &a[i]);
| ^
a.cc:10:7: error: 'i' was not declared in this scope
10 | for(i = 0; i < n; ++i) {
| ^
a.cc:17:9: error: 'i' was not declared in this scope
17 | for(i = 0; i < n; ++i) if(max < a[i]) max = a[i];
| ^
|
s194521494 | p00022 | C++ | // 0022.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//
#include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define ld long double
#define roop(a,t) for(ll a=0;a<t;a++)
ll main()
{
cin.tie(0);
ios::sync_with_stdio(false);
ll n;
while (cin >> n) {
ll sum[5001];
ll ans = -9000000000;
roop(i, n) {
cin >> sum[i];
if (i != 0) { sum[i] += sum[i - 1]; }
ans = max(ans, sum[i]);
}
for (ll i = 0; i < n - 1; i++) {
ll sumi = sum[i];
for (ll j = i + 1; j < n; j++) {
ll sumj = sum[j];
ans = max(ans, sumj - sumi);
}
}
cout << ans << endl;
}
return 0;
}
| cc1plus: error: '::main' must return 'int'
|
s542258458 | p00022 | C++ | using System;
using System.Collections.Generic;
using System.Linq;
class Program {
static int Main(string[] args) {
List<int> inList = new List<int>();
while (true) {
string v = Console.ReadLine();
if (v == "0") { break; }
inList.Add(int.Parse(v));
}
for (int x = 0; x < inList.Count; x++) {
int n = inList[x];
List<int> list = new List<int>();
for (int i = 0; i < n; i++) {
x++;
list.Add(inList[x]);
}
int maxValue = 0;
for (int i = 0; i < list.Count; i++) {
int value = list[i];
if (maxValue < value) { maxValue = value; }
for (int k = i + 1; k < list.Count; k++) {
value += list[k];
if (maxValue < value) { maxValue = value; }
}
}
Console.WriteLine(maxValue);
}
return 0;
}
}
| 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:7:21: error: 'string' has not been declared
7 | static int Main(string[] args) {
| ^~~~~~
a.cc:7:30: error: expected ',' or '...' before 'args'
7 | static int Main(string[] args) {
| ^~~~
a.cc:42:2: error: expected ';' after class definition
42 | }
| ^
| ;
a.cc: In static member function 'static int Program::Main(int*)':
a.cc:8:9: error: 'List' was not declared in this scope
8 | List<int> inList = new List<int>();
| ^~~~
a.cc:8:14: error: expected primary-expression before 'int'
8 | List<int> inList = new List<int>();
| ^~~
a.cc:11:13: error: 'string' was not declared in this scope
11 | string v = Console.ReadLine();
| ^~~~~~
a.cc:12:17: error: 'v' was not declared in this scope
12 | if (v == "0") { break; }
| ^
a.cc:14:13: error: 'inList' was not declared in this scope
14 | inList.Add(int.Parse(v));
| ^~~~~~
a.cc:14:24: error: expected primary-expression before 'int'
14 | inList.Add(int.Parse(v));
| ^~~
a.cc:17:29: error: 'inList' was not declared in this scope
17 | for (int x = 0; x < inList.Count; x++) {
| ^~~~~~
a.cc:20:18: error: expected primary-expression before 'int'
20 | List<int> list = new List<int>();
| ^~~
a.cc:23:17: error: 'list' was not declared in this scope
23 | list.Add(inList[x]);
| ^~~~
a.cc:27:33: error: 'list' was not declared in this scope
27 | for (int i = 0; i < list.Count; i++) {
| ^~~~
a.cc:37:13: error: 'Console' was not declared in this scope
37 | Console.WriteLine(maxValue);
| ^~~~~~~
|
s216827208 | p00022 | C++ | #include<iostream>
#include<vector>
#include<algorithm>
#define INF=-10000000000000000000
int main(void){
int n,a,max=INF;
while(std::cin>>n){
if(n==0) break;
std::vector<int> dp(n+1);
dp[0]=INF;
for(int i=0;i<n;i++){
std::cin>>a;
dp[i+1]=(a>0?dp[i]+a:a);
max=std::max(max,dp[i+1]);
}
std::cout<<max;
}
retrn 0;
}
| a.cc:4:9: warning: ISO C++11 requires whitespace after the macro name
4 | #define INF=-10000000000000000000
| ^~~
a.cc:6:17: warning: integer constant is so large that it is unsigned
6 | int n,a,max=INF;
| ^~~
a.cc:10:15: warning: integer constant is so large that it is unsigned
10 | dp[0]=INF;
| ^~~
a.cc: In function 'int main()':
a.cc:4:12: error: expected primary-expression before '=' token
4 | #define INF=-10000000000000000000
| ^
a.cc:6:17: note: in expansion of macro 'INF'
6 | int n,a,max=INF;
| ^~~
a.cc:4:12: error: expected primary-expression before '=' token
4 | #define INF=-10000000000000000000
| ^
a.cc:10:15: note: in expansion of macro 'INF'
10 | dp[0]=INF;
| ^~~
a.cc:19:5: error: 'retrn' was not declared in this scope
19 | retrn 0;
| ^~~~~
|
s890663390 | p00022 | C++ | #include<iostream>
#include<vector>
#include<algorithm>
#define INF=-10000000000000000
int main(void){
int n,a,max=INF;
while(std::cin>>n){
if(n==0) break;
std::vector<int> dp(n+1);
dp[0]=INF;
for(int i=0;i<n;i++){
std::cin>>a;
dp[i+1]=(a>0?dp[i]+a:a);
max=std::max(max,dp[i+1]);
}
std::cout<<max<<std::endl;
}
return 0;
}
| a.cc:4:9: warning: ISO C++11 requires whitespace after the macro name
4 | #define INF=-10000000000000000
| ^~~
a.cc: In function 'int main()':
a.cc:4:12: error: expected primary-expression before '=' token
4 | #define INF=-10000000000000000
| ^
a.cc:6:17: note: in expansion of macro 'INF'
6 | int n,a,max=INF;
| ^~~
a.cc:4:12: error: expected primary-expression before '=' token
4 | #define INF=-10000000000000000
| ^
a.cc:10:15: note: in expansion of macro 'INF'
10 | dp[0]=INF;
| ^~~
|
s447060142 | p00022 | C++ | #include <iostream>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <math.h>
using namespace std;
int main(){
int a[10000],n,s,m;
while(cin>>n,n){
m=INT_MIN;
for(int i=0;i<n;i++)cin>>a[i];
for(int i=1;i<=n;i++){
for(int j=0;j<n-i+1;j++){
s=0;
for(int k=0;k<i;k++){
s+=a[j+k];
}
m=max(m,s);
}
}
cout<<m<<endl;
}
} | a.cc: In function 'int main()':
a.cc:11:19: error: 'INT_MIN' was not declared in this scope
11 | m=INT_MIN;
| ^~~~~~~
a.cc:6:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
5 | #include <math.h>
+++ |+#include <climits>
6 | using namespace std;
|
s113598590 | p00022 | C++ | #include <iostream>
#include <algorithm>
#include <limit.h>
using namespace std;
int main(){
int a[10000],n,s,m;
while(cin>>n,n){
m=INT_MIN;
for(int i=0;i<n;i++)cin>>a[i];
for(int i=1;i<=n;i++){
for(int j=0;j<n-i+1;j++){
s=0;
for(int k=0;k<i;k++){
s+=a[j+k];
}
m=max(m,s);
}
}
cout<<m<<endl;
}
} | a.cc:3:10: fatal error: limit.h: No such file or directory
3 | #include <limit.h>
| ^~~~~~~~~
compilation terminated.
|
s174299628 | p00022 | C++ | #include<iostream>
#include<vector>
#include<numeric>
#include<functional>
using namespace std;
int main(){
int n;
while(cin >> n){
if(n==0) break;
vector<int> a;
vector<int> s;
int sum=0;
for(int i=0;i<n;++i){
int t;
cin >> t;
a.push_back(t);
}
for(int i=0;i<a.size();++i){
for(int j=i+1;j<=a.size();++j){
s.push_back(accumulate(a.begin()+i,a.begin()+j,0));
}
}
stable_sort(s.begin(),s.end(),greater<int>());
cout << s[0] << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:23:17: error: 'stable_sort' was not declared in this scope
23 | stable_sort(s.begin(),s.end(),greater<int>());
| ^~~~~~~~~~~
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.