submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s471254229
p04044
C++
#include<vector> #include<iostream> #include<cmath> #include<map> using namespace std; int main(){ int N; int L; cin >> N >> L; vector<string> vec(N); for(int i = 0;i < N;i++){ cin >> vec.at(i); } sort(vec.begin(),vec.end()); for(int i = 0;i < N;i++){ cout << vec.at(i); } return 0; }
a.cc: In function 'int main()': a.cc:21:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'? 21 | sort(vec.begin(),vec.end()); | ^~~~ | sqrt
s327549437
p04044
C++
#include<iostream> #include<cstring> #include<cstdio> using namespace std; int ter(char *a,char *b) { return strcmp(a,b); } int main() { int n,l; char a[110][110]; char s[110][110]; cin>>n>>l; getchar(); char b[110]; for(int i=0;i<n;i++) { gets(a[i]); } for(int i=0;i<n;i++) for(int j=i+1;j<n;j++) { char c[110]; if(ter(a[i],a[j])>-1) { strcpy(c,a[i]); strcpy(a[i],a[j]); strcpy(a[j],c); } } for(int i=0;i<n;i++) cout<<a[i]; cout<<endl; }
a.cc: In function 'int main()': a.cc:19:17: error: 'gets' was not declared in this scope; did you mean 'getw'? 19 | gets(a[i]); | ^~~~ | getw
s109827228
p04044
C++
#include<iostream> #include<cstring> #include<cstdio> using namespace std; int ter(char *a,char *b) { return strcmp(a,b); } int main() { int n,l; char a[110][110]; char s[110][110]; cin>>n>>l; getchar(); char b[110]; for(int i=0;i<n;i++) { gets(a[i]); } for(int i=0;i<n;i++) for(int j=i+1;j<n;j++) { char c[110]; if(ter(a[i],a[j])>-1) { strcpy(c,a[i]); strcpy(a[i],a[j]); strcpy(a[j],c); } } for(int i=0;i<n;i++) cout<<a[i]; cout<<endl; }
a.cc: In function 'int main()': a.cc:19:17: error: 'gets' was not declared in this scope; did you mean 'getw'? 19 | gets(a[i]); | ^~~~ | getw
s688568578
p04044
C++
3 3 dxx axx cxx
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 3 3 | ^
s593414563
p04044
C
#include <stdio.h> #include <string.h> int main() { int n,l; int i,j = 0; char input[100][101]; char temp[100]; scanf("%d %d", &n, &l); for(i = 0; i < n; i++){ scanf("%s", input[i]); // printf("%s", input[i]); } for(j = 0;j < n; j++){ for(i = 0; i < n-1; i++){ // if(input[i] > input[i+1]){ if(strcmp(input[i], input[i+1]) > 0){ flag = 1; strcpy(temp, input[i+1]); strcpy(input[i+1], input[i]); strcpy(input[i], temp); } } } for(i = 0; i <= n;i++){ printf("%s", input[i]); } return 0; }
main.c: In function 'main': main.c:21:9: error: 'flag' undeclared (first use in this function) 21 | flag = 1; | ^~~~ main.c:21:9: note: each undeclared identifier is reported only once for each function it appears in
s314796652
p04044
C++
#include<iostream> #include<string> #include<algorithm> using namespace std; int main() { int n, l; cin >> n >> l; string s[n]; for (int i = 0;i < n;i++)cin >> s; sort(s, s + n); for (int i = 0;i < n;i++)cout << s[i]; cout << endl; }
a.cc: In function 'int main()': a.cc:10:38: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::string [n]' {aka 'std::__cxx11::basic_string<char> [n]'}) 10 | for (int i = 0;i < n;i++)cin >> s; | ~~~ ^~ ~ | | | | | std::string [n] {aka std::__cxx11::basic_string<char> [n]} | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/14/iostream:42, from a.cc:1: /usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed: a.cc:10:41: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} 10 | for (int i = 0;i < n;i++)cin >> s; | ^ /usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed: a.cc:10:41: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'short int' [-fpermissive] 10 | for (int i = 0;i < n;i++)cin >> s; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:10:41: error: cannot bind rvalue '(short int)((std::string*)(& s))' to 'short int&' /usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed: a.cc:10:41: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'short unsigned int' [-fpermissive] 10 | for (int i = 0;i < n;i++)cin >> s; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:10:41: error: cannot bind rvalue '(short unsigned int)((std::string*)(& s))' to 'short unsigned int&' /usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed: a.cc:10:41: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'int' [-fpermissive] 10 | for (int i = 0;i < n;i++)cin >> s; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:10:41: error: cannot bind rvalue '(int)((std::string*)(& s))' to 'int&' /usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed: a.cc:10:41: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'unsigned int' [-fpermissive] 10 | for (int i = 0;i < n;i++)cin >> s; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:10:41: error: cannot bind rvalue '(unsigned int)((std::string*)(& s))' to 'unsigned int&' /usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed: a.cc:10:41: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long int' [-fpermissive] 10 | for (int i = 0;i < n;i++)cin >> s; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:10:41: error: cannot bind rvalue '(long int)((std::string*)(& s))' to 'long int&' /usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed: a.cc:10:41: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long unsigned int' [-fpermissive] 10 | for (int i = 0;i < n;i++)cin >> s; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:10:41: error: cannot bind rvalue '(long unsigned int)((std::string*)(& s))' to 'long unsigned int&' /usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed: a.cc:10:41: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long long int' [-fpermissive] 10 | for (int i = 0;i < n;i++)cin >> s; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:10:41: error: cannot bind rvalue '(long long int)((std::string*)(& s))' to 'long long int&' /usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed: a.cc:10:41: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long long unsigned int' [-fpermissive] 10 | for (int i = 0;i < n;i++)cin >> s; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:10:41: error: cannot bind rvalue '(long long unsigned int)((std::string*)(& s))' to 'long long unsigned int&' /usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed: a.cc:10:41: error: cannot bind non-const lvalue reference of type 'void*&' to an rvalue of type 'void*' 10 | for (int i = 0;i < n;i++)cin >> s; | ^ /usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 219 | operator>>(float& __f) | ^~~~~~~~ /usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'std::string [n]' {aka 'std::__cxx11::basic_string<char> [n]'} to 'float&' 219 | operator>>(float& __f) | ~~~~~~~^~~ /usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 223 | operator>>(double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'std::string [n]' {aka 'std::__cxx11::basic_string<char> [n]'} to 'double&' 223 | operator>>(double& __f)
s006459468
p04044
C++
#include<iostream> #include<string> #include<algorithm> using namespace std; int main() { int n, l; cin >> n >> l; string s[n]; for (int i = 0;i < n;i++)cin >> s; sort(s, s + l); for (int i = 0;i < n;i++)cout << s[i]; cout << endl; }
a.cc: In function 'int main()': a.cc:10:38: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::string [n]' {aka 'std::__cxx11::basic_string<char> [n]'}) 10 | for (int i = 0;i < n;i++)cin >> s; | ~~~ ^~ ~ | | | | | std::string [n] {aka std::__cxx11::basic_string<char> [n]} | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/14/iostream:42, from a.cc:1: /usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed: a.cc:10:41: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} 10 | for (int i = 0;i < n;i++)cin >> s; | ^ /usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed: a.cc:10:41: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'short int' [-fpermissive] 10 | for (int i = 0;i < n;i++)cin >> s; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:10:41: error: cannot bind rvalue '(short int)((std::string*)(& s))' to 'short int&' /usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed: a.cc:10:41: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'short unsigned int' [-fpermissive] 10 | for (int i = 0;i < n;i++)cin >> s; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:10:41: error: cannot bind rvalue '(short unsigned int)((std::string*)(& s))' to 'short unsigned int&' /usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed: a.cc:10:41: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'int' [-fpermissive] 10 | for (int i = 0;i < n;i++)cin >> s; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:10:41: error: cannot bind rvalue '(int)((std::string*)(& s))' to 'int&' /usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed: a.cc:10:41: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'unsigned int' [-fpermissive] 10 | for (int i = 0;i < n;i++)cin >> s; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:10:41: error: cannot bind rvalue '(unsigned int)((std::string*)(& s))' to 'unsigned int&' /usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed: a.cc:10:41: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long int' [-fpermissive] 10 | for (int i = 0;i < n;i++)cin >> s; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:10:41: error: cannot bind rvalue '(long int)((std::string*)(& s))' to 'long int&' /usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed: a.cc:10:41: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long unsigned int' [-fpermissive] 10 | for (int i = 0;i < n;i++)cin >> s; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:10:41: error: cannot bind rvalue '(long unsigned int)((std::string*)(& s))' to 'long unsigned int&' /usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed: a.cc:10:41: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long long int' [-fpermissive] 10 | for (int i = 0;i < n;i++)cin >> s; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:10:41: error: cannot bind rvalue '(long long int)((std::string*)(& s))' to 'long long int&' /usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed: a.cc:10:41: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long long unsigned int' [-fpermissive] 10 | for (int i = 0;i < n;i++)cin >> s; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:10:41: error: cannot bind rvalue '(long long unsigned int)((std::string*)(& s))' to 'long long unsigned int&' /usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed: a.cc:10:41: error: cannot bind non-const lvalue reference of type 'void*&' to an rvalue of type 'void*' 10 | for (int i = 0;i < n;i++)cin >> s; | ^ /usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 219 | operator>>(float& __f) | ^~~~~~~~ /usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'std::string [n]' {aka 'std::__cxx11::basic_string<char> [n]'} to 'float&' 219 | operator>>(float& __f) | ~~~~~~~^~~ /usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 223 | operator>>(double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'std::string [n]' {aka 'std::__cxx11::basic_string<char> [n]'} to 'double&' 223 | operator>>(double& __f)
s331401301
p04044
C++
#include<iostream> #include<algorithm> #include<string> using namespace std; int main(){ int n,k; cin>>n>>l; string s[100]; string ans; for(int i=0;i<n;i++){ cin>>s[i]; } sort(s,s+n); for(int i=0;i<n;i++){ ans=ans+s[i]; } cout<<ans; }
a.cc: In function 'int main()': a.cc:7:17: error: 'l' was not declared in this scope 7 | cin>>n>>l; | ^
s248323300
p04044
C++
#include<iostream> #include<algorithm> #include<string> using namespace std; int main(){ int n,k; cin>>n>>l; string s[100]; string ans; for(int i=0;i<n;i++){ cin>>s[i]; } sort(s,s+n); for(int i=0;i<n;i++){ ans=ans+s[i]; } cout<<ans; }
a.cc: In function 'int main()': a.cc:7:17: error: 'l' was not declared in this scope 7 | cin>>n>>l; | ^
s481590045
p04044
Java
import java.util.Scanner; import java.util.Arrays; import java.util.Comparator; public class IrohaLovStr{ public static void main(String[] args) { Scanner sc =new Scanner(System.in); int n=sc.nextInt(); int l=sc.nextInt(); String str[]=new String[l]; String all; for(int i=0;i<n;i++) { //文字列読み取り str[i]=sc.next(); } Arrays.sort(str); for (int i=0;i<n;i++) { System.out.print(str[i]); } System.out.println(); } }
Main.java:6: error: class IrohaLovStr is public, should be declared in a file named IrohaLovStr.java public class IrohaLovStr{ ^ 1 error
s176460493
p04044
C++
#include <iostream> #include <string> #include <algorithm> using namespace std; string s[200]; int ans; int main() { int n, l; cin >> n >> l; for (int i = 0; i < n; i++) { cin >> s[i]; } sort(s, s + n); for (int i = 0; i < n; i++)ans += s[i]; cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:16:40: error: no match for 'operator+=' (operand types are 'int' and 'std::string' {aka 'std::__cxx11::basic_string<char>'}) 16 | for (int i = 0; i < n; i++)ans += s[i]; | ~~~~^~~~~~~
s177569829
p04044
C++
#include<iostream> #include<cstdio> #include<cstdlib> #include<algorithm> #include<vector> #include<string> #include<sstream> #include<iomanip> #include<utility> #include<cmath> #include<set> #include<list> #include<string> #include<queue> #include<stack> #include<deque> #include<map> #include<set> #include<cstring> #include<iterator> #include<bitset> #include<assert.h> //#include<chrono> //#include<time.h> //#include<windows.h> using namespace std; //#define int ll typedef long long ll; typedef pair<int,int> P; typedef pair<int,pair<int,int> > PP; typedef vector<int> VI; typedef vector<long long int> VL; //static const int MOD = 1000000007; //static const int INF = 2147483647; //static const long long INF = 9223372000000000000; //static const long long INF = 9223372000000000000/2; //static const int INF = 1000010000; //int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0}; //int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0}; //int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0}; //int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0}; #define PB push_back #define MP make_pair #define MT make_tuple #define FI first #define SE second #define NP next_permutation #define PQ priority_queue #define UB upper_bound #define LB lower_bound #define SZ(a) int((a).size()) #define LEN(a) int((a).length()) #define SORT(c) sort((c).begin(),(c).end()) #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define REP(i,x) for(int i=0;i<(int)(x);i++) #define REP1(i,x) for(int i=1;i<=(int)(x);i++) #define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--) #define RREP1(i,x) for(int i=((int)(x));i>0;i--) #define ALL(x) (x).begin(),(x).end() struct edge {int /*from,*/to,cost;}; main(){ int n,l; cin >> n >> l; string s[114]; REP(i,n) cin >> s[i]; SORT(ALL(s)); REP(i,n) cout << s[i]; puts(""); return 0; }
a.cc:63:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 63 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:60:20: error: request for member 'begin' in 's', which is of non-class type 'std::string [114]' {aka 'std::__cxx11::basic_string<char> [114]'} 60 | #define ALL(x) (x).begin(),(x).end() | ^~~~~ a.cc:54:23: note: in definition of macro 'SORT' 54 | #define SORT(c) sort((c).begin(),(c).end()) | ^ a.cc:68:10: note: in expansion of macro 'ALL' 68 | SORT(ALL(s)); | ^~~ a.cc:60:32: error: request for member 'end' in 's', which is of non-class type 'std::string [114]' {aka 'std::__cxx11::basic_string<char> [114]'} 60 | #define ALL(x) (x).begin(),(x).end() | ^~~ a.cc:54:23: note: in definition of macro 'SORT' 54 | #define SORT(c) sort((c).begin(),(c).end()) | ^ a.cc:68:10: note: in expansion of macro 'ALL' 68 | SORT(ALL(s)); | ^~~ a.cc:60:20: error: request for member 'begin' in 's', which is of non-class type 'std::string [114]' {aka 'std::__cxx11::basic_string<char> [114]'} 60 | #define ALL(x) (x).begin(),(x).end() | ^~~~~ a.cc:54:35: note: in definition of macro 'SORT' 54 | #define SORT(c) sort((c).begin(),(c).end()) | ^ a.cc:68:10: note: in expansion of macro 'ALL' 68 | SORT(ALL(s)); | ^~~ a.cc:60:32: error: request for member 'end' in 's', which is of non-class type 'std::string [114]' {aka 'std::__cxx11::basic_string<char> [114]'} 60 | #define ALL(x) (x).begin(),(x).end() | ^~~ a.cc:54:35: note: in definition of macro 'SORT' 54 | #define SORT(c) sort((c).begin(),(c).end()) | ^ a.cc:68:10: note: in expansion of macro 'ALL' 68 | SORT(ALL(s)); | ^~~
s527838223
p04044
Java
import java.io.*; import java.util.*; public class Beg42ProbB { static int MOD = 1000000007; static double EPS = 1e-9; public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(in.readLine()); int N = Integer.parseInt(st.nextToken()); int L = Integer.parseInt(st.nextToken()); String[] s = new String[N]; for (int i = 0; i < N; i++) { s[i] = in.readLine(); } Arrays.sort(s); String res = ""; for (int i = 0; i < N; i++) { res += s[i]; } System.out.println(res); in.close(); } }
Main.java:4: error: class Beg42ProbB is public, should be declared in a file named Beg42ProbB.java public class Beg42ProbB { ^ 1 error
s872800548
p04044
C++
#include <cstdio> #include <algorithm> #include <vector> #include <string> using namespace std; vector<string> s; int main() { int n, l; scanf("%d %d", &n, &l); for(int i=0;i<n;i++) { string a; scanf("%s", a); s.push_back(a); } sort(s.begin, s.end()); for(int i=0;i<n;i++) { printf("%s", s[i]); } }
a.cc: In function 'int main()': a.cc:17:7: error: no matching function for call to 'sort(<unresolved overloaded function type>, std::vector<std::__cxx11::basic_string<char> >::iterator)' 17 | sort(s.begin, s.end()); | ~~~~^~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:61, from a.cc:2: /usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate: 'void std::sort(_RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<__cxx11::basic_string<char>*, vector<__cxx11::basic_string<char> > >]' 4762 | sort(_RandomAccessIterator __first, _RandomAccessIterator __last) | ^~~~ /usr/include/c++/14/bits/stl_algo.h:4762:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to '__gnu_cxx::__normal_iterator<std::__cxx11::basic_string<char>*, std::vector<std::__cxx11::basic_string<char> > >' 4762 | sort(_RandomAccessIterator __first, _RandomAccessIterator __last) | ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate: 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)' 4793 | sort(_RandomAccessIterator __first, _RandomAccessIterator __last, | ^~~~ /usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:86: /usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare)' 292 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp); | ^~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate expects 4 arguments, 2 provided /usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator)' 296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last); | ^~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate expects 3 arguments, 2 provided
s504451617
p04044
C++
#include <cstdio> #include <algorithm> #include <vector> #include <string> std::vector<string> s; int main() { int n, l; scanf("%d %d", &n, &l); for(int i=0;i<n;i++) { std::string a; scanf("%s", a); s.std::push_back(a); } std::sort(s.std::begin, s.std::end()); for(int i=0;i<n;i++) { printf("%s", s[i]); } }
a.cc:5:13: error: 'string' was not declared in this scope 5 | std::vector<string> s; | ^~~~~~ a.cc:5:13: note: suggested alternatives: In file included from /usr/include/c++/14/string:41, from a.cc:4: /usr/include/c++/14/bits/stringfwd.h:77:33: note: 'std::string' 77 | typedef basic_string<char> string; | ^~~~~~ /usr/include/c++/14/string:76:11: note: 'std::pmr::string' 76 | using string = basic_string<char>; | ^~~~~~ a.cc:5:19: error: template argument 1 is invalid 5 | std::vector<string> s; | ^ a.cc:5:19: error: template argument 2 is invalid a.cc: In function 'int main()': a.cc:14:7: error: 'std::push_back' is not a class member 14 | s.std::push_back(a); | ^~~ a.cc:16:15: error: 'std::begin' is not a class member 16 | std::sort(s.std::begin, s.std::end()); | ^~~ a.cc:16:29: error: 'std::end' is not a class member 16 | std::sort(s.std::begin, s.std::end()); | ^~~ a.cc:19:23: error: invalid types 'int[int]' for array subscript 19 | printf("%s", s[i]); | ^
s496872284
p04044
C++
#include <cstdio> #include <algorithm> #include <vector> #include <string> std::vector<string> s; int main() { int n, l; scanf("%d %d", &n, &l); for(int i=0;i<n;i++) { std::string a; scanf("%s", a); s.push_back(a); } sort(s.begin, s.end()); for(int i=0;i<n;i++) { printf("%s", s[i]); } }
a.cc:5:13: error: 'string' was not declared in this scope 5 | std::vector<string> s; | ^~~~~~ a.cc:5:13: note: suggested alternatives: In file included from /usr/include/c++/14/string:41, from a.cc:4: /usr/include/c++/14/bits/stringfwd.h:77:33: note: 'std::string' 77 | typedef basic_string<char> string; | ^~~~~~ /usr/include/c++/14/string:76:11: note: 'std::pmr::string' 76 | using string = basic_string<char>; | ^~~~~~ a.cc:5:19: error: template argument 1 is invalid 5 | std::vector<string> s; | ^ a.cc:5:19: error: template argument 2 is invalid a.cc: In function 'int main()': a.cc:14:7: error: request for member 'push_back' in 's', which is of non-class type 'int' 14 | s.push_back(a); | ^~~~~~~~~ a.cc:16:10: error: request for member 'begin' in 's', which is of non-class type 'int' 16 | sort(s.begin, s.end()); | ^~~~~ a.cc:16:19: error: request for member 'end' in 's', which is of non-class type 'int' 16 | sort(s.begin, s.end()); | ^~~ a.cc:16:3: error: 'sort' was not declared in this scope; did you mean 'std::sort'? 16 | sort(s.begin, s.end()); | ^~~~ | std::sort In file included from /usr/include/c++/14/algorithm:86, from a.cc:2: /usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here 296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last); | ^~~~ a.cc:19:23: error: invalid types 'int[int]' for array subscript 19 | printf("%s", s[i]); | ^
s675196920
p04044
C++
#include <iostream> #include <vector> using namespace std; int main(){ int n,l; cin>>n>>l; vector<string> s; for(int i=0;i<n;i++){ string str; cin>>str; s.push_back(str); } sort(s.begin(),s.end()); string ans(""); for(int i=0;i<n;i++){ ans+=s[i]; } cout<<ans; }
a.cc: In function 'int main()': a.cc:14:5: error: 'sort' was not declared in this scope; did you mean 'short'? 14 | sort(s.begin(),s.end()); | ^~~~ | short
s405408324
p04044
C++
#include <iostream> #include <vector> using namespace std; int main(){ int n,l; cin>>n>>l; vector<string> s; for(int i=0;i<n;i++){ string str; cin>>str; s.push_back(str); } sort(s.begin(),s.end()); string ans(""); for(int i=0;i<n;i++){ ans+=s[i]; } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:14:5: error: 'sort' was not declared in this scope; did you mean 'short'? 14 | sort(s.begin(),s.end()); | ^~~~ | short
s400945960
p04044
C++
#include <iostream> #include <vector> using namespace std; int main() { int N, L; string tmp; vector<string> vector1; cin >> N >> L; for (int i = 0; i < N; ++i) { cin >> tmp; vector1.push_back(tmp); } sort(vector1.begin(), vector1.end()); for (int j = 0; j < vector1.size(); ++j) { cout << vector1[j]; } return 0; }
a.cc: In function 'int main()': a.cc:15:5: error: 'sort' was not declared in this scope; did you mean 'short'? 15 | sort(vector1.begin(), vector1.end()); | ^~~~ | short
s524764983
p04044
C++
# main関数 if __name__ == '__main__': n, l = map(int,input().split()) a = [] for i in range(n) : a.append(input()) a.sort() for i in range(n) : print(a[i], end="") print()
a.cc:1:3: error: invalid preprocessing directive #main\U000095a2\U00006570 1 | # main関数 | ^~~~~~~~ a.cc:2:16: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes 2 | if __name__ == '__main__': | ^~~~~~~~~~ a.cc:2:1: error: expected unqualified-id before 'if' 2 | if __name__ == '__main__': | ^~
s919307014
p04044
C++
#include<iostream> using namespace std; int main(){ int n,l; cin >> n >> l; char s[n][l]; int t[n][l]; for(int i = 0;i < n;i++){ cin >> s[i]; for(int j = 0;j < l;j++){ if(s[i][j] == 'a'){ t[i][j] = 1; } if(s[i][j] == 'b'){ t[i][j] = 2; } if(s[i][j] == 'c'){ t[i][j] = 3; } if(s[i][j] == 'd'){ t[i][j] = 4; } if(s[i][j] == 'e'){ t[i][j] = 5; } if(s[i][j] == 'f'){ t[i][j] = 6; } if(s[i][j] == 'g'){ t[i][j] = 7; } if(s[i][j] == 'h'){ t[i][j] = 8; } if(s[i][j] == 'i'){ t[i][j] = 9; } if(s[i][j] == 'j'){ t[i][j] = 10; } if(s[i][j] == 'k'){ t[i][j] = 11; } if(s[i][j] == 'l'){ t[i][j] = 12; } if(s[i][j] == 'm'){ t[i][j] = 13; } if(s[i][j] == 'n'){ t[i][j] = 14; } if(s[i][j] == 'o'){ t[i][j] = 15; } if(s[i][j] == 'p'){ t[i][j] = 16; } if(s[i][j] == 'q'){ t[i][j] = 17; } if(s[i][j] == 'r'){ t[i][j] = 18; } if(s[i][j] == 's'){ t[i][j] = 19; } if(s[i][j] == 't'){ t[i][j] = 20; } if(s[i][j] == 'u'){ t[i][j] = 21; } if(s[i][j] == 'v'){ t[i][j] = 22; } if(s[i][j] == 'w'){ t[i][j] = 23; } if(s[i][j] == 'x'){ t[i][j] = 24; } if(s[i][j] == 'y'){ t[i][j] = 25; } if(s[i][j] == 'z'){ t[i][j] = 26; } } } for(int i = 0;i < l;i++){ for(int j = 1;j < n;j++){ if(i == 0 || t[j-1][i-1] == t[j][i-1] || (t[j][i-1] == t[j+1][i-1] && j < n-1)){ for(int k = 0;k < n;k++){ int x = 0; if(t[x][i] < t[j][i]){ x = j; } for(int m = 0;m < l;m++){ char ss[l]; ss[m] = s[x][m]; s[x][m] = s[n-k-1][m]; s[n-k-1][m] = ss[m]; int tt; t = t[x][m]; t[x][m] = t[n-k-1][m]; t[n-k-1][m] = t[x][m]; } } } } } for(int i = 0;i < n;i++){ for(int j = 0;j < l;j++){ cout << s[i][j]; } } cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:107:27: error: incompatible types in assignment of 'int' to 'int [n][l]' 107 | t = t[x][m]; | ~~^~~~~~~~~
s020240402
p04044
C++
#include<iostream> #include<cstring> #include<string> using namespace std; int main(){ int n,l; string s[111]; cin >> n >> l; for(int i=0;i<n;i++){ cin >> s[i]; } sort(s,s+n); for(int i=0;i<n;i++){ cout << s[i]; if(i+1==n){ cout << endl; } } return 0; }
a.cc: In function 'int main()': a.cc:16:3: error: 'sort' was not declared in this scope; did you mean 'short'? 16 | sort(s,s+n); | ^~~~ | short
s429860095
p04044
C++
#include<iostream> #include<cstring> using namespace std; int main(){ int n,l; string s[111]; cin >> n >> l; for(int i=0;i<n;i++){ cin >> s[i]; } sort(s,s+n); for(int i=0;i<n;i++){ cout << s[i]; if(i+1==n){ cout << endl; } } return 0; }
a.cc: In function 'int main()': a.cc:15:3: error: 'sort' was not declared in this scope; did you mean 'short'? 15 | sort(s,s+n); | ^~~~ | short
s795540110
p04044
C++
#include<iostream> #include<vector> #include<string> using namespace std; vector<string> sort_s(vector<string> s, int begin, int end, int index); vector<string> sort_s(vector<string> s, int begin, int end, int index){ for(int i = begin; i < end; i++){ for(int j = i; j < end; j++){ if(s[i][index] > s[j][index]){ buf = s[j]; s[j] = s[i]; s[i] = buf; } } } char match ; int count = 0; for(int i = begin; i < end; i++){ if(s[i][index] == match){ count++; if(count!=0 && i == end - 1){ if(++index < s[i].length()){ //cout << i -count << i + 1 << index; s = sort_s(s, i - count , i + 1, index ); } count = 0; } }else{ if(count!=0){ if(++index < s[i].length()){ //cout << i -count << i + 1 << index; s = sort_s(s, i - count - 1 , i , index ); } count = 0; } match = s[i][index]; } } return s; } int main(){ int n,l; cin >> n >> l; vector<string> s(n,""); vector<int> a(n,0); for(int i = 0; i < n; i++){ cin >> s[i]; a[i] = i; } s = sort_s(s, 0, n, 0); for(int i = 0; i < n; i++){ cout << s[i]; } cout << endl; }
a.cc: In function 'std::vector<std::__cxx11::basic_string<char> > sort_s(std::vector<std::__cxx11::basic_string<char> >, int, int, int)': a.cc:12:17: error: 'buf' was not declared in this scope 12 | buf = s[j]; | ^~~
s514280744
p04044
C++
#include<iostream> #include<vector> #include<string> using namespace std; vector<string> sort_s(vector<string> s, int begin, int end, int index); vector<string> sort_s(vector<string> s, int begin, int end, int index){ for(int i = begin; i < end; i++){ for(int j = i; j < end; j++){ if(s[i][index] > s[j][index]){ buf = s[j]; s[j] = s[i]; s[i] = buf; } } } char match ; int count = 0; for(int i = begin; i < end; i++){ if(s[i][index] == match){ count++; if(count!=0 && i == end - 1){ if(++index < s[i].length()){ s = sort_s(s, i - count , i + 1, index ); } count = 0; } }else{ if(count!=0){ if(++index < s[i].length()){ s = sort_s(s, i - count , i + 1, index ); } count = 0; } match = s[i][index]; } } return s; } int main(){ int n,l; cin >> n >> l; vector<string> s(n,""); vector<int> a(n,0); for(int i = 0; i < n; i++){ cin >> s[i]; a[i] = i; } s = sort_s(s, 0, n, 0); for(int i = 0; i < n; i++){ cout << s[i]; } cout << endl; }
a.cc: In function 'std::vector<std::__cxx11::basic_string<char> > sort_s(std::vector<std::__cxx11::basic_string<char> >, int, int, int)': a.cc:12:17: error: 'buf' was not declared in this scope 12 | buf = s[j]; | ^~~
s905430018
p04044
C++
#include <iostream> #include <cstdlib> #include <cstring> #include <stdio.h> using namespace std; struct Str { char str[105]; }str[100]; int cmp(const void *a, const void *b) { const struct Str *p1 = (const struct Str*)a; const struct Str *p2 = (const struct Str*)b; return strcmp(p1->str, p2->str); } int main() { int n, l; cin >> n >> l; getchar(); for (int i = 0; i < n; i++) gets(str[i].str); qsort(str, n, sizeof(Str), cmp); for (int i = 0; i < n; i++) printf("%s",str[i].str); return 0; }
a.cc: In function 'int main()': a.cc:22:37: error: 'gets' was not declared in this scope; did you mean 'getw'? 22 | for (int i = 0; i < n; i++) gets(str[i].str); | ^~~~ | getw
s681746933
p04044
C++
#include <iostream> #include <cstdlib> #include <cstring> #include <cstdio> using namespace std; struct Str { char str[105]; }str[100]; int cmp(const void *a, const void *b) { const struct Str *p1 = (const struct Str*)a; const struct Str *p2 = (const struct Str*)b; return strcmp(p1->str, p2->str); } int main() { int n, l; cin >> n >> l; getchar(); for (int i = 0; i < n; i++) gets(str[i].str); qsort(str, n, sizeof(Str), cmp); for (int i = 0; i < n; i++) printf("%s",str[i].str); return 0; }
a.cc: In function 'int main()': a.cc:22:37: error: 'gets' was not declared in this scope; did you mean 'getw'? 22 | for (int i = 0; i < n; i++) gets(str[i].str); | ^~~~ | getw
s908839321
p04044
C
#include <iostream> #include <cstdlib> #include <cstring> #include <cstdio> using namespace std; struct Str { char str[105]; }str[100]; int cmp(const void *a, const void *b) { const struct Str *p1 = (const struct Str*)a; const struct Str *p2 = (const struct Str*)b; return strcmp(p1->str, p2->str); } int main() { int n, l; cin >> n >> l; getchar(); for (int i = 0; i < n; i++) gets(str[i].str); qsort(str, n, sizeof(Str), cmp); for (int i = 0; i < n; i++) printf("%s",str[i].str); return 0; }
main.c:1:10: fatal error: iostream: No such file or directory 1 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s155623359
p04044
C++
#include <iostream> #include <cstdlib> #include <cstring> #include <cstdio> using namespace std; struct Str { char str[105]; }str[100]; int cmp(const void *a, const void *b) { const struct Str *p1 = (const struct Str*)a; const struct Str *p2 = (const struct Str*)b; return strcmp(p1->str, p2->str); } int main() { int n, l; cin >> n >> l; getchar(); for (int i = 0; i < n; i++) gets(str[i].str); qsort(str, n, sizeof(Str), cmp); for (int i = 0; i < n; i++) printf("%s",str[i].str); return 0; }
a.cc: In function 'int main()': a.cc:22:37: error: 'gets' was not declared in this scope; did you mean 'getw'? 22 | for (int i = 0; i < n; i++) gets(str[i].str); | ^~~~ | getw
s400600693
p04044
C++
#include <iostream> #include <cstdlib> #include <cstring> using namespace std; struct Str { char str[105]; }str[100]; int cmp(const void *a, const void *b) { const struct Str *p1 = (const struct Str*)a; const struct Str *p2 = (const struct Str*)b; return strcmp(p1->str, p2->str); } int main() { int n, l; cin >> n >> l; getchar(); for (int i = 0; i < n; i++) gets(str[i].str); qsort(str, n, sizeof(Str), cmp); for (int i = 0; i < n; i++) printf("%s",str[i].str); return 0; }
a.cc: In function 'int main()': a.cc:21:37: error: 'gets' was not declared in this scope; did you mean 'getw'? 21 | for (int i = 0; i < n; i++) gets(str[i].str); | ^~~~ | getw
s628223397
p04044
C++
#include <iostream> #include <cstdlib> #include <cstring> using namespace std; struct Str { char str[105]; }str[100]; int cmp(const void *a, const void *b) { const struct Str *p1 = (const struct Str*)a; const struct Str *p2 = (const struct Str*)b; return strcmp(p1->str, p2->str); } int main() { int n, l; cin >> n >> l; getchar(); for (int i = 0; i < n; i++) gets_s(str[i].str); qsort(str, n, sizeof(Str), cmp); for (int i = 0; i < n; i++) printf("%s",str[i].str); return 0; }
a.cc: In function 'int main()': a.cc:21:37: error: 'gets_s' was not declared in this scope 21 | for (int i = 0; i < n; i++) gets_s(str[i].str); | ^~~~~~
s721837357
p04044
C++
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define mp make_pair #define pb push_back #define eb emplace_back typedef long long ll; const ll mod = 1000000007; const double pi = 3.1415926535897932384626; ll powmod(ll a, ll b) {ll res = 1; ll rem = a % mod; for (; b; b >>= 1) {if (b & 1) res = (res * rem) % mod; rem = (rem * rem) % mod;} return res;} const int N = 108; char hey[N]; string ara[N]; int main() { // freopen("in", "r", stdin); //freopen("out", "w", stdout); int n = 0; int l = 0; scanf("%d %d\n", &n, &l); for (int i = 1; i <= n; ++i) { gets(hey); ara[i] = string(hey); } sort(ara + 1, ara + n + 1); for (int i = 1; i <= n; ++i) { printf("%s", ara[i].c_str()); } puts(""); return 0; }
a.cc: In function 'int main()': a.cc:33:9: error: 'gets' was not declared in this scope; did you mean 'getw'? 33 | gets(hey); | ^~~~ | getw
s518329725
p04044
C++
#include <bits/stdc++.h> using namespace std; int main() { int n,l,i; cin>>n>>l; vector<string > v(n); for(i=0;i<n;i++) cin>>v[i]; sort(v.begin(),v.end()); string s=''''; for(i=0;i<n;i++) s+=v[i]; cout<<s<<endl; return 0; }
a.cc:12:10: error: empty character constant 12 | string s=''''; | ^~ a.cc:12:12: error: empty character constant 12 | string s=''''; | ^~ a.cc: In function 'int main()': a.cc:12:10: error: conversion from 'char' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested 12 | string s=''''; | ^~ a.cc:12:12: error: expected ',' or ';' before '\x0' 12 | string s=''''; | ^~
s462744302
p04044
C++
#include<iostream> #include <string> #include <iomanip> #include <vector> #include <queue> #include <math.h> #include <algorithm> #include <functional> #include <set> #include <map> using namespace std; #define int long long #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define REP(i,n) for (int i=0;i<(n);i++) signed main() { int n, l; cin >> n >> l; vector<string> str(n); string tmp; FOR(i, 1, n) FOR(j, 1, n) { if (str[j - 1] > str[j]) { swap(str[j - 1], str[j]); } } REP(i, n) { cout << str[i]; } cout << endl;
a.cc: In function 'int main()': a.cc:29:22: error: expected '}' at end of input 29 | cout << endl; | ^ a.cc:18:1: note: to match this '{' 18 | { | ^
s738276668
p04044
C++
#define _USE_MATH_DEFINES #include <iostream> #include <stdio.h> #include <string> #include <cstdlib> #include <cmath> #include <algorithm> using namespace std; int main() { int n, l; char s[100][100], tmp[100] = {}; cin >> n >> l; for (int i = 0; i < n; i++) cin >> s[i]; for (int i = 0; i < n - 1; i++) for (int j = 0; j < n - 1; j++) for (int k = 0; k < l - 1; k++) { if (s[j][k] > s[j + 1][k]) { strcpy(tmp, s[j]); strcpy(s[j], s[j + 1]); strcpy(s[j + 1], tmp); break; } } for (int i = 0; i < n; i++) cout << s[i] << endl; return 0; }
a.cc: In function 'int main()': a.cc:19:41: error: 'strcpy' was not declared in this scope 19 | strcpy(tmp, s[j]); | ^~~~~~ a.cc:8:1: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 7 | #include <algorithm> +++ |+#include <cstring> 8 | using namespace std;
s655153316
p04044
C++
#include<iostream> using namespace std; #include<vector> #include<set> int main(){ int n,l; cin>>n>>l; set<string> s; for(int i = 0;i<n;i++){ string a; cin>>a; s.insert(a); } for(auto x : s){ cout<< x <<; } cout<<endl; return 0; }
a.cc: In function 'int main()': a.cc:17:28: error: expected primary-expression before ';' token 17 | cout<< x <<; | ^
s203281783
p04044
C++
3 3 dxx axx cxx
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 3 3 | ^
s287110521
p04044
C++
#include<iostream> #include<vector> #include<string> #include<algorithm> using namespace std; int main() { int n, k; cin>>n>>k; string names[121]; string temp; for(int i = 0; i<n; i++) { cin>>names[i]; } sort(names, names+n); for(int i=0; i<n; i++) cout<<names[i]; cout<<endl; return 0;
a.cc: In function 'int main()': a.cc:22:14: error: expected '}' at end of input 22 | return 0; | ^ a.cc:9:5: note: to match this '{' 9 | { | ^
s910401421
p04044
C++
#include<iostream> #include<vector> #include<string> using namespace std; int main() { int n, k; cin>>n>>k; string names[121]; string temp; for(int i = 0; i<n; i++) { cin>>names[i]; } sort(names, names+n); for(int i=0; i<n; i++) cout<<names[i]; cout<<endl; return 0; }
a.cc: In function 'int main()': a.cc:17:5: error: 'sort' was not declared in this scope; did you mean 'short'? 17 | sort(names, names+n); | ^~~~ | short
s948690604
p04044
C++
#include<iostream> #include<vector> #include<string> using namespace std; int main() { int n, k; cin>>n>>k; string[121] names; string temp; for(int i = 0; i<n; i++) { cin>>names[i]; } sort(names, names+n); for(int i=0; i<n; i++) cout<<names[i]; cout<<endl; return 0; }
a.cc: In function 'int main()': a.cc:10:8: error: expected identifier before numeric constant 10 | string[121] names; | ^~~ a.cc:10:8: error: expected ']' before numeric constant 10 | string[121] names; | ^~~ | ] a.cc:10:7: error: structured binding declaration cannot have type 'std::string' {aka 'std::__cxx11::basic_string<char>'} 10 | string[121] names; | ^ a.cc:10:7: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto' a.cc:10:7: error: empty structured binding declaration a.cc:10:13: error: expected initializer before 'names' 10 | string[121] names; | ^~~~~ a.cc:14:6: error: 'names' was not declared in this scope 14 | cin>>names[i]; | ^~~~~ a.cc:17:6: error: 'names' was not declared in this scope 17 | sort(names, names+n); | ^~~~~ a.cc:17:1: error: 'sort' was not declared in this scope; did you mean 'short'? 17 | sort(names, names+n); | ^~~~ | short
s345250543
p04044
C++
#include <iostream> #include <vector> using namespace std; int main(int argc, const char * argv[]) { int n, l; string s; vector<string> v; cin >> n >> l; for (int i=0; i<n; i++) { cin >> s; v.push_back(s); } sort(v.begin(), v.end()); for (int i=0; i<n; i++) { cout << v[i]; } cout << endl; return 0; }
a.cc: In function 'int main(int, const char**)': a.cc:16:5: error: 'sort' was not declared in this scope; did you mean 'short'? 16 | sort(v.begin(), v.end()); | ^~~~ | short
s977814589
p04044
C++
#include <iostream> #include <vector> #define eol '\n' using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int N,L; cin >> N >> L; vector<string> list(N); for (int i = 0; i < N; i++) { cin >> list[i]; } sort(list.begin(), list.end()); for (int i = 0; i < N; i++) { cout << list[i]; } cout << eol; return 0; }
a.cc: In function 'int main()': a.cc:18:3: error: 'sort' was not declared in this scope; did you mean 'short'? 18 | sort(list.begin(), list.end()); | ^~~~ | short
s109559229
p04044
Java
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int L = sc.nextInt(); String [] S = new String [N]; for(int i=0; i<N; i++){ S[i] = sc.next(); } Arrays.sort(S); String ans=""; for(int i=0; i<N; i++){ ans=ans+S[i] } System.out.println(ans); } }
Main.java:15: error: ';' expected ans=ans+S[i] ^ 1 error
s014401859
p04044
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class Atcoder42bb { public static void main(String[] args) throws IOException { BufferedReader b = new BufferedReader(new InputStreamReader(System.in)); String[] line = b.readLine().split(" "); int N = Integer.parseInt(line[0]); int L = Integer.parseInt(line[1]); String[] S = new String[N]; for (int i = 0; i < N; i++) { S[i] = b.readLine(); } Arrays.sort(S); for (int i = 0; i < N; i++) { System.out.print(S[i]); } } }
Main.java:6: error: class Atcoder42bb is public, should be declared in a file named Atcoder42bb.java public class Atcoder42bb { ^ 1 error
s978780630
p04044
Java
import java.util.Arrays; import java.util.Comparator; import java.util.Scanner; public class Easy { static Cara c[]; public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int l = sc.nextInt(); c = new Cara[l]; for(int i = 0;i < n;i++){ c[i] = new Cara(sc.next(), l); } Arrays.sort(c, new Comparator<Cara>(){ public int compare(Cara a, Cara b){ int i = 0; while(i < l){ if(a.a[i] > b.a[i]){ return 1; }else if(a.a[i] < b.a[i]){ return -1; } i++; } return 0; } }); String answer = ""; for(int i = 0;i < c.length;i++){ answer += c[i].a1; } System.out.println(answer); } } class Cara{ char []a; String a1; Cara(String a,int length){ this.a = new char[length]; this.a1 = a; this.a = a.toCharArray(); } }
Main.java:5: error: class Easy is public, should be declared in a file named Easy.java public class Easy { ^ 1 error
s286540836
p04044
C++
#include <iostream> #include <cmath> #include <string> #include <vector> using namespace std; int main(){ int N,L; cin >> N >> L; vector<string> mozi(N); vector<string> sum(1); for(int i=0;i < N;i++){ cin >> mozi[i]; } qsort(mozi.begin(),mozi.end()); for(int i=0;i < N;i++){ sum[0] += mozi[i]; } cout << sum[0] << endl; return 0; }
a.cc: In function 'int main()': a.cc:18:25: error: cannot convert 'std::vector<std::__cxx11::basic_string<char> >::iterator' to 'void*' 18 | qsort(mozi.begin(),mozi.end()); | ~~~~~~~~~~^~ | | | std::vector<std::__cxx11::basic_string<char> >::iterator In file included from /usr/include/c++/14/cstdlib:79, from /usr/include/c++/14/ext/string_conversions.h:43, from /usr/include/c++/14/bits/basic_string.h:4154, 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/stdlib.h:970:26: note: initializing argument 1 of 'void qsort(void*, size_t, size_t, __compar_fn_t)' 970 | extern void qsort (void *__base, size_t __nmemb, size_t __size, | ~~~~~~^~~~~~
s659138529
p04044
C++
#include <iostream> #include <math> #include <string> #include <vector> using namespace std; int main(){ int N,L; cin >> N >> L; vector<string> mozi(N); vector<string> sum(1); for(int i=0;i < N;i++){ cin >> mozi[i]; } qsort(mozi.begin(),mozi.end()); for(int i=0;i < N;i++){ sum[0] += mozi[i]; } cout << sum[0] << endl; return 0; }
a.cc:2:10: fatal error: math: No such file or directory 2 | #include <math> | ^~~~~~ compilation terminated.
s228798670
p04044
C++
#include <iostream> #include <math> #include <string> #include <vector> using namespace std; int main(){ int N,L; cin >> N >> L; //入力 vector<string> mozi(N); //比較する文字の数 vector<string> sum(1); //文字を足したやつ for(int i=0;i < N;i++){ //文字入力 cin >> mozi[i]; } qsort(mozi.begin(),mozi.end()); //文字列の最初から最後までをクイックソート for(int i=0;i < N;i++){ //文字を合体させる処理 sum[0] += mozi[i]; } cout << sum[0] << endl; //出力 return 0; }
a.cc:2:10: fatal error: math: No such file or directory 2 | #include <math> | ^~~~~~ compilation terminated.
s574566021
p04044
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; import java.util.List; public class Main { private static Scanner sc; public static void main(String[] args) { Main instance = new Main(); sc = instance.new Scanner(); instance.solve(); } private void solve() { try { int n = sc.nextInt(); int l = sc.nextInt(); String[] array = new String[n]; for (int i = 0; i < n; i++) { array[i] = sc.next(); } Arrays.sort(array); System.out.println(String.join("", array)); } catch (Exception e) { e.printStackTrace(); } } private class Scanner { String[] s; int i; BufferedReader br; String regex = " "; public Scanner() { s = new String[0]; i = 0; br = new BufferedReader(new InputStreamReader(System.in)); } @Override protected void finalize() throws Throwable { try { super.finalize(); } finally { destruction(); } } private void destruction() throws IOException { if (br != null) br.close(); } public String next() throws IOException { if (i < s.length) return s[i++]; String st = br.readLine(); while (st == "") st = br.readLine(); s = st.split(regex, 0); i = 0; return s[i++]; } public int nextInt() throws NumberFormatException, IOException { return Integer.parseInt(next()); } public Long nextLong() throws NumberFormatException, IOException { return Long.parseLong(next()); } public Double nextDouble() throws NumberFormatException, IOException { return Double.parseDouble(next()); } } }
Main.java:28: error: cannot find symbol Arrays.sort(array); ^ symbol: variable Arrays location: class Main Main.java:50: warning: [removal] finalize() in Object has been deprecated and marked for removal protected void finalize() throws Throwable { ^ Main.java:52: warning: [removal] finalize() in Object has been deprecated and marked for removal super.finalize(); ^ 1 error 2 warnings
s347559240
p04044
C++
#include <iostream> #include <vector> #include <string> #include <map> #include <cmath> int main() { int N, L; std::cin >> N >> L; std::vector<std::string> a; for (int i = 0; i < N; i++) { std::string tmp; std::cin >> tmp; a.push_back(tmp); } std::sort(a.begin(), a.end()); std::string result(""); for (int i = 0; i < N; i++) { result += a[i]; } std::cout << result << std::endl; return 0; }
a.cc: In function 'int main()': a.cc:19:8: error: 'sort' is not a member of 'std'; did you mean 'sqrt'? 19 | std::sort(a.begin(), a.end()); | ^~~~ | sqrt
s992159741
p04044
C++
#include <iostream> #include <vector> #include <string> #include <map> #include <cmath> int main() { int N, L; std::cin >> N >> L; std::vector<std::string> a; for (int i = 0; i < N; i++) { std::string tmp; std::cin >> tmp; a.push_back(tmp); } std::cout << "hoge" << std::endl; std::sort(a.begin(), a.end()); std::cout << "hoge" << std::endl; std::string result(""); for (int i = 0; i < N; i++) { result += a[i]; } std::cout << result << std::endl; return 0; }
a.cc: In function 'int main()': a.cc:20:8: error: 'sort' is not a member of 'std'; did you mean 'sqrt'? 20 | std::sort(a.begin(), a.end()); | ^~~~ | sqrt
s375905837
p04044
C++
#include <iostream> #include <fstream> #include <cstdio> #include <cmath> #include <vector> #include <cstring> #include <string> #include <set> #include <map> #include <stack> #include <queue> #include <algorithm> using namespace std; #define REP(i,n) for(int i=0; i<n; ++i) #define FOR(i,a,b) for(int i=a; i<=b; ++i) #define FORR(i,a,b) for (int i=a; i>=b; --i) #define pi M_PI typedef long long ll; typedef vector<int> VI; typedef vector<ll> VL; typedef vector<VI> VVI; typedef pair<int,int> P; typedef pair<ll,ll> PL; int main(){ int n, l; cin >> n >> l; vector<string> s(n); REP(i,n) cin >> s[i]; sort(s.clear(),s.end()); REP(i,n) cout << s[i]; cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:32:17: error: invalid use of void expression 32 | sort(s.clear(),s.end()); | ~~~~~~~^~
s926929925
p04044
C++
#include <iostream> #include <string> #include <vector> using namespace std; int main() { int n, l; vector<string> lines; cin >> n >> l; for(int i = 0; i < n; i++) { string line; cin >> line; lines.push_back(line); } sort(lines.begin(), lines.end()); for(int i = 0; i < n; i++) { cout << lines[i]; } cout << endl; }
a.cc: In function 'int main()': a.cc:16:3: error: 'sort' was not declared in this scope; did you mean 'short'? 16 | sort(lines.begin(), lines.end()); | ^~~~ | short
s874322021
p04044
C++
#include <stdio.h> #include <string.h> char a[100][101]; int n, l; void swap(int x, int y) { char t; for(int i=0; i<l; i++) { t=a[x][i]; a[x][i]=a[y][i]; a[y][i]=t; } } #include <stdio.h> #include <string.h> char a[100][101]; int n, l; void swap(int x, int y) { char t; for(int i=0; i<l; i++) { t=a[x][i]; a[x][i]=a[y][i]; a[y][i]=t; } } int main(void) { scanf("%d%d", &n, &l); for(int i=0; i<n; i++) scanf("%s", a[i]); for(int k=l-1; k>-1; k--) { for(int i=0; i<n-1; i++) { for(int j=i+1; j<n; j++) { if(a[i][k]>=a[j][k]) { swap(i, j); } } } // prn(); } for(int i=0; i<n; i++) printf("%s", a[i]); return 0; } } } } for(int i=0; i<n; i++) printf("%s", a[i]); return 0; } */ int main(void) { scanf("%d%d", &n, &l); for(int i=0; i<n; i++) scanf("%s", a[i]); for(int k=l-1; k>-1; k--) { for(int i=0; i<n-1; i++) { for(int j=i+1; j<n; j++) { if(a[i][k]>=a[j][k]) { swap(i, j); } } } prn(); } for(int i=0; i<n; i++) printf("%s", a[i]); return 0; }
a.cc:19:6: error: redefinition of 'char a [100][101]' 19 | char a[100][101]; | ^ a.cc:4:6: note: 'char a [100][101]' previously declared here 4 | char a[100][101]; | ^ a.cc:20:5: error: redefinition of 'int n' 20 | int n, l; | ^ a.cc:5:5: note: 'int n' previously declared here 5 | int n, l; | ^ a.cc:20:8: error: redefinition of 'int l' 20 | int n, l; | ^ a.cc:5:8: note: 'int l' previously declared here 5 | int n, l; | ^ a.cc:22:6: error: redefinition of 'void swap(int, int)' 22 | void swap(int x, int y) { | ^~~~ a.cc:7:6: note: 'void swap(int, int)' previously defined here 7 | void swap(int x, int y) { | ^~~~ a.cc:53:14: error: expected declaration before '}' token 53 | } } | ^ a.cc:54:9: error: expected declaration before '}' token 54 | } | ^ a.cc:55:5: error: expected declaration before '}' token 55 | } | ^ a.cc:57:5: error: expected unqualified-id before 'for' 57 | for(int i=0; i<n; i++) | ^~~ a.cc:57:18: error: 'i' does not name a type 57 | for(int i=0; i<n; i++) | ^ a.cc:57:23: error: 'i' does not name a type 57 | for(int i=0; i<n; i++) | ^ a.cc:60:5: error: expected unqualified-id before 'return' 60 | return 0; | ^~~~~~ a.cc:61:1: error: expected declaration before '}' token 61 | } | ^ a.cc:63:2: error: expected unqualified-id before '/' token 63 | */ | ^
s480539876
p04044
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n,l; cin >> n >> l; vector<string> v(n); for(int i=0;i<n;i++){ cin >> v[i]; } sort(v.begin(),v.end()); for(int unsigned i = 0;i<n;i++){ cout < v[i]; } cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:14:22: error: no match for 'operator<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'}) 14 | cout < v[i]; In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:1: /usr/include/c++/14/bits/regex.h:1143:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1143 | operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1143:5: note: template argument deduction/substitution failed: a.cc:14:27: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 14 | cout < v[i]; | ^ /usr/include/c++/14/bits/regex.h:1224:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)' 1224 | operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1224:5: note: template argument deduction/substitution failed: a.cc:14:27: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' 14 | cout < v[i]; | ^ /usr/include/c++/14/bits/regex.h:1317:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)' 1317 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1317:5: note: template argument deduction/substitution failed: a.cc:14:27: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 14 | cout < v[i]; | ^ /usr/include/c++/14/bits/regex.h:1391:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1391 | operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1391:5: note: template argument deduction/substitution failed: a.cc:14:27: note: '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 14 | cout < v[i]; | ^ /usr/include/c++/14/bits/regex.h:1485:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1485 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1485:5: note: template argument deduction/substitution failed: a.cc:14:27: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 14 | cout < v[i]; | ^ /usr/include/c++/14/bits/regex.h:1560:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1560 | operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1560:5: note: template argument deduction/substitution failed: a.cc:14:27: note: '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 14 | cout < v[i]; | ^ /usr/include/c++/14/bits/regex.h:1660:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1660 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1660:5: note: template argument deduction/substitution failed: a.cc:14:27: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 14 | cout < v[i]; | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /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:14:27: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::pair<_T1, _T2>' 14 | cout < v[i]; | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /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:14:27: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 14 | cout < v[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:14:27: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 14 | cout < v[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:14:27: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 14 | cout < v[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:14:27: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 14 | cout < v[i]; | ^ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/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:14:27: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 14 | cout < v[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:14:27: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 14 | cout < v[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:14:27: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 14 | cout < v[i]; | ^ /usr/include/c++/14/bits/basic_string.h:3874:5: note: candidate: 'template<class _CharT, class _Traits, class _
s292408229
p04044
C++
#include <iostream> #include <algorithm> using namespace std; int main(){ int n,l; char S[100][100]; cin >> n >> l; for(int i=0;i<n;i++){ for(int j=0;j<l;j++){ cin >> S[i][j]; } } for(int i=0;i<n;i++){ sort(S[i],S[i]+l); } for(int i=0;i<n;i++){ for(int j=0;j<l;j++){ cout << S[i][j]; } } cout<<endl; return 0; }
a.cc: In function 'int main()': a.cc:27:5: error: 'cou\U0000ff54' was not declared in this scope 27 | cout<<endl; | ^~~~~
s351804097
p04044
C++
#include <iostream> #include <algorithm> using namespace std; int main(){ int n,l; char S[100][100]; cin >> n >> l; for(int i=0;i<n;i++){ for(int j=0;j<l;j++){ cin >> S[i][j]; } } for(int i=0;i<n;i++){ sort(S[i],S[i]+l); } for(int i=0;i<n;i++){ for(int j=0;j<l;j++){ cout << S[i][j]; } } cou<<endl; return 0; }
a.cc: In function 'int main()': a.cc:27:5: error: 'cou' was not declared in this scope 27 | cou<<endl; | ^~~
s840214428
p04044
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner x = new Scanner(System.in); int num=x.nextInt(); int length=x.nextInt(); String[] arr = new String[num]; for(int i = 0;i<num;i++){ arr[i]=x.next(); } Arrays.sort(arr); String result=""; for(int i = 0;i<num;i++){ result += arr[i]; } return result; } }
Main.java:23: error: incompatible types: unexpected return value return result; ^ 1 error
s053760060
p04044
C++
#include<string> #include<iostream> #include<vector> #include<map> using namespace std; int main() { vector<int> in(3); map<int,int> mp; int N, L; cin >> N; cin >> L; vector<string> S; S.resize(N); for(auto &s: S) cin >> s; sort(S.begin(), S.end()); for(auto s: S) cout << s; cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:22:3: error: 'sort' was not declared in this scope; did you mean 'short'? 22 | sort(S.begin(), S.end()); | ^~~~ | short
s643286861
p04044
C
include<stdio.h> #include<string.h> int main(void) { char str[100][100], temp[100]; int N, L, i; scanf("%d %d", &N, &L); gets(temp); for (L = 0;L < N;L++) gets(str[L]); for (L = 0;L < N-1;L++) { for (i = 0;i < N - 1;i++) { if (strcmp(str[i], str[i + 1]) > 0) { strcpy(temp, str[i]); strcpy(str[i], str[i + 1]); strcpy(str[i + 1], temp); } } } for (i = 0;i < N;i++) printf("%s", str[i]); return 0; }
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token 1 | include<stdio.h> | ^ In file included from main.c:2: /usr/include/string.h:44:22: error: unknown type name 'size_t' 44 | size_t __n) __THROW __nonnull ((1, 2)); | ^~~~~~ /usr/include/string.h:34:1: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' 33 | #include <stddef.h> +++ |+#include <stddef.h> 34 | /usr/include/string.h:47:56: error: unknown type name 'size_t' 47 | extern void *memmove (void *__dest, const void *__src, size_t __n) | ^~~~~~ /usr/include/string.h:47:56: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:55:32: error: unknown type name 'size_t' 55 | int __c, size_t __n) | ^~~~~~ /usr/include/string.h:55:32: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:61:42: error: unknown type name 'size_t' 61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1)); | ^~~~~~ /usr/include/string.h:61:42: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:64:56: error: unknown type name 'size_t' 64 | extern int memcmp (const void *__s1, const void *__s2, size_t __n) | ^~~~~~ /usr/include/string.h:64:56: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:80:60: error: unknown type name 'size_t' 80 | extern int __memcmpeq (const void *__s1, const void *__s2, size_t __n) | ^~~~~~ /usr/include/string.h:80:60: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:107:48: error: unknown type name 'size_t' 107 | extern void *memchr (const void *__s, int __c, size_t __n) | ^~~~~~ /usr/include/string.h:107:48: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:145:53: error: unknown type name 'size_t' 145 | const char *__restrict __src, size_t __n) | ^~~~~~ /usr/include/string.h:145:53: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:153:23: error: unknown type name 'size_t' 153 | size_t __n) __THROW __nonnull ((1, 2)); | ^~~~~~ /usr/include/string.h:153:23: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:159:57: error: unknown type name 'size_t' 159 | extern int strncmp (const char *__s1, const char *__s2, size_t __n) | ^~~~~~ /usr/include/string.h:159:57: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:166:8: error: unknown type name 'size_t' 166 | extern size_t strxfrm (char *__restrict __dest, | ^~~~~~ /usr/include/string.h:166:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:167:54: error: unknown type name 'size_t' 167 | const char *__restrict __src, size_t __n) | ^~~~~~ /usr/include/string.h:167:54: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:179:8: error: unknown type name 'size_t' 179 | extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n, | ^~~~~~ /usr/include/string.h:179:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:179:59: error: unknown type name 'size_t' 179 | extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n, | ^~~~~~ /usr/include/string.h:179:59: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:195:45: error: unknown type name 'size_t' 195 | extern char *strndup (const char *__string, size_t __n) | ^~~~~~ /usr/include/string.h:195:45: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:293:8: error: unknown type name 'size_t' 293 | extern size_t strcspn (const char *__s, const char *__reject) | ^~~~~~ /usr/include/string.h:293:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:297:8: error: unknown type name 'size_t' 297 | extern size_t strspn (const char *__s, const char *__accept) | ^~~~~~ /usr/include/string.h:297:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:389:46: error: unknown type name 'size_t' 389 | extern void *memmem (const void *__haystack, size_t __haystacklen, | ^~~~~~ /usr/include/string.h:389:46: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:390:44: error: unknown type name 'size_t' 390 | const void *__needle, size_t __needlelen) | ^~~~~~ /usr/include/string.h:390:44: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:398:55: error: unknown type name 'size_t' 398 | const void *__restrict __src, size_t __n) | ^~~~~~ /usr/include/string.h:398:55: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:401:53: error: unknown type name 'size_t' 401 | const void *__restrict __src, size_t __n) | ^~~~~~ /usr/include/string.h:401:53: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:407:8: error: unknown type name 'size_t' 407 | extern size_t strlen (const char *__s) | ^~~~~~ /usr/include/string.h:407:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:413:8: error: unknown type name 'size_t' 413 | extern size_t strnlen (const char *__string, size_t __maxlen) | ^~~~~~ /usr/include/string.h:413:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:413:46: error: unknown type name 'size_t' 413 | extern size_t strnlen (const char *__string, size_t __maxlen) | ^~~~~~ /usr/include/string.h:413:46: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' In file included from /usr/include/features.h:523, from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33, from /usr/include/string.h:26: /usr/include/string.h:432:12: error: unknown type name 'size_t' 432 | extern int __REDIRECT_NTH (strerror_r, | ^~~~~~~~~~~~~~ /usr/include/string.h:432:12: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' In file included from /usr/include/string.h:462: /usr/include/strings.h:34:54: error: unknown type name 'size_t' 34 | extern int bcmp (const void *__s1, const void *__s2, size_t __n) | ^~~~~~ /usr/include/strings.h:24:1: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' 23 | #include <stddef.h> +++ |+#include <stddef.h> 24 | /usr/include/strings.h:38:53: error: unknown type name 'size_t' 38 | extern void bcopy (const void *__src, void *__dest, size_t __n) | ^~~~~~ /usr/include/strings.h:38:53: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/strings.h:42:31: error: unknown type name 'size_t' 42 | extern void bzero (void *__s, size_t __n) __THROW __nonnull ((1)); | ^~~~~~ /usr/include/strings.h:42:31: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/strings.h:120:61: error: unknown type name 'size_t' 120 | extern int strncasecmp (const char *__s1, const char *__s2, size_t __n) | ^~~~~~ /usr/include/strings.h:120:61: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/strings.h:134:27: error: unknown type name 'size_t' 134 | size_t __n, locale_t __loc) | ^~~~~~ /usr/include/strings.h:134:27: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:466:40: error: unknown type name
s629694071
p04044
C++
import java.util.*; public class Main { static int N, L; static String[] S; public static void main(String[] args) { Scanner sc = new Scanner(System.in); N = sc.nextInt(); L = sc.nextInt(); S = new String[N]; for(int i = 0; i < N; i++) { S[i] = sc.next(); } Arrays.sort(S); for(int i = 0; i < N; i++) { System.out.print(S[i]); } System.out.println(""); } }
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:4:1: error: expected unqualified-id before 'public' 4 | public class Main { | ^~~~~~
s062399204
p04044
C++
#include<stdio.h> //#include<cstdio> #include<iostream> #include<fstream> #include<string.h> #include<algorithm> #include<functional> using namespace std; int main(void){ int L, N; string S[101]; ifs >> L >> N; for (int i = 0; i < N; i++)cin >> S[i]; sort(S, S + N); for (int i = 0; i < N; i++)cout << S[i]; cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:15:9: error: 'ifs' was not declared in this scope; did you mean 'ffs'? 15 | ifs >> L >> N; | ^~~ | ffs
s129211136
p04044
C++
//gcc -std=gnu11 -O2 -o a.out Main.c -lm #include <stdio.h> #include <string.h> #include <stdlib.h> int sortFunc(const void *str1, const void *str2){ return strcmp(str1, str2); } int main(void) { int n, l, i; char str[100][101]; int ret; ret = scanf("%d %d", &n, &l); for(i = 0 ; i < n ; i++){ ret = scanf("%s", str[i]); } qsort(str, n, sizeof(str[0]), sortFunc); for(i = 0 ; i < n ; i++){ printf("%s", str[i]); } printf("\n"); return 0; }
a.cc: In function 'int sortFunc(const void*, const void*)': a.cc:8:23: error: invalid conversion from 'const void*' to 'const char*' [-fpermissive] 8 | return strcmp(str1, str2); | ^~~~ | | | const void* In file included from a.cc:4: /usr/include/string.h:156:32: note: initializing argument 1 of 'int strcmp(const char*, const char*)' 156 | extern int strcmp (const char *__s1, const char *__s2) | ~~~~~~~~~~~~^~~~ a.cc:8:29: error: invalid conversion from 'const void*' to 'const char*' [-fpermissive] 8 | return strcmp(str1, str2); | ^~~~ | | | const void* /usr/include/string.h:156:50: note: initializing argument 2 of 'int strcmp(const char*, const char*)' 156 | extern int strcmp (const char *__s1, const char *__s2) | ~~~~~~~~~~~~^~~~
s088060474
p04044
C++
#include <iostream> #include <string> using namespace std; string tab[101]; int main() { cin >> n >> l; for (int i = 0; i < n; i++) cin >> tab[i]; sort(tab, tab+n); for (int i = 0; i < n; i++) cout <<tab[i]; cout <<"\n"; return 0; }
a.cc: In function 'int main()': a.cc:7:8: error: 'n' was not declared in this scope 7 | cin >> n >> l; | ^ a.cc:7:13: error: 'l' was not declared in this scope 7 | cin >> n >> l; | ^ a.cc:9:1: error: 'sort' was not declared in this scope; did you mean 'short'? 9 | sort(tab, tab+n); | ^~~~ | short
s747249014
p04044
Java
/* Filename: ABC042B.java * Author: Mushiyo */ import java.util.Scanner; import java.util.Arrays; public class ABC042B { public static void main(String[] args) { Scanner input = new Scanner(System.in); while (input.hasNext()) { int N = input.nextInt(); int L = input.nextInt(); String[] S = new String[N]; for(int i = 0; i < S.length; ++i){ S[i] = input.next(); } Arrays.sort(S); StringBuilder sol = new StringBuilder(); for(int i = 0; i < S.length; ++i){ sol.append(S[i]); } System.out.println(sol); } } }
Main.java:8: error: class ABC042B is public, should be declared in a file named ABC042B.java public class ABC042B { ^ 1 error
s858033709
p04044
C++
/* ID: marik_k1 PROG: LANG: C++ */ #include <bits/stdc++.h> using namespace std; //ifstream fin ("input.txt"); //ofstream fout ("output.txt"); #define forn(i,n) for(int i = 0; i < n; ++i) #define mp make_pair #define pb push_back #define all(t) t.begin(),t.end() #define gcd(x,y) __gcd(x,y) typedef unsigned long long ull; typedef long long ll; typedef pair<int,int> pii; typedef vector<int> vi; const int N = 300000; const int INF = (int)1e7; const double eps = 1e-6; const long long MOD = 1e9 + 7; const double PI = M_PI; vector<string> a(200); int n,l; string ans = ""; int main(){ std::ios::sync_with_stdio(false); //freopen("input.in","r",stdin); //freopen("output.out","w",stdout); cin >> n >> l; for(int i = 0; i < n; ++i){ cin >> a[i]; } sort(a, a + n); for(int i = 0; i < n; ++i) ans += a[i]; cout << ans; return 0; }
a.cc: In function 'int main()': a.cc:44:19: error: no match for 'operator+' (operand types are 'std::vector<std::__cxx11::basic_string<char> >' and 'int') 44 | sort(a, a + n); | ~ ^ ~ | | | | | int | std::vector<std::__cxx11::basic_string<char> > In file included from /usr/include/c++/14/bits/stl_algobase.h:67, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:6: /usr/include/c++/14/bits/stl_iterator.h:627:5: note: candidate: 'template<class _Iterator> constexpr std::reverse_iterator<_Iterator> std::operator+(typename reverse_iterator<_Iterator>::difference_type, const reverse_iterator<_Iterator>&)' 627 | operator+(typename reverse_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:627:5: note: template argument deduction/substitution failed: a.cc:44:21: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int' 44 | sort(a, a + n); | ^ /usr/include/c++/14/bits/stl_iterator.h:1798:5: note: candidate: 'template<class _Iterator> constexpr std::move_iterator<_IteratorL> std::operator+(typename move_iterator<_IteratorL>::difference_type, const move_iterator<_IteratorL>&)' 1798 | operator+(typename move_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1798:5: note: template argument deduction/substitution failed: a.cc:44:21: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int' 44 | sort(a, a + n); | ^ In file included from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/basic_string.h:3598:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3598 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3598:5: note: template argument deduction/substitution failed: a.cc:44:21: note: 'std::vector<std::__cxx11::basic_string<char> >' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 44 | sort(a, a + n); | ^ /usr/include/c++/14/bits/basic_string.h:3616:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3616 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3616:5: note: template argument deduction/substitution failed: a.cc:44:21: note: mismatched types 'const _CharT*' and 'std::vector<std::__cxx11::basic_string<char> >' 44 | sort(a, a + n); | ^ /usr/include/c++/14/bits/basic_string.h:3635:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3635 | operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3635:5: note: template argument deduction/substitution failed: a.cc:44:21: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 44 | sort(a, a + n); | ^ /usr/include/c++/14/bits/basic_string.h:3652:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3652 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3652:5: note: template argument deduction/substitution failed: a.cc:44:21: note: 'std::vector<std::__cxx11::basic_string<char> >' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 44 | sort(a, a + n); | ^ /usr/include/c++/14/bits/basic_string.h:3670:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT)' 3670 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3670:5: note: template argument deduction/substitution failed: a.cc:44:21: note: 'std::vector<std::__cxx11::basic_string<char> >' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 44 | sort(a, a + n); | ^ /usr/include/c++/14/bits/basic_string.h:3682:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3682 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3682:5: note: template argument deduction/substitution failed: a.cc:44:21: note: 'std::vector<std::__cxx11::basic_string<char> >' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 44 | sort(a, a + n); | ^ /usr/include/c++/14/bits/basic_string.h:3689:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3689 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3689:5: note: template argument deduction/substitution failed: a.cc:44:21: note: 'std::vector<std::__cxx11::basic_string<char> >' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 44 | sort(a, a + n); | ^ /usr/include/c++/14/bits/basic_string.h:3696:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3696 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3696:5: note: template argument deduction/substitution failed: a.cc:44:21: note: 'std::vector<std::__cxx11::basic_string<char> >' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 44 | sort(a, a + n); | ^ /usr/include/c++/14/bits/basic_string.h:3719:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3719 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3719:5: note: template argument deduction/substitution failed: a.cc:44:21: note: mismatched types 'const _CharT*' and 'std::vector<std::__cxx11::basic_string<char> >' 44 | sort(a, a + n); | ^ /usr/include/c++/14/bits/basic_string.h:3726:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3726 | operator+(_CharT __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3726:5: note: template argument deduction/substitution failed: a.cc:44:21: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 44 | sort(a, a + n); | ^ /usr/include/c++/14/bits/basic_string.h:3733:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const _CharT*)' 3733 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3733:5: note: template argument deduction/substitution failed: a.cc:44:21: note: 'std::vector<std::__cxx11::basic_string<char> >' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 44 | sort(a, a + n); | ^ /usr/include/c++/14/bits/basic_string.h:3740:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, _CharT)' 3740 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3740:5: note: template argument deduction/substitution failed: a.cc:44:21: note: 'std::vector<std::__cxx11::basic_string<char> >' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 44 | sort(a, a + n); | ^ In file included from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/complex:340:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator+(const complex<_Tp>&, const complex<_Tp>&)' 340 | operator+(const complex<_Tp>& __x, const compl
s506179957
p04044
C++
#include<iostream> #include<string> using namespace std; const int MAX=100; int main() { int N,L; string S[MAX]; cin >> N >> L ; for(int i=0; i<N ; i++) { cin >> S[i]; } sort(S,S+N); string res=""; for(int i=0; i<N ; i++) { res+=S[i]; } cout << res << endl; return 0; }
a.cc: In function 'int main()': a.cc:22:5: error: 'sort' was not declared in this scope; did you mean 'short'? 22 | sort(S,S+N); | ^~~~ | short
s793974624
p04044
C++
#include <iostream> #include <vector> using namespace std; int main (){ int N,L; string T,U; cin >> N >> L; vector<string> s; cin.ignore(); for(int i = 0; i < N; ++i) { cin >> T; s.push_back(T); } sort(s.begin(),s.end()); for(int i = 0; i < N; ++i) { U = U + s[i]; } cout << U << "\n"; return 0; }
a.cc: In function 'int main()': a.cc:15:9: error: 'sort' was not declared in this scope; did you mean 'short'? 15 | sort(s.begin(),s.end()); | ^~~~ | short
s684780291
p04044
C++
#include "iostream" #include "vector" using namespace std; int main(int argc, char const *argv[]) { int N,L; cin >> N >> L; vector<string> S; cin.ignore(); string s; for (int i = 0; i < N; ++i) { cin >> s; S.push_back(s); } sort(S.begin(), S.end()); s = ""; for (int i = 0; i < N; ++i) { s += S[i]; } cout << s << endl; return 0; }
a.cc: In function 'int main(int, const char**)': a.cc:18:9: error: 'sort' was not declared in this scope; did you mean 'short'? 18 | sort(S.begin(), S.end()); | ^~~~ | short
s165837509
p04044
C++
#include <iostream> #include <vector> #include <string> #include <algorithm using namespace std; int main() { size_t n,t; cin>>n;cin>>t; vector<string> v(n); for(auto&& str : v) cin >> str; sort(v.begin(), v.end()); cout << v[0] << v[1] << endl; }
a.cc:4:20: error: missing terminating > character 4 | #include <algorithm | ^
s873022903
p04044
C++
#include <iostream> #include <vector> #include <string> using namespace std; int main() { size_t n,t; cin>>n;cin>>t; vector<string> v(n); for(auto&& str : v) cin >> str; sort(v.begin(), v.end()); cout << v[0] << v[1] << endl; }
a.cc: In function 'int main()': a.cc:12:5: error: 'sort' was not declared in this scope; did you mean 'short'? 12 | sort(v.begin(), v.end()); | ^~~~ | short
s338225914
p04044
Java
import java.util.Scanner; import java.util.Arrays; class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int l = in.nextInt(); String[] s = new String[n]; for(int i=0; i<n; i++) { s[i] = in.nextInt(); } Arrays.sort(s); for(int i=0; i<n; i++) { System.out.print(s[i]); } System.out.println(); in.close(); } }
Main.java:11: error: incompatible types: int cannot be converted to String s[i] = in.nextInt(); ^ 1 error
s958053399
p04044
C++
#include <cstdio> #include <vector> #include <string> using namespace std; int main(){ int n, l; scanf("%d %d", &n, &l); vector<string> s; for(int i=0; i<n; i++){ char tmp[l+1]; scanf("%s", tmp); s.push_back(tmp); } sort(s.begin(), s.end()); for(int i=0; i<n; i++){ printf("%s", s[i].c_str()); } printf("\n"); return 0; }
a.cc: In function 'int main()': a.cc:15:9: error: 'sort' was not declared in this scope; did you mean 'short'? 15 | sort(s.begin(), s.end()); | ^~~~ | short
s095862731
p04044
Java
import java.util.Scanner; import java.util.Comparator; public class Main{ public static void main(String[] args){ Scanner sc =new Scanner(System.in); int n=sc.nextInt(); String[] s=new String[n]; for(int i=0; i<n; i++){ s[i]=sc.next();} Arrays.sort(s); for(int i=0; i<n; i++){ System.out.println(s[i]);} }}
Main.java:12: error: cannot find symbol Arrays.sort(s); ^ symbol: variable Arrays location: class Main 1 error
s638993748
p04044
C++
#include <iostream> #include <string> #include <vector> using namespace std; int main(void){ int n,l; cin>>n>>l; vector<string> s(n); for(int i=0;i<n;i++) cin>>s[i]; sort(s.begin(),s.end()); for(int i=0;i<n;i++) cout<<s[i]; cout<<endl; }
a.cc: In function 'int main()': a.cc:9:5: error: 'sort' was not declared in this scope; did you mean 'short'? 9 | sort(s.begin(),s.end()); | ^~~~ | short
s890430285
p04044
Java
import java.util.Scanner; import java.util.Comparator; public class Main{ public static void main(String[] args){ Scanner sc =new Scanner(System.in); int n=sc.nextInt(); String[] s=new String[n]; for(int i=0; i<s.length; i++){ s[i]=sc.next();} for(int i=0; i<s.length-1; i++){ } Arrays.sort(s); for(int i=0; i<s.length; i++){ System.out.println(s[i]);} }}
Main.java:14: error: cannot find symbol Arrays.sort(s); ^ symbol: variable Arrays location: class Main 1 error
s022574551
p04044
Java
import java.util.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); // 整数の入力 int N = sc.nextInt(); int L = sc.nextInt(); List<String> slist = new ArrayList<>(); // 文字列の入力 for(int i=0; i<N; i++){ slist.add(sc.next()); } List<String> subList = slist.subList(1, teamsName.size()); Collections.sort(slist); StringBuffer sb = new StringBuffer(L * N); for(String s: slist){ sb.append(s); } System.out.println(sb); } }
Main.java:15: error: cannot find symbol List<String> subList = slist.subList(1, teamsName.size()); ^ symbol: variable teamsName location: class Main 1 error
s946370204
p04044
C++
#include <iostream> #include <string> #include <algorithm> using namespace std; int main() { int a,b; cin >> a >> b; string c[100]; for(int i=0;i<a;i++){ cin >> c[i]; } sort(c,c+a); for(int j=0;j<a;j++){ cout << c[j]; }
a.cc: In function 'int main()': a.cc:19:10: error: expected '}' at end of input 19 | } | ^ a.cc:7:12: note: to match this '{' 7 | int main() { | ^
s764807479
p04044
C++
#include <iostream> #include <vector> #include <algorithm> #include <string> using namespace std; int main() { int N, L; cin >> N >> L; vector <string> Sset; for (int i = 0; i < N; i++) { string s; cin >> s; Sset.push_back(s); s.clear(); } sort(Sset.begin(), Sset.end()); string answer; answer = null; for (int i = 0; i< N; i++) { answer += Sset[i]; } cout << answer << endl; return 0; }
a.cc: In function 'int main()': a.cc:19:14: error: 'null' was not declared in this scope 19 | answer = null; | ^~~~
s438961670
p04044
C++
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { int N, L; cin >> N >> L; vector <string> Sset; for (int i = 0; i < N; i++) { string s; cin >> s; Sset.push_back(s); s.clear(); } sort(Sset.begin(), Sset.end()) string answer; answer = null; for (int i = 0; i< N; i++) { answer += Sset[i]; } cout << answer << endl; return 0; }
a.cc: In function 'int main()': a.cc:17:35: error: expected ';' before 'string' 17 | sort(Sset.begin(), Sset.end()) | ^ | ; 18 | string answer; | ~~~~~~ a.cc:19:5: error: 'answer' was not declared in this scope 19 | answer = null; | ^~~~~~ a.cc:19:14: error: 'null' was not declared in this scope 19 | answer = null; | ^~~~
s743117419
p04044
Java
import java.util.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); // 整数の入力 int N = sc.nextInt(); int L = sc.nextInt(); List<String> slist = new ArrayList<>(); // 文字列の入力 for(int i=0; i<N; i++){ slist.add(sc.nextInt()); } Collections.sort(slist); StringBuffer sb = new StringBuffer(L * N); for(String s: slist){ sb.append(s); } } }
Main.java:13: error: incompatible types: int cannot be converted to String slist.add(sc.nextInt()); ^ Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output 1 error
s856926030
p04044
C++
#include <iostream> #include <cstring> #include <algorithm> #include <vector> using namespace std; char S[101][101]; char *ans[101]; int main (void) { int N, L; char *tmp; cin.tie(0); ios::sync_with_stdio(false); cin >> N >> L; for (int i = 0; i < N; i++) { cin >> S[i]; ans[i] = S[i]; } for (int i = 1; i < N; i++) { if (strcmp(ans[i-1], ans[i]) > 0) { tmp = ans[i-1]; ans[i-1] = ans[i]; ans[i] = tmp; } } for (int i = 0; i < N; i++) cout << ans[i]; cout << endl; return 0; } yuta@yuta-HP-P
a.cc:34:5: error: stray '@' in program 34 | yuta@yuta-HP-P | ^ a.cc:34:1: error: 'yuta' does not name a type 34 | yuta@yuta-HP-P | ^~~~
s128045119
p04044
Java
import java.util.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); // 整数の入力 int N = sc.nextInt(); int L = sc.nextInt(); List<String> slist = new ArrayList<>; // 文字列の入力 for(int i=0; i<N; i++){ slist.add(sc.nextInt()); } Collections.sort(slist); StringBuffer sb = new StringBuffer(L * N); for(String s: slist){ sb.append(s); } } }
Main.java:9: error: '(' or '[' expected List<String> slist = new ArrayList<>; ^ 1 error
s173386780
p04044
Java
import java.util.ArrayList; import java.util.Collections; import java.io.*; import java.util.Scanner; class Main{ public static void main(String[] args)throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)\ ); ArrayList<String> list = new ArrayList<String>(); Scanner scan = new Scanner(System.in); int N = scan.nextInt(); int L = scan.nextInt(); for(int i=0;i<N;i++){ list.add(br.readLine()); } String allStr = ""; Collections.sort(list); for(String str : list){ allStr += str; } System.out.println(allStr.replaceAll("\n","")); } }
Main.java:8: error: illegal character: '\' BufferedReader br = new BufferedReader(new InputStreamReader(System.in)\ ^ 1 error
s589300644
p04044
C++
typedef vector<VI> VVI; #define MAX(x,y) ( (x) > (y) ? (x) : (y) ) #define MIN(x, y) ( (x) < (y) ? (x) : (y) ) #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define REP(i,n) FOR(i,0,n) #define IVFOR(p,a) for(vector<int>::iterator p = (a).begin(); p!=(a).end(); p++) #define ILFOR(p,a) for(list<int>::iterator p = (a).begin(); p!=(a).end(); p++) #define ALL(a) (a).begin(),(a).end() #define SORT(c) sort((c).begin(),(c).end()) #define CHECK(x) cout << #x << " = " << (x) << endl #define FINA(y) cout << (y) << endl int main(){ int n, l; cin >> n >> l; vector<string> v(n); REP(i,n){ cin >> v[i]; } SORT(v); REP(i,n){ cout << v[i]; } cout << endl; return 0; }
a.cc:1:9: error: 'vector' does not name a type 1 | typedef vector<VI> VVI; | ^~~~~~ a.cc: In function 'int main()': a.cc:18:3: error: 'cin' was not declared in this scope 18 | cin >> n >> l; | ^~~ a.cc:20:3: error: 'vector' was not declared in this scope 20 | vector<string> v(n); | ^~~~~~ a.cc:20:10: error: 'string' was not declared in this scope 20 | vector<string> v(n); | ^~~~~~ a.cc:20:18: error: 'v' was not declared in this scope 20 | vector<string> v(n); | ^ a.cc:10:17: error: 'sort' was not declared in this scope; did you mean 'short'? 10 | #define SORT(c) sort((c).begin(),(c).end()) | ^~~~ a.cc:25:3: note: in expansion of macro 'SORT' 25 | SORT(v); | ^~~~ a.cc:28:5: error: 'cout' was not declared in this scope 28 | cout << v[i]; | ^~~~ a.cc:31:3: error: 'cout' was not declared in this scope 31 | cout << endl; | ^~~~ a.cc:31:11: error: 'endl' was not declared in this scope 31 | cout << endl; | ^~~~
s272724615
p04044
Java
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; import java.util.List; public class B { public static void main(String[] args) { try { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int[] a = strToIntArray(br.readLine()); List<String> SList = new ArrayList<String>(); for (int i = 0; i < a[0]; i++) { SList.add(br.readLine()); } Collections.sort(SList); StringBuilder sb = new StringBuilder(""); for (String string : SList) { sb.append(string); } System.out.println(sb.toString()); } catch (Exception e) { System.err.println("Error:" + e.getMessage()); } } // Stringで読みこんでスペースで分割されている数字を配列に入れるやつ // 利用法 int[] A = strTointArray(br.readLine()); static int[] strToIntArray(String S) { String[] strArray = S.split(" "); int[] intArray = new int[strArray.length]; for (int i = 0; i < strArray.length; i++) { intArray[i] = Integer.parseInt(strArray[i]); } return intArray; } }
Main.java:7: error: class B is public, should be declared in a file named B.java public class B { ^ 1 error
s149970997
p04045
C++
#include <bits/stdc++.h> #include <atcoder/scc> using namespace atcoder; using namespace std; using lint = long long int; using ulint = unsigned long long int; using pint = pair<int, int>; using plint = pair<lint, lint>; struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_; #define ALL(x) (x).begin(), (x).end() #define SZ(x) ((lint)(x).size()) #define POW2(n) (1LL << (n)) #define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++) #define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--) #define REP(i, n) FOR(i,0,n) #define IREP(i, n) IFOR(i,0,n) template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; } template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; } template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; } template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; } template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; } template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; } template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; } template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; } template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; } template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; } template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); } template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) { vec.resize(len); for (auto &v : vec) ndarray(v, args...); } template<typename T> bool mjjj(T &m, const T q) { if (m < q) {m = q; return true;} else return false; } template<typename T> bool mmin(T &m, const T q) { if (m > q) {m = q; return true;} else return false; } template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first + r.first, l.second + r.second); } template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first - r.first, l.second - r.second); } #define dbg(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ") " << __FILE__ << endl; /* #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/tag_and_trait.hpp> using namespace __gnu_pbds; // find_by_order(), order_of_key() template<typename TK> using pbds_set = tree<TK, null_type, less<TK>, rb_tree_tag, tree_order_statistics_node_update>; template<typename TK, typename TV> using pbds_map = tree<TK, TV, less<TK>, rb_tree_tag, tree_order_statistics_node_update>; */ template< typename T > struct edge { int src, to; T cost; //edge(int to) : src(-1),to(to),cost(-1){} edge(int to, T cost) : src(-1), to(to), cost(cost) {} edge(int src, int to, T cost) : src(src), to(to), cost(cost) {} edge &operator=(const int &x) { to = x; return *this; } operator int() const { return to; } }; template< typename T > using Edges = vector< edge< T > >; template< typename T > using WeightedGraph = vector< Edges< T > >; using UnWeightedGraph = vector< vector< lint > >; template< typename T > using Matrix = vector< vector< T > >; #define INF 1e+9 #define MAX_V 100000 // <最短距離, 頂点の番号> using P = pair<lint, lint>; lint V; vector<edge<lint>> G[MAX_V]; lint d[MAX_V]; // void dijkstra(lint s) { // priority_queue<P, vector<P>, greater<P> > que; // fill(d, d+V, INF); // d[s] = 0; // que.push(P(0, s)); // while (!que.empty()) { // P p = que.top(); // que.pop(); // lint v = p.second; // if (d[v] < p.first) continue; // for (lint i=0; i<G[v].size(); ++i) { // edge<lint> e = G[v][i]; // if (d[e.to] > d[v] + e.cost) { // d[e.to] = d[v] + e.cost; // que.push(P(d[e.to], e.to)); // } // } // } // } const lint mod = 1000000007; struct mint { lint x; // typedef long long lint; mint(lint x=0):x((x%mod+mod)%mod){} mint& operator+=(const mint a) { if ((x += a.x) >= mod) x -= mod; return *this; } mint& operator-=(const mint a) { if ((x += mod-a.x) >= mod) x -= mod; return *this; } mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; } mint operator+(const mint a) const { mint res(*this); return res+=a; } mint operator-(const mint a) const { mint res(*this); return res-=a; } mint operator*(const mint a) const { mint res(*this); return res*=a; } mint pow(lint t) const { if (!t) return 1; mint a = pow(t>>1); a *= a; if (t&1) a *= *this; return a; } // for prime mod mint inv() const { return pow(mod-2); } mint& operator/=(const mint a) { return (*this) *= a.inv(); } mint operator/(const mint a) const { mint res(*this); return res/=a; } }; map< lint, lint > prime_factor(lint n) { map< lint, lint > ret; for(lint i = 2; i * i <= n; i++) { while(n % i == 0) { ret[i]++; n /= i; } } if(n != 1) ret[n] = 1; return ret; } lint MAX = 1000000000; vector<lint> co; bool dfs(lint from,lint to,lint par = -1){ if(from == to){ return true; } for(edge<lint> v : G[from]){ if(v.to == par)continue; if(dfs(v.to,to,from)){ co.push_back(v.cost); return true; } } return false; } lint digit(lint a,lint b){ lint ad = 1,bd = 1; while(a > 9){ ad++; a /= 10; } while(b > 9){ bd++; b /= 10; } return max(ad,bd); } int main(){ lint n,k; cin >> n >> k; vector<lint> d(k,0); lint ans = n; cin >> d; while(true) { bool flag = true; string ns = to_string(ans); for(int i = 0;i < k;i++){ if(ns.find(to_string(d[i])) != string::npos){ ans++; flag = false; break; } } if(flag){ break; } } cout << ans; } lint gcd(lint a, lint b) { if (a < b) { a ^= b; b ^= a; a ^= b; } return b ? gcd(b, a % b) : a; } lint lcm(lint a, lint b) { return a * b / gcd(a, b); }
a.cc:2:10: fatal error: atcoder/scc: No such file or directory 2 | #include <atcoder/scc> | ^~~~~~~~~~~~~ compilation terminated.
s988643664
p04045
C++
#include<iostream> #include<stdio.h> //#include <bits/stdc++.h> #include<vector> #include<float.h> #include<iomanip> #include<algorithm> #include<string> #include<cstring> #include<math.h> #include<cmath> #include<sstream> #include<set> #include<map> #include<queue> #include<cassert> #include<cmath> #include<cstdint> #define INF 1e9 #define LINF 1e19 #define rep(i,n)for(int i=0;(i)<(int)(n);i++) #define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++) #define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i; #define vec(type,n) vector<type>(n) #define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n)) #define ALL(a) (a).begin(),(a).end() #define chmin(a, b) a = min(a, b) #define chmax(a, b) a = max(a, b) #define pb push_back #define sz size() using namespace std; using ll = long long; using Graph = vector<vector<int>>; using P = pair<ll, ll>; const ll MOD = 1e9 + 7; const ll ZER = 0; int d[3] = {-1, 0, 1}; int main(){ string s; int k; cin >> s >> k; bool f = false; vector<int> d(10, 0); char mi = '', ma; rep(i, k){ int a; cin >> a; d[a] = 1; } rep(i, 10){ if(d[i])continue; if(mi == '')mi = (char)(i + '0'); ma = (char)(i + '0'); } string t = ""; if(s[0] > ma){ rep(i, s.sz + 1)cout << mi; cout << endl; return 0; } rep(i, s.sz){ int si = s[i] - '0'; if(f){ t += mi; continue; } rep(j, 10){ if(d[j])continue; if(si == j){ t += (char)(j + '0'); break; } if(si < j){ f = true; t += (char)(j + '0'); break; } } } cout << t << endl; }
a.cc:51:15: error: empty character constant 51 | char mi = '', ma; | ^~ a.cc:59:18: error: empty character constant 59 | if(mi == '')mi = (char)(i + '0'); | ^~
s861338269
p04045
C++
#include <bits/stdc++.h> #define ll long long using namespace std; string to_string(int i){ string S; while(i){ int d = i%10; i /= 10; S += d+'0'; } reverse(S.begin(), S.end()); return S; } int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int N, K; cin >> N >> K; vector<char> D; int ar[10]; memset(ar, 0, sizeof(ar)); for (int i = 0; i < K; i++){ int A; cin >> A; ar[A]++; } int Ans; for (int i = 0; i <=9; i++) if (ar[i] == 0) D.push_back(i+'0'); for (int i = N; ; i++){ string S = to_string(i); bool use = true; for (int j = 0; j < S.size(); j++){ bool ok = false; for (int k = 0; k < D.size(); k++){ if (D[k] == S[j]) ok = true; } if (ok == false) use = false; } if (use){ Ans = i; break; } } cout << Ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:32:25: error: call of overloaded 'to_string(int&)' is ambiguous 32 | string S = to_string(i); | ~~~~~~~~~^~~ a.cc:4:8: note: candidate: 'std::string to_string(int)' 4 | string to_string(int i){ | ^~~~~~~~~ In file included from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52, from a.cc:1: /usr/include/c++/14/bits/basic_string.h:4240:3: note: candidate: 'std::string std::__cxx11::to_string(int)' 4240 | to_string(int __val) | ^~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4259:3: note: candidate: 'std::string std::__cxx11::to_string(unsigned int)' 4259 | to_string(unsigned __val) | ^~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4275:3: note: candidate: 'std::string std::__cxx11::to_string(long int)' 4275 | to_string(long __val) | ^~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4294:3: note: candidate: 'std::string std::__cxx11::to_string(long unsigned int)' 4294 | to_string(unsigned long __val) | ^~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4310:3: note: candidate: 'std::string std::__cxx11::to_string(long long int)' 4310 | to_string(long long __val) | ^~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4327:3: note: candidate: 'std::string std::__cxx11::to_string(long long unsigned int)' 4327 | to_string(unsigned long long __val) | ^~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4401:3: note: candidate: 'std::string std::__cxx11::to_string(float)' 4401 | to_string(float __val) | ^~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4411:3: note: candidate: 'std::string std::__cxx11::to_string(double)' 4411 | to_string(double __val) | ^~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4421:3: note: candidate: 'std::string std::__cxx11::to_string(long double)' 4421 | to_string(long double __val) | ^~~~~~~~~
s653443172
p04045
C++
class Solution{ public: int handMoney(int N, const vector<bool>& dislikes){ int smallestlike = 0; for(;dislikes[smallestlike];smallestlike ++); vector<int> num; while(N) num.push_back(N % 10), N /= 10; int carry = 0; for(int i = 0; i < num.size(); i ++){ int d = num[i] + carry; for(; d < 10; d ++) if(!dislikes[d]) break; if(d != 10){ if(d > num[i]) for(int j = 0; j < i; j ++) num[j] = smallestlike; num[i] = d, carry = 0; } else num[i] = smallestlike, carry = 1; } if(carry) num.push_back(1); int res = 0; for(int i = num.size() - 1; i >= 0; i --) res = res * 10 + num[i]; return res; } };
a.cc:4:32: error: 'vector' does not name a type 4 | int handMoney(int N, const vector<bool>& dislikes){ | ^~~~~~ a.cc:4:38: error: expected ',' or '...' before '<' token 4 | int handMoney(int N, const vector<bool>& dislikes){ | ^ a.cc: In member function 'int Solution::handMoney(int, int)': a.cc:7:14: error: 'dislikes' was not declared in this scope 7 | for(;dislikes[smallestlike];smallestlike ++); | ^~~~~~~~ a.cc:9:9: error: 'vector' was not declared in this scope 9 | vector<int> num; | ^~~~~~ a.cc:9:16: error: expected primary-expression before 'int' 9 | vector<int> num; | ^~~ a.cc:10:18: error: 'num' was not declared in this scope; did you mean 'enum'? 10 | while(N) num.push_back(N % 10), N /= 10; | ^~~ | enum a.cc:13:28: error: 'num' was not declared in this scope; did you mean 'enum'? 13 | for(int i = 0; i < num.size(); i ++){ | ^~~ | enum a.cc:16:21: error: 'dislikes' was not declared in this scope 16 | if(!dislikes[d]) break; | ^~~~~~~~ a.cc:24:19: error: 'num' was not declared in this scope; did you mean 'enum'? 24 | if(carry) num.push_back(1); | ^~~ | enum a.cc:27:21: error: 'num' was not declared in this scope; did you mean 'enum'? 27 | for(int i = num.size() - 1; i >= 0; i --) | ^~~ | enum
s882670977
p04045
Java
import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Scanner; public class MainC { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int cost = scanner.nextInt(); int numDigits = scanner.nextInt(); boolean[] badDigits = new boolean[10]; for (int i=0; i<numDigits; i++) { int badDigit = scanner.nextInt(); badDigits[badDigit] = true; } // we can have possible change of 1 to 100,000 // In case we can't pay the initial amount with x digits we pad one more digit. for (int change=cost; change<100000; change++) { // give up on change amount if she hates a digit int currChange = change; while (currChange > 0) { int currDigit = currChange % 10; if (badDigits[currDigit]) break; else { currChange /= 10; } } // currChange = 0 OR we had a bad digit if (currChange == 0) { System.out.println(change); break; } } scanner.close(); } }
Main.java:6: error: class MainC is public, should be declared in a file named MainC.java public class MainC { ^ 1 error
s702820029
p04045
C++
#include <iostream> using namespace std; int invalidDigit[10]; int res = 1 << 30; int n; void findMinNumber(int now) { if (now >= n) { res = fminl(now, res); return; } for (int i = 0; i < 10; i++) { if (!invalidDigit[i]) { if (now == 0 && i == 0) { continue; } findMinNumber(10 * now + i); } } } int main() { int k; cin >> n >> k; for (int i = 0; i < k; i++) { int x; cin >> x; invalidDigit[x] = true; } findMinNumber(0); cout << res; return 0; }
a.cc: In function 'void findMinNumber(int)': a.cc:13:23: error: 'fminl' was not declared in this scope 13 | res = fminl(now, res); | ^~~~~
s597335831
p04045
C++
#include <iostream> #include <vector> #include <math.h> using namespace std; vector<int > leftRange; vector<int > GetNumberInDigits(int n) { vector<int > res; while (n) { int d = n % 10; res.push_back(d); n /= 10; } reverse(res.begin(), res.end()); return res; } bool IsNumberPresentInArray(int n, vector<int > digits) { for (int i = 0; i < (int)digits.size(); i++) { if (n == digits[i]) { return true; } } return false; } vector<int> FindFirstInvalidIndex(vector<int > number, vector<int > invalidDigits) { vector<int > res; for (int i = 0; i < (int)number.size(); i++) { if (IsNumberPresentInArray(number[i], invalidDigits)) { res.push_back(i); } } return res; } int ConvertArrayToNumber(vector<int > number) { int res = 0; for (int i = 0; i < (int)number.size(); i++) { res = res * 10 + number[i]; } return res; } int FindNextDigit(int n, vector<int > invalidDigits) { while (true) { if (n > 9) n = 0; bool isValid = true; for (int i = 0; i < (int)invalidDigits.size(); i++) { if (invalidDigits[i] == n) { n++; isValid = false; break; } } if (isValid) return n; } } int FindNextMinDigit(int n, vector<int > invalidDigits) { for (int j = 0; j <= 9; j++) { if (!IsNumberPresentInArray(j, invalidDigits)) { return j; } } } void ProcessRightRange(vector<int > &number, int index, vector<int > invalidDigits) { for (int i = index; i < (int)number.size(); i++) { number[i] = FindNextMinDigit(number[i], invalidDigits); } } void ProcessLeftRange(vector<int > number, int index, vector<int > invalidDigits, int nextSum) { if (index < 0) { leftRange.push_back(nextSum); return; } number[index] += nextSum; int nextDigit = FindNextDigit(number[index], invalidDigits); leftRange.push_back(nextDigit); if (nextDigit < number[index]) { ProcessLeftRange(number, index - 1, invalidDigits, 1); } else { ProcessLeftRange(number, index - 1, invalidDigits, 0); } } int GetNextLargerNumber(vector<int > number, vector<int > invalidDigits) { int res = INT_MAX; vector<int > indexes = FindFirstInvalidIndex(number, invalidDigits); if (indexes.size() == 0) { return ConvertArrayToNumber(number); } for (int i = 0; i < indexes.size(); i++) { ProcessRightRange(number, indexes[i] + 1, invalidDigits); ProcessLeftRange(number, indexes[i], invalidDigits, 0); reverse(leftRange.begin(), leftRange.end()); for (int j = indexes[i] + 1; j < number.size(); j++) { leftRange.push_back(number[j]); } res = fminl(res, ConvertArrayToNumber(leftRange)); leftRange.clear(); } return res; } int main() { /*freopen("input.txt", "r", stdin);*/ //freopen("output.txt", "w", stdout); int n, k; cin >> n >> k; vector<int > a(k); for (auto &it : a) cin >> it; vector<int > numberDigits = GetNumberInDigits(n); int res = GetNextLargerNumber(numberDigits, a); cout << res << endl; return 0; }
a.cc: In function 'std::vector<int> GetNumberInDigits(int)': a.cc:18:9: error: 'reverse' was not declared in this scope 18 | reverse(res.begin(), res.end()); | ^~~~~~~ a.cc: In function 'int GetNextLargerNumber(std::vector<int>, std::vector<int>)': a.cc:123:19: error: 'INT_MAX' was not declared in this scope 123 | int res = INT_MAX; | ^~~~~~~ a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 3 | #include <math.h> +++ |+#include <climits> 4 | a.cc:135:17: error: 'reverse' was not declared in this scope 135 | reverse(leftRange.begin(), leftRange.end()); | ^~~~~~~ a.cc: In function 'int FindNextMinDigit(int, std::vector<int>)': a.cc:89:1: warning: control reaches end of non-void function [-Wreturn-type] 89 | } | ^
s944888637
p04045
C++
#include <iostream> #include <vector> #include <math.h> using namespace std; vector<int > leftRange; vector<int > GetNumberInDigits(int n) { vector<int > res; while (n) { int d = n % 10; res.push_back(d); n /= 10; } reverse(res.begin(), res.end()); return res; } bool IsNumberPresentInArray(int n, vector<int > digits) { for (int i = 0; i < (int)digits.size(); i++) { if (n == digits[i]) { return true; } } return false; } vector<int> FindFirstInvalidIndex(vector<int > number, vector<int > invalidDigits) { vector<int > res; for (int i = 0; i < (int)number.size(); i++) { if (IsNumberPresentInArray(number[i], invalidDigits)) { res.push_back(i); } } return res; } int ConvertArrayToNumber(vector<int > number) { int res = 0; for (int i = 0; i < (int)number.size(); i++) { res = res * 10 + number[i]; } return res; } int FindNextDigit(int n, vector<int > invalidDigits) { while (true) { if (n > 9) n = 0; bool isValid = true; for (int i = 0; i < (int)invalidDigits.size(); i++) { if (invalidDigits[i] == n) { n++; isValid = false; break; } } if (isValid) return n; } } int FindNextMinDigit(int n, vector<int > invalidDigits) { for (int j = 0; j <= 9; j++) { if (!IsNumberPresentInArray(j, invalidDigits)) { return j; } } } void ProcessRightRange(vector<int > &number, int index, vector<int > invalidDigits) { for (int i = index; i < (int)number.size(); i++) { number[i] = FindNextMinDigit(number[i], invalidDigits); } } void ProcessLeftRange(vector<int > number, int index, vector<int > invalidDigits, int nextSum) { if (index < 0) { leftRange.push_back(nextSum); return; } number[index] += nextSum; int nextDigit = FindNextDigit(number[index], invalidDigits); leftRange.push_back(nextDigit); if (nextDigit < number[index]) { ProcessLeftRange(number, index - 1, invalidDigits, 1); } else { ProcessLeftRange(number, index - 1, invalidDigits, 0); } } int GetNextLargerNumber(vector<int > number, vector<int > invalidDigits) { int res = INT_MAX; vector<int > indexes = FindFirstInvalidIndex(number, invalidDigits); if (indexes.size() == 0) { return ConvertArrayToNumber(number); } for (int i = 0; i < indexes.size(); i++) { ProcessRightRange(number, indexes[i] + 1, invalidDigits); ProcessLeftRange(number, indexes[i], invalidDigits, 0); reverse(leftRange.begin(), leftRange.end()); for (int j = indexes[i] + 1; j < number.size(); j++) { leftRange.push_back(number[j]); } res = fminl(res, ConvertArrayToNumber(leftRange)); leftRange.clear(); } return res; } int main() { /*freopen("input.txt", "r", stdin);*/ freopen("output.txt", "w", stdout); int n, k; cin >> n >> k; vector<int > a(k); for (auto &it : a) cin >> it; vector<int > numberDigits = GetNumberInDigits(n); int res = GetNextLargerNumber(numberDigits, a); cout << res << endl; return 0; }
a.cc: In function 'std::vector<int> GetNumberInDigits(int)': a.cc:18:9: error: 'reverse' was not declared in this scope 18 | reverse(res.begin(), res.end()); | ^~~~~~~ a.cc: In function 'int GetNextLargerNumber(std::vector<int>, std::vector<int>)': a.cc:123:19: error: 'INT_MAX' was not declared in this scope 123 | int res = INT_MAX; | ^~~~~~~ a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 3 | #include <math.h> +++ |+#include <climits> 4 | a.cc:135:17: error: 'reverse' was not declared in this scope 135 | reverse(leftRange.begin(), leftRange.end()); | ^~~~~~~ a.cc: In function 'int FindNextMinDigit(int, std::vector<int>)': a.cc:89:1: warning: control reaches end of non-void function [-Wreturn-type] 89 | } | ^
s053565694
p04045
C++
#include <iostream> #include <vector> using namespace std; vector<int > leftRange; vector<int > GetNumberInDigits(int n) { vector<int > res; while (n) { int d = n % 10; res.push_back(d); n /= 10; } reverse(res.begin(), res.end()); return res; } bool IsNumberPresentInArray(int n, vector<int > digits) { for (int i = 0; i < (int)digits.size(); i++) { if (n == digits[i]) { return true; } } return false; } int FindFirstInvalidIndex(vector<int > number, vector<int > invalidDigits) { for (int i = 0; i < (int)number.size(); i++) { if (IsNumberPresentInArray(number[i], invalidDigits)) { return i; } } return number.size(); } int ConvertArrayToNumber(vector<int > number) { int res = 0; for (int i = 0; i < (int)number.size(); i++) { res = res * 10 + number[i]; } return res; } int FindNextDigit(int n, vector<int > invalidDigits) { while (true) { if (n > 9) n = 0; bool isValid = true; for (int i = 0; i < (int)invalidDigits.size(); i++) { if (invalidDigits[i] == n) { n++; isValid = false; break; } } if (isValid) return n; } } int FindNextMinDigit(int n, vector<int > invalidDigits) { for (int j = 0; j <= 9; j++) { if (!IsNumberPresentInArray(j, invalidDigits)) { return j; } } } void ProcessRightRange(vector<int > &number, int index, vector<int > invalidDigits) { for (int i = index; i < (int)number.size(); i++) { number[i] = FindNextMinDigit(number[i], invalidDigits); } } void ProcessLeftRange(vector<int > number, int index, vector<int > invalidDigits, int nextSum) { if (index < 0) { leftRange.push_back(nextSum); return; } number[index] += nextSum; int nextDigit = FindNextDigit(number[index], invalidDigits); leftRange.push_back(nextDigit); if (nextDigit < number[index]) { ProcessLeftRange(number, index - 1, invalidDigits, 1); } else { ProcessLeftRange(number, index - 1, invalidDigits, 0); } } int GetNextLargerNumber(vector<int > number, vector<int > invalidDigits) { int index = FindFirstInvalidIndex(number, invalidDigits); if (index == number.size()) { return ConvertArrayToNumber(number); } ProcessRightRange(number, index + 1, invalidDigits); ProcessLeftRange(number, index, invalidDigits, 0); reverse(leftRange.begin(), leftRange.end()); for (int i = index + 1; i < number.size(); i++) { leftRange.push_back(number[i]); } return ConvertArrayToNumber(leftRange); } int main() { /*freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);*/ int n, k; cin >> n >> k; vector<int > a(k); for (auto &it : a) cin >> it; /*for (int i = 0; i <= 10000; i++) { vector<int > numberDigits = GetNumberInDigits(i); int res = GetNextLargerNumber(numberDigits, a); cout << res << endl; leftRange.clear(); }*/ vector<int > numberDigits = GetNumberInDigits(n); int res = GetNextLargerNumber(numberDigits, a); cout << res << endl; return 0; }
a.cc: In function 'std::vector<int> GetNumberInDigits(int)': a.cc:17:9: error: 'reverse' was not declared in this scope 17 | reverse(res.begin(), res.end()); | ^~~~~~~ a.cc: In function 'int GetNextLargerNumber(std::vector<int>, std::vector<int>)': a.cc:131:9: error: 'reverse' was not declared in this scope 131 | reverse(leftRange.begin(), leftRange.end()); | ^~~~~~~ a.cc: In function 'int FindNextMinDigit(int, std::vector<int>)': a.cc:88:1: warning: control reaches end of non-void function [-Wreturn-type] 88 | } | ^
s124744819
p04045
C++
#include<bits/stdc++.h> #define ll long long using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(NULL); int n,k; cin>>n>>k; int d[10]; memset(d,0,sizeof(d)); for(int i=0;i<k;i++) { int x; cin>>x; d[x]=1; } for(int i=n;i<=10000;i++) { bool p=true; int a[10]; memset(a,0,sizeof(a)); while(i>0) { int t=i%10; i/=10; a[t]++; } for(int j=0;j<=9;j++) { if(t[i]>0 && d[i]>0) { p=false; break; } } if(p) { cout<<i; break; } } return 0; }
a.cc: In function 'int main()': a.cc:31:16: error: 't' was not declared in this scope 31 | if(t[i]>0 && d[i]>0) | ^
s755357554
p04045
C
#include<stdio.h> int search(int d,int arr,int k){ int i,flag=0; for(i=0;i<k;i++){ if(d==arr[i]){ flag=1; break; } } return flag; } int main(){ int n,k; scanf("%d %d\n",&n,&k); int m=1,d,i; int arr[k]; for(i=0;i<k;i++){ scanf("%d ",&arr[i]); } while(m!=0){ while(n!=0){ d=n%10; m= search(d,arr,k); if(m==1) {break;} n= n/10; } n++; } printf("%d\n",n); return 0; }
main.c: In function 'search': main.c:5:14: error: subscripted value is neither array nor pointer nor vector 5 | if(d==arr[i]){ | ^ main.c: In function 'main': main.c:23:19: error: passing argument 2 of 'search' makes integer from pointer without a cast [-Wint-conversion] 23 | m= search(d,arr,k); | ^~~ | | | int * main.c:2:22: note: expected 'int' but argument is of type 'int *' 2 | int search(int d,int arr,int k){ | ~~~~^~~
s818912413
p04045
C++
#include<bits/stdc++.h> using namespace std; int main(){ string s; cin>>s; int k; cin>>k; bool n[10]; int index; for(int i=0;i<k;i++){ cin>>index; n[index]=true; } int min; for(index =0;index<10;index++){ if(n[index]==false){ min = index; break; } } for(int i=0;i<n.length();i++){ if(n[s[i]]==true){ n[s[i]]=index; } } cout<<s; }
a.cc: In function 'int main()': a.cc:21:25: error: request for member 'length' in 'n', which is of non-class type 'bool [10]' 21 | for(int i=0;i<n.length();i++){ | ^~~~~~
s119544285
p04045
C++
#include<bits/stdc++.h> using namespace std; int main(){ string n; cin>>n; int k; cin>>k; bool n[10]; int index; for(int i=0;i<k;i++){ cin>>index; n[index]=true; } int min; for(index =0;index<10;index++){ if(n[index]==false){ min = index; break; } } for(int i=0;i<n.length();i++){ if(n[s[i]]==true){ n[s[i]]=index; } } cout<<s; }
a.cc: In function 'int main()': a.cc:8:14: error: conflicting declaration 'bool n [10]' 8 | bool n[10]; | ^ a.cc:4:16: note: previous declaration as 'std::string n' 4 | string n; | ^ a.cc:22:14: error: 's' was not declared in this scope 22 | if(n[s[i]]==true){ | ^ a.cc:26:9: error: 's' was not declared in this scope 26 | cout<<s; | ^
s018873948
p04045
C
#include <stdio.h> int main(void){ int N,K,i,k,l; int j=0,flag=0; scanf("%d %d",&N,&K); int A[K]; for(i=0;i<K;i++){ scanf("%d",&A[i]); } int D[5]; for(i=N;i<10000;i++){ num=i; while(num){ dig = num % 10; D[j]=dig; num = num / 10; j++; } j=0; for(k=0;k<K;k++){ for(l=0;l<5;l++){ if(A[k]==D[l])flag=1; } } if(flag==0)break; } printf("%d\n",i); return 0; }
main.c: In function 'main': main.c:14:9: error: 'num' undeclared (first use in this function) 14 | num=i; | ^~~ main.c:14:9: note: each undeclared identifier is reported only once for each function it appears in main.c:16:17: error: 'dig' undeclared (first use in this function) 16 | dig = num % 10; | ^~~