submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s115874056
p00588
Java
import java.util.Scanner; /** * Created by sonekenichiro on 2017/04/26. */ public class ExtraordinaryGirl { static final int UPPER=1; static final int MIDDLE=2; static final int NEXTBOOKS_UPPER_AND_LOWER=11; static final int NEXTBOOKS_UPPER=12; static final int NEXTBOOKS_LOWER=13; static final int NEXTBOOKS_NONE=14; static char[] upperBooks; static char[] lowerBooks; public static void main(String[] args){ Scanner scan = new Scanner(System.in); int testCaseNum = scan.nextInt(); for(int i = 0;i<testCaseNum;i++){ scan = new Scanner(System.in); int n = scan.nextInt(); scan = new Scanner(System.in); String books= scan.nextLine(); upperBooks = new char[2*n]; lowerBooks = new char[2*n]; for(int j =0; j<upperBooks.length;j++){ upperBooks[j]=books.charAt(j); System.out.print(upperBooks[j]+","); } System.out.println("--"); for(int j =0; j<lowerBooks.length;j++){ lowerBooks[j]=books.charAt(j+(2*n)); System.out.print(lowerBooks[j]+","); } System.out.println("--"); System.out.println(calculateCost(0,n,UPPER)); } } static boolean areBooksInUpperShelf(int num){ return upperBooks[num*2]=='Y'||upperBooks[num*2-1]=='Y'; } static boolean areBooksInLowerShelf(int num){ return lowerBooks[num*2]=='Y'||lowerBooks[num*2-1]=='Y'; } static int whereNextBooks(int num,int maxNum){ if(num==maxNum){ if(lowerBooks[num*2-1]=='Y'&&upperBooks[num*2-1]=='Y'){ return NEXTBOOKS_UPPER_AND_LOWER; }else if(upperBooks[num*2-1]=='Y'){ return NEXTBOOKS_UPPER; }else if(lowerBooks[num*2-1]=='Y'){ return NEXTBOOKS_LOWER; }else{ return NEXTBOOKS_NONE; } }else{ if(areBooksInLowerShelf(num)&&areBooksInUpperShelf(num)){ return NEXTBOOKS_UPPER_AND_LOWER; }else if(areBooksInUpperShelf(num)){ return NEXTBOOKS_UPPER; }else if(areBooksInLowerShelf(num)){ return NEXTBOOKS_LOWER; }else{ return whereNextBooks(num+1,maxNum); } } } static int calculateCost(int num,int maxNum,int position){ if(num==0){ //???????????????????????????????????????????????? if(lowerBooks[num]=='Y'){ position=MIDDLE;//???????£????????????´?????????????????????????????????????????????????????? int cost = calculateCost(num+1,maxNum,position); return cost+3; }else if(upperBooks[num]=='Y'){ //?¬??????¬????????¨???????£???????????£?????????????????????????????????? int nextBooksState=whereNextBooks(num+1,maxNum); if(nextBooksState==NEXTBOOKS_LOWER){ position=MIDDLE; }else{ position=UPPER; } int cost = calculateCost(num+1,maxNum,position); return cost+2; }else{ int cost = calculateCost(num+1,maxNum,position); return cost+1; } }else if(num==maxNum){ if(position==UPPER){ if(lowerBooks[num*2-1]=='Y'){ return 3; }else if(upperBooks[num*2-1]=='Y'){ return 1; }else{ return 0; } }else{ if(lowerBooks[num*2-1]=='Y') { return 2; }else{ return 1; } } }else{ if(position == UPPER){ if(areBooksInLowerShelf(num)){ position = MIDDLE; int cost = calculateCost(num+1,maxNum,position); return cost+3; }else if(areBooksInUpperShelf(num)){ int nextBooksState=whereNextBooks(num+1,maxNum); if(nextBooksState==NEXTBOOKS_LOWER){ position=MIDDLE; }else{ position=UPPER; } int cost = calculateCost(num+1,maxNum,position); return cost+2; }else{ int cost =calculateCost(num+1,maxNum,position); return cost+1; } }else{ if(areBooksInUpperShelf(num)){ int nextBooksState=whereNextBooks(num+1,maxNum); if(nextBooksState==NEXTBOOKS_LOWER){ position=MIDDLE; }else{ position=UPPER; } if(areBooksInLowerShelf(num)){ int cost = calculateCost(num+1,maxNum,position); return cost+3; }else{ int cost = calculateCost(num+1,maxNum,position); return cost+2; } }else if(areBooksInLowerShelf(num)){ int cost = calculateCost(num+1,maxNum,position); return cost+2; }else{ int cost = calculateCost(num+1,maxNum,position); return cost+1; } } } } }
Main.java:7: error: class ExtraordinaryGirl is public, should be declared in a file named ExtraordinaryGirl.java public class ExtraordinaryGirl { ^ 1 error
s336644742
p00588
C
char str[99999]; int main() { int t,i,j,k; scanf("%d", &t); for(i=0;i<t;i++){ int n; scanf("%d%s", &n,s); int a[2] = {0}; for(j=0;j<2;j++){ for(k=0;k<n*2;k++){ if(str[j*2*n+k] == 'Y'){ a[j]++; k += k%2; } } } printf("%d\n", n+max(a[0], 2)+a[1]); } return 0; }
main.c: In function 'main': main.c:5:5: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 5 | scanf("%d", &t); | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | char str[99999]; main.c:5:5: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 5 | scanf("%d", &t); | ^~~~~ main.c:5:5: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:9:26: error: 's' undeclared (first use in this function) 9 | scanf("%d%s", &n,s); | ^ main.c:9:26: note: each undeclared identifier is reported only once for each function it appears in main.c:21:9: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 21 | printf("%d\n", n+max(a[0], 2)+a[1]); | ^~~~~~ main.c:21:9: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:21:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:21:9: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:21:26: error: implicit declaration of function 'max' [-Wimplicit-function-declaration] 21 | printf("%d\n", n+max(a[0], 2)+a[1]); | ^~~
s024814048
p00588
C
char str[99999]; int main() { int t,i,j,k; scanf("%d", &t); for(i=0;i<t;i++){ int n; scanf("%d%s", &n,str); int a[2] = {0}; for(j=0;j<2;j++){ for(k=0;k<n*2;k++){ if(str[j*2*n+k] == 'Y'){ a[j]++; k += k%2; } } } printf("%d\n", n+max(a[0], 2)+a[1]); } return 0; }
main.c: In function 'main': main.c:5:5: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 5 | scanf("%d", &t); | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | char str[99999]; main.c:5:5: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 5 | scanf("%d", &t); | ^~~~~ main.c:5:5: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:21:9: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 21 | printf("%d\n", n+max(a[0], 2)+a[1]); | ^~~~~~ main.c:21:9: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:21:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:21:9: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:21:26: error: implicit declaration of function 'max' [-Wimplicit-function-declaration] 21 | printf("%d\n", n+max(a[0], 2)+a[1]); | ^~~
s214858886
p00588
C++
#include <stdio.h> #include <string.h> #include <algorithm> #include <math.h> using namespace std; int min( int a, int b) { return a>b?b:a; } #define MAXN 10000 bool exist[MAXN*4+10]; int cost[MAXN+10][4]; char s[4*MAXN+10]; int solve() { int n; scanf("%d",&n); if( n<= 0) return 0; gets(s+1); gets(s+1); memset(exist,false,sizeof(exist)); for( int i = 1; i <= 4*n ; i++ ) { if( s[i]=='Y' || s[i]=='y' ) { exist[i] = true; } } memset(cost,0,sizeof(cost)); if( exist[1] ) { if( exist[2*n+1] ) { cost[1][0] = 3; cost[1][1] = 2; cost[1][2] = 2; } else { cost[1][0] = 1; cost[1][1] = 1; cost[1][2] = 2; } } else { if( exist[2*n+1] ) { cost[1][0] = 3; cost[1][1] = 2; cost[1][2] = 2; } else { cost[1][0] = 0; cost[1][1] = 1; cost[1][2] = 2; } } for( int j = 2; j <=n+1 ; j++ ) { if( (exist[((j-1)<<1)] | exist[((j-1)<<1)+1]) ) { if( exist[((n+j-1)<<1)] | exist[((n+j-1)<<1)+1] ) { cost[j][0] = min(min(cost[j-1][0]+4, cost[j-1][1]+3),cost[j-1][2]+3); cost[j][1] = min(min(cost[j-1][0]+3, cost[j-1][1]+3),cost[j-1][2]+3); cost[j][2] = min(min(cost[j-1][0]+3, cost[j-1][1]+3),cost[j-1][2]+4); // printf(" %d,%d,%d,%d",(j-1)<<1,((j-1)<<1)+1,(n+j-1)<<1,((n+j-1)<<1)+1); // puts("(11)"); } else { cost[j][0] = min(min(cost[j-1][0]+2, cost[j-1][1]+2),cost[j-1][2]+3); cost[j][1] = min(min(cost[j-1][0]+2, cost[j-1][1]+2),cost[j-1][2]+3); cost[j][2] = min(min(cost[j-1][0]+3, cost[j-1][1]+3),cost[j-1][2]+4); // puts("(10)"); } } else { if( exist[((n+j-1)<<1)] | exist[((n+j-1)<<1)+1] ) { cost[j][0] = min(min(cost[j-1][0]+4, cost[j-1][1]+3),cost[j-1][2]+3); cost[j][1] = min(min(cost[j-1][0]+3, cost[j-1][1]+2),cost[j-1][2]+2); cost[j][2] = min(min(cost[j-1][0]+3, cost[j-1][1]+2),cost[j-1][2]+2); // puts("(01)"); } else { cost[j][0] = min(min(cost[j-1][0]+1, cost[j-1][1]+2),cost[j-1][2]+3); cost[j][1] = min(min(cost[j-1][0]+2, cost[j-1][1]+1),cost[j-1][2]+2); cost[j][2] = min(min(cost[j-1][0]+3, cost[j-1][1]+2),cost[j-1][2]+1); // puts("(00)"); } } } /* for( int k = 0 ; k < 3 ; k++ ) { for( int i = 1 ; i <= n+1 ; i ++ ) { printf("%d ",cost[i][k]); } puts(""); }*/ return cost[n+1][0]; } int main() { int t; scanf("%d",&t); while( t-- ) { printf("%d\n",solve()); } return 0; }
a.cc: In function 'int solve()': a.cc:25:9: error: 'gets' was not declared in this scope; did you mean 'getw'? 25 | gets(s+1); | ^~~~ | getw
s749471931
p00589
Java
import java.util.Scanner; class Main { private static void solve() { final Scanner scanner = new Scanner(System.in); final char[][] keymap = { null, { ''', ',', '.', '!', '?' }, { 'a', 'b', 'c', 'A', 'B', 'C' }, { 'd', 'e', 'f', 'D', 'E', 'F' }, { 'g', 'h', 'i', 'G', 'H', 'I' }, { 'j', 'k', 'l', 'J', 'K', 'L' }, { 'm', 'n', 'o', 'M', 'N', 'O' }, { 'p', 'q', 'r', 's', 'P', 'Q', 'R', 'S' }, { 't', 'u', 'v', 'T', 'U', 'V' }, { 'w', 'x', 'y', 'z', 'W', 'X', 'Y' , 'Z' } }; while (scanner.hasNext()) { final char[] line = scanner.next().toCharArray(); int index = 0; while (index != line.length) { final char digit = line[index]; int counter = 1; while (++index < line.length && line[index] == digit) { counter++; } if (keymap[digit - '0'] == null) { for (int i = 1; i < counter; i++) { System.out.print(' '); } } else { final int length = keymap[digit - '0'].length; System.out.print(keymap[digit - '0'][(counter - 1) % length]); } } System.out.println(); } } public static void main(String... args) { solve(); } }
Main.java:8: error: empty character literal { ''', ',', '.', '!', '?' }, ^ Main.java:8: error: unclosed character literal { ''', ',', '.', '!', '?' }, ^ Main.java:8: error: illegal start of type { ''', ',', '.', '!', '?' }, ^ Main.java:8: error: <identifier> expected { ''', ',', '.', '!', '?' }, ^ Main.java:9: error: not a statement { 'a', 'b', 'c', 'A', 'B', 'C' }, ^ Main.java:9: error: ';' expected { 'a', 'b', 'c', 'A', 'B', 'C' }, ^ Main.java:9: error: illegal start of type { 'a', 'b', 'c', 'A', 'B', 'C' }, ^ Main.java:9: error: <identifier> expected { 'a', 'b', 'c', 'A', 'B', 'C' }, ^ Main.java:10: error: not a statement { 'd', 'e', 'f', 'D', 'E', 'F' }, ^ Main.java:10: error: ';' expected { 'd', 'e', 'f', 'D', 'E', 'F' }, ^ Main.java:10: error: illegal start of type { 'd', 'e', 'f', 'D', 'E', 'F' }, ^ Main.java:10: error: <identifier> expected { 'd', 'e', 'f', 'D', 'E', 'F' }, ^ Main.java:11: error: not a statement { 'g', 'h', 'i', 'G', 'H', 'I' }, ^ Main.java:11: error: ';' expected { 'g', 'h', 'i', 'G', 'H', 'I' }, ^ Main.java:11: error: illegal start of type { 'g', 'h', 'i', 'G', 'H', 'I' }, ^ Main.java:11: error: <identifier> expected { 'g', 'h', 'i', 'G', 'H', 'I' }, ^ Main.java:12: error: not a statement { 'j', 'k', 'l', 'J', 'K', 'L' }, ^ Main.java:12: error: ';' expected { 'j', 'k', 'l', 'J', 'K', 'L' }, ^ Main.java:12: error: illegal start of type { 'j', 'k', 'l', 'J', 'K', 'L' }, ^ Main.java:12: error: <identifier> expected { 'j', 'k', 'l', 'J', 'K', 'L' }, ^ Main.java:13: error: not a statement { 'm', 'n', 'o', 'M', 'N', 'O' }, ^ Main.java:13: error: ';' expected { 'm', 'n', 'o', 'M', 'N', 'O' }, ^ Main.java:13: error: illegal start of type { 'm', 'n', 'o', 'M', 'N', 'O' }, ^ Main.java:13: error: <identifier> expected { 'm', 'n', 'o', 'M', 'N', 'O' }, ^ Main.java:14: error: not a statement { 'p', 'q', 'r', 's', 'P', 'Q', 'R', 'S' }, ^ Main.java:14: error: ';' expected { 'p', 'q', 'r', 's', 'P', 'Q', 'R', 'S' }, ^ Main.java:14: error: illegal start of type { 'p', 'q', 'r', 's', 'P', 'Q', 'R', 'S' }, ^ Main.java:14: error: <identifier> expected { 'p', 'q', 'r', 's', 'P', 'Q', 'R', 'S' }, ^ Main.java:15: error: not a statement { 't', 'u', 'v', 'T', 'U', 'V' }, ^ Main.java:15: error: ';' expected { 't', 'u', 'v', 'T', 'U', 'V' }, ^ Main.java:15: error: illegal start of type { 't', 'u', 'v', 'T', 'U', 'V' }, ^ Main.java:15: error: <identifier> expected { 't', 'u', 'v', 'T', 'U', 'V' }, ^ Main.java:16: error: not a statement { 'w', 'x', 'y', 'z', 'W', 'X', 'Y' , 'Z' } ^ Main.java:16: error: ';' expected { 'w', 'x', 'y', 'z', 'W', 'X', 'Y' , 'Z' } ^ Main.java:18: error: class, interface, enum, or record expected while (scanner.hasNext()) { ^ Main.java:19: error: unnamed classes are a preview feature and are disabled by default. final char[] line = scanner.next().toCharArray(); ^ (use --enable-preview to enable unnamed classes) Main.java:21: error: class, interface, enum, or record expected while (index != line.length) { ^ Main.java:24: error: class, interface, enum, or record expected while (++index < line.length && line[index] == digit) { ^ Main.java:26: error: class, interface, enum, or record expected } ^ Main.java:28: error: class, interface, enum, or record expected for (int i = 1; i < counter; i++) { ^ Main.java:28: error: class, interface, enum, or record expected for (int i = 1; i < counter; i++) { ^ Main.java:30: error: class, interface, enum, or record expected } ^ Main.java:33: error: class, interface, enum, or record expected System.out.print(keymap[digit - '0'][(counter - 1) % length]); ^ Main.java:34: error: class, interface, enum, or record expected } ^ Main.java:37: error: class, interface, enum, or record expected } ^ Main.java:43: error: class, interface, enum, or record expected } ^ 46 errors
s706370457
p00589
Java
import java.util.Scanner; public class Main2 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String one = ",,.,!?"; String two = "abcABC"; String three = "defDEF"; String four = "ghiGHI"; String five = "jklJKL"; String six = "mnoMNO"; String seven = "pqrsPQRS"; String eight = "tuvTUV"; String nine = "wxyzWXYZ"; String zero = " "; while(sc.hasNext()){ String ans = ""; String line = sc.next(); int n = 0; while(line.length() > n){ int count = 0; while(n + 1 != line.length() && line.charAt(n) == line.charAt(n + 1)){ count++; n++; } String temp = ""; if(line.charAt(n) == '1') temp = one; else if(line.charAt(n) == '2') temp = two; else if(line.charAt(n) == '3') temp = three; else if(line.charAt(n) == '4') temp = four; else if(line.charAt(n) == '5') temp = five; else if(line.charAt(n) == '6') temp = six; else if(line.charAt(n) == '7') temp = seven; else if(line.charAt(n) == '8') temp = eight; else if(line.charAt(n) == '9') temp = nine; else if(line.charAt(n) == '0') temp = zero; if(temp == zero){ if(count >= 1){ for(int k = 0; k < count; k++){ ans += " "; } } }else{ ans += temp.charAt(count % temp.length()); } n++; } System.out.println(ans); } } }
Main.java:3: error: class Main2 is public, should be declared in a file named Main2.java public class Main2 { ^ 1 error
s557753163
p00589
Java
import java.util.Scanner; public class Main2 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String one = ",,.,!?"; String two = "abcABC"; String three = "defDEF"; String four = "ghiGHI"; String five = "jklJKL"; String six = "mnoMNO"; String seven = "pqrsPQRS"; String eight = "tuvTUV"; String nine = "wxyzWXYZ"; String zero = " "; while(sc.hasNext()){ String ans = ""; String line = sc.next(); int n = 0; while(line.length() > n){ int count = 0; while(n + 1 != line.length() && line.charAt(n) == line.charAt(n + 1)){ count++; n++; } String temp = ""; if(line.charAt(n) == '1') temp = one; else if(line.charAt(n) == '2') temp = two; else if(line.charAt(n) == '3') temp = three; else if(line.charAt(n) == '4') temp = four; else if(line.charAt(n) == '5') temp = five; else if(line.charAt(n) == '6') temp = six; else if(line.charAt(n) == '7') temp = seven; else if(line.charAt(n) == '8') temp = eight; else if(line.charAt(n) == '9') temp = nine; else if(line.charAt(n) == '0') temp = zero; if(temp == zero){ if(count >= 1){ for(int k = 0; k < count; k++){ ans += " "; } } }else{ ans += temp.charAt(count % temp.length()); } n++; } System.out.println(ans); } } }
Main.java:3: error: class Main2 is public, should be declared in a file named Main2.java public class Main2 { ^ 1 error
s741147825
p00589
C
#include <bits/stdc++.h> using namespace std; #define LL long long #define xx first #define yy second #define NL '\n' #define mp make_pair #define pb push_back #define FOR(i,j,k) for(i=j;i<=k;i++) #define REV(i,j,k) for(i=j;i>=k;i--) #define READ(f) freopen(f,"r",stdin) #define WRITE(f) freopen(f,"w",stdout) #define MOD 1000000007 #define MAX 100005 int main() { std::ios_base::sync_with_stdio(0); int cases,len,caseno=0,n,i,j,k,cnt,sum; char ch; string s; string p[]={" ", "',.!?", "abcABC", "defDEF", "ghiGHI", "jklJKL", "mnoMNO", "pqrsPQRS", "tuvTUV", "wxyzWXYZ"}; while(cin >> s) { len = s.size(); ch = s[0]; k = 0; FOR(i,1,len-1) { if(ch == s[i]) k++; else { if(ch == '0') { FOR(j,1,k) cout << " "; } else cout << p[(int)(ch-'0')][k]; ch = s[i]; k = 0; } } if(ch == '0') { FOR(j,1,k) cout << " "; } else cout << p[(int)(ch-'0')][k]; cout << NL; } return 0; }
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory 1 | #include <bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s627159597
p00589
C
#include <iostream> #include <string> using namespace std; int num[9] = {5,3,3,3,3,3,4,3,4}; char one[5] = {'\'', ',', '.', '!', '?'}; char lower[8] = {'a', 'd', 'g', 'j', 'm', 'p', 't', 'w'}; char upper[8] = {'A', 'D', 'G', 'J', 'M', 'P', 'T', 'W'}; int main(){ string str; while(cin >> str){ char tmp=-1; int cnt = 0; for(int i=0;i<str.size()+1;i++){ if(i != str.size() && (tmp == -1 || tmp == str[i])){ tmp = str[i]; cnt++; }else{ int div,index; if(tmp != '0'){ div = (cnt-1)/num[tmp-'1']; index = (cnt-1)%num[tmp-'1']; } if(tmp == '1'){ cout << one[index]; }else if('2' <= tmp && tmp <= '9'){ if(div % 2){ cout << (char)(upper[tmp - '2'] + index); }else{ cout << (char)(lower[tmp - '2'] + index); } }else{ for(int j=0;j<cnt-1;j++){ cout << " "; } } tmp = str[i]; cnt = 1; } } cout << endl; } }
main.c:1:10: fatal error: iostream: No such file or directory 1 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s663342490
p00589
C
char *t[]={"',.!?","abcABC","defDEF","ghiGHI","jklJKL","mnoMNO","pqrsPQRS","tuvTUV","wxyzWXYZ"}; main(x,c,d){ for(d=-1,x=-1;~(c=getchar());) if(c=='\n'){ if(d)put();puts(""),d=-1,x=-1; }else if(c-=48){ if(c==d)x++; else if(~x)put(),x=0; if(d==-1)x=0; d=c; }else{ if(~d&&d)put(),x=-1; else putchar(' '); d=-1; } return 0; }
main.c:2:1: error: return type defaults to 'int' [-Wimplicit-int] 2 | main(x,c,d){ | ^~~~ main.c: In function 'main': main.c:2:1: error: type of 'x' defaults to 'int' [-Wimplicit-int] main.c:2:1: error: type of 'c' defaults to 'int' [-Wimplicit-int] main.c:2:1: error: type of 'd' defaults to 'int' [-Wimplicit-int] main.c:3:21: error: implicit declaration of function 'getchar' [-Wimplicit-function-declaration] 3 | for(d=-1,x=-1;~(c=getchar());) | ^~~~~~~ main.c:1:1: note: 'getchar' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>' +++ |+#include <stdio.h> 1 | char *t[]={"',.!?","abcABC","defDEF","ghiGHI","jklJKL","mnoMNO","pqrsPQRS","tuvTUV","wxyzWXYZ"}; main.c:5:12: error: implicit declaration of function 'put' [-Wimplicit-function-declaration] 5 | if(d)put();puts(""),d=-1,x=-1; | ^~~ main.c:5:18: error: implicit declaration of function 'puts' [-Wimplicit-function-declaration] 5 | if(d)put();puts(""),d=-1,x=-1; | ^~~~ main.c:5:18: note: include '<stdio.h>' or provide a declaration of 'puts' main.c:13:12: error: implicit declaration of function 'putchar' [-Wimplicit-function-declaration] 13 | else putchar(' '); | ^~~~~~~ main.c:13:12: note: include '<stdio.h>' or provide a declaration of 'putchar'
s107674650
p00589
C++
#include <iostream> #include <vector> #include <string> #include <map> #include <algorithm> #include <cstdio> #include <cstdlib> #include <cstring> #include <climits> #include <cmath> #include <cassert> using namespace std; const char* table[] = { NULL, "',.!?", "abcABC", "defDEF", "ghiGHI", "jklJKL", "mnoMNO", "pqrsPQRS", "tuvTUV", "wxyzWXYZ", }; int main() { string str; str += '\0'; char prev = 0; int row = 0, col = 0; for (int i = 0; i < (int)str.size(); ++i) { int n = str[i] - '0'; if (n == 0) { if (prev == 0) { cout << ' '; } else { cout << table[row][col]; } } else { if (n != prev) { if (prev != 0) { cout << table[row][col]; } row = n; col = 0; } else { ++col; if (table[row][col] == '\0') { col = 0; } } } prev = n; } cout << endl; } }
a.cc:55:1: error: expected declaration before '}' token 55 | } | ^
s235271801
p00590
Java
public class Main { public static void main(String[] args) throws NumberFormatException, IOException { InputStreamReader ir = new InputStreamReader(System.in); BufferedReader in = new BufferedReader(ir); while(true){ String bString=in.readLine(); if(bString.length()==0||bString==null||bString=="") break; int xiao_case=Integer.valueOf(bString); printPrimes(xiao_case); } } public static void printPrimes(int n){ int c=0; if ( n <= 1) return; int all[] = new int[n+1]; for (int i = 0; i <= n; i++){ all[i] = i; } int prime[] = new int[n+1]; for (int i = 0; i <= n; i++) prime[i] = 1; int x = 2; while (x <= n){ if (prime[x] == 1){ if(checkPrime(n-x+1)) c++; for (int j = 1; j * x <=n; j++) prime[j*x] = 0; } x++; } System.out.println(c); } public static boolean checkPrime(int n){ if(n < 2) return false; if(n == 2 || n == 3) return true; if(n%2 == 0 || n%3 == 0) return false; long sqrtN = (long)Math.sqrt(n)+1; for(long i = 6L; i <= sqrtN; i += 6) { if(n%(i-1) == 0 || n%(i+1) == 0) return false; } return true; } }
Main.java:2: error: cannot find symbol public static void main(String[] args) throws NumberFormatException, IOException { ^ symbol: class IOException location: class Main Main.java:3: error: cannot find symbol InputStreamReader ir = new InputStreamReader(System.in); ^ symbol: class InputStreamReader location: class Main Main.java:3: error: cannot find symbol InputStreamReader ir = new InputStreamReader(System.in); ^ symbol: class InputStreamReader location: class Main Main.java:4: error: cannot find symbol BufferedReader in = new BufferedReader(ir); ^ symbol: class BufferedReader location: class Main Main.java:4: error: cannot find symbol BufferedReader in = new BufferedReader(ir); ^ symbol: class BufferedReader location: class Main 5 errors
s406393270
p00590
C
#include <iostream> #include <string.h> #include <stdio.h> #include <vector> #include <list> #include <math.h> #include <algorithm> using namespace std; pair<int, int> pii[10005]; int N, answer; bool isPrime(int n) { if (n == 1) return 0; if (n == 2) return 1; for (int i = 2; i <= sqrt(n); i ++) if (n % i == 0) return false; return true; } int main() { while (scanf("%d", &N) != EOF) { answer = 0; for (int i = 1; i <= N; i ++) { pii[i].first = i; pii[i].second = N - i + 1; } for (int i = 1; i <= N; i ++) { if (isPrime(pii[i].first) && isPrime(pii[i].second)) answer ++; } printf("%d\n", answer); } return 0; }
main.c:1:10: fatal error: iostream: No such file or directory 1 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s597486446
p00590
C
#include <stdio.h> #include <math.h> struct Pair { int first; int second; }; Pair pii[10005]; int N, answer; bool isPrime(int n) { if (n == 1) return 0; if (n == 2) return 1; for (int i = 2; i <= sqrt(n); i ++) if (n % i == 0) return false; return true; } int main() { while (scanf("%d", &N) != EOF) { answer = 0; for (int i = 1; i <= N; i ++) { pii[i].first = i; pii[i].second = N - i + 1; } for (int i = 1; i <= N; i ++) { if (isPrime(pii[i].first) && isPrime(pii[i].second)) answer ++; } printf("%d\n", answer); } return 0; }
main.c:8:1: error: unknown type name 'Pair'; use 'struct' keyword to refer to the type 8 | Pair pii[10005]; | ^~~~ | struct main.c:10:1: error: unknown type name 'bool' 10 | bool isPrime(int n) { | ^~~~ main.c:3:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>' 2 | #include <math.h> +++ |+#include <stdbool.h> 3 | main.c: In function 'isPrime': main.c:14:32: error: 'false' undeclared (first use in this function) 14 | if (n % i == 0) return false; | ^~~~~ main.c:14:32: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>' main.c:14:32: note: each undeclared identifier is reported only once for each function it appears in main.c:15:12: error: 'true' undeclared (first use in this function) 15 | return true; | ^~~~ main.c:15:12: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>' main.c: In function 'main': main.c:21:19: error: request for member 'first' in something not a structure or union 21 | pii[i].first = i; | ^ main.c:22:19: error: request for member 'second' in something not a structure or union 22 | pii[i].second = N - i + 1; | ^ main.c:25:31: error: request for member 'first' in something not a structure or union 25 | if (isPrime(pii[i].first) && isPrime(pii[i].second)) | ^ main.c:25:56: error: request for member 'second' in something not a structure or union 25 | if (isPrime(pii[i].first) && isPrime(pii[i].second)) | ^
s523859581
p00590
C
#include <stdio.h> #include <math.h> struct Pair { int first; int second; }; Pair pii[10005]; int N, answer; bool isPrime(int n) { if (n == 1) return 0; if (n == 2) return 1; int i; for (i = 2; i <= sqrt(n); i ++) if (n % i == 0) return false; return true; } int main() { while (scanf("%d", &N) != EOF) { answer = 0; int i; for (i = 1; i <= N; i ++) { pii[i].first = i; pii[i].second = N - i + 1; } for (i = 1; i <= N; i ++) { if (isPrime(pii[i].first) && isPrime(pii[i].second)) answer ++; } printf("%d\n", answer); } return 0; }
main.c:8:1: error: unknown type name 'Pair'; use 'struct' keyword to refer to the type 8 | Pair pii[10005]; | ^~~~ | struct main.c:10:1: error: unknown type name 'bool' 10 | bool isPrime(int n) { | ^~~~ main.c:3:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>' 2 | #include <math.h> +++ |+#include <stdbool.h> 3 | main.c: In function 'isPrime': main.c:15:32: error: 'false' undeclared (first use in this function) 15 | if (n % i == 0) return false; | ^~~~~ main.c:15:32: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>' main.c:15:32: note: each undeclared identifier is reported only once for each function it appears in main.c:16:12: error: 'true' undeclared (first use in this function) 16 | return true; | ^~~~ main.c:16:12: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>' main.c: In function 'main': main.c:23:19: error: request for member 'first' in something not a structure or union 23 | pii[i].first = i; | ^ main.c:24:19: error: request for member 'second' in something not a structure or union 24 | pii[i].second = N - i + 1; | ^ main.c:27:31: error: request for member 'first' in something not a structure or union 27 | if (isPrime(pii[i].first) && isPrime(pii[i].second)) | ^ main.c:27:56: error: request for member 'second' in something not a structure or union 27 | if (isPrime(pii[i].first) && isPrime(pii[i].second)) | ^
s259278665
p00590
C
#include<stdio.h> int gcd(int a,int b){ if(b==0) return a; else return gcd(b,a%b); } int main(void){ int i,n; while(scanf("%d",&n)!=EOF){ count=0; for(i=0;i<n;i++){ if(gcd(i,n-i)==1) count++; } printf("%d\n",count); } return 0;}
main.c: In function 'main': main.c:9:5: error: 'count' undeclared (first use in this function) 9 | count=0; | ^~~~~ main.c:9:5: note: each undeclared identifier is reported only once for each function it appears in
s706248565
p00590
C
#include<bits/stdc++.h> #define M 10005 using namespace std; int fac[M]; void sieve() { fac[0]=fac[1]=1; int i,j; for(i=2;i*i<M;i++) { if(!fac[i]) { for(j=i*i;j<M;j+=i) if(!fac[j]) { fac[j]=1; } } } } int main() { sieve(); int x; scanf("%d",&x); while(x--) { int n,i,ans=0; scanf("%d",&n); for(i=1;i<=n;i++) { if(!fac[i]&&!fac[n-i+1]) ans++; } printf("%d\n",ans); } return 0; }
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory 1 | #include<bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s183811776
p00590
C
import java.util.HashSet; import java.util.Scanner; class Main { public static HashSet<Integer> hs = new HashSet<>(); public static void main(String[] args) { Scanner in = new Scanner(System.in); while(in.hasNext()) { int count = 0; int n = in.nextInt(); int a[] = new int[n]; int b[] = new int[n]; for(int i = 0; i < n; i++) { a[i] = i+1; b[i] = n-i; } sieveOfEratosthenes(n); for(int i = 0; i < n; i++) if(hs.contains(a[i]) && hs.contains(b[i])) count++; System.out.println(count); } } static void sieveOfEratosthenes(int n) { long prime[] = new long[n + 1]; for (int p = 2; p * p <= n; p++) if (prime[p] == 0) for (int i = p * 2; i <= n; i += p) prime[i] = 1; for (int i = 2; i <= n; i++) if (prime[i] == 0) hs.add(i); } }
main.c:1:1: error: unknown type name 'import' 1 | import java.util.HashSet; | ^~~~~~ main.c:1:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token 1 | import java.util.HashSet; | ^ main.c:2:1: error: unknown type name 'import' 2 | import java.util.Scanner; | ^~~~~~ main.c:2:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token 2 | import java.util.Scanner; | ^ main.c:4:1: error: unknown type name 'class' 4 | class Main { | ^~~~~ main.c:4:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token 4 | class Main { | ^
s299321015
p00590
C
#include <stdio.h> int prime( int a ) { int j=0; while (j*j < a ) { if( a % j == 0 ) return 0; } return 1; } int main() { int in , i , count; while (1) { count = 0; in=scanf("%d",in); if( in == EOF ) berak; for ( i = 1; i <= in / 2 + 1; in--,i++) { if ( prime(in+i) ) count++; } printf("%d\n",count*2); } return 0; }
main.c: In function 'main': main.c:14:17: error: 'berak' undeclared (first use in this function) 14 | if( in == EOF ) berak; | ^~~~~ main.c:14:17: note: each undeclared identifier is reported only once for each function it appears in
s476986967
p00590
C
#include <math.h> #include <stdio.h> int primaryCheck(int num){ int i, max = sqrt(num); if(num == 1) return 0; if(num == 2) return 1; if(num %2 == 0) return 0; for(i = 3; i <= max; i+= 2){ if(num % i == 0) return 0; } return 1; } int main(int argc, char** argv){ int i, x, cnt = 0; scanf("%d", &x); for(i = 1; i <= x; i++){ if(primaryCheck(i) && primaryCheck(x - i + 1)){ cnt++; } printf("%d\n", cnt); return 0; }
main.c: In function 'main': main.c:33:1: error: expected declaration or statement at end of input 33 | } | ^
s346918940
p00590
C++
#include<bits/stdc++.h> using namespace std; typedef long long ll; ll prime(ll x) { ll i; if (x < 2)return 0; else if (x == 2) return 1; if (x % 2 == 0) return 0; for (i = 3; i*i <= x; i += 2) { if (x%i == 0) return 0; } return 1; } int main() { int N; while (cin >> N, N) { int cnt - 0; for (int i = 1; i <= N; i++) { if (prime(i) && prime(N - i + 1)) cnt++; } cout << cnt << endl; } }
a.cc: In function 'int main()': a.cc:17:25: error: expected initializer before '-' token 17 | int cnt - 0; | ^ a.cc:20:33: error: 'cnt' was not declared in this scope; did you mean 'int'? 20 | cnt++; | ^~~ | int a.cc:22:25: error: 'cnt' was not declared in this scope; did you mean 'int'? 22 | cout << cnt << endl; | ^~~ | int
s336405458
p00590
C++
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1004
a.cc:1:1: error: 'http' does not name a type 1 | http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1004 | ^~~~
s616254071
p00590
C++
#include <iostream> #define LEN 10000 using namespace std; int prime_pair(int N); int is_prime(int p); int prime_list(int MAX); int prime[LEN]; int main(void){ int input; int j = 0; prime_list(LEN); while(cin >> input){ cout << prime_pair(input) << endl; } return 0; } int prime_list(int MAX){ int i = 0; int j = 0; int flag = 1; prime[0] = 2; for(i = 2; i < MAX; i++){ while(prime[j] != 0){ if(i % prime[j] == 0){ flag = 0; } j++; } if(flag){ prime[j] = i; } flag = 1; j=0; } return 0; } int prime_pair(int N){ int count = 0; if(is_prime(2) && is_prime(N-2+1))count++; for(int i = 3; i <= N/2; i = i+2){ if(is_prime(i) && is_prime(N-i+1))count++; } return count*2; } int is_prime(int p){ int flag = 0; int i = 0; while((prime[i] != 0) && (i < p)){ if(p == prime[i]){ flag = 1; break; } i++; } return flag
a.cc: In function 'int is_prime(int)': a.cc:60:16: error: expected ';' at end of input 60 | return flag | ^ | ; a.cc:60:16: error: expected '}' at end of input a.cc:50:20: note: to match this '{' 50 | int is_prime(int p){ | ^
s750435878
p00590
C++
#include <iostream> #define LEN 10001 using namespace std; int prime_pair(int N); int main(void){ int input; int count; bool prime[LEN] = {0}; prime[0] = 1; prime[1] = 1; for(int i = 2; i*i < MAX; i++){ for(int j = i*2; j < MAX; j += i){ prime[j] = 1; } } while(cin >> input){ count = 0; for(int i = 1; i <= N; i++){ if((!prime[i]) && (!prime[N-i+1])) count++; } cout << prime_pair(input) << endl; } return 0; }
a.cc: In function 'int main()': a.cc:13:26: error: 'MAX' was not declared in this scope 13 | for(int i = 2; i*i < MAX; i++){ | ^~~ a.cc:20:29: error: 'N' was not declared in this scope 20 | for(int i = 1; i <= N; i++){ | ^
s349952440
p00590
C++
#include <iostream> #define LEN 10001 using namespace std; int main(void){ int N; int count; bool prime[LEN] = {0}; prime[0] = 1; prime[1] = 1; for(int i = 2; i*i < LEN; i++){ for(int j = i*2; j < LEN; j += i){ prime[j] = 1; } } while(cin >> N){ count = 0; for(int i = 1; i <= N; i++){ if((!prime[i]) && (!prime[N-i+1])) count++; } cout << prime_pair(input) << endl; } return 0; }
a.cc: In function 'int main()': a.cc:22:28: error: 'input' was not declared in this scope; did you mean 'int'? 22 | cout << prime_pair(input) << endl; | ^~~~~ | int a.cc:22:17: error: 'prime_pair' was not declared in this scope 22 | cout << prime_pair(input) << endl; | ^~~~~~~~~~
s714818872
p00590
C++
#include <iostream> #define NMAX (10000) using namespace std; bool prime[NMAX] = {true}; int main() { prime[0] = prime[1] = false; for(int i=3; i<NMAX; i+=2) { if(prime[j]) { int j = i*2; while(j<NMAX) { prime[j] = false; j += j; } } } for(int i; cin >> i;) { int ans = 0; for(int j=1; j<i; j++) { if(prime[j] && prime[i+1-j]) ans++; cout << ans << endl; } return 0; }
a.cc: In function 'int main()': a.cc:12:26: error: 'j' was not declared in this scope 12 | if(prime[j]) { | ^ a.cc:13:29: error: redeclaration of 'int j' 13 | int j = i*2; | ^ a.cc:12:26: note: '<typeprefixerror>j' previously declared here 12 | if(prime[j]) { | ^ a.cc:29:2: error: expected '}' at end of input 29 | } | ^ a.cc:9:12: note: to match this '{' 9 | int main() { | ^
s163062053
p00590
C++
#include <bits/stdc++.h> using namespace std; void main() { // Create a boolean array "prime[0..n]" and initialize // all entries it as true. A value in prime[i] will // finally be false if i is Not a prime, else true. bool prime[n+1]; memset(prime, true, sizeof(prime)); cin>>n; for (int p=2; p*p<=n; p++) { // If prime[p] is not changed, then it is a prime if (prime[p] == true) { // Update all multiples of p for (int i=p*2; i<=n; i += p) prime[i] = false; } } int c=0; for (int p=2; p<=n; p++) { if (prime[p]==prime[n-p-1]) { c++; } } cout<<c; }
a.cc:3:1: error: '::main' must return 'int' 3 | void main() | ^~~~ a.cc: In function 'int main()': a.cc:8:16: error: 'n' was not declared in this scope; did you mean 'yn'? 8 | bool prime[n+1]; | ^ | yn a.cc:9:12: error: 'prime' was not declared in this scope 9 | memset(prime, true, sizeof(prime)); | ^~~~~
s172454525
p00590
C++
1 4 7 51
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 1 | ^
s832238264
p00590
C++
//include //------------------------------------------ #include <vector> #include <list> #include <map> #include <set> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <cstdlib> #include <cctype> #include <string> #include <cstring> #include <ctime> using namespace std; //conversion //------------------------------------------ inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;} template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();} //typedef //------------------------------------------ typedef vector<int> vint; typedef vector<vint> vvint; typedef vector<string> vstring; typedef pair<int, int> pint; typedef pair<pint, int> ppint; typedef pair<int, pint> pintp; typedef unsigned int uint; typedef long long llint; typedef unsigned long long int ullint; //container util //------------------------------------------ #define all(a) (a).begin(),(a).end() #define pb push_back #define mp make_pair #define EXIST(v,i) (find((v).begin(), (v).end(), i) != (v).end()) #define ERASE(v,i) (v).erase(remove((v).begin(),(v).end(),i),(v).end()) #define me (*this) //repetition //------------------------------------------ #define rep(i,s) for(int i=0; i<(int)(s); i++) //constant //-------------------------------------------- const int INF = 100000000; const double EPS = 1e-10; const double PI = acos(-1.0); //clear memory #define CLEAR(a) memset((a), 0 ,sizeof(a)) //debug #define debug(x) cerr << #x << " = " << (x) << endl bitset<10001> prime; void makePrimeList() { prime.set(); prime.at(0) = prime.at(1) = false; for(int i = 2; i * i <= 10000; i++) if(prime[i]) for(int j = 2; i * j <= 10000; j++) prime[i * j] = false; } int main() { makePrimeList(); static int n; while(cin >> n) { vint ary(n); for(int i = 1; i <= n; i++) ary[i - 1] = i; vint rary = ary; reverse(all(rary)); int ans = 0; rep(i,n) { if(prime[ary[i]] == true && prime[rary[i]] == true) ans++; } cout << ans << endl; } return 0; }
a.cc: In function 'void makePrimeList()': a.cc:73:15: error: 'class std::bitset<10001>' has no member named 'at' 73 | prime.at(0) = prime.at(1) = false; | ^~ a.cc:73:29: error: 'class std::bitset<10001>' has no member named 'at' 73 | prime.at(0) = prime.at(1) = false; | ^~
s394803696
p00590
C++
//include //------------------------------------------ #include <vector> #include <list> #include <map> #include <set> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <cstdlib> #include <cctype> #include <string> #include <cstring> #include <ctime> using namespace std; //conversion //------------------------------------------ inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;} template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();} //typedef //------------------------------------------ typedef vector<int> vint; typedef vector<vint> vvint; typedef vector<string> vstring; typedef pair<int, int> pint; typedef pair<pint, int> ppint; typedef pair<int, pint> pintp; typedef unsigned int uint; typedef long long llint; typedef unsigned long long int ullint; //container util //------------------------------------------ #define all(a) (a).begin(),(a).end() #define pb push_back #define mp make_pair #define EXIST(v,i) (find((v).begin(), (v).end(), i) != (v).end()) #define ERASE(v,i) (v).erase(remove((v).begin(),(v).end(),i),(v).end()) #define me (*this) //repetition //------------------------------------------ #define rep(i,s) for(int i=0; i<(int)(s); i++) //constant //-------------------------------------------- const int INF = 100000000; const double EPS = 1e-10; const double PI = acos(-1.0); //clear memory #define CLEAR(a) memset((a), 0 ,sizeof(a)) //debug #define debug(x) cerr << #x << " = " << (x) << endl bitset<10001> prime; void makePrimeList() { prime.set(); prime.at(0) = prime.at(1) = false; for(int i = 2; i * i <= 10000; i++) if(prime[i]) for(int j = 2; i * j <= 10000; j++) prime[i * j] = false; } int main() { makePrimeList(); static int n; while(cin >> n) { vint ary(n); for(int i = 1; i <= n; i++) ary[i - 1] = i; vint rary = ary; reverse(all(rary)); int ans = 0; rep(i,n) { if(prime[ary[i]] == true && prime[rary[i]] == true) ans++; } cout << ans << endl; } return 0; }
a.cc: In function 'void makePrimeList()': a.cc:73:15: error: 'class std::bitset<10001>' has no member named 'at' 73 | prime.at(0) = prime.at(1) = false; | ^~ a.cc:73:29: error: 'class std::bitset<10001>' has no member named 'at' 73 | prime.at(0) = prime.at(1) = false; | ^~
s366264416
p00590
C++
import java.util.Scanner; public class Main{ boolean[] prm; final int mx = 10001; void mkPrm(){ prm = new boolean[mx]; for(int i = 0; i < mx; i++) prm[i] = true; prm[0] = prm[1] = false; for(int i = 0; i < mx; i++) if(prm[i]) for(int j = i+i; j < mx; j+=i) prm[j] = false; return ; } Main(){ Scanner sc = new Scanner(System.in); mkPrm(); while(sc.hasNext()){ int n = sc.nextInt(), cnt = 0; for(int i = 0; i < n; i++) if(prm[i+1] && prm[n-i]) cnt++; System.out.println(String.valueOf(cnt)); } } public static void main(String[] args){ new Main(); } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.Scanner; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: expected unqualified-id before 'public' 3 | public class Main{ | ^~~~~~
s383937797
p00590
C++
//============================================================================ // Name : TopCoderCompetition.cpp // Author : taguchi // Version : // Copyright : Your copyright notice // Description : Hello World in C++, Ansi-style //============================================================================ #include <iostream> #include <bitset> #include <algorithm> #include <map> #include <cstdio> #include <cmath> #include <cstdlib> #include <cstring> #include <string> #include <vector> #include <numeric> #include <list> #include <sstream> using namespace std; //#define P pair<int,int> //#define max 999999 typedef unsigned int uint; typedef unsigned long ul; typedef long long ll; typedef unsigned long long ull; #define rep(i,n) for(ull i = 0;i<n;i++) #define pb(n) push_back(n) #define clear(n) memset(n,0,sizeof(n)) typedef vector<int> vi; typedef vector<string> vs; struct edge{int cost,to;}; vector<string> split(string &in,char delimiter){ vector<string> re; uint cur = 0,next; while((next = in.find_first_of(delimiter,cur)) != string::npos){ re.pb(string(in,cur,next-cur)); cur = next + 1; } re.pb(string(in,cur,in.size()-cur)); return re; } vector<int> split_int(string &in, char delimiter){ vector<string> str = split(in,delimiter); vector<int> re; rep(i,str.size()){ re.pb(strtol(str[i].c_str(),NULL,10)); } return re; } class Range{ public: int a,b; Range(int an,int bn) : a(an),b(bn){} bool operator()(int n){ return a<=n&&n<=b; } bool isCross(Range x){ return x(a) || x(b); } bool contains(Range x){ return this->a <= x.a && x.b <= this->b; } }; bool isnprime[10010]; uint indexpri[10010]; int main(){ int cnt = 0; for(int i = 2;i<10010;i++){ if(!isnprime[i]){ indexpri[cnt++] = i; for(int j = 2;i*j<10010;j++){ isnprime[i*j] = true; } } } isnprime[0] = true;isnprime[1] = true; //while(1){ int n; uint result = 0; cin >> n; if(!n)break; for(int i = 0;i<cnt;i++){ if(n-indexpri[i]+1 < 2)break; if(binary_search(indexpri,indexpri+cnt,n-indexpri[i] + 1)) result++; } cout << result << endl; //} return 0; }
a.cc: In function 'int main()': a.cc:88:23: error: break statement not within loop or switch 88 | if(!n)break; | ^~~~~
s059169002
p00590
C++
#include <cstdlib> #include <iostream> using namespace std; int main(int argc, char *argv[]) { int pri[10001] ; int i , j , n ,count=0; memset(pri , 0 , sizeof( pri ) ) ; for( i = 2 ; i < 10001 ; i ++ ) { if( pri[i] == 0 ) { for( j = 2 ; i * j < 10001 ; j ++ ) { pri[i*j] = 1 ; } } } // for(i=0;i<100;i++) // {cout<<pri[i]<<" ";if(i%10==0)cout<<endl;} while(cin>>n) { for(i=2;i<=(1+n)/2;i++)if( !pri[i] && !pri[n-i+1] )count++; if( (n%2==1) && !pri[(1+n)/2] && n>1) cout<<(2*count+1)<<endl; else cout<<2*count<<endl; count=0; } return 0; }
a.cc: In function 'int main(int, char**)': a.cc:11:5: error: 'memset' was not declared in this scope 11 | memset(pri , 0 , sizeof( pri ) ) ; | ^~~~~~ a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include <iostream> +++ |+#include <cstring> 3 |
s567854001
p00590
C++
#include <iostream> using namespace std; int main() { int pri[10001] ; int i , j , n ,count=0; memset(pri , 0 , sizeof( pri ) ) ; for( i = 2 ; i < 10001 ; i ++ ) { if( pri[i] == 0 ) { for( j = 2 ; i * j < 10001 ; j ++ ) { pri[i*j] = 1 ; } } } while(cin>>n) { for(i=2;i<=(1+n)/2;i++)if( !pri[i] && !pri[n-i+1] )count++; if( (n%2==1) && !pri[(1+n)/2] && n>1) cout<<(2*count+1)<<endl; else cout<<2*count<<endl; count=0; } return 0; }
a.cc: In function 'int main()': a.cc:7:5: error: 'memset' was not declared in this scope 7 | memset(pri , 0 , sizeof( pri ) ) ; | ^~~~~~ a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include <iostream> +++ |+#include <cstring> 2 | using namespace std;
s239919146
p00590
C++
#include <cstdio> bool num[10005]={}; int n; int main(){ num[0]=num[1]=true; for(int i=2;i<=10005;i++){ if(!num[i]){ for(int j=2;j*i<=10000;j++){ num[i*j]=true; } } } while(scanf("%d",&n){ int ans=0; for(int i=1;i<=n;i++){ if(!num[i] && !num[n+1-i]) ans++; } printf("%d\n",ans); } }
a.cc: In function 'int main()': a.cc:13:25: error: expected ')' before '{' token 13 | while(scanf("%d",&n){ | ~ ^ | )
s695048692
p00590
C++
#include <iostream> using namespace std; bool solve[10001]; void prime(){ memset(solve,true,sizeof(solve)); for(int i=2;i<=5000;i++){ for(int j=2;i*j<=10000;j++) solve[i*j] = false; } } int main(){ prime(); int n; while(cin >> n){ int cnt = 0; for(int i=2;i<n;i++){ if(solve[i] && solve[n-i+1]) cnt++; } cout << cnt << endl; } }
a.cc: In function 'void prime()': a.cc:7:3: error: 'memset' was not declared in this scope 7 | memset(solve,true,sizeof(solve)); | ^~~~~~ a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include <iostream> +++ |+#include <cstring> 2 | using namespace std;
s413141602
p00590
C++
#include<iostream> #include<sstream> #include<fstream> #include<cstdio> #include<vector> #include<list> #include<stack> #include<queue> #include<deque> #include<bitset> #include<map> #include<set> #include<algorithm> #include<string> #include<cstring> #include<cmath> #include<cstdlib> using namespace std; bool is_prime(int p){ if(p<=1)return false; if(p==2)return true; if(!(p&1))return false; for(int x=3;x<=sqrt(p);++x) if(!(p%x))return false; return true; } int main(){ bool primes[10002]; memset(primes,0,sizeof(primes)); for(int x=2;x<=10000;++x)if(is_prime(x))primes[x]=true; int n; while(scanf("%d",&n)==1,n){ int c =0 ; int l = n/2; if(n%2==1){ ++l;--c; } for(int x=1;x<=l;++x){ if(primes[x] && prime[n-x+1])c +=2; } cout<<c<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:40:41: error: 'prime' was not declared in this scope; did you mean 'primes'? 40 | if(primes[x] && prime[n-x+1])c +=2; | ^~~~~ | primes
s792058801
p00591
Java
import java.util.Scanner; public class Main2 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(sc.hasNext()){ int n = sc.nextInt(); if(n == 0){ break; } int[][] students = new int[n][n]; boolean[][] tallest = new boolean[n][n]; boolean[][] shortest = new boolean[n][n]; for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ students[i][j] = sc.nextInt(); } } for(int i = 0; i < n; i++){ int rowMin = Integer.MAX_VALUE, columnMax = 0; for(int j = 0; j < n; j++){ columnMax = Math.max(columnMax, students[j][i]); } for(int j = 0; j < n; j++){ rowMin = Math.min(rowMin, students[i][j]); } for(int j = 0; j < n; j++){ if(columnMax == students[j][i]){ tallest[j][i] = true; break; } } for(int j = 0; j < n; j++){ if(rowMin == students[i][j]){ shortest[i][j] = true; break; } } } boolean noAns = true; for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ if(shortest[i][j] && tallest[i][j]){ System.out.println(students[i][j]); noAns = false; break; } } } // if(noAns){ // System.out.println(0); // } } } }
Main.java:3: error: class Main2 is public, should be declared in a file named Main2.java public class Main2 { ^ 1 error
s224371105
p00591
Java
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); for(int n = sc.nextInt(); n > 0; n = sc.nextInt()) { int res = 0; for(int i = 0; i < n; i++) { int min = Integer.MAX_VALUE; for(int j = 0; j < n; j++) min = min(min, sc.nextInt()); res = max(res, min); } System.out.println(res); } } }
Main.java:12: error: cannot find symbol min = min(min, sc.nextInt()); ^ symbol: method min(int,int) location: class Main Main.java:13: error: cannot find symbol res = max(res, min); ^ symbol: method max(int,int) location: class Main 2 errors
s392872510
p00591
Java
import java.util.Scanner; public class Main2 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(sc.hasNext()){ int n = sc.nextInt(); if(n == 0){ break; } int[][] students = new int[n][n]; boolean[][] tallest = new boolean[n][n]; boolean[][] shortest = new boolean[n][n]; for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ students[i][j] = sc.nextInt(); } } for(int i = 0; i < n; i++){ int rowMin = Integer.MAX_VALUE, columnMax = 0; for(int j = 0; j < n; j++){ columnMax = Math.max(columnMax, students[j][i]); } for(int j = 0; j < n; j++){ rowMin = Math.min(rowMin, students[i][j]); } for(int j = 0; j < n; j++){ if(columnMax == students[j][i]){ tallest[j][i] = true; break; } } for(int j = 0; j < n; j++){ if(rowMin == students[i][j]){ shortest[i][j] = true; break; } } } boolean noAns = true; StringBuilder sb = new StringBuilder(); for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ if(shortest[i][j] && tallest[i][j]){ sb.append(students[i][j] + " "); noAns = false; } } } if(noAns){ System.out.println(0); }else{ sb.deleteCharAt(sb.length() - 1); System.out.print(sb); } } } }
Main.java:3: error: class Main2 is public, should be declared in a file named Main2.java public class Main2 { ^ 1 error
s077401355
p00591
Java
import java.util.HashSet; import java.util.Scanner; import java.util.Set; public class Main2 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(true){ int n = sc.nextInt(); if(n == 0){ break; } int[][] students = new int[n][n]; boolean[][] tallest = new boolean[n][n]; boolean[][] shortest = new boolean[n][n]; int[][] x = new int[n][n]; for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ students[i][j] = sc.nextInt(); } } for(int i = 0; i < n; i++){ int columnMax = -1, maxj = -1; for(int j = 0; j < n; j++){ if(columnMax < students[j][i]){ columnMax = students[j][i]; maxj = j; } } if(columnMax == students[maxj][i]){ tallest[maxj][i] = true; x[maxj][i] |= 2; } /* for(int j = 0; j < n; j++){ if(columnMax == students[j][i]){ tallest[j][i] = true; x[j][i] |= 2; } } */ } for(int i = 0; i < n; i++){ int rowMin = Integer.MAX_VALUE, minj = -1; for(int j = 0; j < n; j++){ if(rowMin > students[i][j]){ rowMin = students[i][j]; minj = j; } } if(rowMin == students[i][minj]){ shortest[i][minj] = true; x[i][minj] |= 1; } /* for(int j = 0; j < n; j++){ if(rowMin == students[i][minj]){ shortest[i][minj] = true; x[i][minj] |= 1; } } */ } Set<Integer> both = new HashSet<Integer>(); for(int i = 0;i < n;i++){ for(int j = 0;j < n;j++){ if(x[i][j] == 3){ both.add(students[i][j]); } } } if(both.size() == 1){ StringBuilder sb = new StringBuilder(); for(int v : both){ sb.append(v + " "); } sb.deleteCharAt(sb.length() - 1); System.out.println(sb); }else{ System.out.println(0); } /* boolean noAns = true; StringBuilder sb = new StringBuilder(); for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ if(shortest[i][j] && tallest[i][j]){ sb.append(students[i][j] + " "); noAns = false; } } } if(noAns){ System.out.println(0); }else{ sb.deleteCharAt(sb.length() - 1); System.out.print(sb); } */ } } }
Main.java:5: error: class Main2 is public, should be declared in a file named Main2.java public class Main2 { ^ 1 error
s384800906
p00591
Java
import java.util.HashSet; import java.util.Scanner; import java.util.Set; public class Main2 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(true){ int n = sc.nextInt(); if(n == 0){ break; } int[][] students = new int[n][n]; int[][] x = new int[n][n]; for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ students[i][j] = sc.nextInt(); } } for(int i = 0; i < n; i++){ int columnMax = -1; for(int j = 0; j < n; j++){ if(columnMax < students[j][i]) columnMax = students[j][i]; } for(int j = 0; j < n; j++){ if(columnMax == students[j][i]) x[j][i] |= 2; } } for(int i = 0; i < n; i++){ int rowMin = Integer.MAX_VALUE; for(int j = 0; j < n; j++){ if(rowMin > students[i][j]) rowMin = students[i][j]; } for(int j = 0; j < n; j++){ if(rowMin == students[i][j]) x[i][j] |= 1; } } Set<Integer> both = new HashSet<Integer>(); for(int i = 0;i < n;i++) for(int j = 0;j < n;j++) if(x[i][j] == 3) both.add(students[i][j]); if(both.size() == 1){ StringBuilder sb = new StringBuilder(); for(int v : both){ sb.append(v + " "); } sb.deleteCharAt(sb.length() - 1); System.out.println(sb); }else{ System.out.println(0); } } } }
Main.java:5: error: class Main2 is public, should be declared in a file named Main2.java public class Main2 { ^ 1 error
s012559239
p00591
C
#include<iostream> #include<algorithm> #include<cstring> using namespace std; int a[100][100]; bool shortest[100][100],tallest[100][100]; int main(){ int n; while(cin>>n&&n){ int ans=0; for(int i=0;i<n;i++) for(int j=0;j<n;j++)cin>>a[i][j]; memset(shortest,false,sizeof(shortest)); memset(tallest,false,sizeof(tallest)); for(int i=0;i<n;i++){ int minv=1<<30; for(int j=0;j<n;j++)minv=min(minv,a[i][j]); for(int j=0;j<n;j++)if(a[i][j]==minv)shortest[i][j]=true; } for(int j=0;j<n;j++){ int maxv=-1; for(int i=0;i<n;i++)maxv=max(maxv,a[i][j]); for(int i=0;i<n;i++)if(a[i][j]==maxv)tallest[i][j]=true; } for(int i=0;i<n;i++) for(int j=0;j<n;j++) if(shortest[i][j]&&tallest[i][j])ans=a[i][j]; cout<<ans<<endl; } return 0; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s170349146
p00591
C++
#include<bits/stdc++h> using namespace std; int main(){ while(1){ int n; cin >> n; if(!n) break; vector<vector<int> > a(n, vector<int> (n)); vector<vector<pair<int, int> > > hand(n, vector<pair<int, int> > (n, {0, 0})); for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) cin >> a[i][j]; for(int i = 0; i < n; i++){ int tmp_m = 100100100; int tmp_j; for(int j = 0; j < n; j++){ if(tmp_m > a[i][j]){ tmp_m = a[i][j]; tmp_j = j; } } hand[i][tmp_j].first = true; } for(int j = 0; j < n; j++){ int tmp_M = 0; int tmp_i; for(int i = 0; i < n; i++){ if(tmp_M < a[i][j]){ tmp_M = a[i][j]; tmp_i = i; } } hand[tmp_i][j].second = true; } int ans = 0; for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ if(hand[i][j].first && hand[i][j].second) ans = max(ans, a[i][j); } } cout << ans << endl; } return 0; }
a.cc:1:9: fatal error: bits/stdc++h: No such file or directory 1 | #include<bits/stdc++h> | ^~~~~~~~~~~~~~ compilation terminated.
s274151177
p00591
C++
#include<bits/stdc++h> using namespace std; int main(){ while(1){ int n; cin >> n; if(!n) break; vector<vector<int> > a(n, vector<int> (n)); vector<vector<pair<int, int> > > hand(n, vector<pair<int, int> > (n, {0, 0})); for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) cin >> a[i][j]; for(int i = 0; i < n; i++){ int tmp_m = 100100100; int tmp_j; for(int j = 0; j < n; j++){ if(tmp_m > a[i][j]){ tmp_m = a[i][j]; tmp_j = j; } } hand[i][tmp_j].first = true; } for(int j = 0; j < n; j++){ int tmp_M = 0; int tmp_i; for(int i = 0; i < n; i++){ if(tmp_M < a[i][j]){ tmp_M = a[i][j]; tmp_i = i; } } hand[tmp_i][j].second = true; } int ans = 0; for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ if(hand[i][j].first && hand[i][j].second) ans = max(ans, a[i][j); } } cout << ans << endl; } return 0; }
a.cc:1:9: fatal error: bits/stdc++h: No such file or directory 1 | #include<bits/stdc++h> | ^~~~~~~~~~~~~~ compilation terminated.
s762231293
p00591
C++
#include <iostream> #include <string> #include <sstream> #include <algorithm> #include <vector> #include <utility> #include <stack> #include <queue> #include <map> #include <set> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> using namespace std; #define rep(i,n) for(int i=0; i<(n); i++) #define repc(i,s,e) for(int i=(s); i<(e); i++) #define pb(n) push_back((n)) #define mp(n,m) make_pair((n),(m)) #define all(r) r.begin(),r.end() #define fi first #define se second typedef long long ll; typedef vector<int> vi; typedef vector<vi> vii; typedef vector<ll> vl; typedef vector<vl> vll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int INF = 10000000; const int mod = 1e9 + 7; const double EPS = 1e-9; int main(){ int n; while(cin>>n){ vvi v(n, vi(n, 0)), u(n, vi(n, 0)); for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ cin>>v[i][j]; } } int a = 0, b = 0; for(int i = 0; i < n; i++){ a = b = i; for(int j = 0; j < n; j++){ if(v[i][a] > v[i][j]) a = j; if(v[b][i] < v[j][i]) b = j; } u[i][a] = 1; u[b][i] = 1; } int ans = 0; for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ if(u[i][j]) ans++; } } cout<<ans<<endl; } }
a.cc: In function 'int main()': a.cc:43:17: error: 'vvi' was not declared in this scope; did you mean 'vii'? 43 | vvi v(n, vi(n, 0)), u(n, vi(n, 0)); | ^~~ | vii a.cc:46:38: error: 'v' was not declared in this scope 46 | cin>>v[i][j]; | ^ a.cc:54:36: error: 'v' was not declared in this scope 54 | if(v[i][a] > v[i][j]) a = j; | ^ a.cc:55:36: error: 'v' was not declared in this scope 55 | if(v[b][i] < v[j][i]) b = j; | ^ a.cc:57:25: error: 'u' was not declared in this scope 57 | u[i][a] = 1; | ^ a.cc:64:36: error: 'u' was not declared in this scope 64 | if(u[i][j]) ans++; | ^
s976512483
p00591
C++
#include<iostream> #include<algorithm> using namespace std; int a,a[120][120],b[120][120]; int p[12000]; int main(){ while(true){ cin>>n; if(n==0){break;} for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ cin>>a[i][j]; b[j][i]=a[i][j]; } } for(int i=0;i<n;i++){ sort(a[i],a[i]+n); sort(b[i],b[i]+n); } int P=0; for(int i=0;i<n;i++){ p[a[i][0]]++; p[b[i][n-1]]++; if(p[a[i][0]]==2)P=a[i][0]; if(p[b[i][n-1]]==2)P=b[i][n-1]; } cout<<P<<endl; } }
a.cc:4:7: error: conflicting declaration 'int a [120][120]' 4 | int a,a[120][120],b[120][120]; | ^ a.cc:4:5: note: previous declaration as 'int a' 4 | int a,a[120][120],b[120][120]; | ^ a.cc: In function 'int main()': a.cc:8:22: error: 'n' was not declared in this scope 8 | cin>>n; | ^ a.cc:12:39: error: invalid types 'int[int]' for array subscript 12 | cin>>a[i][j]; | ^ a.cc:13:42: error: invalid types 'int[int]' for array subscript 13 | b[j][i]=a[i][j]; | ^ a.cc:17:31: error: invalid types 'int[int]' for array subscript 17 | sort(a[i],a[i]+n); | ^ a.cc:17:36: error: invalid types 'int[int]' for array subscript 17 | sort(a[i],a[i]+n); | ^ a.cc:22:28: error: invalid types 'int[int]' for array subscript 22 | p[a[i][0]]++; | ^ a.cc:24:31: error: invalid types 'int[int]' for array subscript 24 | if(p[a[i][0]]==2)P=a[i][0]; | ^ a.cc:24:45: error: invalid types 'int[int]' for array subscript 24 | if(p[a[i][0]]==2)P=a[i][0]; | ^
s499215065
p00591
C++
#include<iostream> #include<vector> #include<algorithm> using namespace std; int m[101][101]; typedef pair<int, int> P; int main() { while (cin >> n,n) { vector<P> row; vector<P> ans; for (int x = 0; x < n; x++) { for (int y = 0; y < n; y++) { cin >> m[x][y]; } } for (int x = 0; x < n; x++) { int u = m[x][0]; for (int i = 0; i < n; i++) { u = min(u, m[x][i]); } for (int i = 0; i < n; i++) { if (u == m[x][i]) { P p(x, i); row.push_back(p); } } } for (int y = 0; y < n; y++) { int u = m[0][y], t = 0; for (int i = 0; i < n; i++) { u = max(u, m[i][y]); } for (int i = 0; i < n; i++) { if (u == m[i][y]) { P p(i, y); for(int j = 0; j < row.size(); j++) { if (row[j] == p)ans.push_back(p); } } } } int t = 0; for (int i = 0; i < ans.size(); i++) { if(!i) { int x = ans[i].first; int y = ans[i].second; t = m[x][y]; } else { int x = ans[i].first; int y = ans[i].second; t = max(t, m[x][y]); } } cout << t << endl; } }
a.cc: In function 'int main()': a.cc:12:23: error: 'n' was not declared in this scope 12 | while (cin >> n,n) { | ^
s651912362
p00591
C++
#include<iostream> #include<cstdio> #include<algorithm> #include<string> #include<vector> #include<queue> #include<set> #include<stack> #include<functional> #include<list> #include<unordered_map> #include<map> using namespace std; int a[100][100]; int k[100][100]; signed main() { int b; while (cin >> b, b) { memset(k, 0, sizeof(k)); for (int c = 0; c < b; c++) { for (int d = 0; d < b; d++) { cin >> a[c][d]; } } for (int c = 0; c < b; c++) { int MAX = 0; for (int d = 0; d < b; d++) { MAX = max(MAX, a[d][c]); } for (int d = 0; d < b; d++) { if (a[d][c] == MAX)k[d][c]++; } } for (int c = 0; c < b; c++) { int MIN = 1 << 29; for (int d = 0; d < b; d++) { MIN = min(MIN, a[c][d]); } for (int d = 0; d < b; d++) { if (a[c][d] == MIN)k[c][d]++; } } int MAX = -1; for (int i = 0; i < b; i++) { for (int j = 0; j < b; j++) { if (k[i][j] == 2) { MAX = max(MAX, a[i][j]); } } } cout << MAX << endl; } }
a.cc: In function 'int main()': a.cc:20:17: error: 'memset' was not declared in this scope 20 | memset(k, 0, sizeof(k)); | ^~~~~~ a.cc:13:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 12 | #include<map> +++ |+#include <cstring> 13 | using namespace std;
s064904424
p00591
C++
#include<bits/stdc++.h> #define rep(i) for(int i=0;i<n;i++)using namespace std;int n,c,a[110],b[110];int main(){while(cin>>n&&n){rep(i)a[i]=1145141919,b[i]=0;rep(i)rep(j){cin>>c;a[i]=min(a[i],c);b[j]=max(b[j],c);}rep(i)rep(j)if(a[i]==b[j]){cout<<a[i]<<endl;goto loop;}cout<<"0"<<endl;loop:;}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
s504745639
p00591
C++
#include<stdio.h> #include<limits.h> int main(){ int m[100][100],n,i,j,k,l; int rc,cr; char buf[1000],*ind,*prev; do{ fgets(buf,1000,stdin); n=atoi(buf); if(!n) break; for(i=0;i<n;i++){ fgets(buf,1000,stdin); prev=ind=buf; j=0; while((ind=strchr(ind,' '))!=NULL){ *ind='\0'; ind++; m[i][j++]=atoi(prev); prev=ind; } m[i][j]=atoi(prev); } for(i=0,rc=0,cr=INT_MAX;i<n;i++){ for(j=0,k=INT_MAX,l=0;j<n;j++){ if(k>m[i][j]) k=m[i][j]; if(l<m[j][i]) l=m[j][i]; } if(rc<k) rc=k; if(cr>l) cr=l; } if(rc==cr) printf("%d\n",rc); else printf("0\n"); }while(1); return 0; }
a.cc: In function 'int main()': a.cc:11:7: error: 'atoi' was not declared in this scope 11 | n=atoi(buf); | ^~~~ a.cc:17:18: error: 'strchr' was not declared in this scope 17 | while((ind=strchr(ind,' '))!=NULL){ | ^~~~~~ a.cc:3:1: note: 'strchr' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include<limits.h> +++ |+#include <cstring> 3 |
s812636487
p00591
C++
#include <iostream> using namespace std; int d[100][100]; int main(){ int n; while(cin >> n && n){ for(int i = 0 ; i < n ; i++) for(int j = 0 ; j < n ; j++) cin >> d[i][j]; int cnt[100][100] = {0}; for(int i = 0 ; i < n ; i++) cnt[i][min_element(cnt[i],cnt[i]+n)-cnt[i]]++; for(int i = 0 ; i < n ; i++){ int k = 0; for(int j = 0 ; j < n ; j++){ if( d[j][i] > d[k][i]) k = j; } cnt[k][i]++; } for(int i = 0 ; i < n ; i++) for(int j = 0 ; j < n ; j++) if(cnt[i][j] == 2){ cout << d[i][j] << endl;goto exit;} cout << 0 << endl; exit:; } }
a.cc: In function 'int main()': a.cc:12:53: error: 'min_element' was not declared in this scope 12 | for(int i = 0 ; i < n ; i++) cnt[i][min_element(cnt[i],cnt[i]+n)-cnt[i]]++; | ^~~~~~~~~~~
s269858614
p00591
C++
#include<iostream> using namespace std; int main(){ int n; long long a[100][100]; bool r[100][100],c[100][100]; while(cin >> n && n){ for(int i=0;i<n;i++) for(int j=0;j<n;j++){ cin >> a[i][j]; r[i][j] = c[i][j] = false; } for(int i=0;i<n;i++){ long long m = -1; for(int j=0;j<n;j++) if(m<0 || m<a[i][j])m = a[i][j]; for(int j=0;j<n;j++) if(a[i][j] == m)r[i][j] = true; m = -1; for(int j=0;j<n;j++) if(m<0 || m>a[j][i])m = a[j][i]; for(int j=0;j<n;j++) if(a[j][i] == m)c[j][i] = true; } bool f = false; for(int i=0;i<n;i++) for(int j=0;j<n;j++) if(r[i][j] && c[i][j]){ cout << a[i][j] << endl; f = true; } if(!f)cout << 0 << endl; }
a.cc: In function 'int main()': a.cc:37:10: error: expected '}' at end of input 37 | } | ^ a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s550027288
p00591
C++
#include<iostream> using namespace std; int main() { int n; while(cin>>n) { int p[10001],q,flag,flag1,flag2; for(int k=0;k<n;k++) { for(int i=0;i<n;i++) { cin>>p[i+n*k]; if(i==0){q=p[i+n*k];flag1=0;} if(q>p[i+n*k]){q=p[i+n*k],flag1=i;} } if(k==0)flag=q; else if(flag<q) { flag=q; flag2=flag1; } } for(int l=0;l<n;l++) if(flag<p[flag2+l*n])break; if(l==n) cout<<flag<<endl; else cout<<"0"<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:26:20: error: 'l' was not declared in this scope 26 | if(l==n) | ^
s990599999
p00591
C++
#include<iostream> #include<algorithm> using namespace std; int main() { int a[101][101]; int row[101],col[101]; int n,i,j,temp[101],k,num[101],s[10001]; while(cin>>n) { memset(num,0,sizeof(num)); if(n==0)return 0; for(i=0;i<n;i++) for(j=0;j<n;j++) cin>>a[i][j]; for(i=0;i<n;i++) { for(j=0;j<n;j++) { temp[j]=a[i][j]; num[j]=a[j][i]; } sort(temp,temp+n); sort(num,num+n); row[i]=temp[0]; col[i]=num[n-1]; } k=0; memset(s,0,sizeof(s)); for(i=0;i<n;i++) for(j=0;j<n;j++) { if(a[i][j]==row[i]&&a[i][j]==col[j]) { s[k]=a[i][j]; k++; } } sort(s,s+k); cout<<s[0]; for(i=1;i<k;i++) { if(s[i]!=s[i-1]&&s[i]!=0) cout<<" "<<s[i]; } cout<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:13:17: error: 'memset' was not declared in this scope 13 | memset(num,0,sizeof(num)); | ^~~~~~ a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 4 | #include<algorithm> +++ |+#include <cstring> 5 | using namespace std;
s129911243
p00591
C++
#include <iostream> using namespace std; int main() { int n,zs; while((cin>>n)&&n!=0) { int temp3=0; int (*a)[100],(*b)[100]; a=new int[100][100],b=new int[100][100]; int *temp0=new int[n],*temp=new int[n]; memset(b,0,sizeof(b)); memset(temp,0,sizeof(temp)); for(int c=0;c<n;c++) { for(int d=0;d<n;d++) { cin>>a[c][d]; } } for(int i=0;i<n;i++) { zs=a[i][0]; temp[i]=0; for(int j=1;j<n;j++) {if(zs>a[i][j]) { zs=a[i][j]; temp[i]=j;//隶ー蠖穂ス咲スョ蜿キ } } b[i][temp[i]]=1; } for(int k=0;k<n;k++) { zs=a[0][k]; temp0[k]=0; for(int l=1;l<n;l++) { if(a[l][k]>zs) { zs=a[l][k]; temp0[k]=l; } } if(b[temp0[k]][k]==1) { cout<<a[temp0[k]][k]<<endl; temp3++; break; } } if(temp3==0) cout<<0<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:12:17: error: 'memset' was not declared in this scope 12 | memset(b,0,sizeof(b)); | ^~~~~~ a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include <iostream> +++ |+#include <cstring> 2 | using namespace std;
s013716658
p00591
C++
#include <cstring> #include <iostream> using namespace std; int main() { int n,zs; while((cin>>n)&&n!=0) { int temp3=0,a[100][100],b[100][100]; //int (*a)[100],(*b)[100]; //a=new int[100][100],b=new int[100][100]; int *temp0=new int[n],*temp=new int[n]; memset(b,0,sizeof(b)); memset(temp,0,sizeof(temp)); for(int c=0;c<n;c++) { for(int d=0;d<n;d++) { cin>>a[c][d]; } } for(int i=0;i<n;i++) { zs=a[i][0]; temp[i]=0; for(int j=1;j<n;j++) {if(zs>a[i][j]) { zs=a[i][j]; temp[i]=j;//隶ー蠖穂ス咲スョ蜿キ } } for(j=1;j<n;j++) { if(zs==a[i][j]) b[i][temp[i]]++; } } for(int k=0;k<n;k++) { zs=a[0][k]; temp0[k]=0; for(int l=1;l<n;l++) { if(a[l][k]>zs) { zs=a[l][k]; temp0[k]=l; } } for(l=0;l<n;l++) { if(zs==a[l][k]) b[temp0[k]][k]++; } } for(int p=0;p<n;p++) { if(temp3==1)break; for(int q=0;q<n;q++) if(b[p][q]==2) { cout<<a[p][q]<<endl;temp3=1;break;} } if(temp3==0) cout<<"0"<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:33:29: error: 'j' was not declared in this scope 33 | for(j=1;j<n;j++) | ^ a.cc:51:29: error: 'l' was not declared in this scope 51 | for(l=0;l<n;l++) | ^
s713322350
p00591
C++
#include<iostream> #include<vector> using namespace std; const int MAX = 100; typedef pair<int,int> P; int n; int in[MAX][MAX]; P ans[MAX][MAX]; void row(int m){ int s = (1<<20); for(int i = 0; i < n; i++) s = min(s,in[m][i]); for(int i = 0; i < n; i++) if(s == in[m][i]) ans[m][i].first = true; } void column(int m){ int l = -1; for(int i = 0; i < n; i++) l = max(l,in[i][m]); for(int i = 0; i < n; i++) if(l == in[i][m]) ans[i][m].second = true; } void init(){ for(int i = 0; i < MAX; i++) for(int j = 0; j < MAX; j++) ans[i][j] = P(false,false); } int main(){ while(cin >> n && n){ init(); for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) cin >> in[i][j]; for(int i = 0; i < n; i++){ row(i); column(i); } vector<int> V; for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) if(ans[i][j] == P(true,true)) V.push_back(in[i][j]); if(V.size() == 0) cout << "0" << endl; else if(V.size() == 1) cout << V[0] << endl; else{ sort(V.begin(),V.end()); vector<int> :: iterator ite = V.begin(); while(ite != V.end()){ cout << *ite << endl; ite = upper_bound(V.begin(),V.end(),*ite); } } } return 0; }
a.cc: In function 'int main()': a.cc:64:7: error: 'sort' was not declared in this scope; did you mean 'short'? 64 | sort(V.begin(),V.end()); | ^~~~ | short a.cc:68:15: error: 'upper_bound' was not declared in this scope 68 | ite = upper_bound(V.begin(),V.end(),*ite); | ^~~~~~~~~~~
s428571271
p00591
C++
# -*- coding: utf-8 -*- import sys import copy while True: n = int(raw_input()) if n == 0: break array = [] array2 = [] minflag = [] maxflag = [] for i in range(n): l = [] for j in range(n): l.append(0) minflag.append(copy.copy(l)) maxflag.append(copy.copy(l)) for i in range(n): row = map(int, raw_input().split()) array.append(row) array2.append(row) for i, row in enumerate(array): for j, e in enumerate(row): if e == min(row): minflag[i][j] = 1 else: minflag[i][j] = 0 # print minflag for i, column in enumerate(map(list, zip(*array2))): for j, e in enumerate(column): if e == max(column): maxflag[j][i] = 1 else: maxflag[j][i] = 0 # print minflag # print maxflag for i in range(n): for j in range(n): if (minflag[i][j] == 1 and maxflag[i][j] == 1): print array[i][j]
a.cc:1:3: error: invalid preprocessing directive #- 1 | # -*- coding: utf-8 -*- | ^ a.cc:36:7: error: invalid preprocessing directive #print 36 | # print minflag | ^~~~~ a.cc:45:7: error: invalid preprocessing directive #print 45 | # print minflag | ^~~~~ a.cc:46:7: error: invalid preprocessing directive #print 46 | # print maxflag | ^~~~~ a.cc:3:1: error: 'import' does not name a type 3 | import sys | ^~~~~~ a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
s004921915
p00592
C++
#include <iostream> #include <string> #include <algorithm> #include <map> #include <vector> using namespace std; int transformation(int n) { return 60*n/100+n%100; } int main() { for(int n,p,q;cin>>n>>p>>q,n|p|q;){ { vector<int> bla(24*60+10,0); p = transformation(p); q = transformation(q); for(int c=0;c<n;c++) { int t; cin>>t; while(t--) { int first,second; cin>>first>>second; first = transformation(first); second = transformation(second); for(int c2=first;c2<second;c2++) bla[c2]++; } } int act = 0; int res = 0; for(int c=p;c<q;c++) { if(bla[c]==n) act=0; else act++; res=max(res,act); } cout<<res<<endl; } }
a.cc: In function 'int main()': a.cc:44:2: error: expected '}' at end of input 44 | } | ^ a.cc:14:1: note: to match this '{' 14 | { | ^
s728436271
p00592
C++
#include<iostream> #include<stdio.h> #include<string> #include<math.h> #include<iomanip> #include<algorithm> #include<string.h> #include<cctype> #include<map> #include<set> #include<vector> #include<sstream> #include<stack> #include<queue> using namespace std; //??\?????\??´?????£??????????????\?°¨?????°??????map?????¨??????????????°??? int main() { int N; int start,end; while(cin>>N>>start>>end) { bool arr[2000]=false; //map<int,int> mm; //map<int,int>::iterator iter; //map<int,int>::iterator iter2; if(N==0&&start==0&&end==0) break; start=(start/100)*60+(start%60); end=(end/100)*60+(end%100); for(int i=0;i<N;i++) { int kk; int temp; cin>>kk; int a,b; for(int j=0;j<kk;j++) { cin>>a>>b; a=(a/100)*60+(a%100); b=(b/100)*60+(b%100); if(j==0) { //if(a>start) mm[start]=a; if(a>start) for(int k=start;k<a;k++) arr[k]=true; } else { for(int k=temp;k<a;k++) arr[k]=true; //mm[temp]=a; } temp=b; } if(end>temp) { for(int k=temp;k<end;k++) arr[k]=true; //mm[temp]=end; } } /* for(iter2=mm.begin();iter2!=mm.end();++iter2) { cout<<iter2->first<<" "<<iter2->second<<endl; } */ int max=0; int duration=0; for(int i=start;i<(end+1);i++) { if(arr[i]) duration++; else { if(duration>max) max=duration; duration=0; } //cout<<duration<<endl; } cout<<max<<endl; /* iter=mm.begin(); int start2=iter->first; int end2=iter->second; int max=end2-start2; iter++; for(;iter!=mm.end();++iter) { int p=iter->first; int q=iter->second; if(p<=end2&&q>=end2) end2=q; else if(p>end2) { start2=p; end2=q; } int dur=end2-start2; if(dur>max) max=dur; } cout<<max<<endl; } */ } //while(1); return 0; }
a.cc: In function 'int main()': a.cc:26:21: error: array must be initialized with a brace-enclosed initializer 26 | bool arr[2000]=false; | ^~~~~
s110334182
p00592
C++
1 2100 2400 1 2130 2200 3 2100 2400 3 2100 2130 2200 2230 2300 2330 2 2130 2200 2330 2400 2 2100 2130 2330 2400 0 0 0
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 1 2100 2400 | ^
s706442130
p00592
C++
#include<iostream> #define rep(i,n) for(int i=0;i<n;i++) using namespace std; int main(){ int n,p,q,k,s[99],e[99],a,b,cm,ans,prev,sum; while(cin>>n>>p>>q,n){ p=p/100*60+p%100,q=q/100*60+q%100;sum=0; rep(j,n){ cin>>k; rep(i,k)cin>>a>>b,s[sum+i]=a/100*60+a%100,e[sum+i]=b/100*60+b%100; sum+=k; } sort(s,s+sum);sort(e,e+sum); cm=0;ans=0;prev=p; for(int si=0,ei=0;si<sum||ei<sum;){ if(si<sum&&s[si]<e[ei]){ cm++; if(cm==n&&ans<s[si]-prev)ans=s[si]-prev; si++; }else{ cm--;if(cm==n-1)prev=e[ei];ei++; } } if(ans<q-prev)ans=q-prev; cout<<ans<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:13:17: error: 'sort' was not declared in this scope; did you mean 'short'? 13 | sort(s,s+sum);sort(e,e+sum); | ^~~~ | short
s665982963
p00592
C++
#include<iostream> #define N 2500; using namespace std; int main(){ int in, start,end; while(cin >> in >>start >> end){ if(in == 0 && start == 0 && end == 0) break; int data[N]; int com[N]; for(int i = 0; i < end; i++){ com[i] = 0; data[i] = 0; } for(int i = start; i < end; i++){ if(i%100 < 60) data[i] = 1; } int comnum, s,e; for(int i = 0; i < in; i++){ cin >> comnum; for(int j = 0; j < comnum; j++){ cin >> s >> e; for(int i = s; i < e; i++){ if(i % 100 < 60) com[i]++; } } } for(int i = 0; i < end; i++){ if(com[i] == in) data[i] = 0; } int sum = 0; for(int i = 0; i < end; i++){ if(data[i] == 1) sum++; } cout << sum << endl; } return 0; }
a.cc: In function 'int main()': a.cc:3:15: error: expected ']' before ';' token 3 | #define N 2500; | ^ a.cc:13:14: note: in expansion of macro 'N' 13 | int data[N]; | ^ a.cc:13:15: error: expected primary-expression before ']' token 13 | int data[N]; | ^ a.cc:3:15: error: expected ']' before ';' token 3 | #define N 2500; | ^ a.cc:14:13: note: in expansion of macro 'N' 14 | int com[N]; | ^ a.cc:14:14: error: expected primary-expression before ']' token 14 | int com[N]; | ^ a.cc:17:7: error: 'com' was not declared in this scope 17 | com[i] = 0; | ^~~ a.cc:18:11: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 18 | data[i] = 0; | ^ a.cc:22:26: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 22 | if(i%100 < 60) data[i] = 1; | ^ a.cc:31:28: error: 'com' was not declared in this scope 31 | if(i % 100 < 60) com[i]++; | ^~~ a.cc:37:10: error: 'com' was not declared in this scope 37 | if(com[i] == in) data[i] = 0; | ^~~ a.cc:37:28: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 37 | if(com[i] == in) data[i] = 0; | ^ a.cc:42:14: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 42 | if(data[i] == 1) sum++; | ^
s156894217
p00592
C++
#include <cstdio> #include <cstring> #include <algorithm> using namespace std; #define N 505 #define M 5005 int n, p, q; bool a[N][M]; int dp[2][N][M]; inline int gao() { int x; scanf("%d", &x); return x / 100 * 60 + x % 100; } int main() { while (EOF != scanf("%d", &n)) { p = gao(); q = gao(); if (0 == n && 0 == p && 0 == q) break; memset(a, 0, sizeof(a)); for (int i = 0; i < n; ++i) { int m, l, r; scanf("%d", &m); while (m--) { l = max(p, gao()); r = min(q, gao()); for (int j = l; j < r; ++j) a[i][j - p] = true; } } memset(dp, 0, sizeof(dp)); for (int j = p + 1; j <= q; ++j) for (int i = 0; i < n; ++i) { for (int k = 0; k < n; ++k) { if (a[k][j - 1 - p]) { int tmp = 0; tmp = max(tmp, dp[0][k][j - 1 - p]); tmp = max(tmp, dp[1][k][j - 1 - p]); dp[1][i][j - p] = max(dp[1][i][j - p], tmp); } else { dp[0][i][j - p] = max(dp[0][i][j - p], dp[0][k][j - 1 - p] + 1); } } dp[1][i][j - p] = max(dp[1][i][j - p], dp[0][i][j - p]); } int ans = 0; for (int i = 0; i < n; ++i) ans = max(ans, max(dp[1][i][q - p], dp[0][i][q - p]); printf("%d\n", ans); } return 0; }
a.cc: In function 'int main()': a.cc:52:65: error: expected ')' before ';' token 52 | ans = max(ans, max(dp[1][i][q - p], dp[0][i][q - p]); | ~ ^ | )
s086311842
p00593
C
#include<stdio.h> int main(){ int n,i,j,k=1,cnt,d[10][10]; while(scanf("%d",&n),n){ a=1; for(i=0;i<n*2;i++){ if(i%2){ for(j=0;j<i;j++){ d[j][i-j]=a++; } }else{ for(j=i-1;j>=0;j++){ d[j][i-j]=a++; } } } printf("Case %d:\n",k++); for(i=0;i<n;i++){ for(j=0;j<n;j++){ printf("%3d",d[i][j]); } puts(""); } } return 0; }
main.c: In function 'main': main.c:7:17: error: 'a' undeclared (first use in this function) 7 | a=1; | ^ main.c:7:17: note: each undeclared identifier is reported only once for each function it appears in
s513619137
p00593
C
#include<iostream> #include<cstring> #include <iomanip> using namespace std; void init(int matrix[11][11]) { int i,j; for(i = 0; i < 11;i ++) { for(j = 0; j < 11; j ++) { matrix[i][j] = 0; } } } bool OnBoundary(int i,int j,int caseNum) { //if(i == 0 || i == caseNum - 1 || j == 0 || j == caseNum - 1) if((i == 0 && j >= 0 && j <= caseNum - 1) || (i == caseNum - 1 && j >= 0 && j <= caseNum - 1) || (j == 0 && i >= 0 && i <= caseNum - 1) || (j == caseNum - 1 && i >= 0 && i <= caseNum - 1)) { return true; } else { return false; } } bool OutBoundary(int i,int j,int caseNum) { if(i < 0 || i > caseNum - 1 || j < 0 || j > caseNum - 1) { return true; } else { return false; } } int main() { int caseNum; int n = 0; while(cin>>caseNum) { if(caseNum == 0) break; else { n ++; int i; int j; int matrix[11][11]; init(matrix); int lit = (caseNum - 1) + (caseNum - 1); int seed = 1; bool up = true; for(i = 0,j =0;i + j <= lit; ) { matrix[i][j] = seed; seed ++; // find next if(up == true ) { if(OutBoundary(i - 1,j + 1,caseNum) == true) { if(OnBoundary(i,j + 1,caseNum) == true) { i = i ; j = j + 1; } else { i = i + 1; j = j; } up = false; } else { i = i - 1; j = j + 1; } } else if(up == false ) { if(OutBoundary(i + 1,j - 1,caseNum) == true) { if(OnBoundary(i + 1,j ,caseNum) == true) { i = i + 1 ; j = j ; } else { i = i ; j = j + 1; } up = true; } else { i = i + 1; j = j - 1; } } } // output cout<<"Case "<<n<<":"<<endl; for(i = 0; i < caseNum ; i ++) { for(j = 0; j < caseNum; j ++) { cout.setf(ios::right); cout<<setw(3)<<matrix[i][j]<<" "; } cout<<endl; } // output } } return 0; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s911293665
p00593
C
#define d for(x=0;x<N;x++){for(y=0;y<N;y++ c,m[10][10],x,N;main(y){for(;scanf("%d",&N),N;){d)m[x][y]=(x+y)*(x-~y)/2+1+(x+y\&1?x:y);}printf("Case %d:\n",++c);d)printf("%3d",x+y<N?m[x][y]:N*N+1-m[N+~x][N+\~y]);puts("");}}}
main.c:2:1: warning: data definition has no type or storage class 2 | c,m[10][10],x,N;main(y){for(;scanf("%d",&N),N;){d)m[x][y]=(x+y)*(x-~y)/2+1+(x+y\&1?x:y);}printf("Case %d:\n",++c);d)printf("%3d",x+y<N?m[x][y]:N*N+1-m[N+~x][N+\~y]);puts("");}}} | ^ main.c:2:1: error: type defaults to 'int' in declaration of 'c' [-Wimplicit-int] main.c:2:3: error: type defaults to 'int' in declaration of 'm' [-Wimplicit-int] 2 | c,m[10][10],x,N;main(y){for(;scanf("%d",&N),N;){d)m[x][y]=(x+y)*(x-~y)/2+1+(x+y\&1?x:y);}printf("Case %d:\n",++c);d)printf("%3d",x+y<N?m[x][y]:N*N+1-m[N+~x][N+\~y]);puts("");}}} | ^ main.c:2:13: error: type defaults to 'int' in declaration of 'x' [-Wimplicit-int] 2 | c,m[10][10],x,N;main(y){for(;scanf("%d",&N),N;){d)m[x][y]=(x+y)*(x-~y)/2+1+(x+y\&1?x:y);}printf("Case %d:\n",++c);d)printf("%3d",x+y<N?m[x][y]:N*N+1-m[N+~x][N+\~y]);puts("");}}} | ^ main.c:2:15: error: type defaults to 'int' in declaration of 'N' [-Wimplicit-int] 2 | c,m[10][10],x,N;main(y){for(;scanf("%d",&N),N;){d)m[x][y]=(x+y)*(x-~y)/2+1+(x+y\&1?x:y);}printf("Case %d:\n",++c);d)printf("%3d",x+y<N?m[x][y]:N*N+1-m[N+~x][N+\~y]);puts("");}}} | ^ main.c:2:17: error: return type defaults to 'int' [-Wimplicit-int] 2 | c,m[10][10],x,N;main(y){for(;scanf("%d",&N),N;){d)m[x][y]=(x+y)*(x-~y)/2+1+(x+y\&1?x:y);}printf("Case %d:\n",++c);d)printf("%3d",x+y<N?m[x][y]:N*N+1-m[N+~x][N+\~y]);puts("");}}} | ^~~~ main.c: In function 'main': main.c:2:17: error: type of 'y' defaults to 'int' [-Wimplicit-int] main.c:2:30: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 2 | c,m[10][10],x,N;main(y){for(;scanf("%d",&N),N;){d)m[x][y]=(x+y)*(x-~y)/2+1+(x+y\&1?x:y);}printf("Case %d:\n",++c);d)printf("%3d",x+y<N?m[x][y]:N*N+1-m[N+~x][N+\~y]);puts("");}}} | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | #define d for(x=0;x<N;x++){for(y=0;y<N;y++ main.c:2:30: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 2 | c,m[10][10],x,N;main(y){for(;scanf("%d",&N),N;){d)m[x][y]=(x+y)*(x-~y)/2+1+(x+y\&1?x:y);}printf("Case %d:\n",++c);d)printf("%3d",x+y<N?m[x][y]:N*N+1-m[N+~x][N+\~y]);puts("");}}} | ^~~~~ main.c:2:30: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:2:80: error: stray '\' in program 2 | c,m[10][10],x,N;main(y){for(;scanf("%d",&N),N;){d)m[x][y]=(x+y)*(x-~y)/2+1+(x+y\&1?x:y);}printf("Case %d:\n",++c);d)printf("%3d",x+y<N?m[x][y]:N*N+1-m[N+~x][N+\~y]);puts("");}}} | ^ main.c:2:90: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 2 | c,m[10][10],x,N;main(y){for(;scanf("%d",&N),N;){d)m[x][y]=(x+y)*(x-~y)/2+1+(x+y\&1?x:y);}printf("Case %d:\n",++c);d)printf("%3d",x+y<N?m[x][y]:N*N+1-m[N+~x][N+\~y]);puts("");}}} | ^~~~~~ main.c:2:90: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:2:90: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:2:90: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:2:160: error: stray '\' in program 2 | c,m[10][10],x,N;main(y){for(;scanf("%d",&N),N;){d)m[x][y]=(x+y)*(x-~y)/2+1+(x+y\&1?x:y);}printf("Case %d:\n",++c);d)printf("%3d",x+y<N?m[x][y]:N*N+1-m[N+~x][N+\~y]);puts("");}}} | ^ main.c:2:166: error: implicit declaration of function 'puts' [-Wimplicit-function-declaration] 2 | c,m[10][10],x,N;main(y){for(;scanf("%d",&N),N;){d)m[x][y]=(x+y)*(x-~y)/2+1+(x+y\&1?x:y);}printf("Case %d:\n",++c);d)printf("%3d",x+y<N?m[x][y]:N*N+1-m[N+~x][N+\~y]);puts("");}}} | ^~~~ main.c:2:166: note: include '<stdio.h>' or provide a declaration of 'puts'
s396951202
p00593
C++
#include <iostream> #include <cstdio> using namespace std; int** alloc_mat(int mat_size); //蜉ィ諤∽コ檎サエ謨ー扈?噪蛻?? void del_mat(int **mat, int mat_size); //蛻?勁蜉ィ諤∝?驟咲噪莠檎サエ謨ー扈?void print_mat(int **mat, int mat_size); //謇灘魂莠檎サエ謨ー扈?void fill_mat(int **mat, int mat_size); //蝪ォ蜈?焚扈?クコ陞コ譌区焚扈? int main() { int **zigzag_mat; int mat_size; int count=1; while(cin >> mat_size,mat_size) { cout<<"Case "<<count<<":"<<endl; zigzag_mat = alloc_mat(mat_size); fill_mat(zigzag_mat,mat_size); print_mat(zigzag_mat, mat_size); del_mat(zigzag_mat, mat_size); count++; } return 0; } int** alloc_mat(int mat_size) { int **mat; int i, j; mat = new int*[mat_size]; for (i = 0; i < mat_size; i++) { *(mat+i) = new int[mat_size]; } for (i = 0; i < mat_size; i++) for (j = 0; j < mat_size; j++) mat[i][j] = 0; return mat; } void del_mat(int **mat, int mat_size) { int i; for(i = 0; i < mat_size; i++) delete[] mat[i]; delete[] mat; } void print_mat(int **mat, int mat_size) { int i, j; for(i = 0; i < mat_size; i++) { for (j = 0; j < mat_size; j++) printf("%3d", mat[i][j]+1); cout << endl; } } void fill_mat(int **mat, int mat_size) { int squa = mat_size * mat_size; int i, j, s; for (i = 0; i < mat_size; i++) for (j = 0; j < mat_size; j++) { s = i + j; if (s < mat_size) mat[i][j] = s * (s + 1) / 2 + (((i + j) % 2) ? i : j); else { s = (mat_size - 1 - i) + (mat_size - 1 - j); mat[i][j] = squa - s * (s + 1) / 2 - (mat_size - ((( i + j) % 2) ? i : j)); } } }
a.cc: In function 'int main()': a.cc:16:9: error: 'fill_mat' was not declared in this scope 16 | fill_mat(zigzag_mat,mat_size); | ^~~~~~~~ a.cc:17:9: error: 'print_mat' was not declared in this scope 17 | print_mat(zigzag_mat, mat_size); | ^~~~~~~~~
s157458918
p00593
C++
#define d for(x=0;x<N;x++){for(y=0;y<N;y++ c,m[10][10],x,N;main(y){for(;scanf("%d",&N),N;div(0)){d)m[x][y]=(x+y)*(x-~y)/2-~(x+y&1?x:y);}printf("Case %d:\n",++c);d)printf("%3d",x+y<N?m[x][y]:N*N+1-m[N+~x][N+~y]);puts("");}}}
a.cc:2:1: error: 'c' does not name a type 2 | c,m[10][10],x,N;main(y){for(;scanf("%d",&N),N;div(0)){d)m[x][y]=(x+y)*(x-~y)/2-~(x+y&1?x:y);}printf("Case %d:\n",++c);d)printf("%3d",x+y<N?m[x][y]:N*N+1-m[N+~x][N+~y]);puts("");}}} | ^ a.cc:2:21: error: expected constructor, destructor, or type conversion before '(' token 2 | c,m[10][10],x,N;main(y){for(;scanf("%d",&N),N;div(0)){d)m[x][y]=(x+y)*(x-~y)/2-~(x+y&1?x:y);}printf("Case %d:\n",++c);d)printf("%3d",x+y<N?m[x][y]:N*N+1-m[N+~x][N+~y]);puts("");}}} | ^
s892048090
p00593
C++
class Map def initialize(x,y,number,move) @x = x @y = y @move = move @number = number end attr_accessor :x,:y,:move,:number def +(map) x = self.x + map.x y = self.y + map.y m = self.move n = self.number + 1 tmp = Map.new(x,y,n,m) end end @b = [] @b << Map.new(1,0, 1,0) #sita @b << Map.new(0,1, 1,1) #migi @b << Map.new(1,-1,1,2) #hidarisita @b << Map.new(-1,1,1,3) #migiue def work(map,m) n=m-1 if map.move==3 && map.x!=0 && map.y!=n then return map+@b[3] elsif map.move==2 && map.y!=0 && map.x!=n then return map+@b[2] elsif (map.move==3&&map.x==0)||(map.move==2&&map.x==n) then if map.move==3 then move = 2 else move = 3 end temp = map + @b[1] temp.move = move if map.y==n then temp.move = 2 temp.x = 1 temp.y = n return temp else return temp end else if map.move==3 then move = 2 else move = 3 end temp = map + @b[0] temp.move = move return temp end end $m = Map.new(0,0,1,2) $n = 3 def w(m,n) return work( m, n ) end $COU = 0 def printmap(n) $COU = $COU + 1 puts "Case %d" % $COU c=[$m] i=1 while i<n*n c << w(c[i-1],n) i = i+1 end i=0 while i < n for mapp in c do if mapp.y==i then print "%3d" % mapp.number end end puts i=i+1 end end while true a = gets.to_i if a==0 then break end printmap(a) end
a.cc:3:5: error: stray '@' in program 3 | @x = x | ^ a.cc:4:5: error: stray '@' in program 4 | @y = y | ^ a.cc:5:5: error: stray '@' in program 5 | @move = move | ^ a.cc:6:5: error: stray '@' in program 6 | @number = number | ^ a.cc:17:1: error: stray '@' in program 17 | @b = [] | ^ a.cc:18:1: error: stray '@' in program 18 | @b << Map.new(1,0, 1,0) #sita | ^ a.cc:18:25: error: stray '#' in program 18 | @b << Map.new(1,0, 1,0) #sita | ^ a.cc:19:1: error: stray '@' in program 19 | @b << Map.new(0,1, 1,1) #migi | ^ a.cc:19:25: error: stray '#' in program 19 | @b << Map.new(0,1, 1,1) #migi | ^ a.cc:20:1: error: stray '@' in program 20 | @b << Map.new(1,-1,1,2) #hidarisita | ^ a.cc:20:25: error: stray '#' in program 20 | @b << Map.new(1,-1,1,2) #hidarisita | ^ a.cc:21:1: error: stray '@' in program 21 | @b << Map.new(-1,1,1,3) #migiue | ^ a.cc:21:25: error: stray '#' in program 21 | @b << Map.new(-1,1,1,3) #migiue | ^ a.cc:26:16: error: stray '@' in program 26 | return map+@b[3] | ^ a.cc:28:16: error: stray '@' in program 28 | return map+@b[2] | ^ a.cc:35:18: error: stray '@' in program 35 | temp = map + @b[1] | ^ a.cc:51:18: error: stray '@' in program 51 | temp = map + @b[0] | ^ a.cc:2:7: error: expected initializer before 'initialize' 2 | def initialize(x,y,number,move) | ^~~~~~~~~~
s654201528
p00594
Java
import java.util.Arrays; import java.util.Scanner; public class AOJ_1008_2 { public static int a[]; public static void main(String[] args) { Scanner in=new Scanner(System.in); for(;;) { int n=in.nextInt();//n<1000000 if(n==0) return; a=new int[n]; for(int i=0;i<n;i++) a[i]=in.nextInt(); Arrays.sort(a); int cnt=0; int ans=-1; int ele=a[0]; for(int i=0;i<n;i++) { if(ele==a[i]) { cnt++; if(cnt>n/2) { ans=ele; break; } } else { cnt=1; ele=a[i]; } } System.out.println(ans!=-1 ? ans:"NO COLOR"); } } static public void debug(Object... o) { System.out.println(Arrays.deepToString(o)); } }
Main.java:3: error: class AOJ_1008_2 is public, should be declared in a file named AOJ_1008_2.java public class AOJ_1008_2 ^ 1 error
s701199998
p00594
Java
import java.util.Map.Entry; import java.util.Scanner; import java.util.Set; import java.util.TreeMap; import java.util.TreeSet; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (true) { final int N = sc.nextInt(); if (N == 0) { break; } System.gc(); HashMap<Integer, Integer> map = new HashMap<Integer, Integer>(N); for(int i = 0; i < N; i++){ final int A = sc.nextInt(); int value = 0; if(map.containsKey(A)){ value = map.get(A); } value++; map.put(A, value); } //System.out.println(map); Set<Entry<Integer, Integer>> set = new TreeSet<Entry<Integer, Integer>>(new Comparator<Entry<Integer, Integer>>(){ @Override public int compare(Entry<Integer, Integer> arg0, Entry<Integer, Integer> arg1) { if(arg1.getValue() != arg0.getValue()){ return arg1.getValue() - arg0.getValue(); } return 0; } }); set.addAll(map.entrySet()); for(Entry<Integer, Integer> entry : set){ //System.out.println(entry.getValue()); if(entry.getValue() <= N / 2){ System.out.println("NO COLOR"); }else{ System.out.println(entry.getKey()); } break; } } } }
Main.java:21: error: cannot find symbol HashMap<Integer, Integer> map = new HashMap<Integer, Integer>(N); ^ symbol: class HashMap location: class Main Main.java:21: error: cannot find symbol HashMap<Integer, Integer> map = new HashMap<Integer, Integer>(N); ^ symbol: class HashMap location: class Main Main.java:36: error: cannot find symbol Set<Entry<Integer, Integer>> set = new TreeSet<Entry<Integer, Integer>>(new Comparator<Entry<Integer, Integer>>(){ ^ symbol: class Comparator location: class Main Main.java:38: error: method does not override or implement a method from a supertype @Override ^ 4 errors
s160331352
p00594
Java
import java.util.Scanner; import java.util.TreeMap; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); //int[] array = new int[1000001]; while (true) { final int N = sc.nextInt(); if (N == 0) { break; } System.gc(); int[] array = new int[N]; //Arrays.fill(array, Integer.MAX_VALUE); for(int i = 0; i < N; i++){ array[i] = sc.nextInt(); } Arrays.sort(array); int prev = array[0]; int count = 1; boolean flag = false;; for(int i = 1; i < N; i++){ if(prev == array[i]){ count++; }else{ if(count > N / 2){ System.out.println(prev); flag = true; break; } prev = array[i]; count = 1; } } if(count > 0){ if(count > N / 2){ System.out.println(prev); flag = true; } } if(!flag){ System.out.println("NO COLOR"); } } } }
Main.java:26: error: cannot find symbol Arrays.sort(array); ^ symbol: variable Arrays location: class Main 1 error
s596402095
p00594
Java
public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); //int[] array = new int[1000001]; while (true) { final int N = sc.nextInt(); if (N == 0) { break; } try { Thread.sleep(1); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } System.gc(); int[] array = new int[N]; //Arrays.fill(array, Integer.MAX_VALUE); for(int i = 0; i < N; i++){ array[i] = sc.nextInt(); } Arrays.sort(array); int prev = array[0]; int count = 1; boolean flag = false;; for(int i = 1; i < N; i++){ if(prev == array[i]){ count++; }else{ if(count > N / 2){ System.out.println(prev); flag = true; break; } prev = array[i]; count = 1; } } if(count > 0){ if(count > N / 2){ System.out.println(prev); flag = true; } } if(!flag){ System.out.println("NO COLOR"); } } } }
Main.java:4: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:4: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:29: error: cannot find symbol Arrays.sort(array); ^ symbol: variable Arrays location: class Main 3 errors
s467499008
p00594
Java
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.HashMap; class Main{ public static void main_(String args[]){ (new Main_()).sets(); } HashMap<String, OriginalSet> setsEnvironment; OriginalSet setU; void sets(){ // 標準入力準備 BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str = new String(); setsEnvironment = new HashMap<String, OriginalSet>(); setU = new OriginalSet(); // 集合定義のためのハッシュ try{ while((str = br.readLine()) != null){ int n = Integer.parseInt(str); if(n == 0) return; str = br.readLine(); String array[] = str.split(" "); } }catch(Exception e){ System.err.println(e); } } }
Main.java:10: error: cannot find symbol HashMap<String, OriginalSet> setsEnvironment; ^ symbol: class OriginalSet location: class Main Main.java:11: error: cannot find symbol OriginalSet setU; ^ symbol: class OriginalSet location: class Main Main.java:7: error: cannot find symbol (new Main_()).sets(); ^ symbol: class Main_ location: class Main Main.java:17: error: cannot find symbol setsEnvironment = new HashMap<String, OriginalSet>(); ^ symbol: class OriginalSet location: class Main Main.java:19: error: cannot find symbol setU = new OriginalSet(); ^ symbol: class OriginalSet location: class Main 5 errors
s776354884
p00594
Java
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.HashMap; class Main{ public static void main(String args[]){ (new Main_()).sets(); } HashMap<String, OriginalSet> setsEnvironment; OriginalSet setU; void sets(){ // 標準入力準備 BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str = new String(); setsEnvironment = new HashMap<String, OriginalSet>(); setU = new OriginalSet(); // 集合定義のためのハッシュ try{ while((str = br.readLine()) != null){ int n = Integer.parseInt(str); if(n == 0) return; str = br.readLine(); String array[] = str.split(" "); } }catch(Exception e){ System.err.println(e); } } }
Main.java:10: error: cannot find symbol HashMap<String, OriginalSet> setsEnvironment; ^ symbol: class OriginalSet location: class Main Main.java:11: error: cannot find symbol OriginalSet setU; ^ symbol: class OriginalSet location: class Main Main.java:7: error: cannot find symbol (new Main_()).sets(); ^ symbol: class Main_ location: class Main Main.java:17: error: cannot find symbol setsEnvironment = new HashMap<String, OriginalSet>(); ^ symbol: class OriginalSet location: class Main Main.java:19: error: cannot find symbol setU = new OriginalSet(); ^ symbol: class OriginalSet location: class Main 5 errors
s032129684
p00594
Java
import java.io.*; import java.util.*; public class p1008yet { public static void main(String[] args) { Scanner s = new Scanner(System.in); //BufferedReader r = new BufferedReader(new InputStreamReader(System.in)); try { int A_size; while(true){ /* input from here */ A_size = s.nextInt(); long[] A = new long[A_size]; if(A_size==0){ break; } else if(A_size==1){ System.out.println(s.nextInt()); continue; } else { for(int i=0;i<A_size;i++){ A[i] = s.nextInt(); } } /* input till here */ /* processing from here */ Arrays.sort(A); /* processing till here */ /* output */ boolean nosol = true; int count = 1; for(int i=0;i<A_size-1;i++){ if(A[i]==A[i+1]){ count++; if(count>A_size/2){ System.out.println(A[i]); nosol = false; break; } } else { count = 1; if(i>A_size/2){ break; } } } if(nosol){ System.out.println("NO COLOR"); } } } catch (Exception e) { e.printStackTrace(); } finally { s.close(); } } }
Main.java:4: error: class p1008yet is public, should be declared in a file named p1008yet.java public class p1008yet { ^ 1 error
s194871186
p00594
C
#include<stdio.h> imt a[1000000]; int main(void){ int n; int i,j; while(scanf("%d",&n),n){ for(i=0;i<n;i++){ scanf("%d",&a[i]); } qsort } return 0;}
main.c:2:1: error: unknown type name 'imt'; did you mean 'int'? 2 | imt a[1000000]; | ^~~ | int main.c: In function 'main': main.c:10:1: error: 'qsort' undeclared (first use in this function) 10 | qsort | ^~~~~ main.c:10:1: note: each undeclared identifier is reported only once for each function it appears in main.c:10:6: error: expected ';' before '}' token 10 | qsort | ^ | ; 11 | } | ~
s153228928
p00594
C
#include<stdio.h> imt a[1000000]; int cmp(const void *a,const void *b){ return (int *)b-(int *)a; } int main(void){ int n,m,k; int i,j; while(scanf("%d",&n),n){ m=0; for(i=0;i<n;i++){ scanf("%d",&a[i]); } qsort(a,0,n-1,cmp); for(i=0;i<n;i++){ for(j=i+1;j<n;j++){ if(a[i]!=b[i]){ if(m<j-i){ m=j-i; k=a[i]; } i=j-1; break; } } } if(n/2<m)printf("%d\n",k); else puts("NO COLOR"); } return 0;}
main.c:2:1: error: unknown type name 'imt'; did you mean 'int'? 2 | imt a[1000000]; | ^~~ | int main.c: In function 'main': main.c:14:1: error: implicit declaration of function 'qsort' [-Wimplicit-function-declaration] 14 | qsort(a,0,n-1,cmp); | ^~~~~ main.c:17:10: error: 'b' undeclared (first use in this function) 17 | if(a[i]!=b[i]){ | ^ main.c:17:10: note: each undeclared identifier is reported only once for each function it appears in
s880093752
p00594
C
#include<stdio.h> int a[1000000]; int cmp(const void *a,const void *b){ return (int *)b-(int *)a; } int main(void){ int n,m,k; int i,j; while(scanf("%d",&n),n){ m=0; for(i=0;i<n;i++){ scanf("%d",&a[i]); } qsort(a,0,n-1,cmp); for(i=0;i<n;i++){ for(j=i+1;j<n;j++){ if(a[i]!=b[i]){ if(m<j-i){ m=j-i; k=a[i]; } i=j-1; break; } } } if(n/2<m)printf("%d\n",k); else puts("NO COLOR"); } return 0;}
main.c: In function 'main': main.c:14:1: error: implicit declaration of function 'qsort' [-Wimplicit-function-declaration] 14 | qsort(a,0,n-1,cmp); | ^~~~~ main.c:17:10: error: 'b' undeclared (first use in this function) 17 | if(a[i]!=b[i]){ | ^ main.c:17:10: note: each undeclared identifier is reported only once for each function it appears in
s591015374
p00594
C++
#include <cstdio> #include <algorithm> using namespace std; struct NUM { int color; int num; }; NUM array[1000000]; int main() { int n; int m = 0; int maxi = 0; while (scanf("%d", &n), n){ memset(array, 0, sizeof(array)); for (int i = 0; i < n; i++){ int a; scanf("%d", &a); bool f = false; for (int j = 0; j < m; j++){ if (array[j].color == a){ array[j].num++; if (array[maxi].num < array[j].num){ maxi = j; } f = true; break; } } if (f == false){ array[m].color = a; array[m].num = 1; m++; } } bool f = false; for (int i = 0; i < m; i++){ if (array[i].num > n / 2){ // printf("%d %d\n", m, array[i].num); printf("%d\n", array[i].color); f = true; break; } } if (f == false){ puts("NO COLOR"); } } return 0; }
a.cc: In function 'int main()': a.cc:19:24: error: reference to 'array' is ambiguous 19 | memset(array, 0, sizeof(array)); | ^~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from a.cc:2: /usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array' 99 | struct array; | ^~~~~ a.cc:11:5: note: 'NUM array [1000000]' 11 | NUM array[1000000]; | ^~~~~ a.cc:19:41: error: reference to 'array' is ambiguous 19 | memset(array, 0, sizeof(array)); | ^~~~~ /usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array' 99 | struct array; | ^~~~~ a.cc:11:5: note: 'NUM array [1000000]' 11 | NUM array[1000000]; | ^~~~~ a.cc:19:17: error: 'memset' was not declared in this scope 19 | memset(array, 0, sizeof(array)); | ^~~~~~ a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include <algorithm> +++ |+#include <cstring> 3 | using namespace std; a.cc:27:37: error: reference to 'array' is ambiguous 27 | if (array[j].color == a){ | ^~~~~ /usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array' 99 | struct array; | ^~~~~ a.cc:11:5: note: 'NUM array [1000000]' 11 | NUM array[1000000]; | ^~~~~ a.cc:28:41: error: reference to 'array' is ambiguous 28 | array[j].num++; | ^~~~~ /usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array' 99 | struct array; | ^~~~~ a.cc:11:5: note: 'NUM array [1000000]' 11 | NUM array[1000000]; | ^~~~~ a.cc:29:45: error: reference to 'array' is ambiguous 29 | if (array[maxi].num < array[j].num){ | ^~~~~ /usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array' 99 | struct array; | ^~~~~ a.cc:11:5: note: 'NUM array [1000000]' 11 | NUM array[1000000]; | ^~~~~ a.cc:29:63: error: reference to 'array' is ambiguous 29 | if (array[maxi].num < array[j].num){ | ^~~~~ /usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array' 99 | struct array; | ^~~~~ a.cc:11:5: note: 'NUM array [1000000]' 11 | NUM array[1000000]; | ^~~~~ a.cc:38:33: error: reference to 'array' is ambiguous 38 | array[m].color = a; | ^~~~~ /usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array' 99 | struct array; | ^~~~~ a.cc:11:5: note: 'NUM array [1000000]' 11 | NUM array[1000000]; | ^~~~~ a.cc:39:33: error: reference to 'array' is ambiguous 39 | array[m].num = 1; | ^~~~~ /usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array' 99 | struct array; | ^~~~~ a.cc:11:5: note: 'NUM array [1000000]' 11 | NUM array[1000000]; | ^~~~~ a.cc:46:29: error: reference to 'array' is ambiguous 46 | if (array[i].num > n / 2){ | ^~~~~ /usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array' 99 | struct array; | ^~~~~ a.cc:11:5: note: 'NUM array [1000000]' 11 | NUM array[1000000]; | ^~~~~ a.cc:48:48: error: reference to 'array' is ambiguous 48 | printf("%d\n", array[i].color); | ^~~~~ /usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array' 99 | struct array; | ^~~~~ a.cc:11:5: note: 'NUM array [1000000]' 11 | NUM array[1000000]; | ^~~~~
s268452388
p00594
C++
#include <cstdio> #include <algorithm> using namespace std; struct NUM { int color; int num; }; NUM array[1000000]; int main() { int n; int m = 0; int maxi = 0; while (scanf("%d", &n), n){ memset(array, 0, sizeof(array)); for (int i = 0; i < n; i++){ int a; scanf("%d", &a); bool f = false; for (int j = 0; j < m; j++){ if (array[j].color == a){ array[j].num++; if (array[maxi].num < array[j].num){ maxi = j; } f = true; break; } } if (f == false){ array[m].color = a; array[m].num = 1; m++; } } if (array[maxi].num > n / 2){ printf("%d\n", array[maxi].color); } else { puts("NO COLOR"); } } return 0; }
a.cc: In function 'int main()': a.cc:19:24: error: reference to 'array' is ambiguous 19 | memset(array, 0, sizeof(array)); | ^~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from a.cc:2: /usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array' 99 | struct array; | ^~~~~ a.cc:11:5: note: 'NUM array [1000000]' 11 | NUM array[1000000]; | ^~~~~ a.cc:19:41: error: reference to 'array' is ambiguous 19 | memset(array, 0, sizeof(array)); | ^~~~~ /usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array' 99 | struct array; | ^~~~~ a.cc:11:5: note: 'NUM array [1000000]' 11 | NUM array[1000000]; | ^~~~~ a.cc:19:17: error: 'memset' was not declared in this scope 19 | memset(array, 0, sizeof(array)); | ^~~~~~ a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include <algorithm> +++ |+#include <cstring> 3 | using namespace std; a.cc:27:37: error: reference to 'array' is ambiguous 27 | if (array[j].color == a){ | ^~~~~ /usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array' 99 | struct array; | ^~~~~ a.cc:11:5: note: 'NUM array [1000000]' 11 | NUM array[1000000]; | ^~~~~ a.cc:28:41: error: reference to 'array' is ambiguous 28 | array[j].num++; | ^~~~~ /usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array' 99 | struct array; | ^~~~~ a.cc:11:5: note: 'NUM array [1000000]' 11 | NUM array[1000000]; | ^~~~~ a.cc:29:45: error: reference to 'array' is ambiguous 29 | if (array[maxi].num < array[j].num){ | ^~~~~ /usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array' 99 | struct array; | ^~~~~ a.cc:11:5: note: 'NUM array [1000000]' 11 | NUM array[1000000]; | ^~~~~ a.cc:29:63: error: reference to 'array' is ambiguous 29 | if (array[maxi].num < array[j].num){ | ^~~~~ /usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array' 99 | struct array; | ^~~~~ a.cc:11:5: note: 'NUM array [1000000]' 11 | NUM array[1000000]; | ^~~~~ a.cc:38:33: error: reference to 'array' is ambiguous 38 | array[m].color = a; | ^~~~~ /usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array' 99 | struct array; | ^~~~~ a.cc:11:5: note: 'NUM array [1000000]' 11 | NUM array[1000000]; | ^~~~~ a.cc:39:33: error: reference to 'array' is ambiguous 39 | array[m].num = 1; | ^~~~~ /usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array' 99 | struct array; | ^~~~~ a.cc:11:5: note: 'NUM array [1000000]' 11 | NUM array[1000000]; | ^~~~~ a.cc:44:21: error: reference to 'array' is ambiguous 44 | if (array[maxi].num > n / 2){ | ^~~~~ /usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array' 99 | struct array; | ^~~~~ a.cc:11:5: note: 'NUM array [1000000]' 11 | NUM array[1000000]; | ^~~~~ a.cc:45:40: error: reference to 'array' is ambiguous 45 | printf("%d\n", array[maxi].color); | ^~~~~ /usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array' 99 | struct array; | ^~~~~ a.cc:11:5: note: 'NUM array [1000000]' 11 | NUM array[1000000]; | ^~~~~
s721430011
p00594
C++
#include <iostream> #include <string> #include <sstream> #include <algorithm> #include <vector> #include <utility> #include <stack> #include <queue> #include <map> #include <set> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> using namespace std; #define rep(i,n) for(int i=0; i<(n); i++) #define repc(i,s,e) for(int i=(s); i<(e); i++) #define pb(n) push_back((n)) #define mp(n,m) make_pair((n),(m)) #define all(r) r.begin(),r.end() #define fi first #define se second typedef long long ll; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<ll> vl; typedef vector<vl> vll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int INF = 10000000; const int mod = 1e9 + 7; const double EPS = 1e-9; int main(){ int n, t, ans; while(cin>>n && n > 0){ map<int,int> mp; for(int i = 0; i < n; i++){ cin>>t; ++m[t]; } ans = -1; for(auto it = mp.begin(); it != mp.end(); ++it){ if(it->se*2>n) ans = it->fi; } if(ans == -1) cout<<"NO COLOR"<<endl; else cout<<ans<<endl; } }
a.cc: In function 'int main()': a.cc:46:27: error: 'm' was not declared in this scope 46 | ++m[t]; | ^
s706040584
p00594
C++
#include<iostream> #include<algorithm> using namespace std; typedef long long ll; ll n; ll a[1000010]; ll *p, *q; int main() { while (cin >> n, n) { ll res = 0, t, s, color; for (int i = 0; i < n;i++)scanf_s("%lld", &a[i]); sort(a, a + n); res = upper_bound(a, a + n, a[0]) - lower_bound(a, a + n, a[0]); for (p = &a[0]; upper_bound(a, a + n, *p) != a + n; ) { p = upper_bound(a, a + n, *p); s = upper_bound(a, a + n, *p) - lower_bound(a, a + n, *p); if (res < s) { res = s; color = *p; } } if (2 * res > n ) { cout << color << endl; } else cout << "NO COLOR" << endl; } }
a.cc: In function 'int main()': a.cc:13:43: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 13 | for (int i = 0; i < n;i++)scanf_s("%lld", &a[i]); | ^~~~~~~ | scanf
s786336893
p00594
C++
#include<iostream> #include<algorithm> using namespace std; typedef long long ll; ll n; ll a[1000010]; ll *p, *q; int main() { while (cin >> n, n) { ll res = 0, t, s, color; for (int i = 0; i < n;i++)scanf_s("%lld", &a[i]); sort(a, a + n); res = upper_bound(a, a + n, a[0]) - lower_bound(a, a + n, a[0]); for (p = &a[0]; upper_bound(a, a + n, *p) != a + n; ) { p = upper_bound(a, a + n, *p); s = upper_bound(a, a + n, *p) - lower_bound(a, a + n, *p); if (res < s) { res = s; color = *p; } } if (2 * res > n ) { cout << color << endl; } else cout << "NO COLOR" << endl; } }
a.cc: In function 'int main()': a.cc:13:43: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 13 | for (int i = 0; i < n;i++)scanf_s("%lld", &a[i]); | ^~~~~~~ | scanf
s046416349
p00594
C++
#include<iostream> #include<algorithm> using namespace std; typedef long long ll; ll n; ll a[1000010]; ll *p, *q; int main() { while (cin >> n, n) { ll res = 0, t, s, color; for (int i = 0; i < n;i++)scanf_s("%lld", &a[i]); sort(a, a + n); res = upper_bound(a, a + n, a[0]) - lower_bound(a, a + n, a[0]); for (p = &a[0]; upper_bound(a, a + n, *p) != a + n; ) { p = upper_bound(a, a + n, *p); s = upper_bound(a, a + n, *p) - lower_bound(a, a + n, *p); if (res < s) { res = s; color = *p; } } if (2 * res > n ) { cout << color << endl; } else cout << "NO COLOR" << endl; } }
a.cc: In function 'int main()': a.cc:13:43: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 13 | for (int i = 0; i < n;i++)scanf_s("%lld", &a[i]); | ^~~~~~~ | scanf
s572801364
p00594
C++
#include<iostream> #include<algorithm> using namespace std; typedef long long ll; ll n; ll a[1000010]; ll *p, *q; int main() { while (cin >> n, n) { ll res = 0, t, s, color; for (int i = 0; i < n;i++)scanf_s("%lld", &a[i]); sort(a, a + n); color = a[0]; t=res = upper_bound(a, a + n, a[0]) - lower_bound(a, a + n, a[0]); for (p = &a[0]; t < n; ) { p = upper_bound(a, a + n, *p); s = upper_bound(a, a + n, *p) - lower_bound(a, a + n, *p); t += upper_bound(a, a + n, *p) - lower_bound(a, a + n, *p); if (res < s) { res = s; color = *p; } } if (2 * res > n ) { cout << color << endl; } else cout << "NO COLOR" << endl; } }
a.cc: In function 'int main()': a.cc:13:43: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 13 | for (int i = 0; i < n;i++)scanf_s("%lld", &a[i]); | ^~~~~~~ | scanf
s634051537
p00594
C++
while 1: nums = int(input()) if nums != 0: d = {} stars = list(map(int,input().split())) for x in stars: if x not in d: d[x] = 1 else: d[x] += 1 key = list(d.keys()) val = list(d.values()) m = int(max(val)) if m > nums/2: res = key[val.index(m)] print(res) else: print("NO COLOR") else:break
a.cc:1:1: error: expected unqualified-id before 'while' 1 | while 1: | ^~~~~ a.cc:5:9: error: 'stars' does not name a type 5 | stars = list(map(int,input().split())) | ^~~~~
s839937303
p00594
C++
while 1: nums = int(input()) if nums != 0: d = {} stars = list(map(int,input().split())) for x in stars: if x not in d: d[x] = 1 else: d[x] += 1 key = list(d.keys()) val = list(d.values()) m = int(max(val)) if m > nums/2: res = key[val.index(m)] print(res) else: print("NO COLOR") else:break
a.cc:1:1: error: expected unqualified-id before 'while' 1 | while 1: | ^~~~~ a.cc:5:9: error: 'stars' does not name a type 5 | stars = list(map(int,input().split())) | ^~~~~
s142852170
p00594
C++
#include<stdio.h> #include<stdlib.h> #include<string.h> int getInt(){ int ret = 0, c; c = getchar(); while(!isdigit(c)) c = getchar(); while(isdigit(c)){ ret *= 10; ret += c - '0'; c = getchar(); } return ret; } #define mask (0x7F) int cnt[mask]; int main(){ int n, i; while(n = getInt()){ const int n2 = n / 2; memset(cnt, 0, sizeof(cnt)); for(i = 0; i < n; i++){ int a = getInt(); if(++cnt[a & mask] > n2){ printf("%d\n", a); for(++i; i < n; i++) getInt(); goto end; } } puts("NO COLOR"); end:; } return 0; }
a.cc: In function 'int getInt()': a.cc:8:10: error: 'isdigit' was not declared in this scope 8 | while(!isdigit(c)) c = getchar(); | ^~~~~~~ a.cc:9:9: error: 'isdigit' was not declared in this scope 9 | while(isdigit(c)){ | ^~~~~~~
s968062374
p00594
C++
#include<stdio.h> #include<stdlib.h> #include<string.h> int getInt(){ int ret = 0, c; c = getchar(); while(!isdigit(c)) c = getchar(); while(isdigit(c)){ ret *= 10; ret += c - '0'; c = getchar(); } return ret; } #define mask (0x7F) int cnt[mask]; int main(){ int n, i; while(n = getInt()){ const int n2 = n / 2; memset(cnt, 0, sizeof(cnt)); for(i = 0; i < n; i++){ int a = getInt(); if(++cnt[a & mask] > n2){ printf("%d\n", a); for(++i; i < n; i++) getInt(); goto end; } } puts("NO COLOR"); end:; } return 0; }
a.cc: In function 'int getInt()': a.cc:8:10: error: 'isdigit' was not declared in this scope 8 | while(!isdigit(c)) c = getchar(); | ^~~~~~~ a.cc:9:9: error: 'isdigit' was not declared in this scope 9 | while(isdigit(c)){ | ^~~~~~~
s432454622
p00594
C++
#include<stdio.h> #include<stdlib.h> #include<string.h> #define BUFF_SIZE 1024 char buffer[1024 * 1024]; int pos = 0; int end = 0; int mygetchar(){ if(pos == end){ int i; end = read(0, buffer, sizeof(buffer)); pos = 0; } return buffer[pos++]; } int getInt(){ int ret = 0, c; c = mygetchar(); while(!isdigit(c)) c = mygetchar(); while(isdigit(c)){ ret *= 10; ret += c - '0'; c = mygetchar(); } return ret; } #define mask (0x7F) int cnt[mask]; int main(){ int n, i; while(n = getInt()){ const int n2 = n / 2; memset(cnt, 0, sizeof(cnt)); for(i = 0; i < n; i++){ int a = getInt(); if(++cnt[a & mask] > n2){ printf("%d\n", a); for(++i; i < n; i++) getInt(); goto end; } } puts("NO COLOR"); end:; } return 0; }
a.cc: In function 'int mygetchar()': a.cc:13:11: error: 'read' was not declared in this scope; did you mean 'fread'? 13 | end = read(0, buffer, sizeof(buffer)); | ^~~~ | fread a.cc: In function 'int getInt()': a.cc:22:10: error: 'isdigit' was not declared in this scope 22 | while(!isdigit(c)) c = mygetchar(); | ^~~~~~~ a.cc:23:9: error: 'isdigit' was not declared in this scope 23 | while(isdigit(c)){ | ^~~~~~~
s543325863
p00594
C++
#include<stdio.h> #include<stdlib.h> #include<string.h> #define BUFF_SIZE 1024 char buffer[4 * 1024 * 1024]; int pos = 0; int end = 0; int mygetchar(){ if(pos == end){ end = read(0, buffer, sizeof(buffer)); pos = 0; } return buffer[pos++]; } __attribute__((always_inline)) int getInt(){ int ret = 0, c; c = mygetchar(); while(!isdigit(c)) c = mygetchar(); while(isdigit(c)){ ret *= 10; ret += c - '0'; c = mygetchar(); } return ret; } #define mask (0x7F) int main(){ int n, i; while(n = getInt()){ const int n2 = n / 2; int cnt[mask] = { 0 }; // memset(cnt, 0, sizeof(cnt)); for(i = 0; i < n; i++){ int a = getInt(); if(++cnt[a & mask] > n2){ printf("%d\n", a); for(++i; i < n; i++) getInt(); goto end; } } puts("NO COLOR"); end:; } return 0; }
a.cc: In function 'int mygetchar()': a.cc:12:11: error: 'read' was not declared in this scope; did you mean 'fread'? 12 | end = read(0, buffer, sizeof(buffer)); | ^~~~ | fread a.cc: In function 'int getInt()': a.cc:21:10: error: 'isdigit' was not declared in this scope 21 | while(!isdigit(c)) c = mygetchar(); | ^~~~~~~ a.cc:22:9: error: 'isdigit' was not declared in this scope 22 | while(isdigit(c)){ | ^~~~~~~ a.cc: At global scope: a.cc:18:36: warning: 'always_inline' function might not be inlinable unless also declared 'inline' [-Wattributes] 18 | __attribute__((always_inline)) int getInt(){ | ^~~~~~
s406260329
p00594
C++
#include<iostream> using namespace std; int main() { long long caseNum; while(cin>>caseNum) { if(caseNum == 0) break; else { int *table; table = (int *)malloc(10000000*sizeof(int)); memset(table,0,10000000); long long big = -100; long long small = 100; for(long i = 0;i < caseNum; i ++) { long long deal; cin>>deal; if(big < deal) big = deal; if(small > deal) small = deal; table[deal] ++; } long threadhold = caseNum / 2; //cout<<"t "<<threadhold<<endl; long j; for( j = small; j <= big; j ++) { //cout<<j<<" "<<table[j]<<endl; if(table[j] > threadhold) { cout<<j<<endl; break; } } if(j > big) { cout<<"NO COLOR"<<endl; } free(table); } } return 0; }
a.cc: In function 'int main()': a.cc:16:25: error: 'memset' was not declared in this scope 16 | memset(table,0,10000000); | ^~~~~~ a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include<iostream> +++ |+#include <cstring> 2 |
s197135633
p00594
C++
#include<iostream> #include<memory> using namespace std; int main() { long long caseNum; while(cin>>caseNum) { if(caseNum == 0) break; else { int *table; table = (int *)malloc(10000000*sizeof(int)); memset(table,0,10000000); long long big = -100; long long small = 100; for(long i = 0;i < caseNum; i ++) { long long deal; cin>>deal; if(big < deal) big = deal; if(small > deal) small = deal; table[deal] ++; } long threadhold = caseNum / 2; //cout<<"t "<<threadhold<<endl; long j; for( j = small; j <= big; j ++) { //cout<<j<<" "<<table[j]<<endl; if(table[j] > threadhold) { cout<<j<<endl; break; } } if(j > big) { cout<<"NO COLOR"<<endl; } free(table); } } return 0; }
a.cc: In function 'int main()': a.cc:17:25: error: 'memset' was not declared in this scope 17 | memset(table,0,10000000); | ^~~~~~ a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include<memory> +++ |+#include <cstring> 3 |
s674962468
p00594
C++
#include<iostream> #include<memory> #include<stdlib.h> using namespace std; int main() { long long caseNum; while(cin>>caseNum) { if(caseNum == 0) break; else { int *table; table = (int *)malloc(10000000*sizeof(int)); memset(table,0,10000000); long long big = -100; long long small = 100; for(long i = 0;i < caseNum; i ++) { long long deal; cin>>deal; if(big < deal) big = deal; if(small > deal) small = deal; table[deal] ++; } long threadhold = caseNum / 2; //cout<<"t "<<threadhold<<endl; long j; for( j = small; j <= big; j ++) { //cout<<j<<" "<<table[j]<<endl; if(table[j] > threadhold) { cout<<j<<endl; break; } } if(j > big) { cout<<"NO COLOR"<<endl; } free(table); } } return 0; }
a.cc: In function 'int main()': a.cc:18:25: error: 'memset' was not declared in this scope 18 | memset(table,0,10000000); | ^~~~~~ a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include<stdlib.h> +++ |+#include <cstring> 4 |
s424327545
p00594
C++
import java.util.Scanner; class Main{ public static void main(String args[]){ //(new Main()).universe(); Scanner scanner = new Scanner(System.in); try{ String str = new String(); while((str = scanner.next()) != null){ int n = Integer.parseInt(str); if(n == 0) return; //hashMap = new HashMap<Integer, Integer>(); //System.out.println(scanA(n)); for(int i = 0; i < n; i++){ scanner.next(); } } }catch(Exception e){ System.err.println(e); } } //HashMap<Integer, Integer> hashMap; void universe(){ Scanner scanner = new Scanner(System.in); try{ String str = new String(); while((str = scanner.next()) != null){ int n = Integer.parseInt(str); if(n == 0) return; //hashMap = new HashMap<Integer, Integer>(); //System.out.println(scanA(n)); for(int i = 0; i < n; i++){ scanner.next(); } } }catch(Exception e){ System.err.println(e); } } /* String scanA(int n){ Scanner scanner = new Scanner(System.in); for(int i = 0; i < n; i++){ Integer input_int = scanner.nextInt(); Integer map_value = hashMap.get(input_int); if(map_value != null){ map_value++; if(map_value > n/2) return "" + input_int; hashMap.put(input_int, map_value); }else{ hashMap.put(input_int, 1); } } return "NO COLOR"; } */ }
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.Scanner; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:4:15: error: expected ':' before 'static' 4 | public static void main(String args[]){ | ^~~~~~~ | : a.cc:4:33: error: 'String' has not been declared 4 | public static void main(String args[]){ | ^~~~~~ a.cc:69:2: error: expected ';' after class definition 69 | } | ^ | ; a.cc: In static member function 'static void Main::main(int*)': a.cc:6:17: error: 'Scanner' was not declared in this scope 6 | Scanner scanner = new Scanner(System.in); | ^~~~~~~ a.cc:9:25: error: 'String' was not declared in this scope 9 | String str = new String(); | ^~~~~~ a.cc:10:32: error: 'str' was not declared in this scope; did you mean 'std'? 10 | while((str = scanner.next()) != null){ | ^~~ | std a.cc:10:38: error: 'scanner' was not declared in this scope 10 | while((str = scanner.next()) != null){ | ^~~~~~~ a.cc:10:57: error: 'null' was not declared in this scope 10 | while((str = scanner.next()) != null){ | ^~~~ a.cc:11:41: error: 'Integer' was not declared in this scope 11 | int n = Integer.parseInt(str); | ^~~~~~~ a.cc:22:24: error: 'Exception' does not name a type 22 | }catch(Exception e){ | ^~~~~~~~~ a.cc:23:25: error: 'System' was not declared in this scope 23 | System.err.println(e); | ^~~~~~ a.cc:23:44: error: 'e' was not declared in this scope 23 | System.err.println(e); | ^ a.cc: In member function 'void Main::universe()': a.cc:30:17: error: 'Scanner' was not declared in this scope 30 | Scanner scanner = new Scanner(System.in); | ^~~~~~~ a.cc:33:25: error: 'String' was not declared in this scope 33 | String str = new String(); | ^~~~~~ a.cc:34:32: error: 'str' was not declared in this scope; did you mean 'std'? 34 | while((str = scanner.next()) != null){ | ^~~ | std a.cc:34:38: error: 'scanner' was not declared in this scope 34 | while((str = scanner.next()) != null){ | ^~~~~~~ a.cc:34:57: error: 'null' was not declared in this scope 34 | while((str = scanner.next()) != null){ | ^~~~ a.cc:35:41: error: 'Integer' was not declared in this scope 35 | int n = Integer.parseInt(str); | ^~~~~~~ a.cc:46:24: error: 'Exception' does not name a type 46 | }catch(Exception e){ | ^~~~~~~~~ a.cc:47:25: error: 'System' was not declared in this scope 47 | System.err.println(e); | ^~~~~~ a.cc:47:44: error: 'e' was not declared in this scope 47 | System.err.println(e); | ^
s961734480
p00595
Java
class Main { public static void main(String[] args) { try { Scanner scan = new Scanner(System.in); String str1 = scan.next(); String str2 = scan.next(); if(Integer.parseInt(str1)>10000 || Integer.parseInt(str2)>10000) { System.out.println("??°??????100000????????§??\?????????????????????"); } System.out.println(getGreatest(str1,str2)); } catch (Exception e) { e.printStackTrace(); } } private static int getGreatest(String a,String b) { int num1 = Integer.parseInt(a); int num2 = Integer.parseInt(b); int min_num = Math.min(num1, num2); for(int d = min_num; d>0; d--) { if(num1%d==0 && num2%d==0) { return d; } } return 0; } }
Main.java:9: error: illegal escape character System.out.println("?????????100000???????????\?????????????????????"); ^ 1 error
s376888245
p00595
Java
import java.io.*; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String str1 = scan.next(); String str2 = scan.next(); if(Integer.parseInt(str1)>10000 || Integer.parseInt(str2)>10000) { System.out.println("??°??????100000????????§??\?????????????????????"); } System.out.println(getGreatest(Integer.parseInt(str1),Integer.parseInt(str2))); } public static int getGreatest(int a,int b) { int r; if(a<b) { int temp = a; a = b; b = temp; } while(b>0) { r = a % b; a = b; b = r; return r; } return 0; }
Main.java:13: error: illegal escape character System.out.println("?????????100000???????????\?????????????????????"); ^ Main.java:39: error: reached end of file while parsing } ^ 2 errors