submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s272160737
p00064
C++
int main() { string str; unsigned int x, sum = 0; while (cin >> str) { for (string::size_type i = 0; i < str.length(); i++) { x = 0; while (isdigit(str[i])) { x = 10 * x + str[i] - '0'; i++; } if (x > 0) { sum += x; } } } cout << sum << '\n'; return 0; }
a.cc: In function 'int main()': a.cc:3:9: error: 'string' was not declared in this scope 3 | string str; | ^~~~~~ a.cc:6:16: error: 'cin' was not declared in this scope 6 | while (cin >> str) { | ^~~ a.cc:6:23: error: 'str' was not declared in this scope; did you mean 'std'? 6 | while (cin >> str) { | ^~~ | std a.cc:7:22: error: 'string' is not a class, namespace, or enumeration 7 | for (string::size_type i = 0; i < str.length(); i++) { | ^~~~~~ a.cc:7:47: error: 'i' was not declared in this scope 7 | for (string::size_type i = 0; i < str.length(); i++) { | ^ a.cc:9:32: error: 'isdigit' was not declared in this scope 9 | while (isdigit(str[i])) { | ^~~~~~~ a.cc:18:9: error: 'cout' was not declared in this scope 18 | cout << sum << '\n'; | ^~~~
s389986400
p00064
C++
using System; using System.Linq; public class Test { public static void Main() { int ans=0; while(true){ string str=Console.ReadLine(); if(str==null){break;} string bef=""; for(int i=0;i<str.Length;i++){ char u=str[i]; if(u=='0'||u=='1'||u=='2'||u=='3'||u=='4'||u=='5'||u=='6'||u=='7'||u=='8'||u=='9') {bef+=u;} else if(bef!=""){ ans+=int.Parse(bef); bef=""; } } if(bef!=""){ ans+=int.Parse(bef); bef=""; } } Console.WriteLine(ans); // your code goes here } }
a.cc:1:7: error: expected nested-name-specifier before 'System' 1 | using System; | ^~~~~~ a.cc:2:7: error: expected nested-name-specifier before 'System' 2 | using System.Linq; | ^~~~~~ a.cc:3:1: error: expected unqualified-id before 'public' 3 | public class Test | ^~~~~~
s170252216
p00064
C++
#include <iostream> #include <string> using namespace std; int main() { string str; int cnt; while(cin >> str){ int x = 0; for(int i = 0; i <= (int)str.size(); i++){ if('0' <= str[i] && str[i] <= '9'){ x = x * 10 + (str[i] - '0'); }else{ cnt += x; x = 0; } } } cout<<cnt<<endl; return 0; }
a.cc:10:25: error: extended character   is not valid in an identifier 10 | for(int i = 0; i <= (int)str.size(); i++){ | ^ a.cc:10:29: error: extended character   is not valid in an identifier 10 | for(int i = 0; i <= (int)str.size(); i++){ | ^ a.cc:10:33: error: extended character   is not valid in an identifier 10 | for(int i = 0; i <= (int)str.size(); i++){ | ^ a.cc:10:33: error: extended character   is not valid in an identifier a.cc:10:40: error: extended character   is not valid in an identifier 10 | for(int i = 0; i <= (int)str.size(); i++){ | ^ a.cc:10:58: error: extended character   is not valid in an identifier 10 | for(int i = 0; i <= (int)str.size(); i++){ | ^ a.cc:11:28: error: extended character   is not valid in an identifier 11 | if('0' <= str[i] && str[i] <= '9'){ | ^ a.cc:11:35: error: extended character   is not valid in an identifier 11 | if('0' <= str[i] && str[i] <= '9'){ | ^ a.cc:11:43: error: extended character   is not valid in an identifier 11 | if('0' <= str[i] && str[i] <= '9'){ | ^ a.cc:11:47: error: extended character   is not valid in an identifier 11 | if('0' <= str[i] && str[i] <= '9'){ | ^ a.cc:11:55: error: extended character   is not valid in an identifier 11 | if('0' <= str[i] && str[i] <= '9'){ | ^ a.cc:11:59: error: extended character   is not valid in an identifier 11 | if('0' <= str[i] && str[i] <= '9'){ | ^ a.cc:12:33: error: extended character   is not valid in an identifier 12 | x = x * 10 + (str[i] - '0'); | ^ a.cc:12:37: error: extended character   is not valid in an identifier 12 | x = x * 10 + (str[i] - '0'); | ^ a.cc: In function 'int main()': a.cc:10:29: error: '\U000030000' was not declared in this scope 10 | for(int i = 0; i <= (int)str.size(); i++){ | ^~~ a.cc:10:33: error: '\U00003000i\U00003000' was not declared in this scope; did you mean 'i '? 10 | for(int i = 0; i <= (int)str.size(); i++){ | ^~~~~ | i  a.cc:10:43: error: expected primary-expression before 'int' 10 | for(int i = 0; i <= (int)str.size(); i++){ | ^~~ a.cc:10:40: error: '\U00003000' was not declared in this scope; did you mean 'i '? 10 | for(int i = 0; i <= (int)str.size(); i++){ | ^~ | i  a.cc:10:47: error: expected ';' before 'str' 10 | for(int i = 0; i <= (int)str.size(); i++){ | ^~~ | ; a.cc:10:55: warning: ignoring return value of 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]', declared with attribute 'nodiscard' [-Wunused-result] 10 | for(int i = 0; i <= (int)str.size(); i++){ | ~~~~~~~~^~ In file included from /usr/include/c++/14/string:54, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/basic_string.h:1076:7: note: declared here 1076 | size() const _GLIBCXX_NOEXCEPT | ^~~~ a.cc:10:57: error: expected ')' before ';' token 10 | for(int i = 0; i <= (int)str.size(); i++){ | ~ ^ | ) a.cc:10:58: error: '\U00003000i' was not declared in this scope 10 | for(int i = 0; i <= (int)str.size(); i++){ | ^~~
s996869806
p00064
C++
#include <iostream> #include <string> using namespace std; int main() { string str; int cnt; while(cin >> str, 1){ int x = 0; for(int i = 0; i <= (int)str.size(); i++){ if('0' <= str[i] && str[i] <= '9'){ x = x * 10 + (str[i] - '0'); }else{ cnt += x; x = 0; } } } cout<<cnt<<endl; return 0; }
a.cc:10:25: error: extended character   is not valid in an identifier 10 | for(int i = 0; i <= (int)str.size(); i++){ | ^ a.cc:10:29: error: extended character   is not valid in an identifier 10 | for(int i = 0; i <= (int)str.size(); i++){ | ^ a.cc:10:33: error: extended character   is not valid in an identifier 10 | for(int i = 0; i <= (int)str.size(); i++){ | ^ a.cc:10:33: error: extended character   is not valid in an identifier a.cc:10:40: error: extended character   is not valid in an identifier 10 | for(int i = 0; i <= (int)str.size(); i++){ | ^ a.cc:10:58: error: extended character   is not valid in an identifier 10 | for(int i = 0; i <= (int)str.size(); i++){ | ^ a.cc:11:28: error: extended character   is not valid in an identifier 11 | if('0' <= str[i] && str[i] <= '9'){ | ^ a.cc:11:35: error: extended character   is not valid in an identifier 11 | if('0' <= str[i] && str[i] <= '9'){ | ^ a.cc:11:43: error: extended character   is not valid in an identifier 11 | if('0' <= str[i] && str[i] <= '9'){ | ^ a.cc:11:47: error: extended character   is not valid in an identifier 11 | if('0' <= str[i] && str[i] <= '9'){ | ^ a.cc:11:55: error: extended character   is not valid in an identifier 11 | if('0' <= str[i] && str[i] <= '9'){ | ^ a.cc:11:59: error: extended character   is not valid in an identifier 11 | if('0' <= str[i] && str[i] <= '9'){ | ^ a.cc:12:33: error: extended character   is not valid in an identifier 12 | x = x * 10 + (str[i] - '0'); | ^ a.cc:12:37: error: extended character   is not valid in an identifier 12 | x = x * 10 + (str[i] - '0'); | ^ a.cc: In function 'int main()': a.cc:10:29: error: '\U000030000' was not declared in this scope 10 | for(int i = 0; i <= (int)str.size(); i++){ | ^~~ a.cc:10:33: error: '\U00003000i\U00003000' was not declared in this scope; did you mean 'i '? 10 | for(int i = 0; i <= (int)str.size(); i++){ | ^~~~~ | i  a.cc:10:43: error: expected primary-expression before 'int' 10 | for(int i = 0; i <= (int)str.size(); i++){ | ^~~ a.cc:10:40: error: '\U00003000' was not declared in this scope; did you mean 'i '? 10 | for(int i = 0; i <= (int)str.size(); i++){ | ^~ | i  a.cc:10:47: error: expected ';' before 'str' 10 | for(int i = 0; i <= (int)str.size(); i++){ | ^~~ | ; a.cc:10:55: warning: ignoring return value of 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]', declared with attribute 'nodiscard' [-Wunused-result] 10 | for(int i = 0; i <= (int)str.size(); i++){ | ~~~~~~~~^~ In file included from /usr/include/c++/14/string:54, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/basic_string.h:1076:7: note: declared here 1076 | size() const _GLIBCXX_NOEXCEPT | ^~~~ a.cc:10:57: error: expected ')' before ';' token 10 | for(int i = 0; i <= (int)str.size(); i++){ | ~ ^ | ) a.cc:10:58: error: '\U00003000i' was not declared in this scope 10 | for(int i = 0; i <= (int)str.size(); i++){ | ^~~
s399750695
p00064
C++
#include <iostream> #include <string> using namespace std; int main() { string str; int count; while(cin >> str){ int x = 0; for(int i=0; i <= (int)str.size(); i++){ if("0" <= str[i] && str[i] <= "9"){ x = x * 10 + (str[i] - "0"); }else{ count += x; x = 0; } } } cout << count << endl; return 0; }
a.cc:10:29: error: extended character   is not valid in an identifier 10 | for(int i=0; i <= (int)str.size(); i++){ | ^ a.cc:10:29: error: extended character   is not valid in an identifier a.cc:10:36: error: extended character   is not valid in an identifier 10 | for(int i=0; i <= (int)str.size(); i++){ | ^ a.cc:10:54: error: extended character   is not valid in an identifier 10 | for(int i=0; i <= (int)str.size(); i++){ | ^ a.cc:11:28: error: extended character   is not valid in an identifier 11 | if("0" <= str[i] && str[i] <= "9"){ | ^ a.cc:11:35: error: extended character   is not valid in an identifier 11 | if("0" <= str[i] && str[i] <= "9"){ | ^ a.cc:11:43: error: extended character   is not valid in an identifier 11 | if("0" <= str[i] && str[i] <= "9"){ | ^ a.cc:11:47: error: extended character   is not valid in an identifier 11 | if("0" <= str[i] && str[i] <= "9"){ | ^ a.cc:11:55: error: extended character   is not valid in an identifier 11 | if("0" <= str[i] && str[i] <= "9"){ | ^ a.cc:11:59: error: extended character   is not valid in an identifier 11 | if("0" <= str[i] && str[i] <= "9"){ | ^ a.cc:12:33: error: extended character   is not valid in an identifier 12 | x = x * 10 + (str[i] - "0"); | ^ a.cc:12:37: error: extended character   is not valid in an identifier 12 | x = x * 10 + (str[i] - "0"); | ^ a.cc: In function 'int main()': a.cc:10:29: error: '\U00003000i\U00003000' was not declared in this scope 10 | for(int i=0; i <= (int)str.size(); i++){ | ^~~~~ a.cc:10:39: error: expected primary-expression before 'int' 10 | for(int i=0; i <= (int)str.size(); i++){ | ^~~ a.cc:10:36: error: '\U00003000' was not declared in this scope 10 | for(int i=0; i <= (int)str.size(); i++){ | ^~ a.cc:10:43: error: expected ';' before 'str' 10 | for(int i=0; i <= (int)str.size(); i++){ | ^~~ | ; a.cc:10:51: warning: ignoring return value of 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]', declared with attribute 'nodiscard' [-Wunused-result] 10 | for(int i=0; i <= (int)str.size(); i++){ | ~~~~~~~~^~ In file included from /usr/include/c++/14/string:54, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/basic_string.h:1076:7: note: declared here 1076 | size() const _GLIBCXX_NOEXCEPT | ^~~~ a.cc:10:53: error: expected ')' before ';' token 10 | for(int i=0; i <= (int)str.size(); i++){ | ~ ^ | ) a.cc:10:54: error: '\U00003000i' was not declared in this scope 10 | for(int i=0; i <= (int)str.size(); i++){ | ^~~
s973398421
p00064
C++
#include <iostream> #include <string> #include <stdlib.h> using namespace std; int main() { string memo; int num = 0; int temp; cin >> memo; for(int i = 0; i < memo.size(); i++) { if(memo[i] >= 48 && memo[i] <= 57) { temp = memo[i] - '0'; temp = temp * 10; temp += (memo[i+j] - '0'); } else { num += temp; temp = 0; } } cout << num << endl; return 0; }
a.cc: In function 'int main()': a.cc:17:23: error: 'j' was not declared in this scope 17 | temp += (memo[i+j] - '0'); | ^
s032406419
p00064
C++
bool isdigit(char c); int main(){ string str; while(cin >> str){ int num = 0; int ans = 0; for(int i=0; i<str.size(); ++i){ if(isdigit(str[i])){ if(isdigit(str[i-1])){ num *= 10; num += (int)(str[i]-'0'); }else if(isdigit(str[i])){ num += (int)(str[i]-'0'); } } if(!isdigit(str[i+1])){ ans += num; num = 0; } } cout << ans << endl; } return 0; } bool isdigit(char c){ switch(c){ case '0': return true; case '1': return true; case '2': return true; case '3': return true; case '4': return true; case '5': return true; case '6': return true; case '7': return true; case '8': return true; case '9': return true; default : return false; } }
a.cc: In function 'int main()': a.cc:4:3: error: 'string' was not declared in this scope 4 | string str; | ^~~~~~ a.cc:6:9: error: 'cin' was not declared in this scope 6 | while(cin >> str){ | ^~~ a.cc:6:16: error: 'str' was not declared in this scope; did you mean 'std'? 6 | while(cin >> str){ | ^~~ | std a.cc:27:4: error: 'cout' was not declared in this scope 27 | cout << ans << endl; | ^~~~ a.cc:27:19: error: 'endl' was not declared in this scope 27 | cout << ans << endl; | ^~~~
s362185714
p00064
C++
import java.util.*; import java.math.*; class Main{ public static void main(String args[]){ Scanner s=new Scanner(System.in); BigInteger ret=new BigInteger("0"); while(s.hasNext()){ String str=s.next(); String [] a=str.split("[^0-9]"); for(int i=0;i<a.length;i++){ if(a[i].length()>0)ret=ret.add(new BigInteger(a[i])); } } System.out.println(ret.toString()); } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.*; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:2:1: error: 'import' does not name a type 2 | import java.math.*; | ^~~~~~ a.cc:2: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:16:2: error: expected ';' after class definition 16 | } | ^ | ; a.cc: In static member function 'static void Main::main(int*)': a.cc:5:17: error: 'Scanner' was not declared in this scope 5 | Scanner s=new Scanner(System.in); | ^~~~~~~ a.cc:6:17: error: 'BigInteger' was not declared in this scope 6 | BigInteger ret=new BigInteger("0"); | ^~~~~~~~~~ a.cc:7:23: error: 's' was not declared in this scope 7 | while(s.hasNext()){ | ^ a.cc:8:25: error: 'String' was not declared in this scope 8 | String str=s.next(); | ^~~~~~ a.cc:9:33: error: expected primary-expression before ']' token 9 | String [] a=str.split("[^0-9]"); | ^ a.cc:10:39: error: 'a' was not declared in this scope 10 | for(int i=0;i<a.length;i++){ | ^ a.cc:11:52: error: 'ret' was not declared in this scope 11 | if(a[i].length()>0)ret=ret.add(new BigInteger(a[i])); | ^~~ a.cc:11:68: error: expected type-specifier before 'BigInteger' 11 | if(a[i].length()>0)ret=ret.add(new BigInteger(a[i])); | ^~~~~~~~~~ a.cc:14:17: error: 'System' was not declared in this scope 14 | System.out.println(ret.toString()); | ^~~~~~ a.cc:14:36: error: 'ret' was not declared in this scope 14 | System.out.println(ret.toString()); | ^~~
s843125058
p00064
C++
#include <cctype> #include <cstdlib> #include <iostream> #include <string> using namespace std; int main() { string s; cin>>s; int num=0; string tmp=""; for (int i=0; i<s.length(); i++) { if (isnum(s[i])) { tmp += s[i]; } else if (tmp != "") { num += atoi(tmp); tmp = ""; } } cout << num << endl; }
a.cc: In function 'int main()': a.cc:11:21: error: 'isnum' was not declared in this scope; did you mean 'num'? 11 | if (isnum(s[i])) { | ^~~~~ | num a.cc:14:37: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*' 14 | num += atoi(tmp); | ^~~ | | | std::string {aka std::__cxx11::basic_string<char>} In file included from /usr/include/c++/14/cstdlib:79, from a.cc:2: /usr/include/stdlib.h:105:30: note: initializing argument 1 of 'int atoi(const char*)' 105 | extern int atoi (const char *__nptr) | ~~~~~~~~~~~~^~~~~~
s022307847
p00064
C++
#include <cctype> #include <cstdlib> #include <iostream> #include <string> using namespace std; int main() { string s; cin>>s; int num=0; string tmp=""; for (int i=0; i<s.length(); i++) { if (isalnum(s[i])) { tmp += s[i]; } else if (tmp != "") { num += atoi((const char*)tmp); tmp = ""; } } cout << num << endl; }
a.cc: In function 'int main()': a.cc:14:37: error: invalid cast from type 'std::string' {aka 'std::__cxx11::basic_string<char>'} to type 'const char*' 14 | num += atoi((const char*)tmp); | ^~~~~~~~~~~~~~~~
s422504807
p00064
C++
include <stdio.h> #include <string.h> int main(){ char x[85]; int sum=0,y=0,ans=0,i,z[85]; while(scanf("%s",x)!=EOF){ for(i=0;i<strlen(x);i++){ z[i]=x[i]-'0'; } for(i=0;i<strlen(x);i++){ if(z[i]>=0 && z[i]<=9){ if(y==0&& z[i]>0){sum*=10;}sum+=z[i];y=0; }else{y=1; ans+=sum; sum=0;} } ans+=sum; } printf("%d\n",ans); return 0; }
a.cc:1:1: error: 'include' does not name a type 1 | include <stdio.h> | ^~~~~~~ a.cc: In function 'int main()': a.cc:6:7: error: 'scanf' was not declared in this scope 6 | while(scanf("%s",x)!=EOF){ | ^~~~~ a.cc:6:22: error: 'EOF' was not declared in this scope 6 | while(scanf("%s",x)!=EOF){ | ^~~ a.cc:3:1: note: 'EOF' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' 2 | #include <string.h> +++ |+#include <cstdio> 3 | int main(){ a.cc:7:11: error: 'strlen' was not declared in this scope 7 | for(i=0;i<strlen(x);i++){ | ^~~~~~ a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include <string.h> +++ |+#include <cstring> 3 | int main(){ a.cc:10:11: error: 'strlen' was not declared in this scope 10 | for(i=0;i<strlen(x);i++){ | ^~~~~~ a.cc:10:11: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' a.cc:17:1: error: 'printf' was not declared in this scope 17 | printf("%d\n",ans); | ^~~~~~ a.cc:17:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
s455153211
p00064
C++
#include <stdio.h> #include <string.h> int main(){ char x[1000]; while(scanf("%s",&x)!=EOF){ int sum=0,y=0,ans=0,i,z[1000]; while(scanf("%s",&x)!=EOF){ for(i=0;i<strlen(x);i++){ z[i]=x[i]-'0'; } for(i=0;i<strlen(x);i++){ if(z[i]>=0 && z[i]<=9){ if(y==0){sum*=10;}sum+=z[i];y=0; }else{y=1; ans+=sum; sum=0;} } if(sum!=0){ ans+=sum;} } printf("%d\n",ans); return 0; }
a.cc: In function 'int main()': a.cc:21:2: error: expected '}' at end of input 21 | } | ^ a.cc:3:11: note: to match this '{' 3 | int main(){ | ^
s616624490
p00064
C++
#include <iostream> #include <string> #include <sstream> using namespace std; int main(){ string str="", sub; while(cin>>sub, !cin.eof()){ str+=sub; } str+='Z'; int key=0, tmp, n=str.size(); string s=""; for(int i=0; i<n; ++i){ if('0'<=str[i]&&str[i]<='9'){ s+=str[i]; } else if(s!=""){ stringstream ss(s); ss>>tmp; key+=tmp; s=""; } }
a.cc: In function 'int main()': a.cc:31:10: error: expected '}' at end of input 31 | } | ^ a.cc:7:11: note: to match this '{' 7 | int main(){ | ^
s000101411
p00064
C++
#include <iostream> #include <string> #include <cstdlib> using namespace std; int main() { size_t sum = 0; string s; while( cin >> s ) { for( auto it=s.cbegin(); it<s.cend(); ++it ) { if ( *it >= '0' && *it <= '9' ) { string t; t += *it; for( it=it+1; it < s.cend() && *it >= '0' && *it <= '9'; ++it ) t += *(it); sum += atoi( t.c_str() ); } } } cout << sum << endl; } #include <iostream> #include <string> #include <cstdlib> using namespace std; int main() { size_t sum = 0; string s; while( cin >> s ) { for( auto it=s.cbegin(); it<s.cend(); ++it ) { if ( *it >= '0' && *it <= '9' ) { string t; t += *it; for( it=it+1; it < s.cend() && *it >= '0' && *it <= '9'; ++it ) t += *(it); sum += atoi( t.c_str() ); } } } cout << sum << endl; } #include <iostream> #include <string> #include <cstdlib> using namespace std; int main() { size_t sum = 0; string s; while( cin >> s ) { for( auto it=s.cbegin(); it<s.cend(); ++it ) { if ( *it >= '0' && *it <= '9' ) { string t; t += *it; for( it=it+1; it < s.cend() && *it >= '0' && *it <= '9'; ++it ) t += *(it); sum += atoi( t.c_str() ); } } } cout << sum << endl; }
a.cc:32:5: error: redefinition of 'int main()' 32 | int main() | ^~~~ a.cc:7:5: note: 'int main()' previously defined here 7 | int main() | ^~~~ a.cc:57:5: error: redefinition of 'int main()' 57 | int main() | ^~~~ a.cc:7:5: note: 'int main()' previously defined here 7 | int main() | ^~~~
s864855473
p00064
C++
#include <iostream> #include <string> #include <cctype> using namespace std; int main(int argc, const char * argv[]) { int snum = 0; int stuck = 0; string slit; while(cin >> slit){ for (int i = 0; i < (int)slit.length(); i++) { if (isnumber(slit[i])) { stuck *= 10; stuck += slit[i] - '0'; } if (!isnumber(slit[i + 1])) { snum += stuck; stuck = 0; } } } cout << snum << endl; return 0; }
a.cc: In function 'int main(int, const char**)': a.cc:13:17: error: 'isnumber' was not declared in this scope 13 | if (isnumber(slit[i])) { | ^~~~~~~~ a.cc:17:18: error: 'isnumber' was not declared in this scope 17 | if (!isnumber(slit[i + 1])) { | ^~~~~~~~
s591640441
p00064
C++
#include <iostream> #include <string> #include <cctype> using namespace std; int main(int argc, const char * argv[]) { int snum = 0; int stuck = 0; string slit; while(cin >> slit){ for (int i = 0; i < (int)slit.length(); i++) { if (isnumber(slit[i])) { stuck *= 10; stuck += slit[i] - '0'; } if (!isnumber(slit[i + 1])) { snum += stuck; stuck = 0; } } } cout << snum << endl; return 0; }
a.cc: In function 'int main(int, const char**)': a.cc:13:17: error: 'isnumber' was not declared in this scope 13 | if (isnumber(slit[i])) { | ^~~~~~~~ a.cc:17:18: error: 'isnumber' was not declared in this scope 17 | if (!isnumber(slit[i + 1])) { | ^~~~~~~~
s601935468
p00065
Java
package aoj; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Collections; public class aoj031 { public static void main(String[] args){ BigDecimal one = new BigDecimal("1.00"); int[] abo = {0,0,0,0}; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String tmp = null; int cup = 0; int mun = 0; int ter = 0; String[] rrr; int st = 0,sr = 0; double mon = 0; int syo=0,hisi=0; double aaaa = 1; int zixtusi = 0; int touri = 0; int i = 0; ArrayList<Integer> fas = new ArrayList<Integer>(); ArrayList<Integer> has = new ArrayList<Integer>(); ArrayList<Integer> las = new ArrayList<Integer>(); while(true){ while(true){ try { tmp = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } if(tmp.equals("")){ break; } String[] sprit = tmp.split(",",0); fas.add(Integer.parseInt(sprit[0])); } while(true){ try { tmp = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } if(tmp.equals("")){ break; } String[] sprit = tmp.split(",",0); has.add(Integer.parseInt(sprit[0])); } for(i=0;i<fas.size();i++){ for(int j=0;j<has.size();j++){ if(fas.get(i) == has.get(j)){ int k = 0; for(k=0;k<las.size();k++){ if(las.get(k) == fas.get(i)){ k = 1000000; break; } } if(k != 1000000){ las.add(fas.get(i)); } } } } Collections.sort(las); int[] las2 = new int[las.size()]; for(i=0;i<fas.size();i++){ for(int j=0;j<las.size();j++){ if(fas.get(i) == las.get(j)){ las2[j]++; } } } for(i=0;i<has.size();i++){ for(int j=0;j<las.size();j++){ if(has.get(i) == las.get(j)){ las2[j]++; } } } for(i=0;i<las.size();i++){ System.out.println(las.get(i)+" "+las2[i]); } } } }
Main.java:10: error: class aoj031 is public, should be declared in a file named aoj031.java public class aoj031 { ^ 1 error
s596889881
p00065
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Collections; public class Main { public static void main(String[] args){ int i = 0; ArrayList<Integer> fas = new ArrayList<Integer>(); ArrayList<Integer> has = new ArrayList<Integer>(); ArrayList<Integer> las = new ArrayList<Integer>(); while(true){ while(true){ try { tmp = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } if(tmp.equals("")){ break; } String[] sprit = tmp.split(",",0); fas.add(Integer.parseInt(sprit[0])); } while(true){ try { tmp = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } if(tmp.equals("")){ break; } String[] sprit = tmp.split(",",0); has.add(Integer.parseInt(sprit[0])); } for(i=0;i<fas.size();i++){ for(int j=0;j<has.size();j++){ if(fas.get(i) == has.get(j)){ int k = 0; for(k=0;k<las.size();k++){ if(las.get(k) == fas.get(i)){ k = 1000000; break; } } if(k != 1000000){ las.add(fas.get(i)); } } } } Collections.sort(las); int[] las2 = new int[las.size()]; for(i=0;i<fas.size();i++){ for(int j=0;j<las.size();j++){ if(fas.get(i) == las.get(j)){ las2[j]++; } } } for(i=0;i<has.size();i++){ for(int j=0;j<las.size();j++){ if(has.get(i) == las.get(j)){ las2[j]++; } } } for(i=0;i<las.size();i++){ System.out.println(las.get(i)+" "+las2[i]); } } } }
Main.java:20: error: cannot find symbol tmp = br.readLine(); ^ symbol: variable tmp location: class Main Main.java:20: error: cannot find symbol tmp = br.readLine(); ^ symbol: variable br location: class Main Main.java:26: error: cannot find symbol if(tmp.equals("")){ ^ symbol: variable tmp location: class Main Main.java:30: error: cannot find symbol String[] sprit = tmp.split(",",0); ^ symbol: variable tmp location: class Main Main.java:38: error: cannot find symbol tmp = br.readLine(); ^ symbol: variable tmp location: class Main Main.java:38: error: cannot find symbol tmp = br.readLine(); ^ symbol: variable br location: class Main Main.java:44: error: cannot find symbol if(tmp.equals("")){ ^ symbol: variable tmp location: class Main Main.java:48: error: cannot find symbol String[] sprit = tmp.split(",",0); ^ symbol: variable tmp location: class Main 8 errors
s093024401
p00065
Java
import java.util.ArrayList; import java.util.Collections; public class Main { public static void main(String[] args){ int i = 0; ArrayList<Integer> fas = new ArrayList<Integer>(); ArrayList<Integer> has = new ArrayList<Integer>(); ArrayList<Integer> las = new ArrayList<Integer>(); while(true){ while(true){ try { tmp = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } if(tmp.equals("")){ break; } String[] sprit = tmp.split(",",0); fas.add(Integer.parseInt(sprit[0])); } while(true){ try { tmp = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } if(tmp.equals("")){ break; } String[] sprit = tmp.split(",",0); has.add(Integer.parseInt(sprit[0])); } for(i=0;i<fas.size();i++){ for(int j=0;j<has.size();j++){ if(fas.get(i) == has.get(j)){ int k = 0; for(k=0;k<las.size();k++){ if(las.get(k) == fas.get(i)){ k = 1000000; break; } } if(k != 1000000){ las.add(fas.get(i)); } } } } Collections.sort(las); int[] las2 = new int[las.size()]; for(i=0;i<fas.size();i++){ for(int j=0;j<las.size();j++){ if(fas.get(i) == las.get(j)){ las2[j]++; } } } for(i=0;i<has.size();i++){ for(int j=0;j<las.size();j++){ if(has.get(i) == las.get(j)){ las2[j]++; } } } for(i=0;i<las.size();i++){ System.out.println(las.get(i)+" "+las2[i]); } } } }
Main.java:16: error: cannot find symbol tmp = br.readLine(); ^ symbol: variable tmp location: class Main Main.java:16: error: cannot find symbol tmp = br.readLine(); ^ symbol: variable br location: class Main Main.java:17: error: cannot find symbol } catch (IOException e) { ^ symbol: class IOException location: class Main Main.java:22: error: cannot find symbol if(tmp.equals("")){ ^ symbol: variable tmp location: class Main Main.java:26: error: cannot find symbol String[] sprit = tmp.split(",",0); ^ symbol: variable tmp location: class Main Main.java:34: error: cannot find symbol tmp = br.readLine(); ^ symbol: variable tmp location: class Main Main.java:34: error: cannot find symbol tmp = br.readLine(); ^ symbol: variable br location: class Main Main.java:35: error: cannot find symbol } catch (IOException e) { ^ symbol: class IOException location: class Main Main.java:40: error: cannot find symbol if(tmp.equals("")){ ^ symbol: variable tmp location: class Main Main.java:44: error: cannot find symbol String[] sprit = tmp.split(",",0); ^ symbol: variable tmp location: class Main 10 errors
s191551436
p00065
Java
import java.util.ArrayList; import java.util.Collections; public class Main { public static void main(String[] args){ int i = 0; String tmp; ArrayList<Integer> fas = new ArrayList<Integer>(); ArrayList<Integer> has = new ArrayList<Integer>(); ArrayList<Integer> las = new ArrayList<Integer>(); while(true){ while(true){ try { tmp = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } if(tmp.equals("")){ break; } String[] sprit = tmp.split(",",0); fas.add(Integer.parseInt(sprit[0])); } while(true){ try { tmp = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } if(tmp.equals("")){ break; } String[] sprit = tmp.split(",",0); has.add(Integer.parseInt(sprit[0])); } for(i=0;i<fas.size();i++){ for(int j=0;j<has.size();j++){ if(fas.get(i) == has.get(j)){ int k = 0; for(k=0;k<las.size();k++){ if(las.get(k) == fas.get(i)){ k = 1000000; break; } } if(k != 1000000){ las.add(fas.get(i)); } } } } Collections.sort(las); int[] las2 = new int[las.size()]; for(i=0;i<fas.size();i++){ for(int j=0;j<las.size();j++){ if(fas.get(i) == las.get(j)){ las2[j]++; } } } for(i=0;i<has.size();i++){ for(int j=0;j<las.size();j++){ if(has.get(i) == las.get(j)){ las2[j]++; } } } for(i=0;i<las.size();i++){ System.out.println(las.get(i)+" "+las2[i]); } } } }
Main.java:16: error: cannot find symbol tmp = br.readLine(); ^ symbol: variable br location: class Main Main.java:17: error: cannot find symbol } catch (IOException e) { ^ symbol: class IOException location: class Main Main.java:34: error: cannot find symbol tmp = br.readLine(); ^ symbol: variable br location: class Main Main.java:35: error: cannot find symbol } catch (IOException e) { ^ symbol: class IOException location: class Main 4 errors
s956468525
p00065
Java
import java.util.ArrayList; import java.util.Collections; public class Main { public static void main(String[] args){ int i = 0; String tmp; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ArrayList<Integer> fas = new ArrayList<Integer>(); ArrayList<Integer> has = new ArrayList<Integer>(); ArrayList<Integer> las = new ArrayList<Integer>(); while(true){ while(true){ try { tmp = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } if(tmp.equals("")){ break; } String[] sprit = tmp.split(",",0); fas.add(Integer.parseInt(sprit[0])); } while(true){ try { tmp = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } if(tmp.equals("")){ break; } String[] sprit = tmp.split(",",0); has.add(Integer.parseInt(sprit[0])); } for(i=0;i<fas.size();i++){ for(int j=0;j<has.size();j++){ if(fas.get(i) == has.get(j)){ int k = 0; for(k=0;k<las.size();k++){ if(las.get(k) == fas.get(i)){ k = 1000000; break; } } if(k != 1000000){ las.add(fas.get(i)); } } } } Collections.sort(las); int[] las2 = new int[las.size()]; for(i=0;i<fas.size();i++){ for(int j=0;j<las.size();j++){ if(fas.get(i) == las.get(j)){ las2[j]++; } } } for(i=0;i<has.size();i++){ for(int j=0;j<las.size();j++){ if(has.get(i) == las.get(j)){ las2[j]++; } } } for(i=0;i<las.size();i++){ System.out.println(las.get(i)+" "+las2[i]); } } } }
Main.java:8: error: cannot find symbol BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class BufferedReader location: class Main Main.java:8: error: cannot find symbol BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class BufferedReader location: class Main Main.java:8: error: cannot find symbol BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class InputStreamReader location: class Main Main.java:18: error: cannot find symbol } catch (IOException e) { ^ symbol: class IOException location: class Main Main.java:36: error: cannot find symbol } catch (IOException e) { ^ symbol: class IOException location: class Main 5 errors
s021446259
p00065
Java
import java.util.ArrayList; import java.util.Collections; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args){ int i = 0; String tmp; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ArrayList<Integer> fas = new ArrayList<Integer>(); ArrayList<Integer> has = new ArrayList<Integer>(); ArrayList<Integer> las = new ArrayList<Integer>(); while(true){ while(true){ try { tmp = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } if(tmp.equals("")){ break; } String[] sprit = tmp.split(",",0); fas.add(Integer.parseInt(sprit[0])); } while(true){ try { tmp = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } if(tmp.equals("")){ break; } String[] sprit = tmp.split(",",0); has.add(Integer.parseInt(sprit[0])); } for(i=0;i<fas.size();i++){ for(int j=0;j<has.size();j++){ if(fas.get(i) == has.get(j)){ int k = 0; for(k=0;k<las.size();k++){ if(las.get(k) == fas.get(i)){ k = 1000000; break; } } if(k != 1000000){ las.add(fas.get(i)); } } } } Collections.sort(las); int[] las2 = new int[las.size()]; for(i=0;i<fas.size();i++){ for(int j=0;j<las.size();j++){ if(fas.get(i) == las.get(j)){ las2[j]++; } } } for(i=0;i<has.size();i++){ for(int j=0;j<las.size();j++){ if(has.get(i) == las.get(j)){ las2[j]++; } } } for(i=0;i<las.size();i++){ System.out.println(las.get(i)+" "+las2[i]); } } } }
Main.java:26: error: variable tmp might not have been initialized if(tmp.equals("")){ ^ 1 error
s968546421
p00065
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Collections; public class Main { public static void main(String[] args){ BigDecimal one = new BigDecimal("1.00"); int[] abo = {0,0,0,0}; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String tmp = null; int cup = 0; int mun = 0; int ter = 0; String[] rrr; int st = 0,sr = 0; double mon = 0; int syo=0,hisi=0; double aaaa = 1; int zixtusi = 0; int touri = 0; int i = 0; ArrayList<Integer> fas = new ArrayList<Integer>(); ArrayList<Integer> has = new ArrayList<Integer>(); ArrayList<Integer> las = new ArrayList<Integer>(); int counta=0; while(true){ while(true){ try { tmp = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } if(tmp.equals("")){ break; } } if(counta > 999){ break; } String[] sprit = tmp.split(",",0); fas.add(Integer.parseInt(sprit[0])); counta++; } counta=0; while(true){ try { tmp = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } if(tmp.equals("")){ break; } if(counta > 999){ break; } String[] sprit = tmp.split(",",0); has.add(Integer.parseInt(sprit[0])); counta++; } for(i=0;i<fas.size();i++){ for(int j=0;j<has.size();j++){ if(fas.get(i) == has.get(j)){ int k = 0; for(k=0;k<las.size();k++){ if(las.get(k) == fas.get(i)){ k = 1000000; break; } } if(k != 1000000){ las.add(fas.get(i)); } } } } Collections.sort(las); int[] las2 = new int[las.size()]; for(i=0;i<fas.size();i++){ for(int j=0;j<las.size();j++){ if(fas.get(i) == las.get(j)){ las2[j]++; } } } for(i=0;i<has.size();i++){ for(int j=0;j<las.size();j++){ if(has.get(i) == las.get(j)){ las2[j]++; } } } for(i=0;i<las.size();i++){ System.out.println(las.get(i)+" "+las2[i]); } } } }
Main.java:130: error: class, interface, enum, or record expected } ^ 1 error
s303913238
p00065
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; public class Main { public static void main(String[] args){ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String tmp = null; int i = 0; ArrayList<Integer> fas = new ArrayList<Integer>(); ArrayList<Integer> has = new ArrayList<Integer>(); ArrayList<Integer> las = new ArrayList<Integer>(); int counta=0; while(true){ while(true){ try { tmp = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } if(tmp.equals("")){ break; } if(tmp.length() < 2){ break; } if(counta > 999){ break; } String[] sprit = tmp.split(",",0); fas.add(Integer.parseInt(sprit[0])); counta++; } counta=0; while(true){ try { tmp = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } if(tmp == null){ break; } return; if(tmp.equals("")){ break; } if(tmp.length() < 2){ break; } if(counta > 999){ break; } String[] sprit = tmp.split(",",0); has.add(Integer.parseInt(sprit[0])); counta++; } // // for(i=0;i<fas.size();i++){ // for(int j=0;j<has.size();j++){ // // if(fas.get(i) == has.get(j)){ // int k = 0; // for(k=0;k<las.size();k++){ // if(las.get(k) == fas.get(i)){ // k = 1000000; // break; // } // } // if(k != 1000000){ // las.add(fas.get(i)); // } // } // // } // } // // Collections.sort(las); // // // int[] las2 = new int[las.size()]; // // for(i=0;i<fas.size();i++){ // for(int j=0;j<las.size();j++){ // // if(fas.get(i) == las.get(j)){ // las2[j]++; // } // } // } // // for(i=0;i<has.size();i++){ // for(int j=0;j<las.size();j++){ // // if(has.get(i) == las.get(j)){ // las2[j]++; // } // } // } // // for(i=0;i<las.size();i++){ // System.out.println(las.get(i)+" "+las2[i]); // } } } }
Main.java:58: error: unreachable statement if(tmp.equals("")){ ^ 1 error
s924836657
p00065
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; public class Main { public static void main(String[] args){ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String tmp = null; int i = 0; ArrayList<Integer> fas = new ArrayList<Integer>(); ArrayList<Integer> has = new ArrayList<Integer>(); ArrayList<Integer> las = new ArrayList<Integer>(); int counta=0; while(true){ while(true){ try { tmp = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } if(tmp.equals("")){ break; } if(tmp.length() < 2){ break; } if(counta > 999){ break; } String[] sprit = tmp.split(",",0); fas.add(Integer.parseInt(sprit[0])); counta++; } counta=0; while(true){ try { //tmp = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } if(tmp == null){ break; } //if(tmp.equals("")){ // break; //} if(tmp.length() < 2){ break; } if(counta > 999){ break; } String[] sprit = tmp.split(",",0); has.add(Integer.parseInt(sprit[0])); counta++; } // // for(i=0;i<fas.size();i++){ // for(int j=0;j<has.size();j++){ // // if(fas.get(i) == has.get(j)){ // int k = 0; // for(k=0;k<las.size();k++){ // if(las.get(k) == fas.get(i)){ // k = 1000000; // break; // } // } // if(k != 1000000){ // las.add(fas.get(i)); // } // } // // } // } // // Collections.sort(las); // // // int[] las2 = new int[las.size()]; // // for(i=0;i<fas.size();i++){ // for(int j=0;j<las.size();j++){ // // if(fas.get(i) == las.get(j)){ // las2[j]++; // } // } // } // // for(i=0;i<has.size();i++){ // for(int j=0;j<las.size();j++){ // // if(has.get(i) == las.get(j)){ // las2[j]++; // } // } // } // // for(i=0;i<las.size();i++){ // System.out.println(las.get(i)+" "+las2[i]); // } } } }
Main.java:49: error: exception IOException is never thrown in body of corresponding try statement } catch (IOException e) { ^ 1 error
s611218729
p00065
Java
s = Hash.new nums = Array.new while (line = gets) != "\n" do num,=line.split(",").map(&:to_i) s[num]||=0 s[num]+=1 end while line = gets do num,=line.split(",").map(&:to_i) next unless s[num] nums << num s[num]+=1 end nums.sort! nums.each{|n| puts n.to_s+" "+s[n].to_s }
Main.java:1: error: class, interface, enum, or record expected s = Hash.new ^ 1 error
s606584829
p00065
Java
import java.util.*; public class test { static List<Integer> sengetu = new ArrayList<Integer>(); static List<Integer> result = new ArrayList<Integer>(); static boolean hantei(int n){ for(int i=0;i<sengetu.size();i++)if(n==sengetu.get(i))return true; return false; } static boolean hantei2(int n){ for(int i=0;i<result.size();i++)if(n==result.get(i))return true; return false; } public static void main(String[] args) { Scanner in = new Scanner(System.in); boolean sw=false; Map<Integer,Integer> m = new HashMap<Integer,Integer>();//数をカウント while(in.hasNext()){ String input = in.nextLine(); if(input.length()==0){ sw=true; continue; } String data[] = input.split(","); int ban=Integer.parseInt(data[0]); int num=Integer.parseInt(data[1]); if(m.containsKey(ban)){ m.put(ban,m.get(ban)+1); }else m.put(ban,1); if(!sw)if(!hantei(ban))sengetu.add(ban); if(sw)if(hantei(ban))if(!hantei2(ban))result.add(ban); } Collections.sort(result); for(int i=0;i<result.size();i++)System.out.println(result.get(i)+" "+m.get(result.get(i))); } }
Main.java:2: error: class test is public, should be declared in a file named test.java public class test { ^ 1 error
s928835080
p00065
C
#include <stdio.h> #include <string.h> int p[10010],n[10010]; int main(){ char line[100]; int a,b; int flag=1; int i; while(gets(line)!=NULL){ if(line[0]=='\n')flag=0; else{ sscanf(line,"%d,%d",&a,&b); if(flag)p[a]++; else n[a]++; } } for(int i=0; i<10010; i++){ if(p[i]>0&&n[i]>0){ printf("%d %d\n",i,p[i]+n[i]); } } return 0; }
main.c: In function 'main': main.c:12:15: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration] 12 | while(gets(line)!=NULL){ | ^~~~ | fgets main.c:12:25: warning: comparison between pointer and integer 12 | while(gets(line)!=NULL){ | ^~
s036445513
p00065
C
include<stdio.h> void swap(int *a,int *b){ int t=*a; *a=*b; *b=t; } int main(){ int a,b,x[2000],y[2000],z[2000],s[2000],i=0,j,k=0; while(scanf("%d,%d",&a,&b)!=EOF){ for(j=0;j<i;j++) if(x[j]==a){ y[j]++; break; } if(j==i){ x[i]=a; y[i++]=1; } } while(scanf("%d,%d",&a,&b)!=EOF){ for(j=0;j<k;j++) if(z[j]==a) s[j]++; for(j=0;j<i;j++) if(x[j]==a){ z[k]=a; s[k++]=y[j]+1; break; } } for(j=0;j<k;j++) if(z[j]>z[j+1]){ swap(&z[j],&z[j+1]); swap(&s[j],&s[i+1]); } for(j=0;j<k;j++) printf("%d %d\n",z[j],s[j]); return 0; }
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token 1 | include<stdio.h> | ^ main.c: In function 'main': main.c:9:23: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 9 | while(scanf("%d,%d",&a,&b)!=EOF){ | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | include<stdio.h> main.c:9:23: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 9 | while(scanf("%d,%d",&a,&b)!=EOF){ | ^~~~~ main.c:9:23: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:9:45: error: 'EOF' undeclared (first use in this function) 9 | while(scanf("%d,%d",&a,&b)!=EOF){ | ^~~ main.c:9:45: note: 'EOF' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>' main.c:9:45: note: each undeclared identifier is reported only once for each function it appears in main.c:20:23: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 20 | while(scanf("%d,%d",&a,&b)!=EOF){ | ^~~~~ main.c:20:23: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:33:33: error: implicit declaration of function 'swap' [-Wimplicit-function-declaration] 33 | swap(&z[j],&z[j+1]); | ^~~~ main.c:37:25: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 37 | printf("%d %d\n",z[j],s[j]); | ^~~~~~ main.c:37:25: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:37:25: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:37:25: note: include '<stdio.h>' or provide a declaration of 'printf'
s804160918
p00065
C
include<stdio.h> void swap(int *a,int *b){ int t=*a; *a=*b; *b=t; } int main(){ int a,b,x[2000],y[2000],z[2000],s[2000],i=0,j,k=0; while(scanf("%d,%d",&a,&b)!=EOF){ for(j=0;j<i;j++) if(x[j]==a){ y[j]++; break; } if(j==i){ x[i]=a; y[i++]=1; } } while(scanf("%d,%d",&a,&b)!=EOF){ for(j=0;j<k;j++) if(z[j]==a) s[j]++; for(j=0;j<i;j++) if(x[j]==a){ z[k]=a; s[k++]=y[j]+1; break; } } for(j=0;j<k;j++) if(z[j]>z[j+1]){ swap(&z[j],&z[j+1]); swap(&s[j],&s[i+1]); } for(j=0;j<k;j++) printf("%d %d\n",z[j],s[j]); return 0; }
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token 1 | include<stdio.h> | ^ main.c: In function 'main': main.c:9:23: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 9 | while(scanf("%d,%d",&a,&b)!=EOF){ | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | include<stdio.h> main.c:9:23: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 9 | while(scanf("%d,%d",&a,&b)!=EOF){ | ^~~~~ main.c:9:23: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:9:45: error: 'EOF' undeclared (first use in this function) 9 | while(scanf("%d,%d",&a,&b)!=EOF){ | ^~~ main.c:9:45: note: 'EOF' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>' main.c:9:45: note: each undeclared identifier is reported only once for each function it appears in main.c:20:23: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 20 | while(scanf("%d,%d",&a,&b)!=EOF){ | ^~~~~ main.c:20:23: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:33:33: error: implicit declaration of function 'swap' [-Wimplicit-function-declaration] 33 | swap(&z[j],&z[j+1]); | ^~~~ main.c:37:25: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 37 | printf("%d %d\n",z[j],s[j]); | ^~~~~~ main.c:37:25: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:37:25: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:37:25: note: include '<stdio.h>' or provide a declaration of 'printf'
s536875385
p00065
C
#include <stdio.h> #include <stdlib.h> #define N 1000 int main( void ) { int i; char ch[ N ]; int comp[ N ][ 3 ]; // 使用未使用、顧客番号、カウント int num; for( i = 0; i < N; i++ ) comp[ i ][ 0 ] = comp[ i ][ 1 ] = comp[ i ][ 2 ] = 0; while( gets( ch ) ) { if( !*ch ) break; num = atoi( ch ); for( i = 0; i < N; i++ ) if( !comp[ i ][ 0 ] || // 未使用かどうか comp[ i ][ 1 ] == num ) { // 同じ顧客番号があるか comp[ i ][ 0 ] = 1; comp[ i ][ 1 ] = num; comp[ i ][ 2 ]++; break; } } while( gets( ch ) ) { num = atoi( ch ); for( i = 0; i < N; i++ ) if( !comp[ i ][ 0 ] || // 未使用かどうか comp[ i ][ 1 ] == num ) { // 同じ顧客番号があるか if( comp[ i ][ 0 ] ) comp[ i ][ 0 ] = 2; comp[ i ][ 1 ] = num; comp[ i ][ 2 ]++; break; } } while( 1 ) { int Min, MIn; // 最小値、最小値インデックス for( i = 0; i < N; i++ ) if( comp[ i ][ 0 ] == 2 ) break; if( i == N ) break; Min = comp[ i ][ 1 ]; MIn = i; for( i++ ; i < N; i++ ) if( comp[ i ][ 0 ] == 2 && Min > comp[ i ][ 1 ] ) { Min = comp[ i ][ 1 ]; MIn = i; } comp[ MIn ][ 0 ] = 0; printf( "%d %d\n", comp[ MIn ][ 1 ], comp[ MIn ][ 2 ] ); } return( 0 ); }
main.c: In function 'main': main.c:14:10: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration] 14 | while( gets( ch ) ) { | ^~~~ | fgets
s617911775
p00065
C++
#include <iostream> #include <cstdio> #include <vector> #include <cstdlib> #include <map> #include <utility> using namespace std; #define rep2(x,from,to) for(int x = (from); x < (to); ++(x)) #define rep(x,to) rep2(x,0,to) int main() { char s[10]; vector<int> v1; while(gets(s) && *s != '\0') { v1.push_back(atoi(s)); } vector<int> v2; while(cin >> s) { if(find(v1.begin(), v1.end(), atoi(s)) != v1.end()) { v2.push_back(atoi(s)); } } map<int, int> m; rep(i,v2.size()) { auto it = m.find(v2[i]); if(it == m.end()) { m.insert(make_pair(v2[i], 1)); } else { it->second++; } } rep(i,v1.size()) { auto it = m.find(v1[i]); if(it != m.end()) { it->second++; } } for(auto it = m.begin(); it != m.end(); ++it) { cout << (*it).first << " " << (*it).second << endl; } return 0; }
a.cc: In function 'int main()': a.cc:13:15: error: 'gets' was not declared in this scope; did you mean 'getw'? 13 | while(gets(s) && *s != '\0') { | ^~~~ | getw a.cc:18:24: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int)' 18 | if(find(v1.begin(), v1.end(), atoi(s)) != v1.end()) { | ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/bits/locale_facets.h:48, from /usr/include/c++/14/bits/basic_ios.h:37, from /usr/include/c++/14/ios:46, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)' 435 | find(istreambuf_iterator<_CharT> __first, | ^~~~ /usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: template argument deduction/substitution failed: a.cc:18:24: note: '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>' 18 | if(find(v1.begin(), v1.end(), atoi(s)) != v1.end()) { | ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s433273839
p00065
C++
#include <stdio.h> int main() { int f[3000] = {}, n[3000] = {}, k, d, t = 0; char s[100]; while(gets(s)){ if(s[0] == NULL) t++; else{ sscanf(s, "%d,%d", &k, &d); if(t == 0){ f[k]++; } else{ n[k]++; } } } int i = 0; for(i = 0; i < 3000; ++i){ if(n[i] && f[i]) printf("%d %d\n", i, n[i] + f[i]); } return 0; }
a.cc: In function 'int main()': a.cc:7:15: error: 'gets' was not declared in this scope; did you mean 'getw'? 7 | while(gets(s)){ | ^~~~ | getw a.cc:8:28: warning: NULL used in arithmetic [-Wpointer-arith] 8 | if(s[0] == NULL) | ^~~~
s278609632
p00065
C++
// ConsoleApplication1.cpp : ??????????????? ??¢????????±????????§????????¨????????? ????????????????????????????????? #include "stdafx.h" #include<iostream> #include<string> using namespace std; int main() { int ky[1000] = {}; int ny[1000] = {}; string s; while (cin>>s&&s.empty()) { int it=1; for (int i = 0;i<s.size();i++) { if (s[i] == ',') { it = i; break; } } string a, b; a = s.substr(0, it - 1); b = s.substr(it + 1, s.size() - 1); int c = stoi(a); int d = stoi(b); ky[c - 1]++; } while (cin >> s) { int it; for (int i = 0;i<s.size();i++) { if (s[i] == ',') { it = i; break; } } string a, b; a = s.substr(0, it - 1); b = s.substr(it + 1, s.size() - 1); int c = stoi(a); int d = stoi(b); ny[c - 1]++; } for (int i = 0;i<1000;i++) { if (ky[i] != 0 && ny[i] != 0)cout << i + 1 << ' ' << ky[i] + ny[i] << endl; } return 0; }
a.cc:2:10: fatal error: stdafx.h: No such file or directory 2 | #include "stdafx.h" | ^~~~~~~~~~ compilation terminated.
s433388288
p00065
C++
// ConsoleApplication1.cpp : ??????????????? ??¢????????±????????§????????¨????????? ????????????????????????????????? #include "stdafx.h" #include<iostream> #include<string> using namespace std; int main() { int ky[1000] = {}; int ny[1000] = {}; string s; while (cin>>s&&s.empty()) { int it=1; for (int i = 0;i<s.size();i++) { if (s[i] == ',') { it = i; break; } } string a; a = s.substr(0, it); int c = stoi(a); ky[c - 1]++; } string sa; while (cin >> sa) { int it; for (int i = 0;i<sa.size();i++) { if (sa[i] == ',') { it = i; break; } } string a; a = sa.substr(0, it); int c = stoi(a); ny[c - 1]++; } for (int i = 0;i<1000;i++) { if (ky[i] != 0 && ny[i] != 0)cout << i + 1 << ' ' << ky[i] + ny[i] << endl; } return 0; }
a.cc:2:10: fatal error: stdafx.h: No such file or directory 2 | #include "stdafx.h" | ^~~~~~~~~~ compilation terminated.
s215244587
p00065
C++
#include<iostream> #include<algorithm> #include<map> #include<vector> using namespace std; map<int,int> a; vector<int> b; int n,m; char z; int main(){ while(cin>>n>>z>>m){ if(a.find(n)==a.end())a.insert(n,1); else a[n]++; } while(cin>>n>>z>>m){ if(a.find(n)!=a.end())b.push_back(n); } sort(b.begin(),b.end()); for(int i=0;i<b.size();i++)cout<<n<<" "<<a[n]<<endl; return 0; }
In file included from /usr/include/c++/14/map:63, from a.cc:3: /usr/include/c++/14/bits/stl_map.h: In instantiation of 'void std::map<_Key, _Tp, _Compare, _Alloc>::insert(_InputIterator, _InputIterator) [with _InputIterator = int; _Key = int; _Tp = int; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, int> >]': a.cc:14:33: required from here 14 | if(a.find(n)==a.end())a.insert(n,1); | ~~~~~~~~^~~~~ /usr/include/c++/14/bits/stl_map.h:943:38: error: no matching function for call to 'std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int> >, std::less<int>, std::allocator<std::pair<const int, int> > >::_M_insert_range_unique(int&, int&)' 943 | { _M_t._M_insert_range_unique(__first, __last); } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/map:62: /usr/include/c++/14/bits/stl_tree.h:1096:9: note: candidate: 'template<class _InputIterator> std::__enable_if_t<((bool)std::is_same<_Val, typename std::iterator_traits<_InputIterator>::value_type>::value)> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_range_unique(_InputIterator, _InputIterator) [with _Key = int; _Val = std::pair<const int, int>; _KeyOfValue = std::_Select1st<std::pair<const int, int> >; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, int> >]' 1096 | _M_insert_range_unique(_InputIterator __first, _InputIterator __last) | ^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_tree.h:1096:9: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_tree.h: In substitution of 'template<class _InputIterator> std::__enable_if_t<((bool)std::is_same<std::pair<const int, int>, typename std::iterator_traits< <template-parameter-1-1> >::value_type>::value), void> std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int> >, std::less<int>, std::allocator<std::pair<const int, int> > >::_M_insert_range_unique(_InputIterator, _InputIterator) [with _InputIterator = int]': /usr/include/c++/14/bits/stl_map.h:943:31: required from 'void std::map<_Key, _Tp, _Compare, _Alloc>::insert(_InputIterator, _InputIterator) [with _InputIterator = int; _Key = int; _Tp = int; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, int> >]' 943 | { _M_t._M_insert_range_unique(__first, __last); } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ a.cc:14:33: required from here 14 | if(a.find(n)==a.end())a.insert(n,1); | ~~~~~~~~^~~~~ /usr/include/c++/14/bits/stl_tree.h:1095:58: error: no type named 'value_type' in 'struct std::iterator_traits<int>' 1095 | __enable_if_t<__same_value_type<_InputIterator>::value> | ^~~~~ /usr/include/c++/14/bits/stl_map.h: In instantiation of 'void std::map<_Key, _Tp, _Compare, _Alloc>::insert(_InputIterator, _InputIterator) [with _InputIterator = int; _Key = int; _Tp = int; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, int> >]': a.cc:14:33: required from here 14 | if(a.find(n)==a.end())a.insert(n,1); | ~~~~~~~~^~~~~ /usr/include/c++/14/bits/stl_tree.h:1105:9: note: candidate: 'template<class _InputIterator> std::__enable_if_t<((bool)(! std::is_same<_Val, typename std::iterator_traits<_InputIterator>::value_type>::value))> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_range_unique(_InputIterator, _InputIterator) [with _Key = int; _Val = std::pair<const int, int>; _KeyOfValue = std::_Select1st<std::pair<const int, int> >; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, int> >]' 1105 | _M_insert_range_unique(_InputIterator __first, _InputIterator __last) | ^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_tree.h:1105:9: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_tree.h: In substitution of 'template<class _InputIterator> std::__enable_if_t<((bool)(! std::is_same<std::pair<const int, int>, typename std::iterator_traits< <template-parameter-1-1> >::value_type>::value)), void> std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int> >, std::less<int>, std::allocator<std::pair<const int, int> > >::_M_insert_range_unique(_InputIterator, _InputIterator) [with _InputIterator = int]': /usr/include/c++/14/bits/stl_map.h:943:31: required from 'void std::map<_Key, _Tp, _Compare, _Alloc>::insert(_InputIterator, _InputIterator) [with _InputIterator = int; _Key = int; _Tp = int; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, int> >]' 943 | { _M_t._M_insert_range_unique(__first, __last); } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ a.cc:14:33: required from here 14 | if(a.find(n)==a.end())a.insert(n,1); | ~~~~~~~~^~~~~ /usr/include/c++/14/bits/stl_tree.h:1104:59: error: no type named 'value_type' in 'struct std::iterator_traits<int>' 1104 | __enable_if_t<!__same_value_type<_InputIterator>::value> | ^~~~~
s720796608
p00065
C++
#include<stdio.h> int main(void){ int c[1000] = { 0 }, d[100], count[3000], i = 0; while( scanf("%d,%d", &c[i], &d[i]) !=EOF ) { count[c[i]]++; i++; } n = i; for ( i = 0; i < n; i++ ) { if ( count) } }
a.cc: In function 'int main()': a.cc:8:5: error: 'n' was not declared in this scope 8 | n = i; | ^ a.cc:11:5: error: expected primary-expression before '}' token 11 | } | ^
s688046835
p00065
C++
#include<cstdio> #include<cstring> #include<map> using namespace std; int main(){ int id,d; map<int,int> lastm,currm; char buf[99]; while(gets(buf)&&strlen(buf)){ sscanf(buf,"%d,%d",&id,&d); lastm[id]++; } while(gets(buf)&&strlen(buf)){ sscanf(buf,"%d,%d",&id,&d); currm[id]++; } for(__typeof(lastm.begin()) i=lastm.begin(); i!=lastm.end(); i++){ if(currm[i->first]>0)cout<<i->first<<" "<<(i->second+currm[i->first])<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:9:15: error: 'gets' was not declared in this scope; did you mean 'getw'? 9 | while(gets(buf)&&strlen(buf)){ | ^~~~ | getw a.cc:13:15: error: 'gets' was not declared in this scope; did you mean 'getw'? 13 | while(gets(buf)&&strlen(buf)){ | ^~~~ | getw a.cc:18:38: error: 'cout' was not declared in this scope 18 | if(currm[i->first]>0)cout<<i->first<<" "<<(i->second+currm[i->first])<<endl; | ^~~~ a.cc:4:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 3 | #include<map> +++ |+#include <iostream> 4 | using namespace std; a.cc:18:88: error: 'endl' was not declared in this scope 18 | if(currm[i->first]>0)cout<<i->first<<" "<<(i->second+currm[i->first])<<endl; | ^~~~ a.cc:4:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 3 | #include<map> +++ |+#include <ostream> 4 | using namespace std;
s626680585
p00065
C++
#include <iostream> #include <sstream> #include <string> #include <vector> #include <deque> #include <stack> #include <queue> #include <set> #include <map> #include <bitset> #include <algorithm> #include <numeric> #include <complex> #include <functional> #include <utility> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <climits> #include <cctype> using namespace std; #define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl #define debug(n) cout<<__FILE__<<","<<__LINE__<<": # "<<#n<<"="<<(n)<<endl #define repi(i,a,b) for(int i=int(a);i<int(b);i++) #define rep(i,n) repi(i,0,n) #define iter(c) __typeof((c).begin()) #define tr(c,i) for(iter(c) i=(c).begin();i!=(c).end();i++) #define allof(c) (c).begin(),(c).end() #define mp make_pair typedef long long ll; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<string> vs; typedef pair<int,int> pii; int main() { map<int,int> data[2]; rep(i,2) for(char buf[100];gets(buf) && strlen(buf);){ int n; sscanf(buf,"%d,%*d",&n); data[i][n]++; } map<int,int> res; tr(data[0],i) if(data[1][i->first]) res[i->first]=i->second+data[1][i->first]; tr(res,i) cout<<i->first<<" "<<i->second<<endl; return 0; }
a.cc: In function 'int main()': a.cc:44:35: error: 'gets' was not declared in this scope; did you mean 'getw'? 44 | for(char buf[100];gets(buf) && strlen(buf);){ | ^~~~ | getw
s068308228
p00065
C++
int main() { map<int, int> num; map<int, int>::iterator it; int i; char c; char s[1000000]; while (cin.get(c)) { if (!isdigit(c)) { break; } i = 0; s[i++] = c; while ( cin.get(c) ) { if (!isdigit(c)) break; s[i++] = c; } s[i] = '\0'; num[atoi(s)] --; i = 0; while ( cin.get(c) ) { if (!isdigit(c)) break; s[i++] = c; } s[i] = '\0'; cin.ignore(0xff, '\n'); } while (cin.get(c)) { if (!isdigit(c)) { break; } i = 0; s[i++] = c; while ( cin.get(c) ) { if (!isdigit(c)) break; s[i++] = c; } s[i] = '\0'; num[atoi(s)] = abs(num[atoi(s)]) + 1; i = 0; while ( cin.get(c) ) { if (!isdigit(c)) break; s[i++] = c; } s[i] = '\0'; cin.ignore(0xff, '\n'); } for (it = num.begin(); it != num.end(); it++) { if ((*it).second > 0) cout<<(*it).first<<" "<<(*it).second<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:3:9: error: 'map' was not declared in this scope 3 | map<int, int> num; | ^~~ a.cc:3:13: error: expected primary-expression before 'int' 3 | map<int, int> num; | ^~~ a.cc:4:13: error: expected primary-expression before 'int' 4 | map<int, int>::iterator it; | ^~~ a.cc:8:16: error: 'cin' was not declared in this scope 8 | while (cin.get(c)) { | ^~~ a.cc:9:22: error: 'isdigit' was not declared in this scope 9 | if (!isdigit(c)) { | ^~~~~~~ a.cc:16:30: error: 'isdigit' was not declared in this scope 16 | if (!isdigit(c)) break; | ^~~~~~~ a.cc:20:17: error: 'num' was not declared in this scope; did you mean 'enum'? 20 | num[atoi(s)] --; | ^~~ | enum a.cc:20:21: error: 'atoi' was not declared in this scope 20 | num[atoi(s)] --; | ^~~~ a.cc:24:30: error: 'isdigit' was not declared in this scope 24 | if (!isdigit(c)) break; | ^~~~~~~ a.cc:31:16: error: 'cin' was not declared in this scope 31 | while (cin.get(c)) { | ^~~ a.cc:32:22: error: 'isdigit' was not declared in this scope 32 | if (!isdigit(c)) { | ^~~~~~~ a.cc:39:30: error: 'isdigit' was not declared in this scope 39 | if (!isdigit(c)) break; | ^~~~~~~ a.cc:43:17: error: 'num' was not declared in this scope; did you mean 'enum'? 43 | num[atoi(s)] = abs(num[atoi(s)]) + 1; | ^~~ | enum a.cc:43:21: error: 'atoi' was not declared in this scope 43 | num[atoi(s)] = abs(num[atoi(s)]) + 1; | ^~~~ a.cc:43:32: error: 'abs' was not declared in this scope 43 | num[atoi(s)] = abs(num[atoi(s)]) + 1; | ^~~ a.cc:47:30: error: 'isdigit' was not declared in this scope 47 | if (!isdigit(c)) break; | ^~~~~~~ a.cc:54:14: error: 'it' was not declared in this scope; did you mean 'i'? 54 | for (it = num.begin(); it != num.end(); it++) { | ^~ | i a.cc:54:19: error: 'num' was not declared in this scope; did you mean 'enum'? 54 | for (it = num.begin(); it != num.end(); it++) { | ^~~ | enum a.cc:55:39: error: 'cout' was not declared in this scope 55 | if ((*it).second > 0) cout<<(*it).first<<" "<<(*it).second<<endl; | ^~~~ a.cc:55:77: error: 'endl' was not declared in this scope 55 | if ((*it).second > 0) cout<<(*it).first<<" "<<(*it).second<<endl; | ^~~~
s851699714
p00065
C++
#include <cstdio> #include <cstring> #include <map> #include <vector> #include <algorithm> using namespace std; int main() { int num, day; char input[80]; vector<int> mon; map<int, int> res; while (gets(input)&&strlen(input)!=0) { sscanf(input, "%d%*c%d", &num, &day); mon.push_back(num); } while (scanf("%s", input)!=EOF) { sscanf(input, "%d%*c%d", &num, &day); int cnt = count(mon.begin(), mon.end(), num); if (cnt != 0) { if (res.find(num) == res.end()) { res.insert(make_pair(num, cnt+1)); } else { res[num]++; } } } map<int, int>::iterator itr; for (itr = res.begin(); itr != res.end(); itr++) { printf("%d %d\n", (*itr).first, (*itr).second); } }
a.cc: In function 'int main()': a.cc:12:16: error: 'gets' was not declared in this scope; did you mean 'getw'? 12 | while (gets(input)&&strlen(input)!=0) { | ^~~~ | getw
s936386752
p00065
C++
#include <map> #include <cstdio> #include <sstream> int main(){ std::map<int, int> m; std::string s; int num, sales,t; while(getline(std::cin, s), s.size()){ std::stringstream ss; char c; ss << s; ss >> num >> c >> sales; m[num] = -(-m[num]+1); } while(getline(std::cin, s), s.size()){ std::stringstream ss; char c; ss << s; ss >> num >> c >> sales; if(m[num] >= 0) m[num]++; else m[num] = -(-m[num]+1); } std::map<int, int>::iterator it = m.begin(); while(it != m.end()){ if((*it).second < -1) std::cout << (*it).first << " " << -(*it).second << std::endl; it++; } }
a.cc: In function 'int main()': a.cc:9:22: error: 'cin' is not a member of 'std' 9 | while(getline(std::cin, s), s.size()){ | ^~~ a.cc:4:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 3 | #include <sstream> +++ |+#include <iostream> 4 | a.cc:16:22: error: 'cin' is not a member of 'std' 16 | while(getline(std::cin, s), s.size()){ | ^~~ a.cc:16:22: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:29:12: error: 'cout' is not a member of 'std' 29 | std::cout << (*it).first << " " << -(*it).second << std::endl; | ^~~~ a.cc:29:12: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
s691844830
p00065
C++
#include<iostream> #include<cstdio> #include<algorithm> using namespace std; int main(){ char s[50]; bool month = false; int com[2][1000] = {0},x = 0; while(cin.getline(s,50)){ if(s[0] == 0){ sort(com[0],com[0]+x); month = true; continue; } int n; sscanf(s,"%d,%*d",&n); if(!month){ com[0][x] = n; com[1][x]++; x++; } else if(month){ for(int i=0; i<x; i++){ if(com[0][i] == n){com[1][i]++;break;} else if(com[0][i] > n){break;} } } } for(int i=0; i<x; i++){ if(com[1][i] > 1){cout <<com[0][i]<<" "<<com[1][i]<<endl;} } return 0; } #include<iostream> #include<cstdio> #include<algorithm> using namespace std; int main(){ char s[50]; bool month = false; int com[2][1000] = {0},x = 0; while(cin.getline(s,50)){ if(s[0] == 0){ sort(com[0],com[0]+x); month = true; continue; } int n; sscanf(s,"%d,%*d",&n); if(!month){ com[0][x] = n; com[1][x]++; x++; } else if(month){ for(int i=0; i<x; i++){ if(com[0][i] == n){com[1][i]++;break;} else if(com[0][i] > n){break;} } } } for(int i=0; i<x; i++){ if(com[1][i] > 1){cout <<com[0][i]<<" "<<com[1][i]<<endl;} } return 0; }
a.cc:38:5: error: redefinition of 'int main()' 38 | int main(){ | ^~~~ a.cc:5:5: note: 'int main()' previously defined here 5 | int main(){ | ^~~~
s964419595
p00065
C++
#include<iostream> #include<map> #include<cstdio> using namespace std; int main(){ bool month = false; map<int, pair<int, int> > com; int n; char s[50]; while(cin.getline(s,50)){ if(s == 0){month = true;continue;} sscanf(s,"%d,%*d",&n); if(!month){com[n].first = 1;} else if(month && com[n].first){com[n].first = 2;} com[n].second ++; } for(__typeof(map.begin()) i=map.begin(); i<map.end(); i++){ if(i->second.first == 2){cout <<i->first<<" "<<i->second.second<<endl;} } return 0; }
a.cc: In function 'int main()': a.cc:17:25: error: missing template arguments before '.' token 17 | for(__typeof(map.begin()) i=map.begin(); i<map.end(); i++){ | ^ a.cc:17:40: error: missing template arguments before '.' token 17 | for(__typeof(map.begin()) i=map.begin(); i<map.end(); i++){ | ^ a.cc:17:55: error: missing template arguments before '.' token 17 | for(__typeof(map.begin()) i=map.begin(); i<map.end(); i++){ | ^ a.cc:18:21: error: base operand of '->' is not a pointer 18 | if(i->second.first == 2){cout <<i->first<<" "<<i->second.second<<endl;} | ^~ a.cc:18:50: error: base operand of '->' is not a pointer 18 | if(i->second.first == 2){cout <<i->first<<" "<<i->second.second<<endl;} | ^~ a.cc:18:65: error: base operand of '->' is not a pointer 18 | if(i->second.first == 2){cout <<i->first<<" "<<i->second.second<<endl;} | ^~
s264533365
p00065
C++
#include<iostream> #include<map> #include<cstdio> using namespace std; int main(){ bool month = false; map<int, pair<int, int> > com; int n; char s[50]; while(cin.getline(s,50)){ if(s == 0){month = true;continue;} sscanf(s,"%d,%*d",&n); if(!month){com[n].first = 1;} else if(month && com[n].first){com[n].first = 2;} com[n].second ++; } for(__typeof(com.begin()) i=com.begin(); i<com.end(); i++){ if(i->second.first == 2){cout <<i->first<<" "<<i->second.second<<endl;} } return 0; }
a.cc: In function 'int main()': a.cc:17:51: error: no match for 'operator<' (operand types are 'std::map<int, std::pair<int, int> >::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, std::pair<int, int> >, std::_Select1st<std::pair<const int, std::pair<int, int> > >, std::less<int>, std::allocator<std::pair<const int, std::pair<int, int> > > >::iterator'} and 'std::map<int, std::pair<int, int> >::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, std::pair<int, int> >, std::_Select1st<std::pair<const int, std::pair<int, int> > >, std::less<int>, std::allocator<std::pair<const int, std::pair<int, int> > > >::iterator'}) 17 | for(__typeof(com.begin()) i=com.begin(); i<com.end(); i++){ | ~^~~~~~~~~~ | | | | | _Rb_tree_iterator<[...]> | _Rb_tree_iterator<[...]> In file included from /usr/include/c++/14/string:48, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 448 | operator<(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed: a.cc:17:60: note: 'std::map<int, std::pair<int, int> >::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, std::pair<int, int> >, std::_Select1st<std::pair<const int, std::pair<int, int> > >, std::less<int>, std::allocator<std::pair<const int, std::pair<int, int> > > >::iterator'} is not derived from 'const std::reverse_iterator<_Iterator>' 17 | for(__typeof(com.begin()) i=com.begin(); i<com.end(); i++){ | ^ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 493 | operator<(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed: a.cc:17:60: note: 'std::map<int, std::pair<int, int> >::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, std::pair<int, int> >, std::_Select1st<std::pair<const int, std::pair<int, int> > >, std::less<int>, std::allocator<std::pair<const int, std::pair<int, int> > > >::iterator'} is not derived from 'const std::reverse_iterator<_Iterator>' 17 | for(__typeof(com.begin()) i=com.begin(); i<com.end(); i++){ | ^ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1694 | operator<(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed: a.cc:17:60: note: 'std::map<int, std::pair<int, int> >::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, std::pair<int, int> >, std::_Select1st<std::pair<const int, std::pair<int, int> > >, std::less<int>, std::allocator<std::pair<const int, std::pair<int, int> > > >::iterator'} is not derived from 'const std::move_iterator<_IteratorL>' 17 | for(__typeof(com.begin()) i=com.begin(); i<com.end(); i++){ | ^ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1760 | operator<(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed: a.cc:17:60: note: 'std::map<int, std::pair<int, int> >::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, std::pair<int, int> >, std::_Select1st<std::pair<const int, std::pair<int, int> > >, std::less<int>, std::allocator<std::pair<const int, std::pair<int, int> > > >::iterator'} is not derived from 'const std::move_iterator<_IteratorL>' 17 | for(__typeof(com.begin()) i=com.begin(); i<com.end(); i++){ | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed: a.cc:17:60: note: 'std::map<int, std::pair<int, int> >::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, std::pair<int, int> >, std::_Select1st<std::pair<const int, std::pair<int, int> > >, std::less<int>, std::allocator<std::pair<const int, std::pair<int, int> > > >::iterator'} is not derived from 'const std::pair<_T1, _T2>' 17 | for(__typeof(com.begin()) i=com.begin(); i<com.end(); i++){ | ^ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 673 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed: a.cc:17:60: note: 'std::_Rb_tree_iterator<std::pair<const int, std::pair<int, int> > >' is not derived from 'std::basic_string_view<_CharT, _Traits>' 17 | for(__typeof(com.begin()) i=com.begin(); i<com.end(); i++){ | ^ /usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 680 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed: a.cc:17:60: note: 'std::_Rb_tree_iterator<std::pair<const int, std::pair<int, int> > >' is not derived from 'std::basic_string_view<_CharT, _Traits>' 17 | for(__typeof(com.begin()) i=com.begin(); i<com.end(); i++){ | ^ /usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed: a.cc:17:60: note: 'std::_Rb_tree_iterator<std::pair<const int, std::pair<int, int> > >' is not derived from 'std::basic_string_view<_CharT, _Traits>' 17 | for(__typeof(com.begin()) i=com.begin(); i<com.end(); i++){ | ^ /usr/include/c++/14/bits/basic_string.h:3874:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3874 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: template argument deduction/substitution failed: a.cc:17:60: note: 'std::map<int, std::pair<int, int> >::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, std::pair<int, int> >, std::_Select1st<std::pair<const int, std::pair<int, int> > >, std::less<int>, std::allocator<std::pair<const int, std::pair<int, int> > > >::iterator'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 17 | for(__typeof(com.begin()) i=com.begin(); i<com.end(); i++){ | ^ /usr/include/c++/14/bits/basic_string.h:3888:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3888 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3888:5: note: template argument deduction/substitution failed: a.cc:17:60: note: 'std::map<int, std::pair<int, int> >::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, std::pair<int, int> >, std::_Select1st<std::pair<const int, std::pair<int, int> > >, std::less<int>, std::allocator<std::pair<const int, std::pair<int, int> > > >::iterator'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 17 | for(__typeof(com.begin()) i=com.begin(); i<com.end(); i++){ | ^ /usr/include/c++/14/bits/basic_string.h:3901:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3901 | operator<(c
s520941058
p00065
C++
#include<iostream> #include<map> #include<cstdio> using namespace std; int main(){ bool month = false; map<int, pair<int, int> > com; int n; char s[50]; while(cin.getline(s,50)){ if(s == 0){month = true;continue;} sscanf(s,"%d,%*d",&n); if(!month){com[n].first = 1;} else if(month && com[n].first){com[n].first = 2;} com[n].second ++; } for(__typeof(com.begin()) i=com.begin(); i<com.end(); i++){ if(i->second.first == 2){cout << i->first << " " << i->second.second <<endl;} } return 0; }
a.cc: In function 'int main()': a.cc:17:51: error: no match for 'operator<' (operand types are 'std::map<int, std::pair<int, int> >::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, std::pair<int, int> >, std::_Select1st<std::pair<const int, std::pair<int, int> > >, std::less<int>, std::allocator<std::pair<const int, std::pair<int, int> > > >::iterator'} and 'std::map<int, std::pair<int, int> >::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, std::pair<int, int> >, std::_Select1st<std::pair<const int, std::pair<int, int> > >, std::less<int>, std::allocator<std::pair<const int, std::pair<int, int> > > >::iterator'}) 17 | for(__typeof(com.begin()) i=com.begin(); i<com.end(); i++){ | ~^~~~~~~~~~ | | | | | _Rb_tree_iterator<[...]> | _Rb_tree_iterator<[...]> In file included from /usr/include/c++/14/string:48, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 448 | operator<(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed: a.cc:17:60: note: 'std::map<int, std::pair<int, int> >::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, std::pair<int, int> >, std::_Select1st<std::pair<const int, std::pair<int, int> > >, std::less<int>, std::allocator<std::pair<const int, std::pair<int, int> > > >::iterator'} is not derived from 'const std::reverse_iterator<_Iterator>' 17 | for(__typeof(com.begin()) i=com.begin(); i<com.end(); i++){ | ^ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 493 | operator<(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed: a.cc:17:60: note: 'std::map<int, std::pair<int, int> >::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, std::pair<int, int> >, std::_Select1st<std::pair<const int, std::pair<int, int> > >, std::less<int>, std::allocator<std::pair<const int, std::pair<int, int> > > >::iterator'} is not derived from 'const std::reverse_iterator<_Iterator>' 17 | for(__typeof(com.begin()) i=com.begin(); i<com.end(); i++){ | ^ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1694 | operator<(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed: a.cc:17:60: note: 'std::map<int, std::pair<int, int> >::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, std::pair<int, int> >, std::_Select1st<std::pair<const int, std::pair<int, int> > >, std::less<int>, std::allocator<std::pair<const int, std::pair<int, int> > > >::iterator'} is not derived from 'const std::move_iterator<_IteratorL>' 17 | for(__typeof(com.begin()) i=com.begin(); i<com.end(); i++){ | ^ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1760 | operator<(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed: a.cc:17:60: note: 'std::map<int, std::pair<int, int> >::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, std::pair<int, int> >, std::_Select1st<std::pair<const int, std::pair<int, int> > >, std::less<int>, std::allocator<std::pair<const int, std::pair<int, int> > > >::iterator'} is not derived from 'const std::move_iterator<_IteratorL>' 17 | for(__typeof(com.begin()) i=com.begin(); i<com.end(); i++){ | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed: a.cc:17:60: note: 'std::map<int, std::pair<int, int> >::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, std::pair<int, int> >, std::_Select1st<std::pair<const int, std::pair<int, int> > >, std::less<int>, std::allocator<std::pair<const int, std::pair<int, int> > > >::iterator'} is not derived from 'const std::pair<_T1, _T2>' 17 | for(__typeof(com.begin()) i=com.begin(); i<com.end(); i++){ | ^ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 673 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed: a.cc:17:60: note: 'std::_Rb_tree_iterator<std::pair<const int, std::pair<int, int> > >' is not derived from 'std::basic_string_view<_CharT, _Traits>' 17 | for(__typeof(com.begin()) i=com.begin(); i<com.end(); i++){ | ^ /usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 680 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed: a.cc:17:60: note: 'std::_Rb_tree_iterator<std::pair<const int, std::pair<int, int> > >' is not derived from 'std::basic_string_view<_CharT, _Traits>' 17 | for(__typeof(com.begin()) i=com.begin(); i<com.end(); i++){ | ^ /usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed: a.cc:17:60: note: 'std::_Rb_tree_iterator<std::pair<const int, std::pair<int, int> > >' is not derived from 'std::basic_string_view<_CharT, _Traits>' 17 | for(__typeof(com.begin()) i=com.begin(); i<com.end(); i++){ | ^ /usr/include/c++/14/bits/basic_string.h:3874:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3874 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: template argument deduction/substitution failed: a.cc:17:60: note: 'std::map<int, std::pair<int, int> >::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, std::pair<int, int> >, std::_Select1st<std::pair<const int, std::pair<int, int> > >, std::less<int>, std::allocator<std::pair<const int, std::pair<int, int> > > >::iterator'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 17 | for(__typeof(com.begin()) i=com.begin(); i<com.end(); i++){ | ^ /usr/include/c++/14/bits/basic_string.h:3888:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3888 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3888:5: note: template argument deduction/substitution failed: a.cc:17:60: note: 'std::map<int, std::pair<int, int> >::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, std::pair<int, int> >, std::_Select1st<std::pair<const int, std::pair<int, int> > >, std::less<int>, std::allocator<std::pair<const int, std::pair<int, int> > > >::iterator'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 17 | for(__typeof(com.begin()) i=com.begin(); i<com.end(); i++){ | ^ /usr/include/c++/14/bits/basic_string.h:3901:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3901 | operator<(c
s148230040
p00065
C++
#include<iostream> #include<map> #include<cstdio> using namespace std; int main(){ bool month = false; map<int, pair<int, int> > com; int n; char s[50]; while(cin.getline(s,50)){ if(s == 0){month = true;continue;} sscanf(s,"%d,%*d",&n); if(!month){com[n].first = 1;} else if(month && com[n].first){com[n].first = 2;} com[n].second ++; } for(__typeof(com.begin()) i=com.begin(); i<com.end(); i++){ if(i->second.first == 2){ cout << i->first << " " << i->second.second <<endl; } } return 0; }
a.cc: In function 'int main()': a.cc:17:51: error: no match for 'operator<' (operand types are 'std::map<int, std::pair<int, int> >::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, std::pair<int, int> >, std::_Select1st<std::pair<const int, std::pair<int, int> > >, std::less<int>, std::allocator<std::pair<const int, std::pair<int, int> > > >::iterator'} and 'std::map<int, std::pair<int, int> >::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, std::pair<int, int> >, std::_Select1st<std::pair<const int, std::pair<int, int> > >, std::less<int>, std::allocator<std::pair<const int, std::pair<int, int> > > >::iterator'}) 17 | for(__typeof(com.begin()) i=com.begin(); i<com.end(); i++){ | ~^~~~~~~~~~ | | | | | _Rb_tree_iterator<[...]> | _Rb_tree_iterator<[...]> In file included from /usr/include/c++/14/string:48, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 448 | operator<(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed: a.cc:17:60: note: 'std::map<int, std::pair<int, int> >::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, std::pair<int, int> >, std::_Select1st<std::pair<const int, std::pair<int, int> > >, std::less<int>, std::allocator<std::pair<const int, std::pair<int, int> > > >::iterator'} is not derived from 'const std::reverse_iterator<_Iterator>' 17 | for(__typeof(com.begin()) i=com.begin(); i<com.end(); i++){ | ^ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 493 | operator<(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed: a.cc:17:60: note: 'std::map<int, std::pair<int, int> >::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, std::pair<int, int> >, std::_Select1st<std::pair<const int, std::pair<int, int> > >, std::less<int>, std::allocator<std::pair<const int, std::pair<int, int> > > >::iterator'} is not derived from 'const std::reverse_iterator<_Iterator>' 17 | for(__typeof(com.begin()) i=com.begin(); i<com.end(); i++){ | ^ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1694 | operator<(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed: a.cc:17:60: note: 'std::map<int, std::pair<int, int> >::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, std::pair<int, int> >, std::_Select1st<std::pair<const int, std::pair<int, int> > >, std::less<int>, std::allocator<std::pair<const int, std::pair<int, int> > > >::iterator'} is not derived from 'const std::move_iterator<_IteratorL>' 17 | for(__typeof(com.begin()) i=com.begin(); i<com.end(); i++){ | ^ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1760 | operator<(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed: a.cc:17:60: note: 'std::map<int, std::pair<int, int> >::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, std::pair<int, int> >, std::_Select1st<std::pair<const int, std::pair<int, int> > >, std::less<int>, std::allocator<std::pair<const int, std::pair<int, int> > > >::iterator'} is not derived from 'const std::move_iterator<_IteratorL>' 17 | for(__typeof(com.begin()) i=com.begin(); i<com.end(); i++){ | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed: a.cc:17:60: note: 'std::map<int, std::pair<int, int> >::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, std::pair<int, int> >, std::_Select1st<std::pair<const int, std::pair<int, int> > >, std::less<int>, std::allocator<std::pair<const int, std::pair<int, int> > > >::iterator'} is not derived from 'const std::pair<_T1, _T2>' 17 | for(__typeof(com.begin()) i=com.begin(); i<com.end(); i++){ | ^ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 673 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed: a.cc:17:60: note: 'std::_Rb_tree_iterator<std::pair<const int, std::pair<int, int> > >' is not derived from 'std::basic_string_view<_CharT, _Traits>' 17 | for(__typeof(com.begin()) i=com.begin(); i<com.end(); i++){ | ^ /usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 680 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed: a.cc:17:60: note: 'std::_Rb_tree_iterator<std::pair<const int, std::pair<int, int> > >' is not derived from 'std::basic_string_view<_CharT, _Traits>' 17 | for(__typeof(com.begin()) i=com.begin(); i<com.end(); i++){ | ^ /usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed: a.cc:17:60: note: 'std::_Rb_tree_iterator<std::pair<const int, std::pair<int, int> > >' is not derived from 'std::basic_string_view<_CharT, _Traits>' 17 | for(__typeof(com.begin()) i=com.begin(); i<com.end(); i++){ | ^ /usr/include/c++/14/bits/basic_string.h:3874:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3874 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: template argument deduction/substitution failed: a.cc:17:60: note: 'std::map<int, std::pair<int, int> >::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, std::pair<int, int> >, std::_Select1st<std::pair<const int, std::pair<int, int> > >, std::less<int>, std::allocator<std::pair<const int, std::pair<int, int> > > >::iterator'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 17 | for(__typeof(com.begin()) i=com.begin(); i<com.end(); i++){ | ^ /usr/include/c++/14/bits/basic_string.h:3888:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3888 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3888:5: note: template argument deduction/substitution failed: a.cc:17:60: note: 'std::map<int, std::pair<int, int> >::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, std::pair<int, int> >, std::_Select1st<std::pair<const int, std::pair<int, int> > >, std::less<int>, std::allocator<std::pair<const int, std::pair<int, int> > > >::iterator'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 17 | for(__typeof(com.begin()) i=com.begin(); i<com.end(); i++){ | ^ /usr/include/c++/14/bits/basic_string.h:3901:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3901 | operator<(c
s418716500
p00065
C++
#include <iostream> #include <map> #include <vector> using namespace std; int main(){ vector<int> last; char str[256]; map<int,int> m; map<int,int>::iterator itm; char* tp; while(fgets(str,256,stdin)){ if(strlen(str) == 1) break; tp = strtok(str,","); last.push_back(atoi(tp)); } while(fgets(str,256,stdin)){ if(str == "\0") break; tp = strtok(str,","); vector<int>::iterator it; for(it=last.begin();it!=last.end();++it){ if(atoi(tp) == *it){ if((itm = m.find(*it)) != m.end()){ itm -> second++; }else{ m.insert(pair<int,int>(*it,2)); } } } } for(itm=m.begin(); itm != m.end(); ++itm){ cout << itm->first << " " << itm->second << endl; } return 0; }
a.cc: In function 'int main()': a.cc:13:12: error: 'strlen' was not declared in this scope 13 | if(strlen(str) == 1) break; | ^~~~~~ a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include <vector> +++ |+#include <cstring> 4 | using namespace std; a.cc:14:14: error: 'strtok' was not declared in this scope; did you mean 'strtoq'? 14 | tp = strtok(str,","); | ^~~~~~ | strtoq a.cc:20:14: error: 'strtok' was not declared in this scope; did you mean 'strtoq'? 20 | tp = strtok(str,","); | ^~~~~~ | strtoq
s754907835
p00065
C++
#include <iostream> #include <map> #include <vector> #include <algorithm> using namespace std; int main(){ vector<int> last; char str[256]; map<int,int> m; map<int,int>::iterator itm; char* tp; while(fgets(str,256,stdin)){ if(strlen(str) == 1) break; tp = strtok(str,","); last.push_back(atoi(tp)); } while(fgets(str,256,stdin)){ if(str == "\0") break; tp = strtok(str,","); vector<int>::iterator it; for(it=last.begin();it!=last.end();++it){ if(atoi(tp) == *it){ if((itm = m.find(*it)) != m.end()){ itm -> second++; }else{ m.insert(pair<int,int>(*it,2)); } } } } for(itm=m.begin(); itm != m.end(); ++itm){ cout << itm->first << " " << itm->second << endl; } return 0; }
a.cc: In function 'int main()': a.cc:14:12: error: 'strlen' was not declared in this scope 14 | if(strlen(str) == 1) break; | ^~~~~~ a.cc:5:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 4 | #include <algorithm> +++ |+#include <cstring> 5 | using namespace std; a.cc:15:14: error: 'strtok' was not declared in this scope; did you mean 'strtoq'? 15 | tp = strtok(str,","); | ^~~~~~ | strtoq a.cc:21:14: error: 'strtok' was not declared in this scope; did you mean 'strtoq'? 21 | tp = strtok(str,","); | ^~~~~~ | strtoq
s554297019
p00065
C++
#include <cstdio> #include <cstring> #include <algorithm> #include <map> #include <vector> using namespace std; int main(){ vector<int> last; char str[256]; map<int,int> m; map<int,int>::iterator itm; char* tp; while(fgets(str,256,stdin)){ if(strlen(str) == 1) break; tp = strtok(str,","); last.push_back(atoi(tp)); } while(fgets(str,256,stdin)){ if(str == "\0") break; tp = strtok(str,","); vector<int>::iterator it; for(it=last.begin();it!=last.end();++it){ if(atoi(tp) == *it){ if((itm = m.find(*it)) != m.end()){ itm -> second++; }else{ m.insert(pair<int,int>(*it,2)); } } } } for(itm=m.begin(); itm != m.end(); ++itm){ cout << itm->first << " " << itm->second << endl; } return 0; }
a.cc: In function 'int main()': a.cc:36:9: error: 'cout' was not declared in this scope 36 | cout << itm->first << " " << itm->second << endl; | ^~~~ a.cc:6:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 5 | #include <vector> +++ |+#include <iostream> 6 | using namespace std; a.cc:36:53: error: 'endl' was not declared in this scope 36 | cout << itm->first << " " << itm->second << endl; | ^~~~ a.cc:6:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 5 | #include <vector> +++ |+#include <ostream> 6 | using namespace std;
s531606198
p00065
C++
#include <iostream> #include <stdio.h> #include <string.h> #include <map> using namespace std; int did[1000],dcn[1000]; int main() { int n,k; char s[256]; map<int,int> da1,da2; map<int,int>::iterator it; while(true) { n=atoi(gets(s)); if (strlen(s)==0) break; if (da1.find(n)!=da1.end()) da1[n]++; else da1.insert(map<int,int>::value_type(n,1)); } while(scanf("%d,%d",&n,&k)!=EOF) { if (da1.find(n)!=da1.end()) { if (da2.find(n)!=da2.end()) da2[n]++; else da2.insert(map<int,int>::value_type(n,da1[n]+1)); } } for (it=da2.begin();it!=da2.end();it++) cout << (*it).first << ' ' << (*it).second << endl; return 0; }
a.cc: In function 'int main()': a.cc:15:24: error: 'gets' was not declared in this scope; did you mean 'getw'? 15 | n=atoi(gets(s)); | ^~~~ | getw
s933115170
p00065
C++
#include<iostream> #include<string> using namespace std; class data { public: int times; bool flag[2]; data() { times=0; flag[0]=false; flag[1]=false; } }; int main(void) { data d[1000]; int month=0; while(1) { string s; getline(cin,s); if(cin.eof())break; if(s.length()==0)month++; for(int i=0;i<s.length();i++) { if(s[i]==',') { d[atoi(s.substr(0,i).c_str())].times++; d[atoi(s.substr(0,i).c_str())].flag[month]=true; break; } } } for(int i=0;i<1000;i++) { if(d[i].flag[0]&&d[i].flag[1]) { cout<<i<<' '<<d[i].times<<endl; } } }
a.cc: In function 'int main()': a.cc:21:9: error: reference to 'data' is ambiguous 21 | data d[1000]; | ^~~~ In file included from /usr/include/c++/14/string:53, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:6:7: note: 'class data' 6 | class data | ^~~~ a.cc:33:33: error: 'd' was not declared in this scope 33 | d[atoi(s.substr(0,i).c_str())].times++; | ^ a.cc:41:20: error: 'd' was not declared in this scope 41 | if(d[i].flag[0]&&d[i].flag[1]) | ^
s587635261
p00065
C++
#include<cstdio> #include<cstring> #include<iostream> #include<algorithm> using namespace std; typedef struct{ int no,sum; }P; int main(){ int a,b,i; char tmp[50]; P n[1000]; P temp; while(fgets(tmp,50,stdin)!=NULL){ if(strcmp(tmp,"\n")==0)break; sscanf(tmp,"%d,%d",&n[i].no,&a); n[i].sum=1 i++; } while(scanf("%d,%d",&a,&b)!=EOF){ for(int j=0;j<i;j++){ if(n[j].no==a)n[j].sum++; } } for(int j=0;j<i-1;j++){ for(int k=i-1;k>j;k--){ if(n[k].no<n[k-1].no){ temp=n[k]; n[k]=n[k-1]; n[k-1]=temp; } } } for(int j=0;j<i;j++){ if(n[j].sum!=1){ printf("%d %d\n",n[j].no,n[j].sum); } } }
a.cc: In function 'int main()': a.cc:17:15: error: expected ';' before 'i' 17 | n[i].sum=1 | ^ | ; 18 | i++; | ~
s001224540
p00065
C++
#include<cstdio> #include<vector> #include<algorithm> #include<map> #include<iostream> using namespace std; vector<int> inputs; map<int, int> one, two; int main(){ int x, n; while(~scanf("%d,%*d", &x)){ inputs.push_back(x); } for(int i = 0;i < inputs.size();i++){ if(i < inputs.size() / 2)one[inputs[i]]++; else two[inputs[i]]++; } map<int, int>::iterator it = one.begin(); while(it != one.end()){ if(two[it->first]){ cout << (it->first) << " " << (it->second) + two[it->first] << endl; } it++; } return inputs().size()%2; }
a.cc: In function 'int main()': a.cc:26:18: error: no match for call to '(std::vector<int>) ()' 26 | return inputs().size()%2; | ~~~~~~^~
s096300552
p00065
C++
#include<cstdio> #include<vector> #include<algorithm> #include<map> #include<iostream> using namespace std; vector<int> inputs; map<int, int> one, two; int main(){ int x, n; while(~scanf("%d,%*d", &x)){ inputs.push_back(x); } for(int i = 0;i < inputs.size();i++){ if(i < inputs.size() / 2)one[inputs[i]]++; else two[inputs[i]]++; } map<int, int>::iterator it = one.begin(); while(it != one.end()){ if(two[it->first]){ cout << (it->first) << " " << (it->second) + two[it->first] << endl; } it++; } return inputs().size%2; }
a.cc: In function 'int main()': a.cc:26:18: error: no match for call to '(std::vector<int>) ()' 26 | return inputs().size%2; | ~~~~~~^~
s598521786
p00065
C++
#include<iostream> #include<map> #include<vector> using namespace std; char ch; int cnt=0; int in[2000][2]; map <int,int> t; map <int,bool>u; map <int,bool>v; vector <int> w; int main(){ while(cin>>in[cnt][0]>>ch>>in[cnt][1])cnt++; for(int i=0;i<cnt/2;i++){ if(t[in[i][0]]==0)w.push_back(in[i][0]); t[in[i][0]]++; u[in[i][0]]=true; } for(int i=cnt/2;i<cnt;i++){ t[in[i][0]]++; v[in[i][0]]=true; } sort(w.begin(),w.end()); for(int i=0;i<(int)w.size();i++){ if(u[w[i]]&&v[w[i]])cout<<w[i]<<" "<<t[w[i]]<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:25:3: error: 'sort' was not declared in this scope; did you mean 'short'? 25 | sort(w.begin(),w.end()); | ^~~~ | short
s939933646
p00066
Java
import java.io.*; class Main{ public static void main(String[] args) throws IOException{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String line=""; line=br.readLine(); int d=line.length()/3; char[][][] map=new char[d][3][3]; for(int i=0;i<line.length;i++){ map[(int)i/3][0][i%3]=line.charAt(i) } for(int j=1;j<=2;j++){ line=br.readLine(); for(int i=0;i<line.length;i++){ map[(int)i/3][j][i%3]=line.charAt(i) } } outside: for(int i=0;i<d;i++){ for(int j=0;j<3;j++){ if(map[i][j][0]!='s'&&map[i][j][0]==map[i][j][1]==map[i][j][2]){ System.out.println(map[i][j][0]); continue outside; } if(map[i][0][j]!='s'&&map[i][0][j]==map[i][1][j]==map[i][2][j]){ System.out.println(map[i][0][j]); continue outside; } } if(map[i][1][1]=='s'){ System.out.println("d"); } else if(map[i][0][0]==map[i][1][1]==map[i][2][2]){ System.out.println(map[i][1][1]); } else if(map[i][0][2]==map[i][1][1]==map[i][2][0]){ System.out.println(map[i][1][1]); } else{ System.out.println("d"); } } } }
Main.java:11: error: ';' expected map[(int)i/3][0][i%3]=line.charAt(i) ^ Main.java:16: error: ';' expected map[(int)i/3][j][i%3]=line.charAt(i) ^ 2 errors
s784468189
p00066
Java
import java.io.*; class Main{ public static void main(String[] args) throws IOException{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String line=""; line=br.readLine(); int d=line.length()/3; char[][][] map=new char[d][3][3]; for(int i=0;i<line.length;i++){ map[(int)i/3][0][i%3]=line.charAt(i); } for(int j=1;j<=2;j++){ line=br.readLine(); for(int i=0;i<line.length;i++){ map[(int)i/3][j][i%3]=line.charAt(i); } } outside: for(int i=0;i<d;i++){ for(int j=0;j<3;j++){ if(map[i][j][0]!='s'&&map[i][j][0]==map[i][j][1]==map[i][j][2]){ System.out.println(map[i][j][0]); continue outside; } if(map[i][0][j]!='s'&&map[i][0][j]==map[i][1][j]==map[i][2][j]){ System.out.println(map[i][0][j]); continue outside; } } if(map[i][1][1]=='s'){ System.out.println("d"); } else if(map[i][0][0]==map[i][1][1]==map[i][2][2]){ System.out.println(map[i][1][1]); } else if(map[i][0][2]==map[i][1][1]==map[i][2][0]){ System.out.println(map[i][1][1]); } else{ System.out.println("d"); } } } }
Main.java:10: error: cannot find symbol for(int i=0;i<line.length;i++){ ^ symbol: variable length location: variable line of type String Main.java:15: error: cannot find symbol for(int i=0;i<line.length;i++){ ^ symbol: variable length location: variable line of type String Main.java:22: error: incomparable types: boolean and char if(map[i][j][0]!='s'&&map[i][j][0]==map[i][j][1]==map[i][j][2]){ ^ Main.java:26: error: incomparable types: boolean and char if(map[i][0][j]!='s'&&map[i][0][j]==map[i][1][j]==map[i][2][j]){ ^ Main.java:34: error: incomparable types: boolean and char else if(map[i][0][0]==map[i][1][1]==map[i][2][2]){ ^ Main.java:37: error: incomparable types: boolean and char else if(map[i][0][2]==map[i][1][1]==map[i][2][0]){ ^ 6 errors
s273425127
p00066
Java
import java.io.*; class Main{ public static void main(String[] args) throws IOException{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String line=""; line=br.readLine(); int d=line.length()/3; char[][][] map=new char[d][3][3]; for(int i=0;i<line.length();i++){ map[(int)i/3][0][i%3]=line.charAt(i); } for(int j=1;j<=2;j++){ line=br.readLine(); for(int i=0;i<line.length();i++){ map[(int)i/3][j][i%3]=line.charAt(i); } } outside: for(int i=0;i<d;i++){ for(int j=0;j<3;j++){ if(map[i][j][0]!='s'&&map[i][j][0]==map[i][j][1]==map[i][j][2]){ System.out.println(map[i][j][0]); continue outside; } if(map[i][0][j]!='s'&&map[i][0][j]==map[i][1][j]==map[i][2][j]){ System.out.println(map[i][0][j]); continue outside; } } if(map[i][1][1]=='s'){ System.out.println("d"); } else if(map[i][0][0]==map[i][1][1]==map[i][2][2]){ System.out.println(map[i][1][1]); } else if(map[i][0][2]==map[i][1][1]==map[i][2][0]){ System.out.println(map[i][1][1]); } else{ System.out.println("d"); } } } }
Main.java:22: error: incomparable types: boolean and char if(map[i][j][0]!='s'&&map[i][j][0]==map[i][j][1]==map[i][j][2]){ ^ Main.java:26: error: incomparable types: boolean and char if(map[i][0][j]!='s'&&map[i][0][j]==map[i][1][j]==map[i][2][j]){ ^ Main.java:34: error: incomparable types: boolean and char else if(map[i][0][0]==map[i][1][1]==map[i][2][2]){ ^ Main.java:37: error: incomparable types: boolean and char else if(map[i][0][2]==map[i][1][1]==map[i][2][0]){ ^ 4 errors
s527442514
p00066
Java
import java.io.*; class Main{ public static void main(String[] args) throws IOException{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String line=""; line=br.readLine(); int d=line.length()/3; char[][][] map=new char[d][3][3]; for(int i=0;i<line.length();i++){ map[(int)(i/3)][0][i%3]=line.charAt(i); } for(int j=1;j<=2;j++){ line=br.readLine(); for(int i=0;i<line.length();i++){ map[(int)i/3][j][i%3]=line.charAt(i); } } outside: for(int i=0;i<d;i++){ for(int j=0;j<3;j++){ if(map[i][j][0]!='s'&&map[i][j][0]==map[i][j][1]&&map[i][j][1]==map[i][j][2]){ System.out.println(String.valueOf(map[i][j][0])); continue outside; } if(map[i][0][j]!='s'&&map[i][0][j]==map[i][1][j]&&map[i][1][j]==map[i][2][j]){ System.out.println(String.valueOf(map[i][0][j])); continue outside; } } else if(map[i][1][1]!='s'&&map[i][0][0]==map[i][1][1]&&map[i][1][1]==map[i][2][2]){ System.out.println(String.valueOf(map[i][1][1])); } else if(map[i][1][1]!='s'&&map[i][0][2]==map[i][1][1]&&map[i][1][1]==map[i][2][0]){ System.out.println(String.valueOf(map[i][1][1])); } else{ System.out.println("d"); } } } }
Main.java:31: error: 'else' without 'if' else if(map[i][1][1]!='s'&&map[i][0][0]==map[i][1][1]&&map[i][1][1]==map[i][2][2]){ ^ 1 error
s029078261
p00066
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class TicTacToe { /** * ??? */ public static final char CIRCLE = 'o'; /** * ?? */ public static final char CROSS = 'x'; /** * draw */ public static final char DRAW = 'd'; /** * ????????°??? */ public static final int CIRCLE_NUMBER = 1; /** * ???????°??? */ public static final int CROSS_NUMBER = 0; /** * draw?????°??? */ public static final int DRAW_NUMBER = -1; /** * ?????????????????? */ public static final int COUNT_WIN = 3; public static void main(String[] args) throws IOException { // ??¢??????????????? for (int[] list : read()) { System.out.println(judgeWinner(list)); } } public static List<int[]> read() throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); // ????????????????????? String line = ""; List<int[]> list = new ArrayList<>(); while ((line = br.readLine()) != null && !line.isEmpty()) { // ??\??????????????? int[] gameResult = createGameResult(line); list.add(gameResult); } return list; } // createGameResult /** * ?????? ???????????????????????´?????? * * @return gameResult */ public static int[] createGameResult(String input) { // ??\??????????´??????????-1??§?????????????????????????????\?????¨????????? int[] board = getfilledArray(); // ?????????1??§????????0????????\?????????-1 for (int i = 0; i < input.length(); i++) { if (input.charAt(i) == CIRCLE) { board[i] = CIRCLE_NUMBER; } if (input.charAt(i) == CROSS) { board[i] = CROSS_NUMBER; } } return board; } // fillArray /** * ?????? ????????????????????????????????´?????? * * @return filledArray */ public static int[] getfilledArray() { int[] board = new int[9]; Arrays.fill(board, DRAW_NUMBER); return board; } // horizontal?????????????????£?¶?????????????????????? public static int judgeHorizontal(int[] gameResult) { int circleCount = 0; int crossCount = 0; for (int i = 0; i < 9; i++) { if (i % 3 == 0) { circleCount = 0; crossCount = 0; } switch (gameResult[i]) { case CIRCLE_NUMBER: circleCount++; break; case CROSS_NUMBER: crossCount++; break; } // ???????????? if (circleCount == COUNT_WIN) { return CIRCLE_NUMBER; } // ??????????? if (crossCount == COUNT_WIN) { return CROSS_NUMBER; } } return DRAW_NUMBER; } // vertical?????????????????£?¶??????????????????? public static int judgeVerticel(int[] gameResult) { int circleCount = 0; int crossCount = 0; for (int i = 0; i < 3; i++) { circleCount = 0; crossCount = 0; for (int j = i; j < i + 7; j += 3) { switch (gameResult[j]) { case CIRCLE_NUMBER: circleCount++; break; case CROSS_NUMBER: crossCount++; break; } // ???????????? if (circleCount == COUNT_WIN) { return CIRCLE_NUMBER; } // ??????????? if (crossCount == COUNT_WIN) { return CROSS_NUMBER; } } } return DRAW_NUMBER; } // ???????????????????????????????????? public static int judgeDiagonal(int[] gameResult) { int circleCount = 0; int crossCount = 0; for (int i = 0; i < 3; i += 2) { circleCount = 0; crossCount = 0; for (int j = i; j < 9; j += 4) { switch (gameResult[j]) { case CIRCLE_NUMBER: circleCount++; break; case CROSS_NUMBER: crossCount++; break; } // ???????????? if (circleCount == COUNT_WIN) { return CIRCLE_NUMBER; } // ??????????? if (crossCount == COUNT_WIN) { return CROSS_NUMBER; } } } return DRAW_NUMBER; } // judgeWinner public static char judgeWinner(int[] gameResult) { int winner = DRAW_NUMBER; if ((winner = judgeHorizontal(gameResult)) != DRAW_NUMBER) { return returnString(winner); } if ((winner = judgeVerticel(gameResult)) != DRAW_NUMBER) { return returnString(winner); } if ((winner = judgeDiagonal(gameResult)) != DRAW_NUMBER) { return returnString(winner); } return returnString(winner); } public static char returnString(int i) { switch (i) { case CIRCLE_NUMBER: return CIRCLE; case CROSS_NUMBER: return CROSS; default: return DRAW; } } }
Main.java:8: error: class TicTacToe is public, should be declared in a file named TicTacToe.java public class TicTacToe { ^ 1 error
s010643411
p00066
Java
import java.util.Scanner; /** * @author MS14A * @version 2017/03/06 */ public class Main { private static final String RESULT_DRAW = "d"; /** * メインメソッド * * @param args */ public static void main(String[] args) { // ローカルテスト用。提出時は"System.in"に修正。 InputStream input = System.in; // File input = new File("D:/Temp/AOJ/0066_TicTacToe.txt"); try (Scanner scanner = new Scanner(input)) { while (scanner.hasNextLine()) { System.out.println(judgeWinner(splitLine(scanner.nextLine()))); } } catch (Exception e) { // 対応しない。 } } private static String[] splitLine(String line) { String[] result = new String[line.length()]; for (int i = 0; i < line.length(); i++) { result[i] = String.valueOf(line.charAt(i)); } return result; } private static String judgeWinner(String[] line) { String result = null; // 縦のチェック result = checkVertical(line); if (result != null) { return result; } // 横のチェック result = checkHorizontal(line); if (result != null) { return result; } // 斜めのチェック result = checkDiagonal(line); if (result != null) { return result; } return RESULT_DRAW; } private static String checkVertical(String[] line) { for (int i = 0; i < 3; i++) { if (!"s".equals(line[i]) && line[i].equals(line[i + 3]) && line[i + 3].equals(line[i + 6])) { return line[0]; } } return null; } private static String checkHorizontal(String[] line) { for (int i = 0; i < 9; i += 3) { if (!"s".equals(line[i]) && line[i].equals(line[i + 1]) && line[i + 1].equals(line[i + 2])) { return line[0]; } } return null; } private static String checkDiagonal(String[] line) { if (!"s".equals(line[0]) && line[0].equals(line[4]) && line[4].equals(line[8])) { return line[0]; } if (!"s".equals(line[2]) && line[2].equals(line[4]) && line[4].equals(line[6])) { return line[2]; } return null; } }
Main.java:18: error: cannot find symbol InputStream input = System.in; ^ symbol: class InputStream location: class Main 1 error
s224515689
p00066
Java
import java.util.Scanner; public class Main { public static char check(char ch[]) { int i; for(i=0;i+2<9;i+=3){ if(ch[i]==ch[i+1] && ch[i+1]==ch[i+2]) return ch[i]; } for(i=0;i<3;i++){ if(ch[i]==ch[i+3] && ch[i+3]==ch[i+6]) return ch[i]; } i=0; if(ch[i]==ch[i+4] && ch[i+4]==ch[i+8]) return ch[i]; i=2; if(ch[i]==ch[i+2] && ch[i+2]==ch[i+4]) return ch[i]; return 'd'; } public static void main(String[] args) { Scanner sc=new Scanner(System.in); while(sc.hasNext()){ String str=sc.next(); char ch[]=str.toCharArray(); char ans=check(ch); if(ans=='s') ans='d'; if(ans=='›') ans='o'; if(ans=='~') ans='x'; System.out.println(ans); } } }
Main.java:24: error: unclosed character literal if(ans=='??') ans='o'; ^ Main.java:24: error: illegal character: '\u009b' if(ans=='??') ans='o'; ^ Main.java:24: error: unclosed character literal if(ans=='??') ans='o'; ^ Main.java:25: error: unclosed character literal if(ans=='?~') ans='x'; ^ Main.java:25: error: unclosed character literal if(ans=='?~') ans='x'; ^ 5 errors
s966592350
p00066
Java
import java.util.Arrays; import java.util.Scanner; class Main{ int[][] f; String solve(){ // ヨコ for(int y=0; y<3; ++y){ int t = f[y][0]; if(t==0)continue; boolean b = true; for(int x=0; x<3; ++x){ b &= t==f[y][x]; } if(b){ return t==1 ? "o" : "x"; } } // タテ for(int x=0; x<3; ++x){ int t = f[0][x]; if(t==0)continue; boolean b = true; for(int y=0; y<3; ++y){ b &= t==f[y][x]; } if(b){ return t==1 ? "o" : "x"; } } // ナナメ右下 { int t = f[0][0]; if(t==0)continue; boolean b = true; for(int x=0; x<3; ++x){ b &= t == f[x][x]; } if(b){ return t==1 ? "o" : "x"; } } // ナナメ右上 { int t = f[2][0]; boolean b = true; for(int x=0; x<3; ++x){ b &= t == f[3-1-x][x]; } if(b){ return t==1 ? "o" : "x"; } } return "d"; } void io(){ Scanner sc = new Scanner(System.in); while(sc.hasNext()){ f = new int[3][3]; char[] str = sc.next().toCharArray(); for(int i=0; i<9; ++i){ f[i/3][i%3] = str[i]=='s' ? 0 : str[i]=='o' ? 1 : -1; } System.out.println(solve()); } } public static void main(String[] args){ new Main().io(); } void debug(Object... os){ System.err.println(Arrays.deepToString(os)); } }
Main.java:37: error: continue outside of loop if(t==0)continue; ^ 1 error
s760552912
p00066
C
#include <stdio.h> int main (){ int i,j,k; char a[3][3],b[10000]; while(1){ if(scanf("%s", input)==EOF){ break; } b[k]==0; for(i=0;i<3;i++){ for(j=0;j<3;j++){ scanf(" %c",&a[i][j]); } } for(i=0;i<3;i++){ if(a[i][1]==a[i][2]&&a[i][0]==a[i][1]){ b[k]==a[i][1]; } } for(i=0;i<3;i++){ if(a[1][i]==a[2][i]&&a[0][i]==a[1][i]){ b[k]==a[1][i]; } } if(a[1][1]==a[2][2]&&a[0][0]==a[1][1]){ b[k]==a[1][1]; } if(a[0][2]==a[1][1]&&a[1][1]==a[2][0]){ b[k]==a[1][1]; } if(b[k]==0){ b[k]==d; } k++; } for(i=0;i<k;i++){ printf("%c\n",b[k]); } }
main.c: In function 'main': main.c:7:32: error: 'input' undeclared (first use in this function); did you mean 'int'? 7 | if(scanf("%s", input)==EOF){ | ^~~~~ | int main.c:7:32: note: each undeclared identifier is reported only once for each function it appears in main.c:33:31: error: 'd' undeclared (first use in this function) 33 | b[k]==d; | ^
s532426505
p00066
C
#include <stdio.h> int main (){ int i,j,k; char a[3][3],b[10000]; while(1){ if(scanf("%s", input)==EOF){ break; } b[k]==0; for(i=0;i<3;i++){ for(j=0;j<3;j++){ scanf(" %c",&a[i][j]); } } for(i=0;i<3;i++){ if(a[i][1]==a[i][2]&&a[i][0]==a[i][1]){ b[k]=a[i][1]; } } for(i=0;i<3;i++){ if(a[1][i]==a[2][i]&&a[0][i]==a[1][i]){ b[k]=a[1][i]; } } if(a[1][1]==a[2][2]&&a[0][0]==a[1][1]){ b[k]=a[1][1]; } if(a[0][2]==a[1][1]&&a[1][1]==a[2][0]){ b[k]=a[1][1]; } if(b[k]==0){ b[k]=d; } k++; } for(i=0;i<k;i++){ printf("%c\n",b[k]); } }
main.c: In function 'main': main.c:7:32: error: 'input' undeclared (first use in this function); did you mean 'int'? 7 | if(scanf("%s", input)==EOF){ | ^~~~~ | int main.c:7:32: note: each undeclared identifier is reported only once for each function it appears in main.c:33:30: error: 'd' undeclared (first use in this function) 33 | b[k]=d; | ^
s853254637
p00066
C
#include <stdio.h> int main (){ int i,j,k; char a[3][3],b[10000]; while(1){ b[k]=0; for(i=0;i<3;i++){ for(j=0;j<3;j++){ scanf(" %c",&a[i][j]); } } if(scanf(" %c", a[0][0])==EOF){ break; } for(i=0;i<3;i++){ if(a[i][1]==a[i][2]&&a[i][0]==a[i][1]){ b[k]=a[i][1]; } } for(i=0;i<3;i++){ if(a[1][i]==a[2][i]&&a[0][i]==a[1][i]){ b[k]=a[1][i]; } } if(a[1][1]==a[2][2]&&a[0][0]==a[1][1]){ b[k]=a[1][1]; } if(a[0][2]==a[1][1]&&a[1][1]==a[2][0]){ b[k]=a[1][1]; } if(b[k]==0){ b[k]=d; } k++; } for(i=0;i<k;i++){ printf("%c\n",b[k]); } }
main.c: In function 'main': main.c:33:30: error: 'd' undeclared (first use in this function) 33 | b[k]=d; | ^ main.c:33:30: note: each undeclared identifier is reported only once for each function it appears in
s672080914
p00066
C
#include <stdio.h> #include <string.h> #define N 100 int up(int A); void down(int ans); int main(void){ int ans,i,A[N]; char str[N]; for( ;fgets(str,sizeof(str),stdin)!=NULL; ){ ans=5; for(i=0;i<9;i++){ if(str[i]=='o') A[i+1]=1; else if(str[i]=='x') A[i+1]=0; else if(str[i]=='s') A[i+1]=5; } ans=up(A); down(ans); } return 0; } int up(int A){ int i,ans; for(i=1;i<8;i+=3){ if(A[i]==A[i+1] && A[i+1]==A[i+2] && A[i]!=5){ ans=A[i]; return ans; } } for(i=1;i<4;i+=1){ if(A[i]==A[i+3] && A[i+3]==A[i+6] && A[i]!=5){ ans=A[i]; return ans; } } if(A[1]==A[5] && A[5]==A[9] && A[1]!=5){ ans=A[1]; return ans; } if(A[3]==A[5] && A[5]==A[7] && A[3]!=5){ ans=A[3]; return ans; } } void down(int ans){ if(ans==1) printf("o\n"); else if(ans==0) printf("x\n"); else printf("d\n"); }
main.c: In function 'main': main.c:20:24: error: passing argument 1 of 'up' makes integer from pointer without a cast [-Wint-conversion] 20 | ans=up(A); | ^ | | | int * main.c:4:12: note: expected 'int' but argument is of type 'int *' 4 | int up(int A); | ~~~~^ main.c: In function 'up': main.c:29:21: error: subscripted value is neither array nor pointer nor vector 29 | if(A[i]==A[i+1] && A[i+1]==A[i+2] && A[i]!=5){ | ^ main.c:29:27: error: subscripted value is neither array nor pointer nor vector 29 | if(A[i]==A[i+1] && A[i+1]==A[i+2] && A[i]!=5){ | ^ main.c:29:37: error: subscripted value is neither array nor pointer nor vector 29 | if(A[i]==A[i+1] && A[i+1]==A[i+2] && A[i]!=5){ | ^ main.c:29:45: error: subscripted value is neither array nor pointer nor vector 29 | if(A[i]==A[i+1] && A[i+1]==A[i+2] && A[i]!=5){ | ^ main.c:29:55: error: subscripted value is neither array nor pointer nor vector 29 | if(A[i]==A[i+1] && A[i+1]==A[i+2] && A[i]!=5){ | ^ main.c:30:30: error: subscripted value is neither array nor pointer nor vector 30 | ans=A[i]; | ^ main.c:35:21: error: subscripted value is neither array nor pointer nor vector 35 | if(A[i]==A[i+3] && A[i+3]==A[i+6] && A[i]!=5){ | ^ main.c:35:27: error: subscripted value is neither array nor pointer nor vector 35 | if(A[i]==A[i+3] && A[i+3]==A[i+6] && A[i]!=5){ | ^ main.c:35:37: error: subscripted value is neither array nor pointer nor vector 35 | if(A[i]==A[i+3] && A[i+3]==A[i+6] && A[i]!=5){ | ^ main.c:35:45: error: subscripted value is neither array nor pointer nor vector 35 | if(A[i]==A[i+3] && A[i+3]==A[i+6] && A[i]!=5){ | ^ main.c:35:55: error: subscripted value is neither array nor pointer nor vector 35 | if(A[i]==A[i+3] && A[i+3]==A[i+6] && A[i]!=5){ | ^ main.c:36:30: error: subscripted value is neither array nor pointer nor vector 36 | ans=A[i]; | ^ main.c:40:13: error: subscripted value is neither array nor pointer nor vector 40 | if(A[1]==A[5] && A[5]==A[9] && A[1]!=5){ | ^ main.c:40:19: error: subscripted value is neither array nor pointer nor vector 40 | if(A[1]==A[5] && A[5]==A[9] && A[1]!=5){ | ^ main.c:40:27: error: subscripted value is neither array nor pointer nor vector 40 | if(A[1]==A[5] && A[5]==A[9] && A[1]!=5){ | ^ main.c:40:33: error: subscripted value is neither array nor pointer nor vector 40 | if(A[1]==A[5] && A[5]==A[9] && A[1]!=5){ | ^ main.c:40:41: error: subscripted value is neither array nor pointer nor vector 40 | if(A[1]==A[5] && A[5]==A[9] && A[1]!=5){ | ^ main.c:41:22: error: subscripted value is neither array nor pointer nor vector 41 | ans=A[1]; | ^ main.c:44:13: error: subscripted value is neither array nor pointer nor vector 44 | if(A[3]==A[5] && A[5]==A[7] && A[3]!=5){ | ^ main.c:44:19: error: subscripted value is neither array nor pointer nor vector 44 | if(A[3]==A[5] && A[5]==A[7] && A[3]!=5){ | ^ main.c:44:27: error: subscripted value is neither array nor pointer nor vector 44 | if(A[3]==A[5] && A[5]==A[7] && A[3]!=5){ | ^ main.c:44:33: error: subscripted value is neither array nor pointer nor vector 44 | if(A[3]==A[5] && A[5]==A[7] && A[3]!=5){ | ^ main.c:44:41: error: subscripted value is neither array nor pointer nor vector 44 | if(A[3]==A[5] && A[5]==A[7] && A[3]!=5){ | ^ main.c:45:22: error: subscripted value is neither array nor pointer nor vector 45 | ans=A[3]; | ^
s274160600
p00066
C
#include <stdio.h> #include <string.h> #define N 100 int up(int A); int main(void){ int ans,i,A[N]; char str[N]; for( ;fgets(str,sizeof(str),stdin)!=NULL; ){ ans=5; for(i=0;i<9;i++){ if(str[i]=='o') A[i+1]=1; else if(str[i]=='x') A[i+1]=0; else if(str[i]=='s') A[i+1]=5; } ans=up(A); if(ans==1) printf("o\n"); else if(ans==0) printf("x\n"); else printf("d\n"); } return 0; } int up(int A){ int i,ans; for(i=1;i<8;i+=3){ if(A[i]==A[i+1] && A[i+1]==A[i+2] && A[i]!=5){ ans=A[i]; return ans; } } for(i=1;i<4;i+=1){ if(A[i]==A[i+3] && A[i+3]==A[i+6] && A[i]!=5){ ans=A[i]; return ans; } } if(A[1]==A[5] && A[5]==A[9] && A[1]!=5){ ans=A[1]; return ans; } if(A[3]==A[5] && A[5]==A[7] && A[3]!=5){ ans=A[3]; return ans; } }
main.c: In function 'main': main.c:19:24: error: passing argument 1 of 'up' makes integer from pointer without a cast [-Wint-conversion] 19 | ans=up(A); | ^ | | | int * main.c:4:12: note: expected 'int' but argument is of type 'int *' 4 | int up(int A); | ~~~~^ main.c: In function 'up': main.c:33:21: error: subscripted value is neither array nor pointer nor vector 33 | if(A[i]==A[i+1] && A[i+1]==A[i+2] && A[i]!=5){ | ^ main.c:33:27: error: subscripted value is neither array nor pointer nor vector 33 | if(A[i]==A[i+1] && A[i+1]==A[i+2] && A[i]!=5){ | ^ main.c:33:37: error: subscripted value is neither array nor pointer nor vector 33 | if(A[i]==A[i+1] && A[i+1]==A[i+2] && A[i]!=5){ | ^ main.c:33:45: error: subscripted value is neither array nor pointer nor vector 33 | if(A[i]==A[i+1] && A[i+1]==A[i+2] && A[i]!=5){ | ^ main.c:33:55: error: subscripted value is neither array nor pointer nor vector 33 | if(A[i]==A[i+1] && A[i+1]==A[i+2] && A[i]!=5){ | ^ main.c:34:30: error: subscripted value is neither array nor pointer nor vector 34 | ans=A[i]; | ^ main.c:39:21: error: subscripted value is neither array nor pointer nor vector 39 | if(A[i]==A[i+3] && A[i+3]==A[i+6] && A[i]!=5){ | ^ main.c:39:27: error: subscripted value is neither array nor pointer nor vector 39 | if(A[i]==A[i+3] && A[i+3]==A[i+6] && A[i]!=5){ | ^ main.c:39:37: error: subscripted value is neither array nor pointer nor vector 39 | if(A[i]==A[i+3] && A[i+3]==A[i+6] && A[i]!=5){ | ^ main.c:39:45: error: subscripted value is neither array nor pointer nor vector 39 | if(A[i]==A[i+3] && A[i+3]==A[i+6] && A[i]!=5){ | ^ main.c:39:55: error: subscripted value is neither array nor pointer nor vector 39 | if(A[i]==A[i+3] && A[i+3]==A[i+6] && A[i]!=5){ | ^ main.c:40:30: error: subscripted value is neither array nor pointer nor vector 40 | ans=A[i]; | ^ main.c:44:13: error: subscripted value is neither array nor pointer nor vector 44 | if(A[1]==A[5] && A[5]==A[9] && A[1]!=5){ | ^ main.c:44:19: error: subscripted value is neither array nor pointer nor vector 44 | if(A[1]==A[5] && A[5]==A[9] && A[1]!=5){ | ^ main.c:44:27: error: subscripted value is neither array nor pointer nor vector 44 | if(A[1]==A[5] && A[5]==A[9] && A[1]!=5){ | ^ main.c:44:33: error: subscripted value is neither array nor pointer nor vector 44 | if(A[1]==A[5] && A[5]==A[9] && A[1]!=5){ | ^ main.c:44:41: error: subscripted value is neither array nor pointer nor vector 44 | if(A[1]==A[5] && A[5]==A[9] && A[1]!=5){ | ^ main.c:45:22: error: subscripted value is neither array nor pointer nor vector 45 | ans=A[1]; | ^ main.c:48:13: error: subscripted value is neither array nor pointer nor vector 48 | if(A[3]==A[5] && A[5]==A[7] && A[3]!=5){ | ^ main.c:48:19: error: subscripted value is neither array nor pointer nor vector 48 | if(A[3]==A[5] && A[5]==A[7] && A[3]!=5){ | ^ main.c:48:27: error: subscripted value is neither array nor pointer nor vector 48 | if(A[3]==A[5] && A[5]==A[7] && A[3]!=5){ | ^ main.c:48:33: error: subscripted value is neither array nor pointer nor vector 48 | if(A[3]==A[5] && A[5]==A[7] && A[3]!=5){ | ^ main.c:48:41: error: subscripted value is neither array nor pointer nor vector 48 | if(A[3]==A[5] && A[5]==A[7] && A[3]!=5){ | ^ main.c:49:22: error: subscripted value is neither array nor pointer nor vector 49 | ans=A[3]; | ^
s662602077
p00066
C
#include<stdio.h> int FUNC(char s[],char A){ int M=0,K,I,J; for(J=0;J<7;J+3){ K=0; for(I=J;I<J+3;I++) if(s[I]==A) K++; if(K==3){ M++; break; } } if(M>0)return 1; for(J=0;J<3;J++){ K=0; for(I=J;I<J+7;J+3) if(s[I]==A) K++; if(K==3){ M++; break; } If(M>0)return 1; K=0; if(s[0]==A&&s[4]==A&&s[8]==A) return 1; If(s[2]==1&&s[4]==A&&s[6]==A) return 1; return 0; } int main(){ char s{10],A; while(scanf("%s",s)!=EOF){ A='o'; if(FUNC(s,A){ printf("o\n"); continue; } A='x'; if(FUNC(s,A)) printf("x\n"); else printf("d\n"); } return 0; }
main.c: In function 'FUNC': main.c:24:1: error: implicit declaration of function 'If' [-Wimplicit-function-declaration] 24 | If(M>0)return 1; | ^~ main.c:24:8: error: expected ';' before 'return' 24 | If(M>0)return 1; | ^~~~~~ | ; main.c:28:30: error: expected ';' before 'return' 28 | If(s[2]==1&&s[4]==A&&s[6]==A) | ^ | ; 29 | return 1; | ~~~~~~ main.c: In function 'main': main.c:33:7: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token 33 | char s{10],A; | ^ main.c:33:10: error: expected ';' before ']' token 33 | char s{10],A; | ^ | ; main.c:33:10: error: expected statement before ']' token main.c:33:11: error: expected expression before ',' token 33 | char s{10],A; | ^ main.c:36:13: error: expected ')' before '{' token 36 | if(FUNC(s,A){ | ~ ^ | ) main.c:45:1: error: expected expression before '}' token 45 | } | ^ main.c:47:1: error: expected declaration or statement at end of input 47 | } | ^ main.c: In function 'FUNC': main.c:47:1: error: expected declaration or statement at end of input
s040723329
p00066
C
#include<stdio.h> int FUNC(char s[],char A){ int M=0,K,I,J; for(J=0;J<7;J+3){ K=0; for(I=J;I<J+3;I++) if(s[I]==A) K++; if(K==3){ M++; break; } } if(M>0)return 1; for(J=0;J<3;J++){ K=0; for(I=J;I<J+7;J+3) if(s[I]==A) K++; if(K==3){ M++; break; } if(M>0)return 1; K=0; if(s[0]==A&&s[4]==A&&s[8]==A) return 1; if(s[2]==1&&s[4]==A&&s[6]==A) return 1; return 0; } int main(){ char s{10],A; while(scanf("%s",s)!=EOF){ A='o'; if(FUNC(s,A)){ printf("o\n"); continue; } A='x'; if(FUNC(s,A)) printf("x\n"); else printf("d\n"); } return 0; }
main.c: In function 'main': main.c:33:7: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token 33 | char s{10],A; | ^ main.c:33:10: error: expected ';' before ']' token 33 | char s{10],A; | ^ | ; main.c:33:10: error: expected statement before ']' token main.c:33:11: error: expected expression before ',' token 33 | char s{10],A; | ^ main.c:47:1: error: expected declaration or statement at end of input 47 | } | ^ main.c: In function 'FUNC': main.c:47:1: error: expected declaration or statement at end of input
s182280071
p00066
C
#include<stdio.h> int FUNC(char s[],char A){ int M=0,K,I,J; for(J=0;J<7;J+3){ K=0; for(I=J;I<J+3;I++) if(s[I]==A) K++; if(K==3){ M++; break; } } if(M>0)return 1; for(J=0;J<3;J++){ K=0; for(I=J;I<J+7;J+3) if(s[I]==A) K++; if(K==3){ M++; break; } if(M>0)return 1; K=0; if(s[0]==A&&s[4]==A&&s[8]==A) return 1; if(s[2]==A&&s[4]==A&&s[6]==A) return 1; return 0; } int main(){ char s[10],A; while(scanf("%s",s)!=EOF){ A='o'; if(FUNC(s,A)){ printf("o\n"); continue; } A='x'; if(FUNC(s,A)) printf("x\n"); else printf("d\n"); } return 0; }
main.c: In function 'FUNC': main.c:47:1: error: expected declaration or statement at end of input 47 | } | ^
s685176126
p00066
C
#include<stdio.h> int FUNC(char S,char A){ if(S[0]==A&&S[1]==A&&S[2]==A) return 1; else if(S[3]==A&&S[4]==A&&S[5]==A) return 1; else if(S[6]==A&&S[7]==A&&S[8]==A) return 1 else if(S[0]==A&&S[3]==A&&S[6]==A) return 1; else if(S[1]==A&&S[4]==A&&S[7]==A) return 1; else if(S[2]==A&&S[5]==A&&S[8]==A) return 1; else if(S[0]==A&&S[4]==A&&S[8]==A) return 1; else if(S[2]==A&&S[4]==A&&S[6]==A) return 1; else return 0; } int main(){ char s[10],A; while(scanf("%s",s)!=EOF){ A='o'; if(FUNC(s,A)){ printf("o\n"); contenue; } A='x'; if(FUNC(s,A)) printf("x\n"); else printf("d\n"); } return 0; }
main.c: In function 'FUNC': main.c:3:5: error: subscripted value is neither array nor pointer nor vector 3 | if(S[0]==A&&S[1]==A&&S[2]==A) | ^ main.c:3:14: error: subscripted value is neither array nor pointer nor vector 3 | if(S[0]==A&&S[1]==A&&S[2]==A) | ^ main.c:3:23: error: subscripted value is neither array nor pointer nor vector 3 | if(S[0]==A&&S[1]==A&&S[2]==A) | ^ main.c:5:10: error: subscripted value is neither array nor pointer nor vector 5 | else if(S[3]==A&&S[4]==A&&S[5]==A) | ^ main.c:5:19: error: subscripted value is neither array nor pointer nor vector 5 | else if(S[3]==A&&S[4]==A&&S[5]==A) | ^ main.c:5:28: error: subscripted value is neither array nor pointer nor vector 5 | else if(S[3]==A&&S[4]==A&&S[5]==A) | ^ main.c:7:10: error: subscripted value is neither array nor pointer nor vector 7 | else if(S[6]==A&&S[7]==A&&S[8]==A) | ^ main.c:7:19: error: subscripted value is neither array nor pointer nor vector 7 | else if(S[6]==A&&S[7]==A&&S[8]==A) | ^ main.c:7:28: error: subscripted value is neither array nor pointer nor vector 7 | else if(S[6]==A&&S[7]==A&&S[8]==A) | ^ main.c:8:9: error: expected ';' before 'else' 8 | return 1 | ^ | ; 9 | else if(S[0]==A&&S[3]==A&&S[6]==A) | ~~~~ main.c:11:10: error: subscripted value is neither array nor pointer nor vector 11 | else if(S[1]==A&&S[4]==A&&S[7]==A) | ^ main.c:11:19: error: subscripted value is neither array nor pointer nor vector 11 | else if(S[1]==A&&S[4]==A&&S[7]==A) | ^ main.c:11:28: error: subscripted value is neither array nor pointer nor vector 11 | else if(S[1]==A&&S[4]==A&&S[7]==A) | ^ main.c:13:10: error: subscripted value is neither array nor pointer nor vector 13 | else if(S[2]==A&&S[5]==A&&S[8]==A) | ^ main.c:13:19: error: subscripted value is neither array nor pointer nor vector 13 | else if(S[2]==A&&S[5]==A&&S[8]==A) | ^ main.c:13:28: error: subscripted value is neither array nor pointer nor vector 13 | else if(S[2]==A&&S[5]==A&&S[8]==A) | ^ main.c:15:10: error: subscripted value is neither array nor pointer nor vector 15 | else if(S[0]==A&&S[4]==A&&S[8]==A) | ^ main.c:15:19: error: subscripted value is neither array nor pointer nor vector 15 | else if(S[0]==A&&S[4]==A&&S[8]==A) | ^ main.c:15:28: error: subscripted value is neither array nor pointer nor vector 15 | else if(S[0]==A&&S[4]==A&&S[8]==A) | ^ main.c:17:10: error: subscripted value is neither array nor pointer nor vector 17 | else if(S[2]==A&&S[4]==A&&S[6]==A) | ^ main.c:17:19: error: subscripted value is neither array nor pointer nor vector 17 | else if(S[2]==A&&S[4]==A&&S[6]==A) | ^ main.c:17:28: error: subscripted value is neither array nor pointer nor vector 17 | else if(S[2]==A&&S[4]==A&&S[6]==A) | ^ main.c: In function 'main': main.c:25:9: error: passing argument 1 of 'FUNC' makes integer from pointer without a cast [-Wint-conversion] 25 | if(FUNC(s,A)){ | ^ | | | char * main.c:2:15: note: expected 'char' but argument is of type 'char *' 2 | int FUNC(char S,char A){ | ~~~~~^ main.c:27:1: error: 'contenue' undeclared (first use in this function) 27 | contenue; | ^~~~~~~~ main.c:27:1: note: each undeclared identifier is reported only once for each function it appears in main.c:30:9: error: passing argument 1 of 'FUNC' makes integer from pointer without a cast [-Wint-conversion] 30 | if(FUNC(s,A)) | ^ | | | char * main.c:2:15: note: expected 'char' but argument is of type 'char *' 2 | int FUNC(char S,char A){ | ~~~~~^
s547131787
p00066
C
#include<stdio.h> int FUNC(char S[],char A){ if(S[0]==A&&S[1]==A&&S[2]==A) return 1; else if(S[3]==A&&S[4]==A&&S[5]==A) return 1; else if(S[6]==A&&S[7]==A&&S[8]==A) return 1 else if(S[0]==A&&S[3]==A&&S[6]==A) return 1; else if(S[1]==A&&S[4]==A&&S[7]==A) return 1; else if(S[2]==A&&S[5]==A&&S[8]==A) return 1; else if(S[0]==A&&S[4]==A&&S[8]==A) return 1; else if(S[2]==A&&S[4]==A&&S[6]==A) return 1; else return 0; } int main(){ char s[10],A; while(scanf("%s",s)!=EOF){ A='o'; if(FUNC(s,A)){ printf("o\n"); contenue; } A='x'; if(FUNC(s,A)) printf("x\n"); else printf("d\n"); } return 0; }
main.c: In function 'FUNC': main.c:8:9: error: expected ';' before 'else' 8 | return 1 | ^ | ; 9 | else if(S[0]==A&&S[3]==A&&S[6]==A) | ~~~~ main.c: In function 'main': main.c:27:1: error: 'contenue' undeclared (first use in this function) 27 | contenue; | ^~~~~~~~ main.c:27:1: note: each undeclared identifier is reported only once for each function it appears in
s248830569
p00066
C
#include <iostream> #include <string> using namespace std; int main() { string str; char field[3][3]; while(cin >> str){ int k=0; for(int i=0;i<3;i++){ for(int j=0;j<3;j++){ field[i][j] = str[k++]; } } if((field[0][0] == field[0][1] && field[0][0] == field[0][2]) || (field[0][0] == field[1][0] && field[0][0] == field[2][0])){ cout << field[0][0] << endl; }else if((field[2][0] == field[2][1] && field[2][0] == field[2][2]) || (field[0][2] == field[1][2] && field[0][2] == field[2][2])) cout << field[2][2] << endl; else if((field[1][0] == field[1][1] && field[1][0] == field[1][2]) || (field[0][1] == field[1][1] && field[0][1] == field[2][1])) cout << field[1][1] << endl; else if((field[0][0] == field[1][1] && field[2][2] == field[0][0]) || (field[0][2] == field[1][1] && field[0][2] == field[2][0])) cout << field[1][1] << endl; else cout << 'd' << endl; } return 0; }
main.c:1:10: fatal error: iostream: No such file or directory 1 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s646655693
p00066
C
#include <stdio.h> int main(void){ char t[10]; while(scanf("%s",t)!=EOF){ bool o[10],x[10]; for(int i=0;i<9;++i){ o[i]=(t[i]=='o')?true:false; x[i]=(t[i]=='x')?true:false; } int ans = 2; for(int i=0;i<3;++i){ if(o[i*3]&&o[i*3+1]&&o[i*3+2]||o[i]&&o[3*1+i]&&o[3*2+i]) ans=0; if(x[i*3]&&x[i*3+1]&&x[i*3+2]||x[i]&&x[3*1+i]&&x[3*2+i]) ans=1; } if(o[0]&&o[4]&&o[8]||o[2]&&o[4]&&o[6]) ans=0; if(x[0]&&x[4]&&x[8]||x[2]&&x[4]&&x[6]) ans=1; printf("%c\n",((ans<2)?((ans)?'x':'o'):'d')); } return 0; }
main.c: In function 'main': main.c:6:17: error: unknown type name 'bool' 6 | bool o[10],x[10]; | ^~~~ main.c:2:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>' 1 | #include <stdio.h> +++ |+#include <stdbool.h> 2 | main.c:8:42: error: 'true' undeclared (first use in this function) 8 | o[i]=(t[i]=='o')?true:false; | ^~~~ main.c:8:42: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>' main.c:8:42: note: each undeclared identifier is reported only once for each function it appears in main.c:8:47: error: 'false' undeclared (first use in this function) 8 | o[i]=(t[i]=='o')?true:false; | ^~~~~ main.c:8:47: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
s610550456
p00066
C++
#include <iostream> #include <string> using namespace std; int main(){ string str; cin >> str; while(cin >> str){ if(str[0]==str[1]==str[2] || str[0]==str[3]==str[6] || str[0]==str[4]==str[8]){ if(str[0]==o){ cout << "o" << endl; } else if(str[0]==x){ cout << "x" << endl; } else if(str[8]==str[5]==str[2] || str[8]==str[7]==str[6]){ if(str[8]==o){ cout << "o" << endl; } else if(str[8]==x){ cout << "x" << endl; } else if(str[1]==str[4]==str[7] || str[3]==str[4]==str[5] || str[2]==str[4]==str[6]){ if(str[4]==o){ cout << "o" << endl; } else if(str[4]==x){ cout << "x" << endl; } else if{ cout << "d" << endl; } } } } } return 0; }
a.cc: In function 'int main()': a.cc:19:36: error: 'o' was not declared in this scope 19 | if(str[0]==o){ | ^ a.cc:21:43: error: 'x' was not declared in this scope 21 | } else if(str[0]==x){ | ^ a.cc:33:50: error: expected '(' before '{' token 33 | } else if{ | ^ | (
s226637786
p00066
C++
#include <iostream> #include <string> using namespace std; int main(){ string str; cin >> str; while(cin >> str){ if(str[0]==str[1]==str[2] || str[0]==str[3]==str[6] || str[0]==str[4]==str[8]){ if(str[0]==o){ cout << "o" << endl; } else if(str[0]==x){ cout << "x" << endl; } else if(str[8]==str[5]==str[2] || str[8]==str[7]==str[6]){ if(str[8]==o){ cout << "o" << endl; } else if(str[8]==x){ cout << "x" << endl; } else if(str[1]==str[4]==str[7] || str[3]==str[4]==str[5] || str[2]==str[4]==str[6]){ if(str[4]==o){ cout << "o" << endl; } else if(str[4]==x){ cout << "x" << endl; } else if{ cout << "d" << endl; } } } } } return 0; }
a.cc: In function 'int main()': a.cc:19:36: error: 'o' was not declared in this scope 19 | if(str[0]==o){ | ^ a.cc:21:43: error: 'x' was not declared in this scope 21 | } else if(str[0]==x){ | ^ a.cc:33:50: error: expected '(' before '{' token 33 | } else if{ | ^ | (
s952409493
p00066
C++
#include <iostream> #include <string> using namespace std; int main(){ string str; cin >> str; while(cin >> str){ if(str[0]==str[1]==str[2] || str[0]==str[3]==str[6] || str[0]==str[4]==str[8]){ if(str[0]==o){ cout << "o" << endl; } else if(str[0]==x){ cout << "x" << endl; } else if(str[8]==str[5]==str[2] || str[8]==str[7]==str[6]){ if(str[8]==o){ cout << "o" << endl; } else if(str[8]==x){ cout << "x" << endl; } else if(str[1]==str[4]==str[7] || str[3]==str[4]==str[5] || str[2]==str[4]==str[6]){ if(str[4]==o){ cout << "o" << endl; } else if(str[4]==x){ cout << "x" << endl; } else if{ cout << "d" << endl; } } } } } return 0; }
a.cc: In function 'int main()': a.cc:19:36: error: 'o' was not declared in this scope 19 | if(str[0]==o){ | ^ a.cc:21:43: error: 'x' was not declared in this scope 21 | } else if(str[0]==x){ | ^ a.cc:33:50: error: expected '(' before '{' token 33 | } else if{ | ^ | (
s305567693
p00066
C++
#include <iostream> #include <string> #include <algorithm> using namespace std; int main(){ char array[8] for(int i=0;i<9;i++){ cin >> array[i]; } for(int j=0;j<3;j++){ if(array[j*3]==array[j*3+1] && array[j*3+1]==array[j*3+2]){ if(array[j*3]=="o"){ cout >> "o" >> endl; }else if(array[j*3=="x"]){ cout >> "x" >> endl; } } } for(int k=0;k<3;k++){ if(array[k]==array[k+3] && array[k+3]==array[k+6]){ if(array[k]=="o"){ cout >> "o" >> endl; }else if(array[k=="x"]){ cout >> "x" >> endl; } } } if(array[0]==array[4]&&array[4]==array[8]){ if(array[0]=="o"){ cout >> "o" >> endl; }else if(array[0=="x"]){ cout >> "x" >> endl; } } if(array[2]==array[4]&&array[4]==array[6]){ if(array[0]=="o"){ cout >> "o" >> endl; }else if(array[0=="x"]){ cout >> "x" >> endl; } } }
a.cc: In function 'int main()': a.cc:9:5: error: expected initializer before 'for' 9 | for(int i=0;i<9;i++){ | ^~~ a.cc:9:17: error: 'i' was not declared in this scope 9 | for(int i=0;i<9;i++){ | ^ a.cc:13:17: error: expected unqualified-id before '[' token 13 | if(array[j*3]==array[j*3+1] && array[j*3+1]==array[j*3+2]){ | ^ a.cc:14:21: error: expected unqualified-id before '[' token 14 | if(array[j*3]=="o"){ | ^ a.cc:15:22: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'const char [2]') 15 | cout >> "o" >> endl; | ~~~~ ^~ ~~~ | | | | | const char [2] | std::ostream {aka std::basic_ostream<char>} In file included from /usr/include/c++/14/string:55, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 835 | operator>>(basic_istream<_CharT, _Traits>& __in, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed: a.cc:15:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 15 | cout >> "o" >> endl; | ^~~ In file included from /usr/include/c++/14/bits/memory_resource.h:38, from /usr/include/c++/14/string:68: /usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)' 131 | operator>>(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed: a.cc:15:17: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte' 15 | cout >> "o" >> endl; | ^~~~ In file included from /usr/include/c++/14/istream:1109, from /usr/include/c++/14/iostream:42: /usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)' 978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c) | ^~~~~~~~ /usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed: a.cc:15:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 15 | cout >> "o" >> endl; | ^~~ /usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)' 849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed: a.cc:15:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 15 | cout >> "o" >> endl; | ^~~ /usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)' 854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed: a.cc:15:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 15 | cout >> "o" >> endl; | ^~~ /usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)' 896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed: a.cc:15:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 15 | cout >> "o" >> endl; | ^~~ /usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)' 939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed: a.cc:15:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 15 | cout >> "o" >> endl; | ^~~ /usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)' 945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed: a.cc:15:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 15 | cout >> "o" >> endl; | ^~~ /usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed: /usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = const char (&)[2]]': a.cc:15:25: required from here 15 | cout >> "o" >> endl; | ^~~ /usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ a.cc:16:27: error: expected unqualified-id before '[' token 16 | }else if(array[j*3=="x"]){ | ^ a.cc:17:22: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'const char [2]') 17 | cout >> "x" >> endl; | ~~~~ ^~ ~~~ | | | | | const char [2] | std::ostream {aka std::basic_ostream<char>} /usr/include/c++/14/bits/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 835 | operator>>(basic_istream<_CharT, _Traits>& __in, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed: a.cc:17:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 17 | cout >> "x" >> endl; | ^~~ /usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)' 131 | operator>>(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed: a.cc:17:17: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte' 17 | cout >> "x" >> endl; | ^~~~ /usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)' 978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c) | ^~~~~~~~ /usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed: a.cc:17:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 17 | cout >> "x" >> endl; | ^~~ /usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)' 849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed: a.cc:17:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 17 | cout >> "x" >> endl; | ^~~ /usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)' 854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed: a.cc:17:25: note: 'std::ostream' {aka 'std::basic_ostrea
s568362275
p00066
C++
#include <iostream> #include <string> #include <algorithm> using namespace std; int main(){ char array[8]; for(int i=0;i<9;i++){ cin >> array[i]; } for(int j=0;j<3;j++){ if(array[j*3]==array[j*3+1] && array[j*3+1]==array[j*3+2]){ if(array[j*3]=="o"){ cout >> "o" >> endl; }else if(array[j*3=="x"]){ cout >> "x" >> endl; } } } for(int k=0;k<3;k++){ if(array[k]==array[k+3] && array[k+3]==array[k+6]){ if(array[k]=="o"){ cout >> "o" >> endl; }else if(array[k=="x"]){ cout >> "x" >> endl; } } } if(array[0]==array[4]&&array[4]==array[8]){ if(array[0]=="o"){ cout >> "o" >> endl; }else if(array[0=="x"]){ cout >> "x" >> endl; } } if(array[2]==array[4]&&array[4]==array[6]){ if(array[0]=="o"){ cout >> "o" >> endl; }else if(array[0=="x"]){ cout >> "x" >> endl; } } }
a.cc: In function 'int main()': a.cc:14:26: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 14 | if(array[j*3]=="o"){ | ~~~~~~~~~~^~~~~ a.cc:15:22: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'const char [2]') 15 | cout >> "o" >> endl; | ~~~~ ^~ ~~~ | | | | | const char [2] | std::ostream {aka std::basic_ostream<char>} In file included from /usr/include/c++/14/string:55, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 835 | operator>>(basic_istream<_CharT, _Traits>& __in, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed: a.cc:15:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 15 | cout >> "o" >> endl; | ^~~ In file included from /usr/include/c++/14/bits/memory_resource.h:38, from /usr/include/c++/14/string:68: /usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)' 131 | operator>>(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed: a.cc:15:17: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte' 15 | cout >> "o" >> endl; | ^~~~ In file included from /usr/include/c++/14/istream:1109, from /usr/include/c++/14/iostream:42: /usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)' 978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c) | ^~~~~~~~ /usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed: a.cc:15:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 15 | cout >> "o" >> endl; | ^~~ /usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)' 849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed: a.cc:15:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 15 | cout >> "o" >> endl; | ^~~ /usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)' 854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed: a.cc:15:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 15 | cout >> "o" >> endl; | ^~~ /usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)' 896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed: a.cc:15:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 15 | cout >> "o" >> endl; | ^~~ /usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)' 939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed: a.cc:15:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 15 | cout >> "o" >> endl; | ^~~ /usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)' 945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed: a.cc:15:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 15 | cout >> "o" >> endl; | ^~~ /usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed: /usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = const char (&)[2]]': a.cc:15:25: required from here 15 | cout >> "o" >> endl; | ^~~ /usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ a.cc:16:31: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 16 | }else if(array[j*3=="x"]){ | ~~~^~~~~ a.cc:17:22: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'const char [2]') 17 | cout >> "x" >> endl; | ~~~~ ^~ ~~~ | | | | | const char [2] | std::ostream {aka std::basic_ostream<char>} /usr/include/c++/14/bits/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 835 | operator>>(basic_istream<_CharT, _Traits>& __in, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed: a.cc:17:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 17 | cout >> "x" >> endl; | ^~~ /usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)' 131 | operator>>(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed: a.cc:17:17: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte' 17 | cout >> "x" >> endl; | ^~~~ /usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)' 978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c) | ^~~~~~~~ /usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed: a.cc:17:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 17 | cout >> "x" >> endl; | ^~~ /usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)' 849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed: a.cc:17:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 17 | cout >> "x" >> endl; | ^~~ /usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)' 854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed: a.cc:17:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 17 | cout >> "x" >> endl; | ^~~ /usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istr
s728600599
p00066
C++
#include <iostream> #include <string> #include <algorithm> using namespace std; int main(){ string array; cin >> array[i]; for(int j=0;j<3;j++){ if(array[j*3]==array[j*3+1] && array[j*3+1]==array[j*3+2]){ if(array[j*3]=="o"){ cout >> "o" >> endl; }else if(array[j*3=="x"]){ cout >> "x" >> endl; } } } for(int k=0;k<3;k++){ if(array[k]==array[k+3] && array[k+3]==array[k+6]){ if(array[k]=="o"){ cout >> "o" >> endl; }else if(array[k=="x"]){ cout >> "x" >> endl; } } } if(array[0]==array[4]&&array[4]==array[8]){ if(array[0]=="o"){ cout >> "o" >> endl; }else if(array[0=="x"]){ cout >> "x" >> endl; } } if(array[2]==array[4]&&array[4]==array[6]){ if(array[0]=="o"){ cout >> "o" >> endl; }else if(array[0=="x"]){ cout >> "x" >> endl; } } }
a.cc: In function 'int main()': a.cc:9:18: error: 'i' was not declared in this scope 9 | cin >> array[i]; | ^ a.cc:12:26: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 12 | if(array[j*3]=="o"){ a.cc:13:22: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'const char [2]') 13 | cout >> "o" >> endl; | ~~~~ ^~ ~~~ | | | | | const char [2] | std::ostream {aka std::basic_ostream<char>} In file included from /usr/include/c++/14/string:55, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 835 | operator>>(basic_istream<_CharT, _Traits>& __in, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed: a.cc:13:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 13 | cout >> "o" >> endl; | ^~~ In file included from /usr/include/c++/14/bits/memory_resource.h:38, from /usr/include/c++/14/string:68: /usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)' 131 | operator>>(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed: a.cc:13:17: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte' 13 | cout >> "o" >> endl; | ^~~~ In file included from /usr/include/c++/14/istream:1109, from /usr/include/c++/14/iostream:42: /usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)' 978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c) | ^~~~~~~~ /usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed: a.cc:13:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 13 | cout >> "o" >> endl; | ^~~ /usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)' 849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed: a.cc:13:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 13 | cout >> "o" >> endl; | ^~~ /usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)' 854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed: a.cc:13:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 13 | cout >> "o" >> endl; | ^~~ /usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)' 896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed: a.cc:13:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 13 | cout >> "o" >> endl; | ^~~ /usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)' 939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed: a.cc:13:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 13 | cout >> "o" >> endl; | ^~~ /usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)' 945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed: a.cc:13:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 13 | cout >> "o" >> endl; | ^~~ /usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed: /usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = const char (&)[2]]': a.cc:13:25: required from here 13 | cout >> "o" >> endl; | ^~~ /usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ a.cc:14:31: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 14 | }else if(array[j*3=="x"]){ | ~~~^~~~~ a.cc:15:22: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'const char [2]') 15 | cout >> "x" >> endl; | ~~~~ ^~ ~~~ | | | | | const char [2] | std::ostream {aka std::basic_ostream<char>} /usr/include/c++/14/bits/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 835 | operator>>(basic_istream<_CharT, _Traits>& __in, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed: a.cc:15:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 15 | cout >> "x" >> endl; | ^~~ /usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)' 131 | operator>>(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed: a.cc:15:17: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte' 15 | cout >> "x" >> endl; | ^~~~ /usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)' 978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c) | ^~~~~~~~ /usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed: a.cc:15:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 15 | cout >> "x" >> endl; | ^~~ /usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)' 849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed: a.cc:15:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 15 | cout >> "x" >> endl; | ^~~ /usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)' 854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed: a.cc:15:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 15 | cout >> "x" >> endl; | ^~~ /usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _T
s667036480
p00066
C++
#include<iostream> #include<string> using namespace std; int main() { string a; while(cin >> a){ if(a[0] == a[1] && a[0] == a[2] && a[0] != "s"){ if(a[0] == "o") cout << "o" << endl; if(a[0] == "x") cout << "x" << endl; }else if(a[3] == a[4] && a[3] == a[5] && a[3] != "s"){ if(a[3] == "o") cout << "o" << endl; if(a[3] == "x") cout << "x" << endl; }else if(a[6] == a[7] && a[8] == a[7] && a[8] != "s"){ if(a[6] == "o") cout << "o" << endl; if(a[6] == "x") cout << "x" << endl; }else if(a[0] == a[3] && a[0] == a[6] && a[0] != "s"){ if(a[0] == "o") cout << "o" << endl; if(a[0] == "x") cout << "x" << endl; }else if(a[1] == a[4] && a[7] == a[4] && a[4] != "s"){ if(a[4] == "o") cout << "o" << endl; if(a[4] == "x") cout << "x" << endl; }else if(a[2] == a[5] && a[8] == a[5] && a[5] != "s"){ if(a[2] == "o") cout << "o" << endl; if(a[2] == "x") cout << "x" << endl; }else if(a[0] == a[4] && a[8] == a[4] && a[0] != "s"){ if(a[0] == "o") cout << "o" << endl; if(a[0] == "x") cout << "x" << endl; }else if(a[2] == a[4] && a[6] == a[4] && a[4] != "s"){ if(a[4] == "o") cout << "o" << endl; if(a[4] == "x") cout << "x" << endl; }else{ cout << "d" << endl; } } return 0; }
a.cc: In function 'int main()': a.cc:8:57: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 8 | if(a[0] == a[1] && a[0] == a[2] && a[0] != "s"){ a.cc:9:33: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 9 | if(a[0] == "o") a.cc:11:33: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 11 | if(a[0] == "x") a.cc:13:63: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 13 | }else if(a[3] == a[4] && a[3] == a[5] && a[3] != "s"){ a.cc:14:33: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 14 | if(a[3] == "o") a.cc:16:33: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 16 | if(a[3] == "x") a.cc:18:63: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 18 | }else if(a[6] == a[7] && a[8] == a[7] && a[8] != "s"){ a.cc:19:33: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 19 | if(a[6] == "o") a.cc:21:33: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 21 | if(a[6] == "x") a.cc:23:63: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 23 | }else if(a[0] == a[3] && a[0] == a[6] && a[0] != "s"){ a.cc:24:33: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 24 | if(a[0] == "o") a.cc:26:33: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 26 | if(a[0] == "x") a.cc:28:63: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 28 | }else if(a[1] == a[4] && a[7] == a[4] && a[4] != "s"){ a.cc:29:33: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 29 | if(a[4] == "o") a.cc:31:33: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 31 | if(a[4] == "x") a.cc:33:63: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 33 | }else if(a[2] == a[5] && a[8] == a[5] && a[5] != "s"){ a.cc:34:33: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 34 | if(a[2] == "o") a.cc:36:33: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 36 | if(a[2] == "x") a.cc:38:63: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 38 | }else if(a[0] == a[4] && a[8] == a[4] && a[0] != "s"){ a.cc:39:33: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 39 | if(a[0] == "o") a.cc:41:33: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 41 | if(a[0] == "x") a.cc:43:63: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 43 | }else if(a[2] == a[4] && a[6] == a[4] && a[4] != "s"){ a.cc:44:33: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 44 | if(a[4] == "o") a.cc:46:33: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 46 | if(a[4] == "x")
s652937391
p00066
C++
#include <stdio.h> #include <cctype> #include <iostream> #include <set> #include <string> #include <queue> #include <map> #include <utility> using namespace std; int size(string x){ string::size_type size=x.size(); return size; } #define fu(l,k) for(int i=l;i<k;i++) #define fd(l,k) for(int i=l;i>k;i--) #define sort(ss) sort(ss.begin(), ss.end()) #define rsort(ss) sort(ss.rbegin(), ss.rend()) typedef vector<string> vs; typedef vector<int> vi; double pi(){ return M_PI; } typedef set<int> set_i; typedef set<string> set_s; int INF=1000000; int main(){ string ss; while(cin>>ss){ if(ss="EOF") break; if(ss[0]==ss[1]&&ss[1]==ss[2]) cout<<ss[0]<<endl; else if(ss[0]==ss[1]&&ss[1]==ss[2]) cout<<ss[0]<<endl; else if(ss[3]==ss[4]&&ss[4]==ss[5]) cout<<ss[3]<<endl; else if(ss[6]==ss[7]&&ss[7]==ss[8]) cout<<ss[6]<<endl; else if(ss[0]==ss[3]&&ss[3]==ss[6]) cout<<ss[0]<<endl; else if(ss[1]==ss[4]&&ss[4]==ss[7]) cout<<ss[1]<<endl; else if(ss[2]==ss[5]&&ss[5]==ss[8]) cout<<ss[2]<<endl; else if(ss[0]==ss[4]&&ss[4]==ss[8]) cout<<ss[0]<<endl; else if(ss[2]==ss[4]&&ss[4]==ss[6]) cout<<ss[2]<<endl; else cout<<'d'<<endl; } }
a.cc: In function 'double pi()': a.cc:21:16: error: 'M_PI' was not declared in this scope 21 | return M_PI; | ^~~~ a.cc: In function 'int main()': a.cc:29:22: error: could not convert 'ss.std::__cxx11::basic_string<char>::operator=(((const char*)"EOF"))' from 'std::__cxx11::basic_string<char>' to 'bool' 29 | if(ss="EOF") break; | ~~^~~~~~ | | | std::__cxx11::basic_string<char>
s060161342
p00066
C++
#include <stdio.h> #include <cctype> #include <iostream> #include <set> #include <string> #include <queue> #include <map> #include <utility> using namespace std; int size(string x){ string::size_type size=x.size(); return size; } #define fu(l,k) for(int i=l;i<k;i++) #define fd(l,k) for(int i=l;i>k;i--) #define sort(ss) sort(ss.begin(), ss.end()) #define rsort(ss) sort(ss.rbegin(), ss.rend()) typedef vector<string> vs; typedef vector<int> vi; double pi(){ return M_PI; } typedef set<int> set_i; typedef set<string> set_s; int INF=1000000; int main(){ string ss; while(cin>>ss){ if(ss="EOF") break; if(ss[0]==ss[1]&&ss[1]==ss[2]) cout<<ss[0]<<endl; else if(ss[0]==ss[1]&&ss[1]==ss[2]) cout<<ss[0]<<endl; else if(ss[3]==ss[4]&&ss[4]==ss[5]) cout<<ss[3]<<endl; else if(ss[6]==ss[7]&&ss[7]==ss[8]) cout<<ss[6]<<endl; else if(ss[0]==ss[3]&&ss[3]==ss[6]) cout<<ss[0]<<endl; else if(ss[1]==ss[4]&&ss[4]==ss[7]) cout<<ss[1]<<endl; else if(ss[2]==ss[5]&&ss[5]==ss[8]) cout<<ss[2]<<endl; else if(ss[0]==ss[4]&&ss[4]==ss[8]) cout<<ss[0]<<endl; else if(ss[2]==ss[4]&&ss[4]==ss[6]) cout<<ss[2]<<endl; else cout<<"d"<<endl; } }
a.cc: In function 'double pi()': a.cc:21:16: error: 'M_PI' was not declared in this scope 21 | return M_PI; | ^~~~ a.cc: In function 'int main()': a.cc:29:22: error: could not convert 'ss.std::__cxx11::basic_string<char>::operator=(((const char*)"EOF"))' from 'std::__cxx11::basic_string<char>' to 'bool' 29 | if(ss="EOF") break; | ~~^~~~~~ | | | std::__cxx11::basic_string<char>
s952271564
p00066
C++
#include <map> #include <set> #include <stack> #include <queue> #include <cmath> #include <string> #include <vector> #include <iostream> #include <algorithm> using namespace std; #define endl '\n' typedef long long ll; typedef long double lb; typedef vector<int> vi; typedef vector<vector<int> > vii; typedef pair<int, int> pii; typedef pair<int, string> pis; typedef pair<string, int> psi; inline bool inside(int y, int x, int H, int W) { return (y >= 0 && x >= 0 && y < H && x < W); } inline int in() {int x; std::cin >> x; return x;} const ll MOD = 1e9 + 7; const ll INF = 1e9 + 9; const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}; const int dy[] = {1, 0, -1, 0, 1, -1, -1, 1}; int main() { cin.tie(0); ios::sync_with_stdio(false); string s; while (cin >> s){ if (s[0] == s[1] && s[1] == s[2] && s[0] != 's') cout << s[0] << endl; else if (s[3] == s[4] && s[4] == s[5] && s[3] != ’s') cout << s[3] << endl; else if (s[6] == s[7] && s[7] == s[8] && s[6] != ’s') cout << s[6] << endl; else if (s[0] == s[3] && s[3] == s[6] && s[0] != ’s') cout << s[0] << endl; else if (s[1] == s[4] && s[4] == s[7] && s[1] != ’s') cout << s[1] << endl; else if (s[2] == s[5] && s[5] == s[8] && s[2] != ’s') cout << s[2] << endl; else if (s[0] == s[4] && s[4] == s[8] && s[4] != ’s') cout << s[4] << endl; else if (s[2] == s[4] && s[4] == s[6] && s[4] != ’s') cout << s[4] << endl; else cout << 'd' << endl; } return (0); }
a.cc:44:54: error: extended character ’ is not valid in an identifier 44 | else if (s[3] == s[4] && s[4] == s[5] && s[3] != ’s') cout << s[3] << endl; | ^ a.cc:44:56: warning: missing terminating ' character 44 | else if (s[3] == s[4] && s[4] == s[5] && s[3] != ’s') cout << s[3] << endl; | ^ a.cc:44:56: error: missing terminating ' character 44 | else if (s[3] == s[4] && s[4] == s[5] && s[3] != ’s') cout << s[3] << endl; | ^~~~~~~~~~~~~~~~~~~~~~~~ a.cc:45:54: error: extended character ’ is not valid in an identifier 45 | else if (s[6] == s[7] && s[7] == s[8] && s[6] != ’s') cout << s[6] << endl; | ^ a.cc:45:56: warning: missing terminating ' character 45 | else if (s[6] == s[7] && s[7] == s[8] && s[6] != ’s') cout << s[6] << endl; | ^ a.cc:45:56: error: missing terminating ' character 45 | else if (s[6] == s[7] && s[7] == s[8] && s[6] != ’s') cout << s[6] << endl; | ^~~~~~~~~~~~~~~~~~~~~~~~ a.cc:47:54: error: extended character ’ is not valid in an identifier 47 | else if (s[0] == s[3] && s[3] == s[6] && s[0] != ’s') cout << s[0] << endl; | ^ a.cc:47:56: warning: missing terminating ' character 47 | else if (s[0] == s[3] && s[3] == s[6] && s[0] != ’s') cout << s[0] << endl; | ^ a.cc:47:56: error: missing terminating ' character 47 | else if (s[0] == s[3] && s[3] == s[6] && s[0] != ’s') cout << s[0] << endl; | ^~~~~~~~~~~~~~~~~~~~~~~~ a.cc:48:54: error: extended character ’ is not valid in an identifier 48 | else if (s[1] == s[4] && s[4] == s[7] && s[1] != ’s') cout << s[1] << endl; | ^ a.cc:48:56: warning: missing terminating ' character 48 | else if (s[1] == s[4] && s[4] == s[7] && s[1] != ’s') cout << s[1] << endl; | ^ a.cc:48:56: error: missing terminating ' character 48 | else if (s[1] == s[4] && s[4] == s[7] && s[1] != ’s') cout << s[1] << endl; | ^~~~~~~~~~~~~~~~~~~~~~~~ a.cc:49:54: error: extended character ’ is not valid in an identifier 49 | else if (s[2] == s[5] && s[5] == s[8] && s[2] != ’s') cout << s[2] << endl; | ^ a.cc:49:56: warning: missing terminating ' character 49 | else if (s[2] == s[5] && s[5] == s[8] && s[2] != ’s') cout << s[2] << endl; | ^ a.cc:49:56: error: missing terminating ' character 49 | else if (s[2] == s[5] && s[5] == s[8] && s[2] != ’s') cout << s[2] << endl; | ^~~~~~~~~~~~~~~~~~~~~~~~ a.cc:51:54: error: extended character ’ is not valid in an identifier 51 | else if (s[0] == s[4] && s[4] == s[8] && s[4] != ’s') cout << s[4] << endl; | ^ a.cc:51:56: warning: missing terminating ' character 51 | else if (s[0] == s[4] && s[4] == s[8] && s[4] != ’s') cout << s[4] << endl; | ^ a.cc:51:56: error: missing terminating ' character 51 | else if (s[0] == s[4] && s[4] == s[8] && s[4] != ’s') cout << s[4] << endl; | ^~~~~~~~~~~~~~~~~~~~~~~~ a.cc:52:54: error: extended character ’ is not valid in an identifier 52 | else if (s[2] == s[4] && s[4] == s[6] && s[4] != ’s') cout << s[4] << endl; | ^ a.cc:52:56: warning: missing terminating ' character 52 | else if (s[2] == s[4] && s[4] == s[6] && s[4] != ’s') cout << s[4] << endl; | ^ a.cc:52:56: error: missing terminating ' character 52 | else if (s[2] == s[4] && s[4] == s[6] && s[4] != ’s') cout << s[4] << endl; | ^~~~~~~~~~~~~~~~~~~~~~~~ a.cc: In function 'int main()': a.cc:44:54: error: '\U00002019s' was not declared in this scope 44 | else if (s[3] == s[4] && s[4] == s[5] && s[3] != ’s') cout << s[3] << endl; | ^~ a.cc:44:56: error: expected ')' before 'else' 44 | else if (s[3] == s[4] && s[4] == s[5] && s[3] != ’s') cout << s[3] << endl; | ~ ^ | ) 45 | else if (s[6] == s[7] && s[7] == s[8] && s[6] != ’s') cout << s[6] << endl; | ~~~~
s268739913
p00066
C++
#include <iostream> #include <string> using namespace std; int main(){ string s; int k; while(cin>>s){ k=0; s='1'+s; if(s[1]==s[2]&&s[2]==s[3]&&k[1]!='s')k=1; else if(s[4]==s[5]&&s[5]==s[6]&&k[4]!='s')k=4; else if(s[7]==s[8]&&s[8]==s[9]&&k[7]!='s')k=7; else if(s[1]==s[4]&&s[4]==s[7]&&k[1]!='s')k=1; else if(s[2]==s[5]&&s[5]==s[8]&&k[2]!='s')k=2; else if(s[3]==s[6]&&s[6]==s[9]&&k[3]!='s')k=3; else if(s[1]==s[5]&&s[5]==s[9]&&k[1]!='s')k=1; else if(s[3]==s[5]&&s[5]==s[7]&&k[3]!='s')k=3; if(k==0)cout<<'d'<<endl; else cout<<s[k]<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:11:33: error: invalid types 'int[int]' for array subscript 11 | if(s[1]==s[2]&&s[2]==s[3]&&k[1]!='s')k=1; | ^ a.cc:12:38: error: invalid types 'int[int]' for array subscript 12 | else if(s[4]==s[5]&&s[5]==s[6]&&k[4]!='s')k=4; | ^ a.cc:13:38: error: invalid types 'int[int]' for array subscript 13 | else if(s[7]==s[8]&&s[8]==s[9]&&k[7]!='s')k=7; | ^ a.cc:14:38: error: invalid types 'int[int]' for array subscript 14 | else if(s[1]==s[4]&&s[4]==s[7]&&k[1]!='s')k=1; | ^ a.cc:15:38: error: invalid types 'int[int]' for array subscript 15 | else if(s[2]==s[5]&&s[5]==s[8]&&k[2]!='s')k=2; | ^ a.cc:16:38: error: invalid types 'int[int]' for array subscript 16 | else if(s[3]==s[6]&&s[6]==s[9]&&k[3]!='s')k=3; | ^ a.cc:17:38: error: invalid types 'int[int]' for array subscript 17 | else if(s[1]==s[5]&&s[5]==s[9]&&k[1]!='s')k=1; | ^ a.cc:18:38: error: invalid types 'int[int]' for array subscript 18 | else if(s[3]==s[5]&&s[5]==s[7]&&k[3]!='s')k=3; | ^
s980841733
p00066
C++
#include<stdio.h> int main(void){ int str2[100], i = 0, char str[100]; scanf("%s", str); while (str[i] != \0) { if ( str[i] == 'o') str2[i] = 1; else if ( str[i] == 'x') str2[i] = 2; else if ( str[i] == 's') str2[i] = 0; i++ } if ( str2[1] + str[2] + str[3] == 3 ) printf("o"); else if ( str2[1] + str[2] + str[3] == 6 ) printf("x\n"); else if ( str2[4] + str[5] + str[6] == 3 ) printf("o\n"); else if ( str2[4] + str[5] + str[6] == 6 ) printf("x\n"); else if ( str2[7] + str[8] + str[9] == 3 ) printf("o\n"); else if ( str2[7] + str[8] + str[9] == 6 ) printf("x\n"); else if ( str2[1] + str[4] + str[7] == 3 ) printf("o\n"); else if ( str2[1] + str[4] + str[7] == 6 ) printf("x\n"); else if ( str2[2] + str[5] + str[8] == 3 ) printf("o\n"); else if ( str2[2] + str[5] + str[8] == 6 ) printf("x\n"); else if ( str2[3] + str[6] + str[9] == 3 ) printf("o\n"); else if ( str2[3] + str[6] + str[9] == 6 ) printf("x\n"); else if ( str2[1] + str[5] + str[9] == 3 ) printf("o\n"); else if ( str2[1] + str[5] + str[9] == 6 ) printf("x\n"); else if ( str2[3] + str[5] + str[7] == 3 ) printf("o\n"); else if ( str2[3] + str[5] + str[7] == 6 ) printf("x\n"); else printf("d\n");
a.cc:6:21: error: stray '\' in program 6 | while (str[i] != \0) { | ^ a.cc: In function 'int main()': a.cc:4:4: error: expected unqualified-id before 'char' 4 | char str[100]; | ^~~~ a.cc:5:16: error: 'str' was not declared in this scope; did you mean 'str2'? 5 | scanf("%s", str); | ^~~ | str2 a.cc:10:7: error: expected ';' before '}' token 10 | i++ | ^ | ; 11 | } | ~ a.cc:28:23: error: expected '}' at end of input 28 | else printf("d\n"); | ^ a.cc:2:15: note: to match this '{' 2 | int main(void){ | ^
s466549059
p00066
C++
#include <iostream> #include <math.h> #inclide <map> #include <algorithm> #include <vector> #include<string> using namespace std; #define pb push_back; #define ll long long; ll mod=1000000007; int sum1; int main{ string a; while(cin>>a) {bool owin=false; bool xwin=false; if(a[0]==a[1]&&a[1]==a[2]){ if(a[0]=='o'){owin=true;} else{xwin=true;} } if(a[3]==a[4]&&a[5]==a[4]){ if(a[4]=='o'){owin=true;} else{xwin=true;} } if(a[6]==a[7]&&a[7]==a[8]){ if(a[6]=='o'){owin=true;} else{xwin=true;} } if(a[0]==a[4]&&a[4]==a[8]){ if(a[0]=='o'){owin=true;} else{xwin=true;} } if(a[4]==a[6]&&a[4]==a[2]){ if(a[4]=='o'){owin=true;} else{xwin=true;} } if(xwin){cout<<"o"<<endl;} else if(xwin){cout<<"x"<<endl;} else{cout<<"d"<<endl;} }return 0; }
a.cc:3:2: error: invalid preprocessing directive #inclide; did you mean #include? 3 | #inclide <map> | ^~~~~~~ | include a.cc:9:17: error: declaration does not declare anything [-fpermissive] 9 | #define ll long long; | ^~~~ a.cc:10:1: note: in expansion of macro 'll' 10 | ll mod=1000000007; | ^~ a.cc:10:4: error: 'mod' does not name a type 10 | ll mod=1000000007; | ^~~ a.cc:13:5: error: cannot declare '::main' to be a global variable 13 | int main{ | ^~~~ a.cc:14:8: error: expected primary-expression before 'a' 14 | string a; | ^ a.cc:14:8: error: expected '}' before 'a' a.cc:13:9: note: to match this '{' 13 | int main{ | ^ a.cc:15:1: error: expected unqualified-id before 'while' 15 | while(cin>>a) | ^~~~~ a.cc:41:2: error: expected unqualified-id before 'return' 41 | }return 0; | ^~~~~~ a.cc:42:1: error: expected declaration before '}' token 42 | } | ^
s235696141
p00066
C++
#include <iostream> #include <math.h> #include <algorithm> #include <vector> #include<string> using namespace std; int main{ string a; while(cin>>a) {bool owin=false; bool xwin=false; if(a[0]==a[1]&&a[1]==a[2]){ if(a[0]=='o'){owin=true;} else{xwin=true;} } if(a[3]==a[4]&&a[5]==a[4]){ if(a[4]=='o'){owin=true;} else{xwin=true;} } if(a[6]==a[7]&&a[7]==a[8]){ if(a[6]=='o'){owin=true;} else{xwin=true;} } if(a[0]==a[4]&&a[4]==a[8]){ if(a[0]=='o'){owin=true;} else{xwin=true;} } if(a[4]==a[6]&&a[4]==a[2]){ if(a[4]=='o'){owin=true;} else{xwin=true;} } if(xwin){cout<<"o"<<endl;} else if(xwin){cout<<"x"<<endl;} else{cout<<"d"<<endl;} }return 0; }
a.cc:9:5: error: cannot declare '::main' to be a global variable 9 | int main{ | ^~~~ a.cc:10:8: error: expected primary-expression before 'a' 10 | string a; | ^ a.cc:10:8: error: expected '}' before 'a' a.cc:9:9: note: to match this '{' 9 | int main{ | ^ a.cc:11:1: error: expected unqualified-id before 'while' 11 | while(cin>>a) | ^~~~~ a.cc:37:2: error: expected unqualified-id before 'return' 37 | }return 0; | ^~~~~~ a.cc:38:1: error: expected declaration before '}' token 38 | } | ^
s188050147
p00066
C++
#include <iostream> #include <math.h> #include <algorithm> #include <vector> #include <string> #include <map> using namespace std; #define ll long long #define rep(i,n) for(int i=0;i<n;i++) #define ld long double #define forever while(true) #define int main(){ string a; while(cin>>a) { bool owin=false; bool xwin=false; if(a[0]==a[1]&&a[1]==a[2]){ if(a[0]=='o'){owin=true;} else if(a[0]=='x'){xwin=true;} } if(a[3]==a[4]&&a[5]==a[4]){ if(a[4]=='o'){owin=true;} else if(a[4]=='x'){xwin=true;} } if(a[6]==a[7]&&a[7]==a[8]){ if(a[6]=='o'){owin=true;} else if(a[6]=='x'){xwin=true;} } if(a[0]==a[4]&&a[4]==a[8]){ if(a[0]=='o'){owin=true;} else if(a[0]=='x'){xwin=true;} } if(a[4]==a[6]&&a[4]==a[2]){ if(a[4]=='o'){owin=true;} else if(a[6]=='x'){xwin=true;} } if(a[0]==a[3]&&a[3]==a[6]){ if(a[0]=='o'){owin=true;} else if(a[0]=='x'){xwin=true;} } if(a[4]==a[1]&&a[4]==a[7]){ if(a[1]=='o'){owin=true;} else if(a[1]=='x'){xwin=true;} } if(a[2]==a[5]&&a[8]==a[2]){ if(a[2]=='o'){owin=true;} else if(a[5]=='x'){xwin=true;} } if(owin){cout<<"o"<<endl;} else if(xwin){cout<<"x"<<endl;} else{cout<<"d"<<endl;} }return 0; }
a.cc:13:9: error: no macro name given in #define directive 13 | #define | ^
s539204523
p00066
C++
main(){ char s[10],cel[3][3]; while(~scanf("%s",s)){ char win='d'; int i,j,cnt; for(i=0;i<3;i++)for(j=0;j<3;j++)cel[i][j]=s[3*i+j]; for(i=0;i<3;i++){ cnt=0; for(j=0;j<3;j++) cnt+=cel[i][j]; if(cnt==3*'o') win='o'; if(cnt==3*'x') win='x'; } for(i=0;i<3;i++){ cnt=0; for(j=0;j<3;j++) cnt+=cel[j][i]; if(cnt==3*'o') win='o'; if(cnt==3*'x') win='x'; } for(i=cnt=0;i<3;i++) cnt+=cel[i][i]; if(cnt==3*'o') win='o'; if(cnt==3*'x') win='x'; for(i=cnt=0;i<3;i++) cnt+=cel[i][2-i]; if(cnt==3*'o') win='o'; if(cnt==3*'x') win='x'; printf("%c\n",win); } exit(0); }
a.cc:1:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 1 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:3:16: error: 'scanf' was not declared in this scope 3 | while(~scanf("%s",s)){ | ^~~~~ a.cc:30:17: error: 'printf' was not declared in this scope 30 | printf("%c\n",win); | ^~~~~~ a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | main(){ a.cc:32:9: error: 'exit' was not declared in this scope 32 | exit(0); | ^~~~ a.cc:1:1: note: 'exit' is defined in header '<cstdlib>'; this is probably fixable by adding '#include <cstdlib>' +++ |+#include <cstdlib> 1 | main(){
s700566789
p00066
C++
char*p="012345678036147258048246",f,s[11];main(i){for(;read(0,s,10);i||puts("d"))for(i=24;i>1;f-'s'&&f==s[p[i+1]-48]&f==s[p[i+2]-48]&&puts(&f,i=1))f=s[p[i-=3]-48];}
a.cc:1:8: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings] 1 | char*p="012345678036147258048246",f,s[11];main(i){for(;read(0,s,10);i||puts("d"))for(i=24;i>1;f-'s'&&f==s[p[i+1]-48]&f==s[p[i+2]-48]&&puts(&f,i=1))f=s[p[i-=3]-48];} | ^~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:1:47: error: expected constructor, destructor, or type conversion before '(' token 1 | char*p="012345678036147258048246",f,s[11];main(i){for(;read(0,s,10);i||puts("d"))for(i=24;i>1;f-'s'&&f==s[p[i+1]-48]&f==s[p[i+2]-48]&&puts(&f,i=1))f=s[p[i-=3]-48];} | ^
s989401670
p00066
C++
#include <iostream> #include <string> #include <algorithm> using namespace std; const int size = 3; bool check ( char hyo[size][size], char mark ) { for (int y = 0; y < size; ++y) for (int x = 0; x < size; ++x) { if (x+2 < size && hyo[y][x] == mark && hyo[y][x+1] == mark && hyo[y][x+2] == mark) { return true; } if (y+2 < size && hyo[y][x] == mark && hyo[y+1][x] == mark && hyo[y+2][x] == mark) { return true; } if (x+2 < size && y+2 < size && hyo[y][x] == mark && hyo[y+1][x+1] == mark && hyo[y+2][x+2] == mark) { return true; } if (x-2 >= 0 && y+2 < size && hyo[y][x] == mark && hyo[y+1][x-1] == mark && hyo[y+2][x-2] == mark) { return true; } } return false; } int main ( void ) { string str; while (cin >> str) { char hyo[size][size]; for (int y = 0; y < size; ++y) for (int x = 0; x < size; ++x) hyo[y][x] = str[y*size + x]; char judge = 'd' char mark[] = { 'o', 'x' }; for (int i = 0; i < 2; ++i) { if (check(hyo, mark[i])) { judge = mark[i]; } } cout << judge << endl; } return 0; }
a.cc:9:23: error: reference to 'size' is ambiguous 9 | bool check ( char hyo[size][size], char mark ) | ^~~~ In file included from /usr/include/c++/14/string:53, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])' 272 | size(const _Tp (&)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)' 262 | size(const _Container& __cont) noexcept(noexcept(__cont.size())) | ^~~~ a.cc:7:11: note: 'const int size' 7 | const int size = 3; | ^~~~ a.cc:9:29: error: reference to 'size' is ambiguous 9 | bool check ( char hyo[size][size], char mark ) | ^~~~ /usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])' 272 | size(const _Tp (&)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)' 262 | size(const _Container& __cont) noexcept(noexcept(__cont.size())) | ^~~~ a.cc:7:11: note: 'const int size' 7 | const int size = 3; | ^~~~ a.cc:9:34: error: expected ')' before ',' token 9 | bool check ( char hyo[size][size], char mark ) | ~ ^ | ) a.cc:9:36: error: expected unqualified-id before 'char' 9 | bool check ( char hyo[size][size], char mark ) | ^~~~ a.cc: In function 'int main()': a.cc:27:15: error: reference to 'size' is ambiguous 27 | char hyo[size][size]; | ^~~~ /usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])' 272 | size(const _Tp (&)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)' 262 | size(const _Container& __cont) noexcept(noexcept(__cont.size())) | ^~~~ a.cc:7:11: note: 'const int size' 7 | const int size = 3; | ^~~~ a.cc:27:21: error: reference to 'size' is ambiguous 27 | char hyo[size][size]; | ^~~~ /usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])' 272 | size(const _Tp (&)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)' 262 | size(const _Container& __cont) noexcept(noexcept(__cont.size())) | ^~~~ a.cc:7:11: note: 'const int size' 7 | const int size = 3; | ^~~~ a.cc:29:26: error: reference to 'size' is ambiguous 29 | for (int y = 0; y < size; ++y) | ^~~~ /usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])' 272 | size(const _Tp (&)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)' 262 | size(const _Container& __cont) noexcept(noexcept(__cont.size())) | ^~~~ a.cc:7:11: note: 'const int size' 7 | const int size = 3; | ^~~~ a.cc:30:28: error: reference to 'size' is ambiguous 30 | for (int x = 0; x < size; ++x) | ^~~~ /usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])' 272 | size(const _Tp (&)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)' 262 | size(const _Container& __cont) noexcept(noexcept(__cont.size())) | ^~~~ a.cc:7:11: note: 'const int size' 7 | const int size = 3; | ^~~~ a.cc:31:10: error: 'hyo' was not declared in this scope 31 | hyo[y][x] = str[y*size + x]; | ^~~ a.cc:31:28: error: reference to 'size' is ambiguous 31 | hyo[y][x] = str[y*size + x]; | ^~~~ /usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])' 272 | size(const _Tp (&)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)' 262 | size(const _Container& __cont) noexcept(noexcept(__cont.size())) | ^~~~ a.cc:7:11: note: 'const int size' 7 | const int size = 3; | ^~~~ a.cc:34:6: error: expected ',' or ';' before 'char' 34 | char mark[] = { 'o', 'x' }; | ^~~~ a.cc:38:19: error: 'hyo' was not declared in this scope 38 | if (check(hyo, mark[i])) { judge = mark[i]; } | ^~~ a.cc:38:24: error: 'mark' was not declared in this scope 38 | if (check(hyo, mark[i])) { judge = mark[i]; } | ^~~~
s728777022
p00066
C++
def get_winner(s): for p in ['o','x']: for i in xrange(3): win_h=True win_v=True for j in xrange(3): if s[i*3+j]!=p: win_h=False if s[j*3+i]!=p: win_v=False if win_h or win_v: return p if p==s[0]==s[4]==s[8] or p==s[2]==s[4]==s[5]: return p return 'd' while 1: try: s=raw_input() print get_winner(s) except EOFError: break
a.cc:1:1: error: 'def' does not name a type 1 | def get_winner(s): | ^~~
s957597544
p00066
C++
#include<iostream> #include<string> using namespace std; int main(){ string s; while(getline(cin,s)){ if(s=="")break; if(s[0]!="s"&&s[0]==s[1]&&s[1]==s[2]){cout<<s[0]<<endl;continue;} if(s[3]!="s"&&s[3]==s[4]&&s[4]==s[5]){cout<<s[3]<<endl;continue;} if(s[6]!="s"&&s[6]==s[7]&&s[7]==s[8]){cout<<s[6]<<endl;continue;} if(s[0]!="s"&&s[0]==s[3]&&s[3]==s[6]){cout<<s[0]<<endl;continue;} if(s[1]!="s"&&s[1]==s[4]&&s[4]==s[7]){cout<<s[1]<<endl;continue;} if(s[2]!="s"&&s[2]==s[5]&&s[5]==s[8]){cout<<s[2]<<endl;continue;} if(s[0]!="s"&&s[0]==s[4]&&s[4]==s[8]){cout<<s[0]<<endl;continue;} if(s[2]!="s"&&s[2]==s[4]&&s[4]==s[6]){cout<<s[2]<<endl;continue;} cout<<"d"<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:8:8: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 8 | if(s[0]!="s"&&s[0]==s[1]&&s[1]==s[2]){cout<<s[0]<<endl;continue;} a.cc:9:8: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 9 | if(s[3]!="s"&&s[3]==s[4]&&s[4]==s[5]){cout<<s[3]<<endl;continue;} a.cc:10:8: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 10 | if(s[6]!="s"&&s[6]==s[7]&&s[7]==s[8]){cout<<s[6]<<endl;continue;} a.cc:11:8: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 11 | if(s[0]!="s"&&s[0]==s[3]&&s[3]==s[6]){cout<<s[0]<<endl;continue;} a.cc:12:8: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 12 | if(s[1]!="s"&&s[1]==s[4]&&s[4]==s[7]){cout<<s[1]<<endl;continue;} a.cc:13:8: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 13 | if(s[2]!="s"&&s[2]==s[5]&&s[5]==s[8]){cout<<s[2]<<endl;continue;} a.cc:14:8: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 14 | if(s[0]!="s"&&s[0]==s[4]&&s[4]==s[8]){cout<<s[0]<<endl;continue;} a.cc:15:8: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 15 | if(s[2]!="s"&&s[2]==s[4]&&s[4]==s[6]){cout<<s[2]<<endl;continue;}
s894216196
p00066
C++
#!/usr/bin/env ruby # encoding: utf-8 while true do num = 0 win = "0" str = gets.chop if str==nil then break end for i in 0..2 do if str[num]==str[num+1] && str[num]==str[num+2] then if win=="0" then win = str[num] end end num += 3 end for i in 0..2 do if str[i]==str[i+3] && str[i]==str[i+6] then if win=="0" then win = str[i] end end end if (str[0]==str[4]&&str[0]==str[8])||(str[2]==str[4]&&str[2]==str[6]) then if win=="0" then win = str[4] end end if win == "o"||win == "x" then print win,"\n" else print "d\n" end end
a.cc:1:2: error: invalid preprocessing directive #! 1 | #!/usr/bin/env ruby | ^ a.cc:2:3: error: invalid preprocessing directive #encoding 2 | # encoding: utf-8 | ^~~~~~~~ a.cc:10:18: error: too many decimal points in number 10 | for i in 0..2 do | ^~~~ a.cc:18:18: error: too many decimal points in number 18 | for i in 0..2 do | ^~~~ a.cc:3:1: error: expected unqualified-id before 'while' 3 | while true do | ^~~~~
s796974924
p00066
C++
#include <iostream> #include <string> using namespace std; int main(){ string mas; bool judge; while(cin >> mas){ judge = false; for(int i=0;i<9;i+=3){ if(mas.substr(i,3) == "ooo"){ cout << "o" << endl; judge = true; break; } if(mas.substr(i,3) == "xxx"){ cout << "x" << endl; judge = true; break; } } for(int i=0;i<3;i++){ if(mas[i] == mas[i+3] && mas[i+3] == mas[i+6] && !judge && mas[i] != 's'){ cout << mas[i] << endl; judge = true; break; } } if(mas[0] == mas[4] && mas[4] == mas[8] && !judge && mas[i] != 's') { cout << mas[0] << endl; judge = true; } else if(mas[2] == mas[4] && mas[4] == mas[6] && !judge && mas[i] != 's'){ cout << mas[2] << endl; judge = true; } else if(!judge) cout << "d" << endl; } }
a.cc: In function 'int main()': a.cc:29:66: error: 'i' was not declared in this scope 29 | if(mas[0] == mas[4] && mas[4] == mas[8] && !judge && mas[i] != 's') { | ^
s568073734
p00066
C++
#include<iostream> using namespace std; int main(void) { char a[9]; while(cin>>a) { int x=0; for(int i=0;i<3;i++) { if((a[i*3]=='o' && a[i*3+1]=='o' && a[i*3+2]=='o') || (a[i]=='o' && a[i+3]=='o' && a[i+6]=='o')) { cout<<'o'<<endl; x++; break; } else if((a[i*3]=='x' && a[i*3+1]=='x' && a[i*3+2]=='x') || (a[i]=='x' && a[i+3]=='x' && a[i+6]=='x')) { cout<<'x'<<endl; x++; break; } j+=2; } if(a[0]=='o' && a[4]=='o' && a[8]=='o' || (a[2]=='o' && a[4]=='o' && a[6]=='o')) { cout<<'o'<<endl; x++; } if((a[0]=='x' && a[4]=='x' && a[8]=='x') || (a[2]=='x' && a[4]=='x' && a[6]=='x')) { cout<<'x'<<endl; x++; } if(x==0)cout<<'d'<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:25:11: error: 'j' was not declared in this scope 25 | j+=2; | ^
s216124916
p00066
C++
#include<iostream> #include<string> using namespace std; int main(){ string in; while(cin>>in!='\0'){ char han; //cout<<in[0]<<endl; if{((in[0]==in[1]&&in[1]==in[2])||(in[0]==in[4]&&in[4]==in[8])||(in[0]==in[3]&&in[3]==in[6]))if(in[0]!='s')han=in[0];} else {if((in[2]==in[4]&&in[4]==in[6])||(in[2]==in[5]&&in[5]==in[8]))if(in[2]!='s')han=in[2];} else {if(in[1]==in[4]&&in[4]==in[7])if(in[1]!='s')han=in[1];} else {if(in[3]==in[4]&&in[4]==in[5])if(in[3]!='s')han=in[3];} else {if(in[6]==in[7]&&in[7]==in[8])if(in[6]!='s')han=in[6];} else han='d'; cout <<han<<endl; } }
a.cc: In function 'int main()': a.cc:6:16: error: no match for 'operator!=' (operand types are 'std::basic_istream<char>' and 'char') 6 | while(cin>>in!='\0'){ | ~~~~~~~^~~~~~ | | | | | char | std::basic_istream<char> a.cc:6:16: note: candidate: 'operator!=(int, int)' (built-in) 6 | while(cin>>in!='\0'){ | ~~~~~~~^~~~~~ a.cc:6:16: note: no known conversion for argument 1 from 'std::basic_istream<char>' to 'int' In file included from /usr/include/c++/14/iosfwd:42, from /usr/include/c++/14/ios:40, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/postypes.h:197:5: note: candidate: 'template<class _StateT> bool std::operator!=(const fpos<_StateT>&, const fpos<_StateT>&)' 197 | operator!=(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/postypes.h:197:5: note: template argument deduction/substitution failed: a.cc:6:18: note: 'std::basic_istream<char>' is not derived from 'const std::fpos<_StateT>' 6 | while(cin>>in!='\0'){ | ^~~~ In file included from /usr/include/c++/14/string:43, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44: /usr/include/c++/14/bits/allocator.h:243:5: note: candidate: 'template<class _T1, class _T2> bool std::operator!=(const allocator<_CharT>&, const allocator<_T2>&)' 243 | operator!=(const allocator<_T1>&, const allocator<_T2>&) | ^~~~~~~~ /usr/include/c++/14/bits/allocator.h:243:5: note: template argument deduction/substitution failed: a.cc:6:18: note: 'std::basic_istream<char>' is not derived from 'const std::allocator<_CharT>' 6 | while(cin>>in!='\0'){ | ^~~~ In file included from /usr/include/c++/14/string:48: /usr/include/c++/14/bits/stl_iterator.h:455:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 455 | operator!=(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:455:5: note: template argument deduction/substitution failed: a.cc:6:18: note: 'std::basic_istream<char>' is not derived from 'const std::reverse_iterator<_Iterator>' 6 | while(cin>>in!='\0'){ | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:500:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 500 | operator!=(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:500:5: note: template argument deduction/substitution failed: a.cc:6:18: note: 'std::basic_istream<char>' is not derived from 'const std::reverse_iterator<_Iterator>' 6 | while(cin>>in!='\0'){ | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:1686:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1686 | operator!=(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1686:5: note: template argument deduction/substitution failed: a.cc:6:18: note: 'std::basic_istream<char>' is not derived from 'const std::move_iterator<_IteratorL>' 6 | while(cin>>in!='\0'){ | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:1753:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1753 | operator!=(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1753:5: note: template argument deduction/substitution failed: a.cc:6:18: note: 'std::basic_istream<char>' is not derived from 'const std::move_iterator<_IteratorL>' 6 | while(cin>>in!='\0'){ | ^~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h:1052:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator!=(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1052 | operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1052:5: note: template argument deduction/substitution failed: a.cc:6:18: note: 'std::basic_istream<char>' is not derived from 'const std::pair<_T1, _T2>' 6 | while(cin>>in!='\0'){ | ^~~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:651:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 651 | operator!=(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:651:5: note: template argument deduction/substitution failed: a.cc:6:18: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 6 | while(cin>>in!='\0'){ | ^~~~ /usr/include/c++/14/string_view:658:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 658 | operator!=(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:658:5: note: template argument deduction/substitution failed: a.cc:6:18: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 6 | while(cin>>in!='\0'){ | ^~~~ /usr/include/c++/14/string_view:666:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 666 | operator!=(__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:666:5: note: template argument deduction/substitution failed: a.cc:6:18: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'char' 6 | while(cin>>in!='\0'){ | ^~~~ /usr/include/c++/14/bits/basic_string.h:3833:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3833 | operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3833:5: note: template argument deduction/substitution failed: a.cc:6:18: note: 'std::basic_istream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 6 | while(cin>>in!='\0'){ | ^~~~ /usr/include/c++/14/bits/basic_string.h:3847:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3847 | operator!=(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3847:5: note: template argument deduction/substitution failed: a.cc:6:18: note: mismatched types 'const _CharT*' and 'std::basic_istream<char>' 6 | while(cin>>in!='\0'){ | ^~~~ /usr/include/c++/14/bits/basic_string.h:3860:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3860 | operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3860:5: note: template argument deduction/substitution failed: a.cc:6:18: note: 'std::basic_istream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 6 | while(cin>>in!='\0'){ | ^~~~ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2613:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator!=(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2613 | operator!=(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2613:5: note: template argument deduction/substitution failed: a.cc:6:18: note: 'std::basic_istream<char>' is not derived from 'const std::tuple<_UTypes ...>' 6 | while(cin>>in!='\0'){ | ^~~~ In file included from /usr/include/c++/14/bits/locale_facets.h:48, from /usr/include/c++/14/bits/basic_ios.h:37, from /usr/include/c++/14/ios:46: /usr/include/c++/14/bits/streambuf_iterator.h:242:5: note: candidate: 'template<class _CharT, class _Traits> bool std::operator!=(const istreambuf_iterator<_CharT, _Traits>&, const istreambuf_iterator<_CharT, _Traits>&)' 242 | operator!=(const istreambuf_iterator<_CharT, _Traits>& __a, | ^~~~~~~~ /usr/include/c++/14/bits/streambuf_iterator.h:242:5: note: template argument deduction/substitution failed: a.cc:6:18: note: 'std::basic_istream<char>' is not derived from 'const std::istreambuf_iterator<_CharT, _Traits>' 6 | while(cin>>in!='\0'){ | ^~~~ In file included from /usr/include/c++/14/bits/ios_base.h:46: /usr/include/c++/14/system_error:525:3: note: candidate: 'bool std::operator!=(const error_code&, const error_code&)' 525 | operator!=(const error_code& __lhs, const error_code& __rhs) noexcept | ^~~~~~~~