submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s171182960
p00005
C++
#include <iostream> #include <algorithm> using namespace std; int GCD(int& a, int& b) { if (b == 0) { return a; } return GCD(b, a%b); } int main() { int gcd; for (int a, b; cin >> a >> b;) { gcd = GCD(a, b); cout << gcd << " " << a * b / gcd << endl; } return 0; }
a.cc: In function 'int GCD(int&, int&)': a.cc:10:24: error: cannot bind non-const lvalue reference of type 'int&' to an rvalue of type 'int' 10 | return GCD(b, a%b); | ~^~ a.cc:6:22: note: initializing argument 2 of 'int GCD(int&, int&)' 6 | int GCD(int& a, int& b) { | ~~~~~^
s648773363
p00005
C++
include <iostream> #include <vector> #include <math.h> #include <string> int main(void); unsigned int gcd(unsigned int x, unsigned int y); unsigned int lcm(unsigned int x, unsigned int y); int main(){ int dataset_count = 0; unsigned int first_num = 0; unsigned int second_num = 0; std::vector<unsigned int> first_num_vector; std::vector<unsigned int> second_num_vector; while (dataset_count < 2){ std::cin >> first_num >> second_num; //while ((std::cin >> first_num >> second_num) || (dataset_count < 50)){ dataset_count++; first_num_vector.push_back(first_num); second_num_vector.push_back(second_num); } for (int i = 0; i < first_num_vector.size(); i++){ std::cout << gcd(first_num_vector[i], second_num_vector[i]) << " " << lcm(first_num_vector[i], second_num_vector[i]) << std::endl; } while (1); return 0; } // 最大公約数を求める関数 unsigned int gcd(unsigned int x, unsigned int y) { unsigned int r; if (x == 0 || y == 0) // 引数チェック { return 0; } // ユーグリッドの互除法 while ((r = x % y) != 0) // yで割り切れるまでループ { x = y; y = r; } return y; } // 最小公倍数を求める関数 unsigned int lcm(unsigned int x, unsigned int y) { unsigned int rtn; if (x == 0 || y == 0) // 引数チェック { return 0; } rtn = (x / gcd(x, y)) * (y / gcd(x, y)); return rtn * gcd(x, y); }
a.cc:1:1: error: 'include' does not name a type 1 | include <iostream> | ^~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/vector:62, from a.cc:2: /usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity 164 | __is_null_pointer(std::nullptr_t) | ^ /usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)' 159 | __is_null_pointer(_Type) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std' 164 | __is_null_pointer(std::nullptr_t) | ^~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/type_traits:295:27: error: 'size_t' has not been declared 295 | template <typename _Tp, size_t = sizeof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std' 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:984:26: error: 'size_t' has not been declared 984 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std' 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std' 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std' 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std' 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1451:32: error: 'size_t' was not declared in this scope 1451 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 63 | #include <bits/version.h> +++ |+#include <cstddef> 64 | /usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid 1451 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared 1453 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope 1454 | struct extent<_Tp[_Size], 0> | ^~~~~ /usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid 1454 | struct extent<_Tp[_Size], 0> | ^ /usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~ /usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid 1455 | : public integral_constant<size_t, _Size> { }; | ^ /usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid /usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared 1457 | template<typename _Tp, unsigned _Uint, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope 1458 | struct extent<_Tp[_Size], _Uint> | ^~~~~ /usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid 1458 | struct extent<_Tp[_Size], _Uint> | ^ /usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope 1463 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid 1463 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type 1857 | { static constexpr size_t __size = sizeof(_Tp); }; | ^~~~~~ /usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~~~~ /usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~ /usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp' 1860 | struct __select; | ^~~~~~~~ /usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared 1862 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^~~ /usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^ /usr/include/c++/14/type_traits:1866:14: error: 'size_t' has not been declared 1866 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1867:23: error: '_Sz' was not declared in this scope 1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false> | ^~~ /usr/include/c++/14/type_traits:1867:58: error: template argument 1 is invalid 1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false> |
s218084975
p00005
C++
#include<iostream> #include<algorithm> #define LL long long int main() { LL a, b; while (std::cin >> a >> b) { LL gcd = __gcd(a, b); std::cout << __gcd(a,b) << " " << (a*b) / gcd << std::endl; } return 0; }
a.cc: In function 'int main()': a.cc:7:26: error: '__gcd' was not declared in this scope; did you mean 'std::__gcd'? 7 | LL gcd = __gcd(a, b); | ^~~~~ | std::__gcd In file included from /usr/include/c++/14/algorithm:61, from a.cc:2: /usr/include/c++/14/bits/stl_algo.h:1137:5: note: 'std::__gcd' declared here 1137 | __gcd(_EuclideanRingElement __m, _EuclideanRingElement __n) | ^~~~~
s646259888
p00005
C++
#include <iostream> using namespace std;#include <iostream> #include <cstdio> using namespace std; long long gcd(long long a, long long b){ long long x,r; if(a < b){ x = a; a = b; b = x; } for(x = 0; b != 0; x++){ r = a%b; a = b; b = r; } return a; } int main(void){ long long a, b; while(cin >> a >> b){ long long lcm = a*b/gcd(a,b); cout << gcd(a,b) << " " << lcm << endl; } return 0; }
a.cc:2:21: error: stray '#' in program 2 | using namespace std;#include <iostream> | ^ a.cc:2:22: error: 'include' does not name a type 2 | using namespace std;#include <iostream> | ^~~~~~~
s740660576
p00005
C++
#include <stdio.h> int gcd( int a, int b ) { int temp; if( a < b ) { temp = a; a = b; b = temp; } if( b < 1 ) return -1; if( a % b == 0 ) return b; return gcd( b, a % b ); } int main(){ int a,b; whie(scanf("%d%d",&a,&b) != EOF){ int g=gcd(a,b); printf("%d %d\n",g,a/g*b); } return 0; }
a.cc: In function 'int main()': a.cc:17:3: error: 'whie' was not declared in this scope 17 | whie(scanf("%d%d",&a,&b) != EOF){ | ^~~~
s675770040
p00005
C++
#include <iostream> #include <cstdio> using namespace std; int gcd(int a, int b) { int p,q,r; if(a>b){p=b;b=a;a=p;} while(r!=0){ q=b/a; r=b%a; b=a; a=r; } return b; } int main(void){ longint a, b; while(cin >> a >> b) { int lcm = a/gcd(a,b)*b; cout << gcd(a,b) << " " << lcm << endl; } return 0; }
a.cc: In function 'int main()': a.cc:19:5: error: 'longint' was not declared in this scope; did you mean 'long'? 19 | longint a, b; | ^~~~~~~ | long a.cc:20:18: error: 'a' was not declared in this scope 20 | while(cin >> a >> b) { | ^ a.cc:20:23: error: 'b' was not declared in this scope 20 | while(cin >> a >> b) { | ^
s186557145
p00005
C++
#include <iostream> #include <cstdio> using namespace std; int gcd(int a, int b) { longint p,q,r; if(a>b){p=b;b=a;a=p;} while(r!=0){ q=b/a; r=b%a; b=a; a=r; } return b; } int main(void){ longint a, b; while(cin >> a >> b) { int lcm = a/gcd(a,b)*b; cout << gcd(a,b) << " " << lcm << endl; } return 0; }
a.cc: In function 'int gcd(int, int)': a.cc:7:9: error: 'longint' was not declared in this scope; did you mean 'long'? 7 | longint p,q,r; | ^~~~~~~ | long a.cc:8:17: error: 'p' was not declared in this scope 8 | if(a>b){p=b;b=a;a=p;} | ^ a.cc:9:15: error: 'r' was not declared in this scope 9 | while(r!=0){ | ^ a.cc:10:9: error: 'q' was not declared in this scope 10 | q=b/a; | ^ a.cc: In function 'int main()': a.cc:19:5: error: 'longint' was not declared in this scope; did you mean 'long'? 19 | longint a, b; | ^~~~~~~ | long a.cc:20:18: error: 'a' was not declared in this scope 20 | while(cin >> a >> b) { | ^ a.cc:20:23: error: 'b' was not declared in this scope 20 | while(cin >> a >> b) { | ^
s489090534
p00005
C++
#include <iostream> #include <cstdio> using namespace std; int gcd(int a, int b) { longint p,q,r; if(a>b){p=b;b=a;a=p;} while(r!=0){ q=b/a; r=b%a; b=a; a=r; } return b; } int main(void){ longint a, b; while(cin >> a >> b) { longint lcm = a/gcd(a,b)*b; cout << gcd(a,b) << " " << lcm << endl; } return 0; }
a.cc: In function 'int gcd(int, int)': a.cc:7:9: error: 'longint' was not declared in this scope; did you mean 'long'? 7 | longint p,q,r; | ^~~~~~~ | long a.cc:8:17: error: 'p' was not declared in this scope 8 | if(a>b){p=b;b=a;a=p;} | ^ a.cc:9:15: error: 'r' was not declared in this scope 9 | while(r!=0){ | ^ a.cc:10:9: error: 'q' was not declared in this scope 10 | q=b/a; | ^ a.cc: In function 'int main()': a.cc:19:5: error: 'longint' was not declared in this scope; did you mean 'long'? 19 | longint a, b; | ^~~~~~~ | long a.cc:20:18: error: 'a' was not declared in this scope 20 | while(cin >> a >> b) { | ^ a.cc:20:23: error: 'b' was not declared in this scope 20 | while(cin >> a >> b) { | ^ a.cc:21:14: error: expected ';' before 'lcm' 21 | longint lcm = a/gcd(a,b)*b; | ^~~~ | ; a.cc:22:34: error: 'lcm' was not declared in this scope 22 | cout << gcd(a,b) << " " << lcm << endl; | ^~~
s639052386
p00005
C++
#include <iostream> #include <cstdio> using namespace std; int gcd(int a, int b) { r = a % b; while(r!=0){ a = b; b = r; r = a % b; } } int main(void){ int a, b, tmp; if (a < b){ tmp = b; b = a; a = tmp; } (cin >> a >> b); int lcm = b * a / gcd(a,b); cout << gcd(a,b) << " " << lcm << endl; return 0; }
a.cc: In function 'int gcd(int, int)': a.cc:6:3: error: 'r' was not declared in this scope 6 | r = a % b; | ^ a.cc:13:1: warning: no return statement in function returning non-void [-Wreturn-type] 13 | } | ^
s055431300
p00005
C++
#include <iostream> #include <cstdio> using namespace std; int gcd(int a, int b) { for (int i = a; i >= 1; i--) if(a % i == 0) if(b % i == 0) return i; int main(void){ int a, b; while(cin >> a >> b) { int lcm = a / gcd(a,b) * b; cout << gcd(a,b) << " " << lcm << endl; } return 0; }
a.cc: In function 'int gcd(int, int)': a.cc:14:15: error: a function-definition is not allowed here before '{' token 14 | int main(void){ | ^ a.cc:21:2: error: expected '}' at end of input 21 | } | ^ a.cc:5:23: note: to match this '{' 5 | int gcd(int a, int b) { | ^ a.cc:21:2: warning: control reaches end of non-void function [-Wreturn-type] 21 | } | ^
s015133881
p00005
C++
#include <iostream> #include <stdio.h> int gcd( int a, int b ) { int temp; if( a < b ) { temp = a; a = b; b = temp; } if( b < 1 ) return -1; if( a % b == 0 ) return b; return gcd( b, a % b ); } int main(){ int a,b; while(1){ cin >> a >> b; if(cin.eof()) break; int g=gcd(a,b); //printf("%d %d\n",g,a/g*b); cout << g << a/g*b << endl; } return 0; }
a.cc: In function 'int main()': a.cc:19:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 19 | cin >> a >> b; | ^~~ | std::cin In file included from a.cc:1: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:24:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 24 | cout << g << a/g*b << endl; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:24:27: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 24 | cout << g << a/g*b << endl; | ^~~~ | std::endl In file included from /usr/include/c++/14/iostream:41: /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~
s462831128
p00005
C++
#include <iostream> #include <vector> using namespace std; struct xy { long long x; long long y; }; int getGCD(int a, int b) { if (b != 0) return getGCD(b, a%b); else return a; } int main() { int a, b; vector<xy> dst; while (cin >> a >> b ) { int GCD = a > b ? getGCD(a, b) : getGCD(b, a); long long LCD = long long(a) * long long(b) / long long(GCD); dst.push_back({ GCD ,LCD }); } for (vector<xy>::iterator it = dst.begin(); it < dst.end(); it++) cout << (*it).x << " " << (*it).y << endl; return 0; }
a.cc: In function 'int main()': a.cc:23:33: error: expected primary-expression before 'long' 23 | long long LCD = long long(a) * long long(b) / long long(GCD); | ^~~~
s528686988
p00005
C++
#include <stdio.h>long main(void){ int a, b, c, d, tmp; scanf("%d %d", &a, &b); d = a * b; if(a < b) { tmp = a; a = b; b = tmp; } c = a % b; while(c != 0) { a = b; b = c; c = a % b; } printf("%d %d\n", b, d / b); return 0; }
a.cc:1:24: warning: extra tokens at end of #include directive 1 | #include <stdio.h>long main(void){ | ^~~~ a.cc:1:10: fatal error: stdio.h>lon: No such file or directory 1 | #include <stdio.h>long main(void){ | ^~~~~~~~~~~~~ compilation terminated.
s128920975
p00005
C++
#include <stdio.h> long long main(void){ int a, b, c, d, tmp; scanf("%d %d", &a, &b); d = a * b; if(a < b) { tmp = a; a = b; b = tmp; } c = a % b; while(c != 0) { a = b; b = c; c = a % b; } printf("%d %d\n", b, d / b); return 0; }
cc1plus: error: '::main' must return 'int'
s418107558
p00005
C++
#include <iostream> #include <cstdio>using namespace std; int gcd(int a, int b) { int p,q,r; if(a<b){p=b;b=a;a=p; } if(a < b) { return gcd(b, a); } while(r!=0){ q=b/a; r=b%a; b=a; a=r; } return b; } int main(void) { int a, b; while(cin >> a >> b) { int lcm = a/gcd(a,b)*b; cout << gcd(a,b) << " " << lcm << endl; } return 0; }
a.cc:2:24: warning: extra tokens at end of #include directive 2 | #include <cstdio>using namespace std; | ^~~~~~~~~ a.cc:2:10: fatal error: cstdio>usin: No such file or directory 2 | #include <cstdio>using namespace std; | ^~~~~~~~~~~~~ compilation terminated.
s111032019
p00005
C++
#include <stdio.h> long long fibo(int n){ int a, b, c, d, tmp; scanf("%d %d", &a, &b); d = a * b; if(a < b) { tmp = a; a = b; b = tmp; } c = a % b; while(c != 0) { a = b; b = c; c = a % b; } printf("%d %d\n", b, d / b); return 0; }
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s431859811
p00005
C++
#include <iostream> #include <cstdio>using namespace std; int gcd(int a, int b) if(a < b) { return gcd(b, a); } while(r!=0){ q=b/a; r=b%a; b=a; a=r; } return b; } int main(void) { int a, b; while(cin >> a >> b) { int lcm = a/gcd(a,b)*b; cout << gcd(a,b) << " " << lcm << endl; } return 0; }
a.cc:2:24: warning: extra tokens at end of #include directive 2 | #include <cstdio>using namespace std; | ^~~~~~~~~ a.cc:2:10: fatal error: cstdio>usin: No such file or directory 2 | #include <cstdio>using namespace std; | ^~~~~~~~~~~~~ compilation terminated.
s214702518
p00005
C++
#include <iostream>#include <cstdio>using namespace std;int gcd(int a, int b){int p,q,r;if(a<b){p=b;b=a;a=p;} while(r!=0){ q=b/a; r=b%a; b=a; a=r; } return b;}int main(void){ int a, b; while(cin >> a >> b) { int lcm = a/gcd(a,b)*b; cout << gcd(a,b) << " " << lcm << endl; } return 0;}
a.cc:1:20: warning: extra tokens at end of #include directive 1 | #include <iostream>#include <cstdio>using namespace std;int gcd(int a, int b){int p,q,r;if(a<b){p=b;b=a;a=p;} while(r!=0){ q=b/a; r=b%a; b=a; a=r; } return b;}int main(void){ int a, b; while(cin >> a >> b) { int lcm = a/gcd(a,b)*b; cout << gcd(a,b) << " " << lcm << endl; } return 0;} | ^ /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s256176480
p00005
C++
#include <iostream>#include <cstdio>using namespace std;int gcd(int a, int b){int p,q,r;if(a<b){p=b;b=a;a=p;} while(r!=0){ q=b/a; r=b%a; b=a; a=r; } return b;}int main(void){ int a, b; while(cin >> a >> b) { int lcm = a/gcd(a,b)*b; cout << gcd(a,b) << " " << lcm << endl; } return 0;}
a.cc:1:20: warning: extra tokens at end of #include directive 1 | #include <iostream>#include <cstdio>using namespace std;int gcd(int a, int b){int p,q,r;if(a<b){p=b;b=a;a=p;} while(r!=0){ q=b/a; r=b%a; b=a; a=r; } return b;}int main(void){ int a, b; while(cin >> a >> b) { int lcm = a/gcd(a,b)*b; cout << gcd(a,b) << " " << lcm << endl; } return 0;} | ^ /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s827220480
p00005
C++
#include <iostream> #include <cstdio> using namespace std; int gcd(int a, int b){ int p,q,r; if(a<b){p=b;b=a;a=p; } while((r=b%a)!=0){ q=b/a; b=a; a=r; } return a; int main(void) { int a, b; while(cin >> a >> b) { int lcm = a/gcd(a,b)*b; cout << gcd(a,b) << " " << lcm << endl; } return 0; }
a.cc: In function 'int gcd(int, int)': a.cc:21:1: error: a function-definition is not allowed here before '{' token 21 | { int a, b; | ^ a.cc:27:2: error: expected '}' at end of input 27 | } | ^ a.cc:5:22: note: to match this '{' 5 | int gcd(int a, int b){ | ^
s936145356
p00005
C++
#include <iostream> #include <cstdio> using namespace std; int gcd(int a, int b){ int p,q,r; if(a<b){p=b;b=a;a=p; } while((r=b%a)!=0){ q=b/a; b=a; a=r; return a; } int main(void) { int a, b; while(cin >> a >> b) { int lcm = a/gcd(a,b)*b; cout << gcd(a,b) << " " << lcm << endl; } return 0; }
a.cc: In function 'int gcd(int, int)': a.cc:22:1: error: a function-definition is not allowed here before '{' token 22 | { int a, b; | ^ a.cc:28:2: error: expected '}' at end of input 28 | } | ^ a.cc:5:22: note: to match this '{' 5 | int gcd(int a, int b){ | ^ a.cc:28:2: warning: control reaches end of non-void function [-Wreturn-type] 28 | } | ^
s860385793
p00005
C++
#include <iostream> #include <cstdio> using namespace std; int gcd(int a, int b){ int p,q,r; if(a<b){p=b;b=a;a=p; } while(r!=0){ q=b/a; r=b%a; b=a; a=r; } return b; } int main(void) { int a, b; while((r=b%a)!=0){ q=b/a; b=a; a=r; } return a; }
a.cc: In function 'int main()': a.cc:24:13: error: 'r' was not declared in this scope 24 | while((r=b%a)!=0){ | ^ a.cc:25:3: error: 'q' was not declared in this scope 25 | q=b/a; | ^
s671737848
p00005
C++
include<iostream> long long gcd(long long a,long long b){ if(b==0) return a; gcd(b,(a%b)); } int main() { long long i,j,res; while(std::cin>>i>>j) { res=gcd(i,j); std::cout<<res<<" "<<(i*j)/res<<"\n"; } }
a.cc:1:1: error: 'include' does not name a type 1 | include<iostream> | ^~~~~~~ a.cc: In function 'int main()': a.cc:9:14: error: 'cin' is not a member of 'std' 9 | while(std::cin>>i>>j) { | ^~~ a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' +++ |+#include <iostream> 1 | include<iostream> a.cc:10:9: error: 'gcd' was not declared in this scope 10 | res=gcd(i,j); | ^~~ a.cc:11:10: error: 'cout' is not a member of 'std' 11 | std::cout<<res<<" "<<(i*j)/res<<"\n"; | ^~~~ a.cc:11:10: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
s665024097
p00005
C++
#include <iostream> using namespace std; int main(int argc, char **argv) { int a, b, s, t; while(cin >> a >> b){ for(int i = (a > b)? b : a; i >= 1; i--){ if(b%i == 0 && a%i == 0){ break; } } s = a; t = b; while(s != t){ if(s > t){ while(s > t){ t += b; } } else { while(t > s){ s += a; } } } cout << i << " " << s << endl; } return 0; }
a.cc: In function 'int main(int, char**)': a.cc:28:25: error: 'i' was not declared in this scope 28 | cout << i << " " << s << endl; | ^
s274948666
p00005
C++
#include <iostream> #include <vector> using namespace std; int gcd(int a,int b) { int l,s,r; if (a<b) { l=b; s=a; } else { l=a; s=b; } while(true) { r=l%s; if (r == 0) break; l=s; s=r; } return s; } int main() { int a,b; vector<int> r1,r2; while (scanf("%d %d",&a,&b) != EOF) { r1.push_back(gcd(a,b)); r2.push_back(a/r1[r1.size()-1]*b); } for (int i=0; i<r1.size(); i++) {
a.cc: In function 'int main()': a.cc:36:6: error: expected '}' at end of input 36 | { | ~^ a.cc:36:6: error: expected '}' at end of input a.cc:27:1: note: to match this '{' 27 | { | ^
s800673990
p00005
C++
main(){ unsigned int i,j,a,b; while(scanf("%d %d",&a,&b)!=-1){ if(a<b){ //for(i=1;b%(a/i);for(;a%i;i++)) //; for(i=a;a%i||b%i;i--); for(j=i;j%b;j+=i); }else{ for(i=b;a%i||b%i;i--); for(j=i;j%a;j+=i); } printf("%d %d\n",i,j); } return 0; }
a.cc:1:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 1 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:3:9: error: 'scanf' was not declared in this scope 3 | while(scanf("%d %d",&a,&b)!=-1){ | ^~~~~ a.cc:13:5: error: 'printf' was not declared in this scope 13 | printf("%d %d\n",i,j); | ^~~~~~ a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | main(){
s629970482
p00005
C++
gcd(a,b){b==0?a:gcd(b,a%b);}c;main(a,b){while(~scanf("%d%d",&a,&b),c=gcd(a,b))printf("%d %d",c,a/c*b);exit(0);}
a.cc:1:4: error: expected constructor, destructor, or type conversion before '(' token 1 | gcd(a,b){b==0?a:gcd(b,a%b);}c;main(a,b){while(~scanf("%d%d",&a,&b),c=gcd(a,b))printf("%d %d",c,a/c*b);exit(0);} | ^ a.cc:1:29: error: 'c' does not name a type 1 | gcd(a,b){b==0?a:gcd(b,a%b);}c;main(a,b){while(~scanf("%d%d",&a,&b),c=gcd(a,b))printf("%d %d",c,a/c*b);exit(0);} | ^ a.cc:1:35: error: expected constructor, destructor, or type conversion before '(' token 1 | gcd(a,b){b==0?a:gcd(b,a%b);}c;main(a,b){while(~scanf("%d%d",&a,&b),c=gcd(a,b))printf("%d %d",c,a/c*b);exit(0);} | ^
s537396388
p00005
C++
#include<iostream> using namesapce std; int gcd(int a, int b){ return a%b ? gcd(b, a%b) : b; } int lcm(int a, int b){ return a/gcd(a,b)*b; } int main(){ int a,b; while(cin>>a>>b){ cout<<gcd(a,b)<<" "<<lcm(a,b)<<endl; } return 0; }
a.cc:2:7: error: expected nested-name-specifier before 'namesapce' 2 | using namesapce std; | ^~~~~~~~~ a.cc: In function 'int main()': a.cc:10:7: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 10 | while(cin>>a>>b){ | ^~~ | std::cin In file included from a.cc:1: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:11:1: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 11 | cout<<gcd(a,b)<<" "<<lcm(a,b)<<endl; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:11:32: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 11 | cout<<gcd(a,b)<<" "<<lcm(a,b)<<endl; | ^~~~ | std::endl In file included from /usr/include/c++/14/iostream:41: /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~
s184127703
p00005
C++
include<iostream> #include<algorithm> using namespace std; int gcd(int,int); int lcm(int,int); int tes(int,int); int main(){ int a,b; while(cin >> a >> b){ cout << gcd(a,b); cout << " " << lcm(a,b) << endl; } } int gcd(int a,int b){ int n; n=min(a,b); for(int i=n;i>=1;i--){ if(a%i == 0 && b%i==0)return i; } } /* int tes(int a,int b){ if(b == 0)return a; return tes(b,a%b); } */ int lcm( int a,int b){ return (a*b)/gcd(a,b); }
a.cc:1:1: error: 'include' does not name a type 1 | include<iostream> | ^~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/algorithm:60, from a.cc:2: /usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity 164 | __is_null_pointer(std::nullptr_t) | ^ /usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)' 159 | __is_null_pointer(_Type) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std' 164 | __is_null_pointer(std::nullptr_t) | ^~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/type_traits:295:27: error: 'size_t' has not been declared 295 | template <typename _Tp, size_t = sizeof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std' 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:984:26: error: 'size_t' has not been declared 984 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std' 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std' 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std' 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std' 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1451:32: error: 'size_t' was not declared in this scope 1451 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 63 | #include <bits/version.h> +++ |+#include <cstddef> 64 | /usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid 1451 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared 1453 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope 1454 | struct extent<_Tp[_Size], 0> | ^~~~~ /usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid 1454 | struct extent<_Tp[_Size], 0> | ^ /usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~ /usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid 1455 | : public integral_constant<size_t, _Size> { }; | ^ /usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid /usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared 1457 | template<typename _Tp, unsigned _Uint, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope 1458 | struct extent<_Tp[_Size], _Uint> | ^~~~~ /usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid 1458 | struct extent<_Tp[_Size], _Uint> | ^ /usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope 1463 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid 1463 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type 1857 | { static constexpr size_t __size = sizeof(_Tp); }; | ^~~~~~ /usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~~~~ /usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~ /usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp' 1860 | struct __select; | ^~~~~~~~ /usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared 1862 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^~~ /usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^ /usr/include/c++/14/type_traits:1866:14: error: 'size_t' has not been declared 1866 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1867:23: error: '_Sz' was not declared in this scope 1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false> | ^~~ /usr/include/c++/14/type_traits:1867:58: error: template argument 1 is invalid 1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false>
s072858043
p00005
C++
int main(){ int a,b; int gcd,lcm,hoge; while(cin >> a >> b){ if (a > b) { hoge = a; a = b; b = hoge; } for (int i=1;i < a;i++){ if (a%i==0 && b%i==0){ gcd = i; } } for (int j=a;1;j++){ if (j%a==0 && j%b==0){ lcm = j; break; } } cout << gcd << " " << lcm << endl; } return 0; }
a.cc: In function 'int main()': a.cc:5:15: error: 'cin' was not declared in this scope 5 | while(cin >> a >> b){ | ^~~ a.cc:22:17: error: 'cout' was not declared in this scope 22 | cout << gcd << " " << lcm << endl; | ^~~~ a.cc:22:46: error: 'endl' was not declared in this scope 22 | cout << gcd << " " << lcm << endl; | ^~~~
s021034009
p00005
C++
#include <iostream> #include <vector> #include <cmath> #include <map> typedef long long ll; using namespace std; ll gcd(ll a, ll b) { while( 1 ) { a = a % b; if( a == 0 )return b; b = b % a; if( b == 0 )return a; } } return a; } int main() { ll a,b; while(~scanf("%lld %lld",&a,&b)){ printf("%lld %lld",gcd(a,b),(a*b)/gcd(a,b)); } }
a.cc:20:1: error: expected unqualified-id before 'return' 20 | return a; | ^~~~~~ a.cc:21:1: error: expected declaration before '}' token 21 | } | ^
s092153234
p00005
C++
#include <iostream> using namespace std; long gcd(int a,int b){ if(a == 0)return b; else if(a > b)return gcd(a%b,b); return gcd(b%a,a); } void main(){ long a,b; while(!cin.eof()){ cin >> a >> b; long g = gcd(a,b); cout << g << " " << a*(b/g); } }
a.cc:10:1: error: '::main' must return 'int' 10 | void main(){ | ^~~~
s917216348
p00005
C++
#include<iostream> using namespace std; long long gcm(long long a, long long b){ if(b > a){ long long d; d = a; a = b; b = d; } long long c; while(b!=0){ c = a % b; a = b; b = c; } return a; } void main(){ long long c,d,e; std::cin>>c>>d; e = gcm(c,d); std::cout<<e<<" "<<(c*d)/e; }
a.cc:18:1: error: '::main' must return 'int' 18 | void main(){ | ^~~~
s042543713
p00005
C++
#include<iostream> using namespace std; int main(){ int a,b,c,d,e; for(int i=0;i<2;i++){ std::cin>>a>>b; d=a; e=b; if(b>a){ d = a; a = b; b = d; } while(b!=0){ c = a % b; a = b; b = c; } std::cout<<a<<" "<<((e/a)*(d/a)*a)<<endl;8 } }
a.cc: In function 'int main()': a.cc:20:43: error: expected ';' before '}' token 20 | std::cout<<a<<" "<<((e/a)*(d/a)*a)<<endl;8 | ^ | ; 21 | } | ~
s554857847
p00005
C++
int main(){ // m*n = LCM * GCD unsigned long long m, n; while(cin >> m >> n){ int LCM, GCD; if(m<n){ int swap; swap = m; m = n; n = swap; } int m_, n_; m_ = m; n_ = n; do { if(n_==0){ GCD = m_; break; } int swap = m_ % n_; m_ = n_; n_ = swap; } while(1); LCM = (m*n)/GCD; cout << GCD << " " << LCM << endl; } return 0; }
a.cc: In function 'int main()': a.cc:4:15: error: 'cin' was not declared in this scope 4 | while(cin >> m >> n){ | ^~~ a.cc:29:17: error: 'cout' was not declared in this scope 29 | cout << GCD << " " << LCM << endl; | ^~~~ a.cc:29:46: error: 'endl' was not declared in this scope 29 | cout << GCD << " " << LCM << endl; | ^~~~
s572698265
p00005
C++
long long gcd(long long m, long long n){ if(m<n){ long long swap; swap = m; m = n; n = swap; } do { if(n==0){ return m; } int swap = m % n; m = n; n = swap; } while(1); } int main(){ // m*n = LCM * GCD long long m, n; while(cin >> m >> n){ long long LCM, GCD; GCD = gcd(m, n); LCM = (m*n)/GCD; cout << GCD << " " << LCM << endl; } return 0; }
a.cc: In function 'int main()': a.cc:25:15: error: 'cin' was not declared in this scope 25 | while(cin >> m >> n){ | ^~~ a.cc:30:17: error: 'cout' was not declared in this scope 30 | cout << GCD << " " << LCM << endl; | ^~~~ a.cc:30:46: error: 'endl' was not declared in this scope 30 | cout << GCD << " " << LCM << endl; | ^~~~
s416948433
p00005
C++
#include<iostream> using namespace std; int main(){ int a,b,c,d; cin >> a >> c; b=a; d=c; while(b!=d){ if(d<b){d+=c;} else b+=a; } cout << b << \n; }
a.cc:13:22: error: stray '\' in program 13 | cout << b << \n; | ^ a.cc: In function 'int main()': a.cc:13:23: error: 'n' was not declared in this scope 13 | cout << b << \n; | ^
s772582362
p00005
C++
#include <iostream> #include <iomanip> #include <cstdlib> #include <ctime> #include <algorithm> #include <string> using namespace std; int main() { double x,y,r,a,b; cin>>x>>y; a=x; b=y; while(x%y!=0) { r=x%y; x=y; y=r; } cout<<y<<" "<<a*b/y<<endl; return 0; }
a.cc: In function 'int main()': a.cc:17:8: error: invalid operands of types 'double' and 'double' to binary 'operator%' 17 | while(x%y!=0) | ~^~ | | | | | double | double a.cc:19:4: error: invalid operands of types 'double' and 'double' to binary 'operator%' 19 | r=x%y; | ~^~ | | | | | double | double
s492081758
p00005
C++
#include <iostream> #include <algorithm> using namespace std; int main() { double x,y,n,a,b; while(cin>>x>>y) { a=x; b=y; while(x%y!=0) { n=x%y; x=y; y=n; } cout<<y<<" "<<a*b/y<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:16:8: error: invalid operands of types 'double' and 'double' to binary 'operator%' 16 | while(x%y!=0) | ~^~ | | | | | double | double a.cc:18:4: error: invalid operands of types 'double' and 'double' to binary 'operator%' 18 | n=x%y; | ~^~ | | | | | double | double
s960043653
p00005
C++
#include <iostream> #include <algorithm> using namespace std; int main() { double x,y,n,a,b; while(cin>>x>>y) { a=x; b=y; if(x>y) while(x%y!=0) { n=x%y; x=y; y=n; cout<<y<<" "<<a*b/y<<endl; } else while(y%x!=0) { n=y%x; y=x; x=n; cout<<x<<" "<<a*b/x<<endl; } } return 0; }
a.cc: In function 'int main()': a.cc:17:8: error: invalid operands of types 'double' and 'double' to binary 'operator%' 17 | while(x%y!=0) | ~^~ | | | | | double | double a.cc:19:4: error: invalid operands of types 'double' and 'double' to binary 'operator%' 19 | n=x%y; | ~^~ | | | | | double | double a.cc:25:8: error: invalid operands of types 'double' and 'double' to binary 'operator%' 25 | while(y%x!=0) | ~^~ | | | | | double | double a.cc:27:4: error: invalid operands of types 'double' and 'double' to binary 'operator%' 27 | n=y%x; | ~^~ | | | | | double | double
s300265573
p00005
C++
#include<iostream> using namespace std; unsigned long long int GCD(); int main(void){ while(1){ unsigned long long int a, b, gcd, lcm, temp; if( a < b){ temp = a; a = b; b = temp; } cin >> a >> b; if(a == 0 || b == 0) return 0; gcd = GCD(a,b); lcm = a * b / gcd; cout << gcd << ' ' << lcm << endl; } return 0; } unsigned long long int GCD(unsinged long long int a, b){ if(a % b == 0) return (b); else return (GCD(b, a%b); }
a.cc: In function 'int main()': a.cc:17:26: error: too many arguments to function 'long long unsigned int GCD()' 17 | gcd = GCD(a,b); | ~~~^~~~~ a.cc:4:24: note: declared here 4 | unsigned long long int GCD(); | ^~~ a.cc: At global scope: a.cc:24:47: error: 'long long unsigned int GCD' redeclared as different kind of entity 24 | unsigned long long int GCD(unsinged long long int a, b){ | ^~~ a.cc:4:24: note: previous declaration 'long long unsigned int GCD()' 4 | unsigned long long int GCD(); | ^~~ a.cc:24:28: error: 'unsinged' was not declared in this scope; did you mean 'unsigned'? 24 | unsigned long long int GCD(unsinged long long int a, b){ | ^~~~~~~~ | unsigned a.cc:24:54: error: 'b' was not declared in this scope 24 | unsigned long long int GCD(unsinged long long int a, b){ | ^
s292401344
p00005
C++
#include <iostream> using namespace std; int main(){ int a; int b; int d; int e; int f; while(cin>>d>>e){ a=d; b=e; while(1){ c=a%b; a=b; b=c; if(b==0){break;} } f=d/a*e; cout << a <<" "; cout << f <<endl;}}
a.cc: In function 'int main()': a.cc:14:1: error: 'c' was not declared in this scope 14 | c=a%b; | ^
s046334104
p00005
C++
#include<stdio.h> int gcd(int a, int b){ if(a == 0)return b; else return gcd(b % a, a); } int lcm(int a, int b){ return a / gcd(a, b) * b; } int main(){ int a, b; while(scanf("%d%d", &x, &y) != EOF){ printf("%d %d\n", gcd(x, y), lcm(x, y)); } return 0; }
a.cc: In function 'int main()': a.cc:14:24: error: 'x' was not declared in this scope 14 | while(scanf("%d%d", &x, &y) != EOF){ | ^ a.cc:14:28: error: 'y' was not declared in this scope 14 | while(scanf("%d%d", &x, &y) != EOF){ | ^
s108378461
p00005
C++
void printFunc(int a,int b,int c,int d,int e,int f); long gcd(long a,long b); int main(){ long a = 0,b = 0; while(fscanf(stdin,"%d %d",&a,&b) != EOF){ printf("%d %d",gcd(a,b),a*b/gcd(a,b)); } return 0; } long gcd(long a,long b){ if(b == 0){ return a; } else{ gcd(b,a%b); } }
a.cc: In function 'int main()': a.cc:7:16: error: 'stdin' was not declared in this scope 7 | while(fscanf(stdin,"%d %d",&a,&b) != EOF){ | ^~~~~ a.cc:1:1: note: 'stdin' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | void printFunc(int a,int b,int c,int d,int e,int f); a.cc:7:9: error: 'fscanf' was not declared in this scope 7 | while(fscanf(stdin,"%d %d",&a,&b) != EOF){ | ^~~~~~ a.cc:7:40: error: 'EOF' was not declared in this scope 7 | while(fscanf(stdin,"%d %d",&a,&b) != EOF){ | ^~~ a.cc:7:40: note: 'EOF' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' a.cc:8:5: error: 'printf' was not declared in this scope 8 | printf("%d %d",gcd(a,b),a*b/gcd(a,b)); | ^~~~~~ a.cc:8:5: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' a.cc: In function 'long int gcd(long int, long int)': a.cc:19:8: warning: control reaches end of non-void function [-Wreturn-type] 19 | gcd(b,a%b); | ~~~^~~~~~~
s623593653
p00005
C++
include<iostream> #include<cstdio> using namespace std; int main(){ long long int a,b,c,r,s; while(cin >> a >> b){ s=a*b; while(b!=0){ c=a/b; r=a%b; a=b; b=r; } cout << a << ' ' << s/a << endl; } return 0; }
a.cc:1:1: error: 'include' does not name a type 1 | include<iostream> | ^~~~~~~ a.cc: In function 'int main()': a.cc:9:9: error: 'cin' was not declared in this scope 9 | while(cin >> a >> b){ | ^~~ a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 2 | #include<cstdio> +++ |+#include <iostream> 3 | using namespace std; a.cc:22:5: error: 'cout' was not declared in this scope 22 | cout << a << ' ' << s/a << endl; | ^~~~ a.cc:22:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:22:33: error: 'endl' was not declared in this scope 22 | cout << a << ' ' << s/a << endl; | ^~~~ a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 2 | #include<cstdio> +++ |+#include <ostream> 3 | using namespace std;
s835282186
p00005
C++
#include <iostream> #include <vector> using namespace std; int getLCM(int, int); int getGCD(int, int, int); int main(int argc, char *argv[]) { int x, y; vector<int> result; while (cin >> x >> y) { int lcm = getLCM(x, y); int gcd = getGCD(x, y, lcm); result.push_back(lcm); result.push_back(gcd); } for (int i = 0; i < result.size()/2; i++) cout << result[i*2] << ' ' << result[i*2+1] << endl; return 0; } int getLCM(int x, int y) { int tmp; if (x < y) { tmp = y; y = x; x = tmp; } while (x % y != 0) { tmp = x % y; x = y; y = tmp; } return y; }
/usr/bin/ld: /tmp/ccPD8x1R.o: in function `main': a.cc:(.text+0x3e): undefined reference to `getGCD(int, int, int)' collect2: error: ld returned 1 exit status
s554930411
p00005
C++
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner cin = new Scanner(System.in); int a,b; while(true){ a = cin.nextInt(); b = cin.nextInt(); System.out.println(gcd(a,b)+" "+lcm(a,b)); } } private static int gcd(int a, int b) { if(b == 0) return a; else return gcd(b,a%b); } private static int lcm(int a, int b) { return a*b/gcd(a,b); } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.Scanner; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: expected unqualified-id before 'public' 3 | public class Main { | ^~~~~~
s356908129
p00005
C++
include <iostream> #include <vector> using namespace std; int main() { int a,b,c,x,y; vector<int> lc,gc; while(cin >> a >> b) { x=a; y=b; while( a % b!=0) { c=b; b=a % b; a=c; } lc.push_back(b); y=y/b; gc.push_back(y*x); } for (c=0;c<lc.size();c++) cout << lc[c] << " " << gc[c] << endl; return 0; }
a.cc:1:1: error: 'include' does not name a type 1 | include <iostream> | ^~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/vector:62, from a.cc:2: /usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity 164 | __is_null_pointer(std::nullptr_t) | ^ /usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)' 159 | __is_null_pointer(_Type) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std' 164 | __is_null_pointer(std::nullptr_t) | ^~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/type_traits:295:27: error: 'size_t' has not been declared 295 | template <typename _Tp, size_t = sizeof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std' 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:984:26: error: 'size_t' has not been declared 984 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std' 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std' 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std' 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std' 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1451:32: error: 'size_t' was not declared in this scope 1451 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 63 | #include <bits/version.h> +++ |+#include <cstddef> 64 | /usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid 1451 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared 1453 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope 1454 | struct extent<_Tp[_Size], 0> | ^~~~~ /usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid 1454 | struct extent<_Tp[_Size], 0> | ^ /usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~ /usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid 1455 | : public integral_constant<size_t, _Size> { }; | ^ /usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid /usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared 1457 | template<typename _Tp, unsigned _Uint, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope 1458 | struct extent<_Tp[_Size], _Uint> | ^~~~~ /usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid 1458 | struct extent<_Tp[_Size], _Uint> | ^ /usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope 1463 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid 1463 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type 1857 | { static constexpr size_t __size = sizeof(_Tp); }; | ^~~~~~ /usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~~~~ /usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~ /usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp' 1860 | struct __select; | ^~~~~~~~ /usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared 1862 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^~~ /usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^ /usr/include/c++/14/type_traits:1866:14: error: 'size_t' has not been declared 1866 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1867:23: error: '_Sz' was not declared in this scope 1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false> | ^~~ /usr/include/c++/14/type_traits:1867:58: error: template argument 1 is invalid 1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false> |
s735319252
p00005
C++
include<stdio.h> //公約数の関数 unsigned long long int kouyakusuu_f(unsigned long long int a,unsigned long long int b) { //返す変数 unsigned long long int kouyakusuu_ans = 0; //無限ループ for (unsigned long long int i = a;;i -= 2) { //両方割れるなら if (a %i == 0) { if (b % i == 0) { kouyakusuu_ans = i; break; } } } return kouyakusuu_ans; } //公倍数の関数 unsigned long long int koubaisuu_f(unsigned long long int a,unsigned long long int b) { //保存用変数(aとbをもう入れちゃう) unsigned long long int hozon1 = a,hozon2 = b; //インクリメント変数 int count1 = 0,count2 = 0; //合うまで続ける while (hozon1 != hozon2) { //aのほうが小さいとき(bが大きい) while (hozon1 < hozon2) { count1++; //小さいaを少しずつ増やす hozon1 = a * count1; } //bの方が小さいとき(aが大きい) while (hozon2 < hozon1) { count2++; //小さいbを少しずつ増やす hozon2 = b * count2; } } //どうせ同じだからどっちでも問題ない return hozon1; } int main(void) { //公倍数と公約数 unsigned long long int kouyakusuu = 0; unsigned long long int koubaisuu = 0; //入力 unsigned long long int a = 0,b = 0; //回しまくる while (scanf("%d %d",&a,&b) != EOF) { //同じ値ならそのマンまでいいでしょう if (a != b) { //公約数を関数よりもとめる kouyakusuu = kouyakusuu_f(a,b); //公倍数を関数により求める koubaisuu = koubaisuu_f(a,b); } //同じ値ならそのまま else { koubaisuu = a; kouyakusuu = a; } //表示 printf("%llu %llu\n",kouyakusuu,koubaisuu); } return 0; }
a.cc:1:1: error: 'include' does not name a type 1 | include<stdio.h> | ^~~~~~~ a.cc: In function 'int main()': a.cc:72:16: error: 'scanf' was not declared in this scope 72 | while (scanf("%d %d",&a,&b) != EOF) | ^~~~~ a.cc:72:40: error: 'EOF' was not declared in this scope 72 | while (scanf("%d %d",&a,&b) != EOF) | ^~~ a.cc:1:1: note: 'EOF' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | include<stdio.h> a.cc:78:38: error: 'kouyakusuu_f' was not declared in this scope; did you mean 'kouyakusuu'? 78 | kouyakusuu = kouyakusuu_f(a,b); | ^~~~~~~~~~~~ | kouyakusuu a.cc:89:17: error: 'printf' was not declared in this scope 89 | printf("%llu %llu\n",kouyakusuu,koubaisuu); | ^~~~~~ a.cc:89:17: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
s404296769
p00005
C++
#include <cstdio> #include <cstdlib> using namespace std; int main() { for(long long a, b; scanf("%lld %lld", &a, &b) == 2;) { long long g = __gcd(a, b); printf("%lld %lld\n", g, a / g * b); } return EXIT_SUCCESS; }
a.cc: In function 'int main()': a.cc:7:31: error: '__gcd' was not declared in this scope; did you mean '__gid_t'? 7 | long long g = __gcd(a, b); | ^~~~~ | __gid_t
s861892136
p00005
C++
#include<iostream> using namespace std; int main(){ int gcd( int m, int n ) { // 引数に0がある場合は0を返す if ( ( 0 == m ) || ( 0 == n ) ) return 0; // ユークリッドの方法 while( m != n ) { if ( m > n ) m = m - n; else n = n - m; } return m; }//gcd int lcm( int m, int n ) { // 引数に0がある場合は0を返す if ( ( 0 == m ) || ( 0 == n ) ) return 0; return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n) }//lcm cout << lcm << ' ' << gcd << endl; retrun 0; }
a.cc: In function 'int main()': a.cc:5:1: error: a function-definition is not allowed here before '{' token 5 | { | ^ a.cc:19:1: error: a function-definition is not allowed here before '{' token 19 | { | ^ a.cc:26:10: error: 'lcm' was not declared in this scope 26 | cout << lcm << ' ' << gcd << endl; | ^~~ a.cc:26:24: error: 'gcd' was not declared in this scope 26 | cout << lcm << ' ' << gcd << endl; | ^~~ a.cc:27:2: error: 'retrun' was not declared in this scope 27 | retrun 0; | ^~~~~~
s128731290
p00005
C++
#include<iostream> using namespace std; long main(){ long long int a,b; while(cin>>a>>b){ long long int c=a,d=b; while(c!=d){ if(c>d){ d+=b; }else{ c+=a; } } while(1){ d=a%b; if(d==0)break; a=b; b=d; } cout<<c<<' '<<b<<endl; } return 0; }
cc1plus: error: '::main' must return 'int'
s988045353
p00005
C++
int gcd(int x,int y){ if(y==0)return x; else return gcd(y,x%y); } int main(){ for(int i=0;i<5;i++){ int a,b; std::cin>>a>>b; std::cout<<gcd(a,b)<<" "<<a/gcd(a,b)*b<<std::endl; } return 0; }
a.cc: In function 'int main()': a.cc:8:22: error: 'cin' is not a member of 'std' 8 | std::cin>>a>>b; | ^~~ a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' +++ |+#include <iostream> 1 | int gcd(int x,int y){ a.cc:9:22: error: 'cout' is not a member of 'std' 9 | std::cout<<gcd(a,b)<<" "<<a/gcd(a,b)*b<<std::endl; | ^~~~ a.cc:9:22: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:9:62: error: 'endl' is not a member of 'std' 9 | std::cout<<gcd(a,b)<<" "<<a/gcd(a,b)*b<<std::endl; | ^~~~ a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' +++ |+#include <ostream> 1 | int gcd(int x,int y){
s766449009
p00005
C++
int gcd(int x,int y){ if(y==0)return x; else return gcd(y,x%y); } int main(){ for(int i=0;i<5;i++){ int a,b; std::cin>>a>>b; std::cout<<gcd(a,b)<<" "<<a/gcd(a,b)*b<<std::endl; } return 0; }
a.cc: In function 'int main()': a.cc:8:22: error: 'cin' is not a member of 'std' 8 | std::cin>>a>>b; | ^~~ a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' +++ |+#include <iostream> 1 | int gcd(int x,int y){ a.cc:9:22: error: 'cout' is not a member of 'std' 9 | std::cout<<gcd(a,b)<<" "<<a/gcd(a,b)*b<<std::endl; | ^~~~ a.cc:9:22: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:9:62: error: 'endl' is not a member of 'std' 9 | std::cout<<gcd(a,b)<<" "<<a/gcd(a,b)*b<<std::endl; | ^~~~ a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' +++ |+#include <ostream> 1 | int gcd(int x,int y){
s930744405
p00005
C++
//----- ユークリッドの互除法を行う関数 -----// int f_kouyakusuu(int , int , int*); //----- 最小公倍数を求める関数 -----// int f_koubaisuu(int , int , int*); //*****----- main -----*****// int main(void) { //入力変数2つ int x = 0 , y = 0; //公約数と公倍数は保存しておかなければならない int kouyakusuu = 0 , koubaisuu = 0; while (scanf("%d %d" , &x , &y) != EOF) { koubaisuu = f_koubaisuu(x , y , &kouyakusuu); printf("%d %d\n" , kouyakusuu , koubaisuu); } return 0; } //*****----- ユークリッドの互除法を利用する関数 -----*****// int f_kouyakusuu(int x , int y , int *kouyakusuu) //最初x<yでもforによって入れ替えられる { //保存変数 int hozon = 0; //割って0になるまで while ((hozon = x % y) != 0) { x = y; y = hozon; } //公約数を保存する *kouyakusuu = y; //最後に割ったxを返す return y; } //*****----- 最小公倍数を求めるプログラム *****-----// int f_koubaisuu(int x , int y , int *kouyakusuu) { //最初に計算して値を小さくする int modoriti = f_kouyakusuu(x , y , kouyakusuu); //値がでかいので工夫 unsigned long long int hozon = x * y; hozon = x / modoriti; //計算して値を返す return hozon * y; }
a.cc: In function 'int main()': a.cc:19:16: error: 'scanf' was not declared in this scope 19 | while (scanf("%d %d" , &x , &y) != EOF) | ^~~~~ a.cc:19:44: error: 'EOF' was not declared in this scope 19 | while (scanf("%d %d" , &x , &y) != EOF) | ^~~ a.cc:1:1: note: 'EOF' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | //----- ユークリッドの互除法を行う関数 -----// a.cc:22:17: error: 'printf' was not declared in this scope 22 | printf("%d %d\n" , kouyakusuu , koubaisuu); | ^~~~~~ a.cc:22:17: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
s559809943
p00005
C++
#include <iostream> using namespace std; typedef long long lli; lli gcd(lli a, lli b) { return b == 0 ? a : gcd(b, a%b); } lli lcm(lli a, lli b) { return *b/gcd(a,b); } int main() { lli a, b; while(cin >> a >> b) { cout << gcd(a, b) << " " << lcm(a, b) << endl; } }
a.cc: In function 'lli lcm(lli, lli)': a.cc:11:10: error: invalid type argument of unary '*' (have 'lli' {aka 'long long int'}) 11 | return *b/gcd(a,b); | ^~
s976722703
p00005
C++
#include <iostream> using namespace std; typedef long long lli; lli gcd(lli a, lli b) { return b == 0 ? a : gcd(b, a%b); } lli lcm(lli a, lli b) { return *b/gcd(a,b); } int main() { lli a, b; while(cin >> a >> b) { cout << gcd(a, b) << " " << lcm(a, b) << endl; } return 0; }
a.cc: In function 'lli lcm(lli, lli)': a.cc:11:10: error: invalid type argument of unary '*' (have 'lli' {aka 'long long int'}) 11 | return *b/gcd(a,b); | ^~
s044791943
p00005
C++
#include <stdio.h> int main(void){ int a,b,d; while(~scanf("%d%d",&a,&b)){ int&t=a<b?a:b,n=1; d=t; while(d>1){ if(a%d||b%d)d--; else a/=d,b/=d,n*=d,d=t; } printf("%d %d\n",n,n*a*b); } return 0;
a.cc: In function 'int main()': a.cc:13:14: error: expected '}' at end of input 13 | return 0; | ^ a.cc:2:15: note: to match this '{' 2 | int main(void){ | ^
s764965631
p00005
C++
#include<iostream> #include<algorithm> using namespace std; long koyaku(long a,long b); int main(){ long c,d,e; unsigned long f; while(cin>>c>>d){ e=koyaku(c,d); f=c/e*d; cout<<e<<" "<<f<<endl; } return 0; } long koyaku(long a,long b){ long n=max(a,b); long ans=1; for(long i=1;i<=n/2;i++){ if(a%i==0&&b%i==0)ans=i; } if(a%n==0&&b%n==0)ans=n; return
a.cc: In function 'long int koyaku(long int, long int)': a.cc:24:15: error: expected primary-expression at end of input 24 | return | ^ a.cc:24:15: error: expected ';' at end of input 24 | return | ^ | ; a.cc:24:15: error: expected '}' at end of input a.cc:17:27: note: to match this '{' 17 | long koyaku(long a,long b){ | ^
s912062319
p00005
C++
#include <stdio.h> int main(){ long int a,b,aa,bb; long int x,y; while(scanf("%d %d",&a,&b) != EOF){ aa=a; bb=b; while(a%b!=0){ x=a%b; a=b; b=x; } for(i=1;i<=aa*bb;i++){ if(i%aa==0 && i%bb==0){ y=i; break; } } printf("%d %d\n",b,y); } return 0; }
a.cc: In function 'int main()': a.cc:15:5: error: 'i' was not declared in this scope 15 | for(i=1;i<=aa*bb;i++){ | ^
s740565311
p00005
C++
#include<iostream> #include <xiosbase> using namespace std; long long gcd(long long a,long long b) { if(b==0) return a; else return gcd(b,a%b); } long long kmm(long long a,long long b) { return a*b/gcd(a,b); } int main() { system("CLS"); long long a,b; cin>>a>>b; while(!cin.eof()) { cout<<gcd(a,b); cout<<" "; cout<<kmm(a,b); cout<<endl; cin>>a>>b; } return 0; }
a.cc:3:10: fatal error: xiosbase: No such file or directory 3 | #include <xiosbase> | ^~~~~~~~~~ compilation terminated.
s560770943
p00005
C++
/* -*- coding:utf-8 -*- */ #include <iostream> #include <boost/math/common_factor_rt.hpp> using namespace std; int main(void) { int a, b; while(cin >> a >> b, !cin.eof()) cout << boost::math::gcd(a,b) << ' ' << boost::math::lcm(a,b) << endl; return 0; }
a.cc:4:10: fatal error: boost/math/common_factor_rt.hpp: No such file or directory 4 | #include <boost/math/common_factor_rt.hpp> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated.
s365871032
p00005
C++
include <iostream> using namespace std; int main(){ int a,b; while(cin>>a>>b){ int max=0,min; for(int i=a;max=0;i--){ if(a%i==0 && b%i==0){ max=i;}} min=(a/max)*b; cout<<max<<" "<<min<<endl; } return 0; }
a.cc:1:1: error: 'include' does not name a type 1 | include <iostream> | ^~~~~~~ a.cc: In function 'int main()': a.cc:5:7: error: 'cin' was not declared in this scope 5 | while(cin>>a>>b){ | ^~~ a.cc:11:1: error: 'cout' was not declared in this scope 11 | cout<<max<<" "<<min<<endl; | ^~~~ a.cc:11:22: error: 'endl' was not declared in this scope 11 | cout<<max<<" "<<min<<endl; | ^~~~
s701577953
p00005
C++
#include <iostream> using namespace std; int main(){ int a,b,i; while(cin>>a>>b){ int max=0,min; i=1; while(r!=0){ r=x%y; x=y; y=r; } max=x; min=(a/max)*b; cout<<max<<" "<<min<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:8:7: error: 'r' was not declared in this scope 8 | while(r!=0){ | ^ a.cc:9:3: error: 'x' was not declared in this scope 9 | r=x%y; | ^ a.cc:9:5: error: 'y' was not declared in this scope 9 | r=x%y; | ^ a.cc:13:5: error: 'x' was not declared in this scope 13 | max=x; | ^
s760523855
p00005
C++
#include <iostream> using namespace std; int main() { int a,b,c,e,f; while(cin>>a>>b){ int g=0,l=0; e=a; f=b; if(e>f){ e=e-f; } if(f>e){ f=f-e; } if(f==e){ l=e; } if(l!=0)break; cout<<l<<" "<<a*b/l<<endl; } return 0;
a.cc: In function 'int main()': a.cc:22:18: error: expected '}' at end of input 22 | return 0; | ^ a.cc:4:12: note: to match this '{' 4 | int main() { | ^
s276975045
p00005
C++
#include <iostream> using namespace std; long long main() { int a,b,e,f; while(cin>>a>>b){ int l; e=a; f=b; while(1){ if(e>f){ e=e%f; } if(f>e){ f=f%e; } if(f==e){ l=e; cout<<l<<" "<<(a*b)/l<<endl; break; } } } return 0; }
cc1plus: error: '::main' must return 'int'
s575862889
p00005
C++
#include<iostream> #define nijuoku 2000000000 using namespace std; int saidaikouyaku(__int64 a, __int64 b){ int big = max(a,b); int little = min(a,b); for(__int64 i = little; i > 1; --i){ if(little % i == 0 && big % i == 0)return i; } return -1; } int saisyoukoubai(__int64 a, __int64 b){ int big = max(a,b); int little = min(a,b); for(__int64 i = big; i < nijuoku; i += big){ if(i % little == 0)return i; } return -1; }; int main(){ __int64 a, b; while(cin >> a >> b){ cout << saidaikouyaku(a,b) << ' ' << saisyoukoubai(a,b) << endl; } return 0; }
a.cc:7:19: error: '__int64' was not declared in this scope; did you mean '__int64_t'? 7 | int saidaikouyaku(__int64 a, __int64 b){ | ^~~~~~~ | __int64_t a.cc:7:30: error: '__int64' was not declared in this scope; did you mean '__int64_t'? 7 | int saidaikouyaku(__int64 a, __int64 b){ | ^~~~~~~ | __int64_t a.cc:7:39: error: expression list treated as compound expression in initializer [-fpermissive] 7 | int saidaikouyaku(__int64 a, __int64 b){ | ^ a.cc:17:19: error: '__int64' was not declared in this scope; did you mean '__int64_t'? 17 | int saisyoukoubai(__int64 a, __int64 b){ | ^~~~~~~ | __int64_t a.cc:17:30: error: '__int64' was not declared in this scope; did you mean '__int64_t'? 17 | int saisyoukoubai(__int64 a, __int64 b){ | ^~~~~~~ | __int64_t a.cc:17:39: error: expression list treated as compound expression in initializer [-fpermissive] 17 | int saisyoukoubai(__int64 a, __int64 b){ | ^ a.cc: In function 'int main()': a.cc:32:5: error: '__int64' was not declared in this scope; did you mean '__int64_t'? 32 | __int64 a, b; | ^~~~~~~ | __int64_t a.cc:34:18: error: 'a' was not declared in this scope 34 | while(cin >> a >> b){ | ^ a.cc:34:23: error: 'b' was not declared in this scope 34 | while(cin >> a >> b){ | ^ a.cc:35:30: error: 'saidaikouyaku' cannot be used as a function 35 | cout << saidaikouyaku(a,b) << ' ' << saisyoukoubai(a,b) << endl; | ~~~~~~~~~~~~~^~~~~ a.cc:35:59: error: 'saisyoukoubai' cannot be used as a function 35 | cout << saidaikouyaku(a,b) << ' ' << saisyoukoubai(a,b) << endl; | ~~~~~~~~~~~~~^~~~~
s800999833
p00005
C++
#include <iostream> #include <cmath> using namespace std; int rez(int64_t a, int64_t b) { if(b == 0)return a; else return rez(b, a%b); } int main() { while(x != -1) { int a, b; cin >> a >> b; cout << rez(a, b) << (a*b)/rez(a, b) << endl; } }
a.cc: In function 'int main()': a.cc:15:11: error: 'x' was not declared in this scope 15 | while(x != -1) | ^
s638391996
p00005
C++
#include<iostream> using namespace std; int main(){ int a, b, tmp, m=0, s=0, ai, bi; while(cin >> a >> b){ ai=a; bi=b; while(1){ if(a<b){ tmp=a; a=b; b=tmp; } if(a%b==0){ m=b; break; }else a=a%b; } } s=ai*bi/m; cout<< m << " " << s << endl; } return 0; }
a.cc:23:4: error: expected unqualified-id before 'return' 23 | return 0; | ^~~~~~ a.cc:24:1: error: expected declaration before '}' token 24 | } | ^
s707651687
p00005
C++
#include<iostream> using namespace std; int main() { int a,b; while(cin.peek!=EOF) { cin>>a>>b; int w=a,f=b; int temp=a%b; while(temp!=0) { a=b; b=temp; temp=a%b; } cout<<b<<" "<<w/b*f<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:6:13: error: invalid use of member function 'std::basic_istream<_CharT, _Traits>::int_type std::basic_istream<_CharT, _Traits>::peek() [with _CharT = char; _Traits = std::char_traits<char>; int_type = int]' (did you forget the '()' ?) 6 | while(cin.peek!=EOF) | ~~~~^~~~ | ()
s259923349
p00005
C++
#include <iostream> #include <cmath> using namespace std; int main() { // your code goes here int a,b; int miner,maxer; while(cin >> a >> b){ int a2=a,b2=b; while(max(a2,b2)%min(a2,b2)!=0){ if(a2>b2) a2=a2-b2; else b2=b2-a2; } miner =min(a2,b2) cout << miner << endl; cout << a*b/miner << endl; } return 0; }
a.cc: In function 'int main()': a.cc:17:34: error: expected ';' before 'cout' 17 | miner =min(a2,b2) | ^ | ; 18 | cout << miner << endl; | ~~~~
s824585108
p00005
C++
#include <stdio.h> int main( void ){ unsigned float a[20],b[20]; int nCount; for( int i = 0;scanf( "%f %f",&a[i],&b[i] ) != EOF;i++ ) nCount = i; for( int k = 0;k < i;k++ ){ unsigned float buf_a = a[k],buf_b = b[k]; while( buf_a != buf_b ){ if( buf_a < buf_b ) buf_a += a[k]; else buf_b += b[k]; } printf( "%d ",( int )buf_a ); int m,n; if( a[k] < b[k] ) m = b[k],n = a[k]; else if( a[k] > b[k] ) n = b[k],m = a[k]; else { printf( "%d\n",a[k] ); continue; } while( true ){ int buf = n; n = m % n; m = buf; if( n == 0 ) { printf( "%d\n",m ); break; } } } return 0; }
a.cc: In function 'int main()': a.cc:4:5: error: 'unsigned' specified with 'float' 4 | unsigned float a[20],b[20]; | ^~~~~~~~ a.cc:4:5: error: 'unsigned' specified with 'float' a.cc:8:24: error: 'i' was not declared in this scope 8 | for( int k = 0;k < i;k++ ){ | ^ a.cc:9:9: error: 'unsigned' specified with 'float' 9 | unsigned float buf_a = a[k],buf_b = b[k]; | ^~~~~~~~ a.cc:9:9: error: 'unsigned' specified with 'float'
s340035640
p00005
C++
#include <stdio.h> int main( void ){ float a[20],b[20]; int nCount; for( int i = 0;scanf( "%f %f",&a[i],&b[i] ) != EOF;i++ ) nCount = i; for( int k = 0;k < i;k++ ){ float buf_a = a[k],buf_b = b[k]; while( buf_a != buf_b ){ if( buf_a < buf_b ) buf_a += a[k]; else buf_b += b[k]; } printf( "%d ",( int )buf_a ); int m,n; if( a[k] < b[k] ) m = b[k],n = a[k]; else if( a[k] > b[k] ) n = b[k],m = a[k]; else { printf( "%d\n",a[k] ); continue; } while( true ){ int buf = n; n = m % n; m = buf; if( n == 0 ) { printf( "%d\n",m ); break; } } } return 0; }
a.cc: In function 'int main()': a.cc:8:24: error: 'i' was not declared in this scope 8 | for( int k = 0;k < i;k++ ){ | ^
s835320148
p00005
C++
#include <stdio.h> int main( ){ float a[20],b[20]; int nCount; for( int i = 0;scanf( "%f %f",&a[i],&b[i] ) != EOF;i++ ) nCount = i; for( int k = 0;k < i;k++ ){ float buf_a = a[k],buf_b = b[k]; while( buf_a != buf_b ){ if( buf_a < buf_b ) buf_a += a[k]; else buf_b += b[k]; } printf( "%d ",( int )buf_a ); int m,n; if( a[k] < b[k] ) m = b[k],n = a[k]; else if( a[k] > b[k] ) n = b[k],m = a[k]; else { printf( "%d\n",a[k] ); continue; } while( true ){ int buf = n; n = m % n; m = buf; if( n == 0 ) { printf( "%d\n",m ); break; } } } return 0; }
a.cc: In function 'int main()': a.cc:8:24: error: 'i' was not declared in this scope 8 | for( int k = 0;k < i;k++ ){ | ^
s790201513
p00005
C++
#include <stdio.h> int main( ){ float a[20],b[20]; int nCount = 0; while( scanf( "%f %f",&a[nCount],&b[nCount] ) != EOF ){ nCount++; } for( int k = 0;k < i;k++ ){ float buf_a = a[k],buf_b = b[k]; while( buf_a != buf_b ){ if( buf_a < buf_b ) buf_a += a[k]; else buf_b += b[k]; } printf( "%d ",( int )buf_a ); int m,n; if( a[k] < b[k] ) m = b[k],n = a[k]; else if( a[k] > b[k] ) n = b[k],m = a[k]; else { printf( "%d\n",a[k] ); continue; } while( true ){ int buf = n; n = m % n; m = buf; if( n == 0 ) { printf( "%d\n",m ); break; } } } return 0; }
a.cc: In function 'int main()': a.cc:10:24: error: 'i' was not declared in this scope 10 | for( int k = 0;k < i;k++ ){ | ^
s455022496
p00005
C++
#include <stdio.h> int main(){ int buf1[50],buf[50]; int k = 0; while( scanf( "%d %d",&buf1[k],&buf2[k] ) != EOF ) k++; for( int i = 0;i < k;i++ ){ int b1 = buf1[i],b2 = buf2[i]; int m,n; if( b 1< b2 ){ m = b2,n = b1; } else if( b1 > b2 ){ m = b1,n = b2; } else printf( "%d ",b2 ); while( true ){ int buf = n; n = m % n; m = buf; if( n == 0 ){ printf( "%d\n",m ); break; } while( b1 != b2 ){ if( b1 < b2 ) b1 += buf1[i]; else b2 += buf2[i]; } printf( "%d\n",b1 ); } reutrn 0; }
a.cc: In function 'int main()': a.cc:8:37: error: 'buf2' was not declared in this scope; did you mean 'buf'? 8 | while( scanf( "%d %d",&buf1[k],&buf2[k] ) != EOF ) k++; | ^~~~ | buf a.cc:11:31: error: 'buf2' was not declared in this scope; did you mean 'buf'? 11 | int b1 = buf1[i],b2 = buf2[i]; | ^~~~ | buf a.cc:13:13: error: 'b' was not declared in this scope 13 | if( b 1< b2 ){ | ^ a.cc:13:14: error: expected ')' before numeric constant 13 | if( b 1< b2 ){ | ~ ^~ | ) a.cc:33:5: error: 'reutrn' was not declared in this scope 33 | reutrn 0; | ^~~~~~ a.cc:34:2: error: expected '}' at end of input 34 | } | ^ a.cc:3:11: note: to match this '{' 3 | int main(){ | ^
s891831991
p00005
C++
#include <stdio.h> int main(){ int buf1[50],buf2[50]; int k = 0; while( scanf( "%d %d",&buf1[k],&buf2[k] ) != EOF ) k++; for( int i = 0;i < k;i++ ){ int b1 = buf1[i],b2 = buf2[i]; int m,n; if( b 1< b2 ){ m = b2,n = b1; } else if( b1 > b2 ){ m = b1,n = b2; } else printf( "%d ",b2 ); while( true ){ int buf = n; n = m % n; m = buf; if( n == 0 ){ printf( "%d\n",m ); break; } while( b1 != b2 ){ if( b1 < b2 ) b1 += buf1[i]; else b2 += buf2[i]; } printf( "%d\n",b1 ); } reutrn 0; }
a.cc: In function 'int main()': a.cc:13:13: error: 'b' was not declared in this scope 13 | if( b 1< b2 ){ | ^ a.cc:13:14: error: expected ')' before numeric constant 13 | if( b 1< b2 ){ | ~ ^~ | ) a.cc:33:5: error: 'reutrn' was not declared in this scope 33 | reutrn 0; | ^~~~~~ a.cc:34:2: error: expected '}' at end of input 34 | } | ^ a.cc:3:11: note: to match this '{' 3 | int main(){ | ^
s324343970
p00005
C++
#include <stdio.h> int main(){ int buf1[50],buf2[50]; int k = 0; while( scanf( "%d %d",&buf1[k],&buf2[k] ) != EOF ) k++; for( int i = 0;i < k;i++ ){ int b1 = buf1[i],b2 = buf2[i]; int m,n; if( b 1< b2 ){ m = b2,n = b1; } else if( b1 > b2 ){ m = b1,n = b2; } else printf( "%d ",b2 ); while( true ){ int buf = n; n = m % n; m = buf; if( n == 0 ){ printf( "%d\n",m ); break; } } while( b1 != b2 ){ if( b1 < b2 ) b1 += buf1[i]; else b2 += buf2[i]; } printf( "%d\n",b1 ); } reutrn 0; }
a.cc: In function 'int main()': a.cc:13:13: error: 'b' was not declared in this scope 13 | if( b 1< b2 ){ | ^ a.cc:13:14: error: expected ')' before numeric constant 13 | if( b 1< b2 ){ | ~ ^~ | ) a.cc:34:5: error: 'reutrn' was not declared in this scope 34 | reutrn 0; | ^~~~~~
s752340636
p00005
C++
#include <stdio.h> int main(){ int buf1[50],buf2[50]; int k = 0; while( scanf( "%d %d",&buf1[k],&buf2[k] ) != EOF ) k++; for( int i = 0;i < k;i++ ){ int b1 = buf1[i],b2 = buf2[i]; int m,n; if( b1< b2 ){ m = b2,n = b1; } else if( b1 > b2 ){ m = b1,n = b2; } else printf( "%d ",b2 ); while( true ){ int buf = n; n = m % n; m = buf; if( n == 0 ){ printf( "%d\n",m ); break; } while( b1 != b2 ){ if( b1 < b2 ) b1 += buf1[i]; else b2 += buf2[i]; } printf( "%d\n",b1 ); } return 0; }
a.cc: In function 'int main()': a.cc:34:2: error: expected '}' at end of input 34 | } | ^ a.cc:3:11: note: to match this '{' 3 | int main(){ | ^
s366287213
p00005
C++
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 #include <stdio.h> int main(){ int buf1[50],buf2[50]; int k = 0; while( scanf( "%d %d",&buf1[k],&buf2[k] ) != EOF ) k++; for( int i = 0;i < k;i++ ){ int b1 = buf1[i],b2 = buf2[i]; int m,n; if( b1< b2 ){ m = b2,n = b1; } else if( b1 > b2 ){ m = b1,n = b2; } else { n = 0; m = b1; } while( n != 0 ){ int buf = n; n = m % n; m = buf; } printf( "%d ",m ); while( b1 != b2 ){ if( b1 < b2 ) b1 += buf1[i]; else b2 += buf2[i]; } printf( "%d\n",b1 ); } return 0; }
a.cc:2:1: error: expected unqualified-id before numeric constant 2 | 11 | ^~ a.cc: In function 'int main()': a.cc:36:12: error: 'scanf' was not declared in this scope 36 | while( scanf( "%d %d",&buf1[k],&buf2[k] ) != EOF ) k++; | ^~~~~ a.cc:55:9: error: 'printf' was not declared in this scope 55 | printf( "%d ",m ); | ^~~~~~ a.cc:30:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' 29 | #include <stdio.h> +++ |+#include <cstdio> 30 |
s496492149
p00005
C++
#include <algorithm> #include <iostream> int main() { long long a, b; while (std::cin >> a >> b) { std::cout << __gcd(a,b) << " " << a / __gcd(a,b) * b << "\n"; } }
a.cc: In function 'int main()': a.cc:6:30: error: '__gcd' was not declared in this scope; did you mean 'std::__gcd'? 6 | std::cout << __gcd(a,b) << " " << a / __gcd(a,b) * b << "\n"; | ^~~~~ | std::__gcd In file included from /usr/include/c++/14/algorithm:61, from a.cc:1: /usr/include/c++/14/bits/stl_algo.h:1137:5: note: 'std::__gcd' declared here 1137 | __gcd(_EuclideanRingElement __m, _EuclideanRingElement __n) | ^~~~~
s264374596
p00005
C++
#include <iostream> inline u_long lcm(u_long a, u_long b) { return a * b / std::__gcd(a, b); } int main(void) { u_long a, b; while (std::cin >> a >> b) { std::cout << std::__gcd(a, b) << " " << lcm(a,b) << std::endl; } return 0; }
a.cc: In function 'u_long lcm(u_long, u_long)': a.cc:4:25: error: '__gcd' is not a member of 'std' 4 | return a * b / std::__gcd(a, b); | ^~~~~ a.cc: In function 'int main()': a.cc:11:27: error: '__gcd' is not a member of 'std' 11 | std::cout << std::__gcd(a, b) << " " << lcm(a,b) << std::endl; | ^~~~~
s850337386
p00005
C++
#include<iostream> using namespace std; //最大公約数 int gcd(int a, int b) { int r; while((r = a % b) != 0) { a = b; b = r; } return b; } //最小公倍数 nt lcm(int a, int b) { return (a * b / gcd(a,b)); } int main(){ int a,b; while(cin >> a >> b){ if(a == -1 or b == -1) break; while(a <= 0 or b <= 0){ cin >> a >> b; } if(a > 0 and b > 0){ cout << gcd(a,b) << lcm(a,b); } } return 0; }
a.cc:18:1: error: 'nt' does not name a type; did you mean 'int'? 18 | nt lcm(int a, int b) | ^~ | int a.cc: In function 'int main()': a.cc:35:29: error: 'lcm' was not declared in this scope 35 | cout << gcd(a,b) << lcm(a,b); | ^~~
s775857779
p00005
C++
#include<iostream> int gcd(int a, int b){ while((a % b) != 0) { a = b; b = (a % b); } return b; } int lcm(int a, int b){ return ((a / gcd(a, b)) * b); } int main(){ int a,b; while(cin >> a >> b){ if(a == -1 or b == -1) break; std::cin >> a >> b; std::cout << gcd(a, b) << " " << lcm(a, b)<< std::endl; } return 0; }
a.cc: In function 'int main()': a.cc:17:11: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 17 | while(cin >> a >> b){ | ^~~ | std::cin In file included from a.cc:1: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~
s407398129
p00005
C++
#include<iostream> int gcd(int a, int b){ while((a % b) != 0) { a = b; b = (a % b); } return b; } int lcm(int a, int b){ return ((a / gcd(a, b)) * b); } int main(){ int a,b; while(std::cin >> a >> b){ if(a == -1 or b == -1) break; cin >> a >> b; std::cout << gcd(a, b) << " " << lcm(a, b)<< std::endl; } return 0; }
a.cc: In function 'int main()': a.cc:19:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 19 | cin >> a >> b; | ^~~ | std::cin In file included from a.cc:1: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~
s944792847
p00005
C++
#include<iostream> int gcd(int a, int b){ while((int remainder = a % b) != 0) { a = b; b = remainder; } return b; } int lcm(int a, int b){ return ((a / gcd(a, b)) * b); } int main(){ int a,b; while(std::cin >> a >> b){ if(a == -1 or b == -1) break; std::cout << gcd(a, b) << " " << lcm(a, b)<< std::endl; } return 0; }
a.cc: In function 'int gcd(int, int)': a.cc:4:12: error: expected primary-expression before 'int' 4 | while((int remainder = a % b) != 0) { | ^~~ a.cc:4:12: error: expected ')' before 'int' 4 | while((int remainder = a % b) != 0) { | ~^~~ | ) a.cc:7:6: error: expected ')' before 'return' 7 | } | ^ | ) 8 | return b; | ~~~~~~ a.cc:4:10: note: to match this '(' 4 | while((int remainder = a % b) != 0) { | ^ a.cc:9:1: warning: control reaches end of non-void function [-Wreturn-type] 9 | } | ^
s390327934
p00005
C++
#include<iostream> int gcd(int a, int b){ while((int remainder = (a % b)) != 0) { a = b; b = remainder; } return b; } int lcm(int a, int b){ return ((a / gcd(a, b)) * b); } int main(){ int a,b; while(std::cin >> a >> b){ if(a == -1 or b == -1) break; std::cout << gcd(a, b) << " " << lcm(a, b)<< std::endl; } return 0; }
a.cc: In function 'int gcd(int, int)': a.cc:4:12: error: expected primary-expression before 'int' 4 | while((int remainder = (a % b)) != 0) { | ^~~ a.cc:4:12: error: expected ')' before 'int' 4 | while((int remainder = (a % b)) != 0) { | ~^~~ | ) a.cc:7:6: error: expected ')' before 'return' 7 | } | ^ | ) 8 | return b; | ~~~~~~ a.cc:4:10: note: to match this '(' 4 | while((int remainder = (a % b)) != 0) { | ^ a.cc:9:1: warning: control reaches end of non-void function [-Wreturn-type] 9 | } | ^
s791763713
p00005
C++
#include <iostream> #include <algorithm> #define MAX 50000 using namespace std; int p[MAX]; int main() { //素数 fill(p, p + MAX, 1); for (int i = 2; i < MAX; i++){ int sqrti = (int)sqrt(i); for (int j = 2; j <= sqrti; j++){ if (i % j == 0){ p[i] = 0; break; } } } int a, b; while (cin >> a >> b){ int gcm = 1; bool flag = true; while (flag){ for (int i = 2;; i++){ if (p[i] == 1 && a % i == 0 && b % i == 0){ gcm = gcm * i; a = a / i; b = b / i; break; } if (i == min(a, b)){ flag = false; break; } } } int lcm = gcm * a * b; cout << gcm << " " << lcm << endl; } return 0; }
a.cc: In function 'int main()': a.cc:13:34: error: 'sqrt' was not declared in this scope; did you mean 'sqrti'? 13 | int sqrti = (int)sqrt(i); | ^~~~ | sqrti
s312923558
p00006
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class P0006_1 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line = ""; while ((line = br.readLine()) != null && !line.isEmpty()) { char[] str = line.toCharArray(); char c; int u; for (int i = 0; i < str.length / 2; i++) { c = str[i]; u = str.length - 1 - i; str[i] = str[u]; str[u] = c; } System.out.println(str); } } }
Main.java:5: error: class P0006_1 is public, should be declared in a file named P0006_1.java public class P0006_1 { ^ 1 error
s864244737
p00006
Java
import java.io.*; import java.lang.*; public class Test { public static void main(String[] args) throws IOException { BufferedReader buf = new BufferedReader(new InputStreamReader(System.in)); StringBuffer s = new StringBuffer(buf.readLine()); String sun = s.reverse().toString(); System.out.println(sun); } }
Main.java:5: error: class Test is public, should be declared in a file named Test.java public class Test { ^ 1 error
s462190088
p00006
Java
import java.util.*; class Main { final private static BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); final private static StringBuilder sb = new StringBuilder(); public statics void main(final String[] args) { final String line = in.nextLine(); for (int i = line.length() - 1; 0 <= i; --i) { sb.append(line.charAt(i)); } System.out.println(sb); } }
Main.java:6: error: <identifier> expected public statics void main(final String[] args) { ^ 1 error
s253335032
p00006
Java
import java.util.*; class Main { final private static BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); final private static StringBuilder sb = new StringBuilder(); public static void main(final String[] args) { final String line = in.nextLine(); for (int i = line.length() - 1; 0 <= i; --i) { sb.append(line.charAt(i)); } System.out.println(sb); } }
Main.java:4: error: cannot find symbol final private static BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class BufferedReader location: class Main Main.java:4: error: cannot find symbol final private static BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class BufferedReader location: class Main Main.java:4: error: cannot find symbol final private static BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class InputStreamReader location: class Main 3 errors
s199259085
p00006
Java
import java.util.*; import java.io.*; class Main { final private static BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); final private static StringBuilder sb = new StringBuilder(); public static void main(final String[] args) { final String line = in.nextLine(); for (int i = line.length() - 1; 0 <= i; --i) { sb.append(line.charAt(i)); } System.out.println(sb); } }
Main.java:9: error: cannot find symbol final String line = in.nextLine(); ^ symbol: method nextLine() location: variable in of type BufferedReader 1 error
s743419664
p00006
Java
import java.util.*; import java.io.*; class Main { final private static BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); final private static StringBuilder sb = new StringBuilder(); public static void main(final String[] args) { final String line = in.readLine(); for (int i = line.length() - 1; 0 <= i; --i) { sb.append(line.charAt(i)); } System.out.println(sb); } }
Main.java:9: error: unreported exception IOException; must be caught or declared to be thrown final String line = in.readLine(); ^ 1 error
s646664327
p00006
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; class Main { public static void main(String[] arg) throws NumberFormatException, IOException { InputStreamReader file = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(new FileReader(file)); String line = br.readLine(); br.close(); printReverseString(line); } private static void printReverseString(String line) { for(int i = line.length() - 1; i > -1; i--) { System.out.print(line.charAt(i)); } } }
Main.java:9: error: cannot find symbol BufferedReader br = new BufferedReader(new FileReader(file)); ^ symbol: class FileReader location: class Main 1 error
s421278364
p00006
Java
import java.io.*; public class Str_Reverse{ public static void main(String[] args){ InputStreamReader isr = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(isr); String line; while((line=br.readLine())!=null){ StringBuffer reverse = new StringBuffer().append(line); System.out.print(reverse.reverse()+"\n"); } } }
Main.java:3: error: class Str_Reverse is public, should be declared in a file named Str_Reverse.java public class Str_Reverse{ ^ 1 error
s102816994
p00006
Java
import java.io.*; public class Str_Reverse{ public static void main(String[] args)throws IOException{ InputStreamReader isr = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(isr); String line; while((line=br.readLine())!=null){ StringBuffer reverse = new StringBuffer().append(line); System.out.print(reverse.reverse()+"\n"); } } }
Main.java:3: error: class Str_Reverse is public, should be declared in a file named Str_Reverse.java public class Str_Reverse{ ^ 1 error
s045492728
p00006
Java
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner ab = new Scanner(System.in); String arr = ab.next(); for (int i = arr.length() - 1; i >= 0 ; i--) { char arr2 = arr.charAt(i); System.out.print(arr2); } System.out.println(); } }
Main.java:3: error: class Solution is public, should be declared in a file named Solution.java public class Solution { ^ 1 error
s037029372
p00006
Java
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner input = new Scanner(System.in); String forward = input.nextLine(); StringBuilder sb = new StringBuilder(); sb.append(forward); String reverse = sb.reverse().toString(); System.out.printf("%s\n",reverse); } }
Main.java:3: error: class Solution is public, should be declared in a file named Solution.java public class Solution { ^ 1 error
s548868084
p00006
Java
import java.util.*; class Main{ public static void main(String[] args){ Scanner sc=new Scanner; String str=sc.next(); char[] c=new char[str.length()]; for(int i=0;i<str.length();i++){ c[i]=str.charAt(i); } for(int i=str.length()-1;i>=0;i--){ System.out.print(c[i]); }
Main.java:5: error: '(' or '[' expected Scanner sc=new Scanner; ^ Main.java:13: error: reached end of file while parsing } ^ 2 errors