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_...
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...
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, f...
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 ma...
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); } retu...
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 << en...
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 n...
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 <...
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:1...
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) << " " << l...
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:1...
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)...
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...
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) { | ...
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,...
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; ///< L...
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...
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); r...
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); ...
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.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); ...
/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 ...
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; } ret...
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 = ...
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; } ret...
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 = ...
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; ...
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; ...
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:2...
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 ...
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(...
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.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 ...
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(~sc...
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 fro...
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=...
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 __g...
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; } re...
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...
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",g...
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); ...
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...
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); ...
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: 'end...
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=...
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=...
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=...
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 ...
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...
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 | voi...
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 ad...
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)...
/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; ...
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...
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; ...
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 7...
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 ...
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 << e...
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...
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...
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) ...
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) | ...
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&&...
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...
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...
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; | ...
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 ...
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(__int6...
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(__i...
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; ...
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 << en...
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...
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++ ){ | ^...
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]; el...
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 ...
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]; ...
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 = ...
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 ...
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 ){ ...
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 ...
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 ){ ...
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 ...
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...
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;...
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 thi...
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...
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) << " " <...
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; ...
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::c...
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 c...
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::c...
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; ...
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 <...
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: e...
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...
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:...
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 >> ...
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.read...
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.pri...
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...
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...
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 BufferedRea...
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(); ...
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(); ...
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)); ...
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.pr...
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)...
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); Syste...
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); Str...
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