submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s147666358
p00005
C++
#include<iostream> #include<cstdio> using namespace std; int gcd(int a,int b) { if (b == 0)return a; else return gcd(b, a %b); } int main() { int a, b; while (scanf_s("%d%d", &a, &b)) { int g = gcd(a, b); int lcm = a / g*b; printf("%d %d\n", g, lcm); } }
a.cc: In function 'int main()': a.cc:15:16: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 15 | while (scanf_s("%d%d", &a, &b)) | ^~~~~~~ | scanf
s105171420
p00005
C++
#include <iostream> #include <cstdio> #include <cmath> #include <vector> #include <queue> #include <map> #include <set> #include <string> #include <algorithm> #include <functional> using namespace std; #define FOR(i,a,b) for (int i=(a);i<(b);i++) #define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--) #define REP(i,n) for (int i=0;i<(n);i++) #define RREP(i,n) for (int i=(n)-1;i>=0;i--) #define INF 1<<30 #define ALEN(ARR) (sizeof(ARR) / sizeof(ARR[0])) #define MP make_pair #define mp make_pair #define pb push_back #define PB push_back #define DEBUG(x) cout<<#x<<": "<<x<<endl #define ll long long #define ull unsigned long long #define MOD 1000000007 int gcd(int a, int b) { if(a < b) swap(a, b); while(b > 0) { int r = a % b; a = b; b = r; } return a; } int lcm(int a, int b) { if(a == 0 || b == 0) { cout << "Error" << endl; return 0; } return (a * b / gcd(a, b)); } int main(){ cin.tie(0); ios::sync_with_stdio(false); cout.precision(16); int a, b; while(cin >> a >> b) cout << gcd(x, y) << " " << lcm(x, y) << endl; return 0; }
a.cc: In function 'int main()': a.cc:53:36: error: 'x' was not declared in this scope 53 | while(cin >> a >> b) cout << gcd(x, y) << " " << lcm(x, y) << endl; | ^ a.cc:53:39: error: 'y' was not declared in this scope 53 | while(cin >> a >> b) cout << gcd(x, y) << " " << lcm(x, y) << endl; | ^
s257176947
p00005
C++
def gcd(a,b) return a if b == 0 gcd(b,a%b) end def lcm(a,b) return a * b / gcd(a,b) end while line = gets a,b = line.split.map(&:to_i) p "#{gcd(a,b)} #{lcm(a,b)}" end
a.cc:1:1: error: 'def' does not name a type 1 | def gcd(a,b) | ^~~
s880404210
p00005
C++
def gcd(a,b) if b==0 a else gcd(b,a%b) end def lcm(a,b){a * b / gcd(a,b)} while line = gets a,b = line.split.map(&:to_i) print gcd(a,b)," ",lcm(a,b),"\n" end
a.cc:1:1: error: 'def' does not name a type 1 | def gcd(a,b) | ^~~ a.cc:8:1: error: expected unqualified-id before 'while' 8 | while line = gets | ^~~~~
s878900054
p00005
C++
#include <stdio.h> int gcd(__int64 a,__int64 b){ return b==0?a:gcd(b,a%b); } __int64 a,b; int main() { while(scanf("%ld%ld",&a,&b) != EOF){ printf("%ld\n%ld\n",gcd(a,b),a * b / gcd(a,b)); } return 0; }
a.cc:2:9: error: '__int64' was not declared in this scope; did you mean '__int64_t'? 2 | int gcd(__int64 a,__int64 b){ | ^~~~~~~ | __int64_t a.cc:2:19: error: '__int64' was not declared in this scope; did you mean '__int64_t'? 2 | int gcd(__int64 a,__int64 b){ | ^~~~~~~ | __int64_t a.cc:2:28: error: expression list treated as compound expression in initializer [-fpermissive] 2 | int gcd(__int64 a,__int64 b){ | ^ a.cc:5:1: error: '__int64' does not name a type; did you mean '__int64_t'? 5 | __int64 a,b; | ^~~~~~~ | __int64_t a.cc: In function 'int main()': a.cc:8:31: error: 'a' was not declared in this scope 8 | while(scanf("%ld%ld",&a,&b) != EOF){ | ^ a.cc:8:34: error: 'b' was not declared in this scope 8 | while(scanf("%ld%ld",&a,&b) != EOF){ | ^ a.cc:9:40: error: 'gcd' cannot be used as a function 9 | printf("%ld\n%ld\n",gcd(a,b),a * b / gcd(a,b)); | ~~~^~~~~ a.cc:9:57: error: 'gcd' cannot be used as a function 9 | printf("%ld\n%ld\n",gcd(a,b),a * b / gcd(a,b)); | ~~~^~~~~
s187705013
p00005
C++
#include <cstdio> #include <iostream> #include <algorithm> using namespace std; ?? int main() { ????????int n, m; ????????while (2 == scanf("%d%d", &n, &m)) { ????????????????printf("%d %d\n", __gcd(n, m), n / __gcd(n, m) * m); ????????} ????????return 0; }
a.cc:5:1: error: expected unqualified-id before '?' token 5 | ?? | ^
s183530265
p00005
C++
#include <iostream> using namespace std; int main(){ int a,a2,i=1,j=1,b,b2; cin>>a>>b; while(1){ a2=a*i; b2=b*j; if(a2==b2)break; else if(a2<b2)#include <iostream> using namespace std; int main(){ int a,a2,i=1,j=1,b,b2; cin>>a>>b; while(1){ a2=a*i; b2=b*j; if(a2==b2)break; else if(a2<b2)#include <iostream> using namespace std; int main(){ int a,a2,i=1,j=1,b,b2; cin>>a>>b; while(1){ a2=a*i; b2=b*j; if(a2==b2)break; else if(a2<b2)#include <iostream> using namespace std; int main(){ int a,a2,i=1,j=1,b,b2; cin>>a>>b; while(1){ a2=a*i; b2=b*j; if(a2==b2)break; else if(a2<b2)#include <iostream> using namespace std; int main(){ int a,a2,i=1,j=1,b,b2; cin>>a>>b; while(1){ a2=a*i; b2=b*j; if(a2==b2)break; else if(a2<b2)#include <iostream> using namespace std; int main(){ int a,a2,i=1,j=1,b,b2; cin>>a>>b; while(1){ a2=a*i; b2=b*j; if(a2==b2)break; else if(a2<b2)#include <iostream> using namespace std; int main(){ int a,a2,i=1,j=1,b,b2; cin>>a>>b; while(1){ a2=a*i; b2=b*j; if(a2==b2)break; else if(a2<b2)#include <iostream> using namespace std; int main(){ int a,a2,i=1,j=1,b,b2; cin>>a>>b; while(1){ a2=a*i; b2=b*j; if(a2==b2)break; else if(a2<b2) i++; else j++; } if(a<b){ for(i=2;i<a+1;i++) if(a%i==0 && b%i==0)break; cout<<i<<endl; } else { for(i=2;i<b+1;i++) if(a%i==0 && b%i==0)break; cout<<i<<endl; } cout<<a2<<endl; return 0; }
a.cc:10:19: error: stray '#' in program 10 | else if(a2<b2)#include <iostream> | ^ a.cc:19:19: error: stray '#' in program 19 | else if(a2<b2)#include <iostream> | ^ a.cc:28:19: error: stray '#' in program 28 | else if(a2<b2)#include <iostream> | ^ a.cc:37:19: error: stray '#' in program 37 | else if(a2<b2)#include <iostream> | ^ a.cc:46:19: error: stray '#' in program 46 | else if(a2<b2)#include <iostream> | ^ a.cc:55:19: error: stray '#' in program 55 | else if(a2<b2)#include <iostream> | ^ a.cc:64:19: error: stray '#' in program 64 | else if(a2<b2)#include <iostream> | ^ a.cc: In function 'int main()': a.cc:10:20: error: 'include' was not declared in this scope 10 | else if(a2<b2)#include <iostream> | ^~~~~~~ a.cc:10:37: error: expected primary-expression before '>' token 10 | else if(a2<b2)#include <iostream> | ^ a.cc:11:1: error: expected primary-expression before 'using' 11 | using namespace std; | ^~~~~ a.cc:12:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 12 | int main(){ | ^~ a.cc:12:9: note: remove parentheses to default-initialize a variable 12 | int main(){ | ^~ | -- a.cc:12:9: note: or replace parentheses with braces to value-initialize a variable a.cc:12:11: error: a function-definition is not allowed here before '{' token 12 | int main(){ | ^ a.cc:90:2: error: expected '}' at end of input 90 | } | ^ a.cc:6:11: note: to match this '{' 6 | while(1){ | ^ a.cc:90:2: error: expected '}' at end of input 90 | } | ^ a.cc:3:11: note: to match this '{' 3 | int main(){ | ^
s322768974
p00005
C++
#include <iostream> using namespace std; int main(){ int a,b,gcd,lcm,tmp,r; while(cin>>num_a>>num_b){ a=num_a,b=num_b; if(a<b){ tmp = a; a = b; b = tmp; } r=a%b; while(r!=0){ a = b; b = r; r = a % b; } gcd = b; lcm = (num_a*num_b)/gcd; cout<<gcd<<" "<<lcm<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:5:12: error: 'num_a' was not declared in this scope 5 | while(cin>>num_a>>num_b){ | ^~~~~ a.cc:5:19: error: 'num_b' was not declared in this scope 5 | while(cin>>num_a>>num_b){ | ^~~~~
s242060842
p00005
C++
#include <iostream> #include <vector> #include <algorithm> #include <fstream> #include <sstream> #include <string> #include <iomanip> #include <math.h> #include <limits> using namespace std; typedef unsigned long long ullong; class cgl { public: ullong gcd(ullong, ullong); ullong lcm(ullong, ullong, ullong); }; ullong cgl::gcd(ullong a, ullong b) { if (a % b == 0) return b; return gcd(b, a % b); } ullong cgl::lcm(ullong a, ullong b, ullong g) { return a * b / g; } int main() { cin.tie(0); ios::sync_with_stdio(false); cgl cg; ullong a, b, g; for (;;) { cin >> a >> b; if (fin.fail()) break; g = cg.gcd(a, b); cout << g << " " << cg.lcm(a, b, g) << endl; } return 0; }
a.cc: In function 'int main()': a.cc:45:21: error: 'fin' was not declared in this scope; did you mean 'sin'? 45 | if (fin.fail()) break; | ^~~ | sin
s046433599
p00005
C++
#include <iostream> #include <stdio.h> using namespace std; __int64 gcd(__int64 a, __int64 b) { if (b == 0) return a; return gcd(b, a % b); } int main() { __int64 a, b, t; while (scanf("%I64d%I64d", &a, &b) != EOF) { if (a < b) t = gcd(b, a); else t = gcd(a, b); printf("%I64d %I64d\n", t, a * b / t); } return 0; }
a.cc:6:1: error: '__int64' does not name a type; did you mean '__int64_t'? 6 | __int64 gcd(__int64 a, __int64 b) | ^~~~~~~ | __int64_t a.cc: In function 'int main()': a.cc:15:9: error: '__int64' was not declared in this scope; did you mean '__int64_t'? 15 | __int64 a, b, t; | ^~~~~~~ | __int64_t a.cc:16:37: error: 'a' was not declared in this scope 16 | while (scanf("%I64d%I64d", &a, &b) != EOF) | ^ a.cc:16:41: error: 'b' was not declared in this scope 16 | while (scanf("%I64d%I64d", &a, &b) != EOF) | ^ a.cc:19:25: error: 't' was not declared in this scope; did you mean 'tm'? 19 | t = gcd(b, a); | ^ | tm a.cc:19:29: error: 'gcd' was not declared in this scope 19 | t = gcd(b, a); | ^~~ a.cc:21:25: error: 't' was not declared in this scope; did you mean 'tm'? 21 | t = gcd(a, b); | ^ | tm a.cc:21:29: error: 'gcd' was not declared in this scope 21 | t = gcd(a, b); | ^~~ a.cc:22:41: error: 't' was not declared in this scope; did you mean 'tm'? 22 | printf("%I64d %I64d\n", t, a * b / t); | ^ | tm
s663800234
p00005
C++
#include<stdio.h> #include<stdlib.h> int main() { log long int num1,num2,num; while(scanf("%lld %lld",num1,&num2)!=EOF){ num=num1*num2; while(num1 !=num2) if(num1>num2) num1=num1-num2; else num2=num2-num1; } printf("%lld %dll\n",num1,num/num1); return 0; }
a.cc: In function 'int main()': a.cc:6:3: error: 'log' was not declared in this scope; did you mean 'long'? 6 | log long int num1,num2,num; | ^~~ | long a.cc:7:27: error: 'num1' was not declared in this scope 7 | while(scanf("%lld %lld",num1,&num2)!=EOF){ | ^~~~ a.cc:7:33: error: 'num2' was not declared in this scope 7 | while(scanf("%lld %lld",num1,&num2)!=EOF){ | ^~~~ a.cc:8:3: error: 'num' was not declared in this scope; did you mean 'enum'? 8 | num=num1*num2; | ^~~ | enum a.cc:15:24: error: 'num1' was not declared in this scope 15 | printf("%lld %dll\n",num1,num/num1); | ^~~~ a.cc:15:29: error: 'num' was not declared in this scope; did you mean 'enum'? 15 | printf("%lld %dll\n",num1,num/num1); | ^~~ | enum
s415545489
p00005
C++
#include<stdio.h> #include<math.h> int main() { long long a,b,g,l,m,n,t; while(scanf("%lld%lld,&a,&b")!=EOF); { m=a; n=b; if(a==0) g=b; else if(b==0) g=b; else { while(n!=0) } } return 0; } }
a.cc: In function 'int main()': a.cc:22:13: error: expected primary-expression before '}' token 22 | } | ^ a.cc: At global scope: a.cc:27:1: error: expected declaration before '}' token 27 | } | ^
s207935167
p00005
C++
#include <iostream> #include <stdio.h> #include <cmath> using namespace std; int d(int n,int m) { int t; while(m!=0) { if(n<m) {t=n;n=m;m=t;} t=m; m=n%m; n=t; } return n; } int main() { int t,n,m; while( scanf("%d %d",&n,&m)) { t=d(n,m); long long l=n/t*m; cout<<k<<" "<<l<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:24:15: error: 'k' was not declared in this scope 24 | cout<<k<<" "<<l<<endl; | ^
s231940926
p00005
C++
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 #include<iostream> #include<string> #include<iomanip> using namespace std; int main(){ int a,b; while(cin>>a>>b){ int x=a,y=b; while(true){ if(x==y) break; if(x>y) x-=y; else if(y>x) y-=x; } cout<<x<<" "; int keep=x; x=a/keep; y=b/keep; cout<<x*y*keep<<endl; } return 0; }
a.cc:2:1: error: expected unqualified-id before numeric constant 2 | 2 | ^ In file included from /usr/include/c++/14/iosfwd:42, from /usr/include/c++/14/ios:40, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:26: /usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type 68 | typedef ptrdiff_t streamsize; // Signed integral type | ^~~~~~~~~ /usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 40 | #include <cwchar> // For mbstate_t +++ |+#include <cstddef> 41 | In file included from /usr/include/c++/14/bits/exception_ptr.h:38, from /usr/include/c++/14/exception:166, from /usr/include/c++/14/ios:41: /usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ In file included from /usr/include/wchar.h:35, from /usr/include/c++/14/cwchar:44, from /usr/include/c++/14/bits/postypes.h:40: /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive] 132 | __attribute__((__externally_visible__)); | ^ /usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive] 134 | __attribute__((__externally_visible__)); | ^ /usr/include/c++/14/new:140:29: error: 'std::size_t' has not been declared 140 | void operator delete(void*, std::size_t) _GLIBCXX_USE_NOEXCEPT | ^~~ /usr/include/c++/14/new:142:31: error: 'std::size_t' has not been declared 142 | void operator delete[](void*, std::size_t) _GLIBCXX_USE_NOEXCEPT | ^~~ /usr/include/c++/14/new:145:26: error: declaration of 'operator new' as non-function 145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~~~~ /usr/include/c++/14/new:145:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:145:52: error: expected primary-expression before 'const' 145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~ /usr/include/c++/14/new:147:26: error: declaration of 'operator new []' as non-function 147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~~~~ /usr/include/c++/14/new:147:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:147:54: error: expected primary-expression before 'const' 147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~ /usr/include/c++/14/new:154:26: error: declaration of 'operator new' as non-function 154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t) | ^~~~~~~~ /usr/include/c++/14/new:154:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:154:68: error: expected primary-expression before ')' token 154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t) | ^ /usr/include/c++/14/new:155:73: error: attributes after parenthesized initializer ignored [-fpermissive] 155 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__)); | ^ /usr/include/c++/14/new:156:26: error: declaration of 'operator new' as non-function 156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~~~~ /usr/include/c++/14/new:156:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:156:68: error: expected primary-expression before ',' token 156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^ /usr/include/c++/14/new:156:70: error: expected primary-expression before 'const' 156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~ /usr/include/c++/14/new:162:26: error: declaration of 'operator new []' as non-function 162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t) | ^~~~~~~~ /usr/include/c++/14/new:162:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:162:70: error: expected primary-expression before ')' token 162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t) | ^ /usr/include/c++/14/new:163:73: error: attributes after parenthesized initializer ignored [-fpermissive] 163 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__)); | ^ /usr/include/c++/14/new:164:26: error: declaration of 'operator new []' as non-function 164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~~~~ /usr/include/c++/14/new:164:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:164:70: error: expected primary-expression before ',' token 164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) | ^ /usr/include/c++/14/new:164:72: error: expected primary-expression before 'const' 164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~ /usr/include/c++/14/new:171:29: error: 'std::size_t' has not been declared 171 | void operator delete(void*, std::size_t, std::align_val_t) | ^~~ /usr/include/c++/14/new:173:31: error: 'std::size_t' has not been declared 173 | void operator delete[](void*, std::size_t, std::align_val_t) | ^~~ /usr/include/c++/14/new:179:33: error: declaration of 'operator new' as non-function 179 | _GLIBCXX_NODISCARD inline void* operator new(std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT | ^~~~~~~~ /usr/include/c++/14/new:179:51: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 179 | _GLIBCXX_NODI
s721109757
p00005
C++
// GCDandLCM.cpp : ??????????????? ??¢????????±????????§????????¨????????? ????????????????????????????????? // #include "stdafx.h" #include <iostream> #include <iomanip> using namespace std; double eucAlg(int a,int b); int main(int argc, char* argv[]) { double a,b; //??\?????? double c, d; //?????? while(cin >> a >> b){ c = eucAlg(a, b); d = a * b / c; cout << fixed << setprecision(0) << c << " " << d << endl; } return 0; } //?????????????????????????????? double eucAlg( int a, int b ) { double c; do { c = a % b; if(c == 0){ break; } a = b; b = c; }while(1); return b; }
a.cc:4:10: fatal error: stdafx.h: No such file or directory 4 | #include "stdafx.h" | ^~~~~~~~~~ compilation terminated.
s756872054
p00005
C++
import java.util.*; class Main { public static int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); } public static void main(String[] args) { Scanner scanner = new Scanner(System.in); while (scanner.hasNext()) { int a = scanner.nextInt(); int b = scanner.nextInt(); int g = gcd(a, b); System.out.println(g + " " + a / g * b); } } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.*; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:4:15: error: expected ':' before 'static' 4 | public static int gcd(int a, int b) { | ^~~~~~~ | : a.cc:7:15: error: expected ':' before 'static' 7 | public static void main(String[] args) { | ^~~~~~~ | : a.cc:7:33: error: 'String' has not been declared 7 | public static void main(String[] args) { | ^~~~~~ a.cc:7:42: error: expected ',' or '...' before 'args' 7 | public static void main(String[] args) { | ^~~~ a.cc:16:2: error: expected ';' after class definition 16 | } | ^ | ; a.cc: In static member function 'static void Main::main(int*)': a.cc:8:17: error: 'Scanner' was not declared in this scope 8 | Scanner scanner = new Scanner(System.in); | ^~~~~~~ a.cc:9:24: error: 'scanner' was not declared in this scope 9 | while (scanner.hasNext()) { | ^~~~~~~ a.cc:13:25: error: 'System' was not declared in this scope 13 | System.out.println(g + " " + a / g * b); | ^~~~~~
s213725174
p00005
C++
#include<iostream> using namespace std; int gcd(int a,int b){ while(a>0&&b>0){ if(a>b) a%=b; else b%=a; } if(a==0) return b; else return a; } int main(){ int a,b; while(cin>>a>>b){ int c=gcd(a,b); lcm=a*b/c; cout<<c<<" "<<lcm<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:19:9: error: 'lcm' was not declared in this scope 19 | lcm=a*b/c; | ^~~
s509166175
p00005
C++
#include<iostream> using namespace std; int a,b; int gcd(int x,int y){ a=x; b=y; while(a>0&&b>0){ if(a>b) a%=b; else b%=a; } if(a==0) return b; else if(b==0) return a; } int main(){ while(cin>>x>>y){ int c=gcd(x,y); int lcm=(x*y)/c; cout<<c<<" "<<lcm<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:20:16: error: 'x' was not declared in this scope 20 | while(cin>>x>>y){ | ^ a.cc:20:19: error: 'y' was not declared in this scope 20 | while(cin>>x>>y){ | ^ a.cc: In function 'int gcd(int, int)': a.cc:17:1: warning: control reaches end of non-void function [-Wreturn-type] 17 | } | ^
s238603430
p00005
C++
#include<iostream> #include<stdio.h> using namespace std; typedef __int64 ll; ll gcd(ll a,ll b){ return (b==0)?a:gcd(b,a%b); } ll lcm(ll a,ll b){ return a/gcd(a,b)*b; } int main(){ ll a,b; while(scanf("%I64d %I64d",&a,&b)!=EOF){ cout<<gcd(a,b)<<" "<<lcm(a,b)<<endl; } return 0; }
a.cc:4:9: error: '__int64' does not name a type; did you mean '__int64_t'? 4 | typedef __int64 ll; | ^~~~~~~ | __int64_t a.cc:5:1: error: 'll' does not name a type 5 | ll gcd(ll a,ll b){ | ^~ a.cc:8:1: error: 'll' does not name a type 8 | ll lcm(ll a,ll b){ | ^~ a.cc: In function 'int main()': a.cc:12:5: error: 'll' was not declared in this scope 12 | ll a,b; | ^~ a.cc:13:32: error: 'a' was not declared in this scope 13 | while(scanf("%I64d %I64d",&a,&b)!=EOF){ | ^ a.cc:13:35: error: 'b' was not declared in this scope 13 | while(scanf("%I64d %I64d",&a,&b)!=EOF){ | ^ a.cc:14:15: error: 'gcd' was not declared in this scope 14 | cout<<gcd(a,b)<<" "<<lcm(a,b)<<endl; | ^~~ a.cc:14:30: error: 'lcm' was not declared in this scope 14 | cout<<gcd(a,b)<<" "<<lcm(a,b)<<endl; | ^~~
s110678745
p00005
C++
#include <iostream> using namespace std; int gcd(int a; int b){ if(b>0){ return gcd(b, a%b); } else{ return a; } } 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) << " " << lem(a,b) << endl; } }
a.cc:5:14: error: expected ')' before ';' token 5 | int gcd(int a; int b){ | ~ ^ | ) a.cc:5:21: error: expected initializer before ')' token 5 | int gcd(int a; int b){ | ^ a.cc: In function 'int lcm(int, int)': a.cc:15:23: error: too many arguments to function 'int gcd(int)' 15 | return ((a/gcd(a,b)) *b); | ~~~^~~~~ a.cc:5:5: note: declared here 5 | int gcd(int a; int b){ | ^~~ a.cc: In function 'int main()': a.cc:22:28: error: too many arguments to function 'int gcd(int)' 22 | cout << gcd(a,b) << " " << lem(a,b) << endl; | ~~~^~~~~ a.cc:5:5: note: declared here 5 | int gcd(int a; int b){ | ^~~ a.cc:22:44: error: 'lem' was not declared in this scope; did you mean 'lcm'? 22 | cout << gcd(a,b) << " " << lem(a,b) << endl; | ^~~ | lcm
s599733578
p00005
C++
#include <iostream> using namespace std; int gcd(int a; int b){ if(b>0){ return gcd(b, a%b); } else{ return a; } } 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; } }
a.cc:5:14: error: expected ')' before ';' token 5 | int gcd(int a; int b){ | ~ ^ | ) a.cc:5:21: error: expected initializer before ')' token 5 | int gcd(int a; int b){ | ^ a.cc: In function 'int lcm(int, int)': a.cc:15:23: error: too many arguments to function 'int gcd(int)' 15 | return ((a/gcd(a,b)) *b); | ~~~^~~~~ a.cc:5:5: note: declared here 5 | int gcd(int a; int b){ | ^~~ a.cc: In function 'int main()': a.cc:22:28: error: too many arguments to function 'int gcd(int)' 22 | cout << gcd(a,b) << " " << lcm(a,b) << endl; | ~~~^~~~~ a.cc:5:5: note: declared here 5 | int gcd(int a; int b){ | ^~~
s731974013
p00005
C++
#include <math.h> #include <algorithm> #include <iomanip> using namespace std; int main(){ long long int x, y; while (cin >> x >> y) { long long int a, b, c; a = max(x, y); b = min(x, y); c = a % b; while (c) { a = b; b = c; c = a % b; } cout << b << ' ' << x * y / b << endl; } return 0; }
a.cc: In function 'int main()': a.cc:8:16: error: 'cin' was not declared in this scope 8 | while (cin >> x >> y) { | ^~~ a.cc:4:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 3 | #include <iomanip> +++ |+#include <iostream> 4 | using namespace std; a.cc:18:17: error: 'cout' was not declared in this scope 18 | cout << b << ' ' << x * y / b << endl; | ^~~~ a.cc:18:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
s588589040
p00005
C++
#include<cstdio> #include<iostream> #include <algorithm> using namespace std; int main() { long a, b; while (cin >> a >> b) { cout << __gcd(a, b) << " " << a * b / gcd(a, b) << endl; } }
a.cc: In function 'int main()': a.cc:11:55: error: 'gcd' was not declared in this scope 11 | cout << __gcd(a, b) << " " << a * b / gcd(a, b) << endl; | ^~~
s912851466
p00005
C++
#include<cstdio> #include<iostream> #include <algorithm> using namespace std; int main() { long int a, b; while (cin >> a >> b) { cout << __gcd(a, b) << " " << a * b / gcd(a, b) << endl; } }
a.cc: In function 'int main()': a.cc:10:55: error: 'gcd' was not declared in this scope 10 | cout << __gcd(a, b) << " " << a * b / gcd(a, b) << endl; | ^~~
s446752936
p00005
C++
#include<cstdio> #include<iostream> #include <algorithm> using namespace std; int main() { long int a, b; while (cin >> a >> b) { cout << __gcd(a, b) << " " << a / gcd(a, b) * b << endl; } }
a.cc: In function 'int main()': a.cc:10:51: error: 'gcd' was not declared in this scope 10 | cout << __gcd(a, b) << " " << a / gcd(a, b) * b << endl; | ^~~
s707937723
p00005
C++
using System; using System.Linq; public class Test { public static int gcd(int x, int y) { if(y == 0) return x; return gcd(y, x % y); } public static int lcm(int x, int y) { return x / gcd(x, y) * y; } public static void Main() { string buf; while(!string.IsNullOrEmpty(buf = Console.ReadLine())) { string[] sc = buf.Split(); int a = int.Parse(sc[0]), b = int.Parse(sc[1]); Console.WriteLine(gcd(a, b) + " " + lcm(a, b)); } } }
a.cc:1:7: error: expected nested-name-specifier before 'System' 1 | using System; | ^~~~~~ a.cc:2:7: error: expected nested-name-specifier before 'System' 2 | using System.Linq; | ^~~~~~ a.cc:3:1: error: expected unqualified-id before 'public' 3 | public class Test { | ^~~~~~
s016274321
p00005
C++
#include <cstdio> #include <iostream> #include <algorithm> using namespace std; int main() { int n, m; while (2 == scanf("%d%d", &n, &m)) { printf("%d %d\n", __gcd(n, m), n / __lcm(n, m)); } return 0; }
a.cc: In function 'int main()': a.cc:9:44: error: '__lcm' was not declared in this scope 9 | printf("%d %d\n", __gcd(n, m), n / __lcm(n, m)); | ^~~~~
s614533548
p00005
C++
#include <cstdio> #include <iostream> #include <algorithm> using namespace std; int main() { int n, m; while (2 == scanf("%d%d", &n, &m)) { printf("%d %d\n", __gcd(n, m), n / __lcm(n, m)); } return 0; }
a.cc: In function 'int main()': a.cc:9:44: error: '__lcm' was not declared in this scope 9 | printf("%d %d\n", __gcd(n, m), n / __lcm(n, m)); | ^~~~~
s532417580
p00005
C++
#include<iostream> using namespace std; int main(){ int a,b,x; long long c; cin >> a >> b; c=a*b; if(a>=b){ x=a; a=b; b=x%b; } else if(a<b){ b=a%b; } while(b>0){ x=a; a=b; b=x%b; } cout << a << " " << c/a << endl; retern 0; }
a.cc: In function 'int main()': a.cc:22:5: error: 'retern' was not declared in this scope; did you mean 'extern'? 22 | retern 0; | ^~~~~~ | extern
s765126570
p00005
C++
#include<iostream> using namespace std; int main(){ int a,b,x; long long c; cin >> a >> b; c=a*b; if(a>=b){ x=a; a=b; b=x%b; } else if(a<b){ b=a%b; } while(b>0){ x=a; a=b; b=x%b; } cout << a << " " << c/a << endl; retern 0; }
a.cc: In function 'int main()': a.cc:22:5: error: 'retern' was not declared in this scope; did you mean 'extern'? 22 | retern 0; | ^~~~~~ | extern
s006427305
p00005
C++
#include <iostream> using namespace std; typedef long long ll; ll gcd(ll a,ll b) { return b>0?gcd(b,a%b):a; } ll lcm(ll a,ll b) { return a/gcd(a,b)*b; } int main() { ll a,b; while ((cin>>a>>b)>0) { ll GCD=gcd(a,b); cout<<GCD<<" "<<a/GCD*b<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:16:23: error: no match for 'operator>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'int') 16 | while ((cin>>a>>b)>0) | ~~~~~~~~~~~^~ | | | | | int | std::basic_istream<char>::__istream_type {aka std::basic_istream<char>} a.cc:16:23: note: candidate: 'operator>(int, int)' (built-in) 16 | while ((cin>>a>>b)>0) | ~~~~~~~~~~~^~ a.cc:16:23: note: no known conversion for argument 1 from 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'int' In file included from /usr/include/c++/14/string:48, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_iterator.h:462:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 462 | operator>(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:462:5: note: template argument deduction/substitution failed: a.cc:16:24: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 16 | while ((cin>>a>>b)>0) | ^ /usr/include/c++/14/bits/stl_iterator.h:507:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 507 | operator>(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:507:5: note: template argument deduction/substitution failed: a.cc:16:24: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 16 | while ((cin>>a>>b)>0) | ^ /usr/include/c++/14/bits/stl_iterator.h:1714:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1714 | operator>(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1714:5: note: template argument deduction/substitution failed: a.cc:16:24: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 16 | while ((cin>>a>>b)>0) | ^ /usr/include/c++/14/bits/stl_iterator.h:1774:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1774 | operator>(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1774:5: note: template argument deduction/substitution failed: a.cc:16:24: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 16 | while ((cin>>a>>b)>0) | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h:1058:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1058 | operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1058:5: note: template argument deduction/substitution failed: a.cc:16:24: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::pair<_T1, _T2>' 16 | while ((cin>>a>>b)>0) | ^ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:695:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 695 | operator> (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:695:5: note: template argument deduction/substitution failed: a.cc:16:24: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 16 | while ((cin>>a>>b)>0) | ^ /usr/include/c++/14/string_view:702:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 702 | operator> (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:702:5: note: template argument deduction/substitution failed: a.cc:16:24: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 16 | while ((cin>>a>>b)>0) | ^ /usr/include/c++/14/string_view:710:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 710 | operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:710:5: note: template argument deduction/substitution failed: a.cc:16:24: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int' 16 | while ((cin>>a>>b)>0) | ^ /usr/include/c++/14/bits/basic_string.h:3915:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3915 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3915:5: note: template argument deduction/substitution failed: a.cc:16:24: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 16 | while ((cin>>a>>b)>0) | ^ /usr/include/c++/14/bits/basic_string.h:3929:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3929 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3929:5: note: template argument deduction/substitution failed: a.cc:16:24: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 16 | while ((cin>>a>>b)>0) | ^ /usr/include/c++/14/bits/basic_string.h:3942:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3942 | operator>(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3942:5: note: template argument deduction/substitution failed: a.cc:16:24: note: mismatched types 'const _CharT*' and 'std::basic_istream<char>' 16 | while ((cin>>a>>b)>0) | ^ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2619:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator>(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2619 | operator>(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2619:5: note: template argument deduction/substitution failed: a.cc:16:24: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::tuple<_UTypes ...>' 16 | while ((cin>>a>>b)>0) | ^
s899779768
p00005
C++
#include<iostream> #include<algorithm> using namespace std; int main(){ int a, b, min ,max, gcd, lcm; while(cin >> a >> b){ min = min(a, b); max = max(a, b); for(int i = 0; i < min; i++){ if(min % i == 0 && max % i == 0) gcd = i; } while(1){ int i = 1; if( (max * i) % min == 0) { lcm = max *i; break; } else i++; } cout << gcd << " " << lcm << endl; }
a.cc: In function 'int main()': a.cc:10:26: error: 'min' cannot be used as a function 10 | min = min(a, b); | ~~~^~~~~~ a.cc:11:26: error: 'max' cannot be used as a function 11 | max = max(a, b); | ~~~^~~~~~ a.cc:27:2: error: expected '}' at end of input 27 | } | ^ a.cc:5:11: note: to match this '{' 5 | int main(){ | ^
s756815191
p00005
C++
#include<iostream> #include<cmath> using namespace std; int main(){ int a, b, min ,max, gcd, lcm; while(cin >> a >> b){ min = min(a, b); max = max(a, b); for(int i = 0; i < min; i++){ if(min % i == 0 && max % i == 0) gcd = i; } while(1){ int i = 1; if( (max * i) % min == 0) { lcm = max *i; break; } else i++; } cout << gcd << " " << lcm << endl; }
a.cc: In function 'int main()': a.cc:10:26: error: 'min' cannot be used as a function 10 | min = min(a, b); | ~~~^~~~~~ a.cc:11:26: error: 'max' cannot be used as a function 11 | max = max(a, b); | ~~~^~~~~~ a.cc:27:2: error: expected '}' at end of input 27 | } | ^ a.cc:5:11: note: to match this '{' 5 | int main(){ | ^
s716090284
p00005
C++
#include<iostream> #include<algorithm> using namespace std; int main(){ int a, b, min ,max, gcd, lcm; while(cin >> a >> b){ min = min(a, b); max = max(a, b); for(int i = 0; i < min; i++){ if(min % i == 0 && max % i == 0) gcd = i; } while(1){ int i = 1; if( (max * i) % min == 0) { lcm = max *i; break; } else i++; } } cout << gcd << " " << lcm << endl; }
a.cc: In function 'int main()': a.cc:10:26: error: 'min' cannot be used as a function 10 | min = min(a, b); | ~~~^~~~~~ a.cc:11:26: error: 'max' cannot be used as a function 11 | max = max(a, b); | ~~~^~~~~~
s851821001
p00005
C++
#include<iostream> #include<algorithm> #include<cmath> using namespace std; int main(){ int a, b, min ,max, gcd, lcm; while(cin >> a >> b){ min = min(a, b); max = max(a, b); for(int i = 0; i < min; i++){ if(min % i == 0 && max % i == 0) gcd = i; } while(1){ int i = 1; if( (max * i) % min == 0) { lcm = max *i; break; } else i++; } } cout << gcd << " " << lcm << endl; }
a.cc: In function 'int main()': a.cc:11:26: error: 'min' cannot be used as a function 11 | min = min(a, b); | ~~~^~~~~~ a.cc:12:26: error: 'max' cannot be used as a function 12 | max = max(a, b); | ~~~^~~~~~
s601053258
p00005
C++
#include<iostream> using namespace std; int main(){ int a, b; while(cin >> a >> b){ int max = max(a,b); int min = min(a,b); int gcd = 0, lcm = 0; for(int i = 0; i < min; i++){ if(max % i == 0) gcd = i; } int j = 1; while(1){ if((max * j) % min == 0){ lcm = max * j; break; } else{ i++; } } cout << gcd << " " << lcm << endl; } }
a.cc: In function 'int main()': a.cc:8:18: error: 'max' cannot be used as a function 8 | int max = max(a,b); | ~~~^~~~~ a.cc:9:18: error: 'min' cannot be used as a function 9 | int min = min(a,b); | ~~~^~~~~ a.cc:25:9: error: 'i' was not declared in this scope 25 | i++; | ^
s019900515
p00005
C++
#include<iostream> #include<algorithm> using namespace std; int main(){ int a, b; while(cin >> a >> b){ int max = max(a,b); int min = min(a,b); int gcd = 0, lcm = 0; for(int i = 0; i < min; i++){ if(max % i == 0) gcd = i; } int j = 1; while(1){ if((max * j) % min == 0){ lcm = max * j; break; } else{ i++; } } cout << gcd << " " << lcm << endl; } }
a.cc: In function 'int main()': a.cc:9:18: error: 'max' cannot be used as a function 9 | int max = max(a,b); | ~~~^~~~~ a.cc:10:18: error: 'min' cannot be used as a function 10 | int min = min(a,b); | ~~~^~~~~ a.cc:26:9: error: 'i' was not declared in this scope 26 | i++; | ^
s145257136
p00005
C++
#include<iostream> #include<algorithm> #include<cmath> using namespace std; int main(){ int a, b; while(cin >> a >> b){ int max = max(a,b); int min = min(a,b); int gcd = 0, lcm = 0; for(int i = 0; i < min; i++){ if(max % i == 0) gcd = i; } int j = 1; while(1){ if((max * j) % min == 0){ lcm = max * j; break; } else{ i++; } } cout << gcd << " " << lcm << endl; } }
a.cc: In function 'int main()': a.cc:10:18: error: 'max' cannot be used as a function 10 | int max = max(a,b); | ~~~^~~~~ a.cc:11:18: error: 'min' cannot be used as a function 11 | int min = min(a,b); | ~~~^~~~~ a.cc:28:9: error: 'i' was not declared in this scope 28 | i++; | ^
s752564478
p00005
C++
#include<iostream> #include<algorithm> #include<cmath> using namespace std; int main(){ int a, b; while(cin >> a >> b){ int max = max(a, b); int min = min(a, b); long gcd = 0, lcm = 0; for(int i = 0; i < min; i++){ if(max % i == 0) gcd = i; } int j = 1; while(1){ if((max * j) % min == 0){ lcm = max * j; break; } else{ i++; } } cout << gcd << " " << lcm << endl; } }
a.cc: In function 'int main()': a.cc:10:18: error: 'max' cannot be used as a function 10 | int max = max(a, b); | ~~~^~~~~~ a.cc:11:18: error: 'min' cannot be used as a function 11 | int min = min(a, b); | ~~~^~~~~~ a.cc:28:9: error: 'i' was not declared in this scope 28 | i++; | ^
s047712870
p00005
C++
#include<iostream> #include<algorithm> #include<cmath> using namespace std; int main(){ int a, b; while(cin >> a >> b){ int max = max(a, b); int min = min(a, b); long gcd = 0, lcm = 0; for(int i = 0; i < min; i++){ if(max % i == 0) gcd = i; } int j = 1; while(1){ if((max * j) % min == 0){ lcm = max * j; break; } else{ j++; } } cout << gcd << " " << lcm << endl; } }
a.cc: In function 'int main()': a.cc:10:18: error: 'max' cannot be used as a function 10 | int max = max(a, b); | ~~~^~~~~~ a.cc:11:18: error: 'min' cannot be used as a function 11 | int min = min(a, b); | ~~~^~~~~~
s962122688
p00005
C++
#include<iostream> #include <cstdio> #include <algorithm> using namespace std; int main() { int a, b, c=1, GCD, LCM , d,???e; while (cin >> a >> b) { d = a; e = b; while (c) { c = a % b; if (c == 0) { GCD = b; break; } else { a = b; b = c; } } d /= GCD; e /= GCD; LCM = d*e*GCD; cout << GCD << " " << LCM << endl; c = 1; } return 0; }
a.cc: In function 'int main()': a.cc:10:37: error: expected unqualified-id before '?' token 10 | int a, b, c=1, GCD, LCM , d,???e; | ^ a.cc:14:17: error: 'e' was not declared in this scope 14 | e = b; | ^
s931529483
p00005
C++
#include<stdio.h> int main(){ long a,b,m,l; while(scanf("%d %d",&a,%b)!=EOF){ m = a%b; l = a*b; while(m){ a = b; b = m; m = a%b; } printf("%d %d\n",b,l/b); } }
a.cc: In function 'int main()': a.cc:4:26: error: expected primary-expression before '%' token 4 | while(scanf("%d %d",&a,%b)!=EOF){ | ^
s147944529
p00005
C++
//0005 #include <bits/stdc++.h> using namespace std; int main(){ double a,b; while(cin>>a>>b){ cout<<gcd(a,b)<<" "<<a / gcd(a,b) * b <<endl; } return 0; }
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:58, from a.cc:2: /usr/include/c++/14/numeric: In instantiation of 'constexpr std::common_type_t<_Mn, _Nn> std::gcd(_Mn, _Nn) [with _Mn = double; _Nn = double; common_type_t<_Mn, _Nn> = double]': a.cc:9:18: required from here 9 | cout<<gcd(a,b)<<" "<<a / gcd(a,b) * b <<endl; | ~~~^~~~~ /usr/include/c++/14/numeric:175:21: error: static assertion failed: std::gcd arguments must be integers 175 | static_assert(is_integral_v<_Mn> && is_integral_v<_Nn>, | ^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/numeric:175:21: note: 'std::is_integral_v<double>' evaluates to false In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/type_traits: In instantiation of 'struct std::make_unsigned<double>': /usr/include/c++/14/type_traits:2076:11: required by substitution of 'template<class _Tp> using std::make_unsigned_t = typename std::make_unsigned::type [with _Tp = double]' 2076 | using make_unsigned_t = typename make_unsigned<_Tp>::type; | ^~~~~~~~~~~~~~~ /usr/include/c++/14/numeric:182:24: required from 'constexpr std::common_type_t<_Mn, _Nn> std::gcd(_Mn, _Nn) [with _Mn = double; _Nn = double; common_type_t<_Mn, _Nn> = double]' 182 | return __detail::__gcd<make_unsigned_t<_Ct>>(__m2, __n2); | ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:9:18: required from here 9 | cout<<gcd(a,b)<<" "<<a / gcd(a,b) * b <<endl; | ~~~^~~~~ /usr/include/c++/14/type_traits:1929:13: error: invalid use of incomplete type 'class std::__make_unsigned_selector<double, false, false>' 1929 | { using type = typename __make_unsigned_selector<_Tp>::__type; }; | ^~~~ /usr/include/c++/14/type_traits:1837:11: note: declaration of 'class std::__make_unsigned_selector<double, false, false>' 1837 | class __make_unsigned_selector; | ^~~~~~~~~~~~~~~~~~~~~~~~
s285018898
p00005
C++
//0005 #include <bits/stdc++.h> using namespace std; int main(){ double a,b; while(cin>>a>>b){ cout<<__gcd(a,b)<<" "<<a / __gcd(a,b) * b <<endl; } return 0; }
In file included from /usr/include/c++/14/algorithm:61, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:2: /usr/include/c++/14/bits/stl_algo.h: In instantiation of '_EuclideanRingElement std::__gcd(_EuclideanRingElement, _EuclideanRingElement) [with _EuclideanRingElement = double]': a.cc:9:20: required from here 9 | cout<<__gcd(a,b)<<" "<<a / __gcd(a,b) * b <<endl; | ~~~~~^~~~~ /usr/include/c++/14/bits/stl_algo.h:1141:43: error: invalid operands of types 'double' and 'double' to binary 'operator%' 1141 | _EuclideanRingElement __t = __m % __n; | ~~~~^~~~~
s858062143
p00005
C++
def get_input(): while True: try: yield ''.join(raw_input()) except EOFError: break if __name__ == '__main__': a = list(get_input()) for n in a: inl=n.split() num=inl[0]+inl[1] l=list(num) time=0 for i in l: time+=1 print time
a.cc:4:19: error: empty character constant 4 | yield ''.join(raw_input()) | ^~ a.cc:8:16: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes 8 | if __name__ == '__main__': | ^~~~~~~~~~ a.cc:1:1: error: 'def' does not name a type 1 | def get_input(): | ^~~
s359522767
p00005
C++
#include <iostream> using namespace std; int gcd(int x,int y){ if(x%y==0) return n; else{ int z=x%y return gcd(y,z); } } int main() { int a,b; int g; long int l; cin >> a >> b; if(a>b) g=gcd(a,b); else if(a<b) g=gcd(b,a); else g=a; l=a*b/g; cout << g << " " << l << " " << endl; return 0; }
a.cc: In function 'int gcd(int, int)': a.cc:5:21: error: 'n' was not declared in this scope 5 | if(x%y==0) return n; | ^ a.cc:8:5: error: expected ',' or ';' before 'return' 8 | return gcd(y,z); | ^~~~~~
s059340251
p00005
C++
#include <iostream> using namespace std; int gcd(int x,int y){ if(x%y==0) return n; else{ int z=x%y return gcd(y,z); } } int main() { int a,b; int g; long int l; cin >> a >> b; if(a>b) g=gcd(a,b); else if(a<b) g=gcd(b,a); else g=a; l=a*b/g; cout << g << " " << l << " " << endl; return 0; }
a.cc: In function 'int gcd(int, int)': a.cc:5:21: error: 'n' was not declared in this scope 5 | if(x%y==0) return n; | ^ a.cc:8:5: error: expected ',' or ';' before 'return' 8 | return gcd(y,z); | ^~~~~~
s214938205
p00005
C++
#include <iostream> using namespace std; int gcd(int x,int y){ if(x%y==0) return n; else{ int z=x%y return gcd(y,z); } } int main() { int a,b; int g; long int l; cin >> a >> b; if(a>b) g=gcd(a,b); else if(a<b) g=gcd(b,a); else g=a; l=a*b/g; cout << g << " " << l << " " << endl; return 0; }
a.cc: In function 'int gcd(int, int)': a.cc:5:21: error: 'n' was not declared in this scope 5 | if(x%y==0) return n; | ^ a.cc:8:5: error: expected ',' or ';' before 'return' 8 | return gcd(y,z); | ^~~~~~
s328055591
p00005
C++
#include <iostream> using namespace std; int gcd(int x,int y){ if(x%y==0) return y; else{ int z=x%y return gcd(y,z); } } int main() { int a,b; int g; long int l; cin >> a >> b; if(a>b) g=gcd(a,b); else if(a<b) g=gcd(b,a); else g=a; l=a*b/g; cout << g << " " << l << " " << endl; return 0; }
a.cc: In function 'int gcd(int, int)': a.cc:8:5: error: expected ',' or ';' before 'return' 8 | return gcd(y,z); | ^~~~~~ a.cc:7:9: warning: control reaches end of non-void function [-Wreturn-type] 7 | int z=x%y | ^
s554801298
p00005
C++
#include <iostream> //std::cout, std::cin #include <string> //std::string,std::to_string(C++11) #include <vector> //std::vector #include <valarray> //std::valarray #include <algorithm> //std::sort #include <ctime> //localtime_s #include <cstdlib> //abs #include <cmath> //abs,std::pow,sqrt,sin,cos,round,floor,ceil #include <fstream> //std::ifstream,std::ofstream #include <iomanip> //std::setprecision,std::setw,std::setfill #include <random> //std::random(C++11) #include <numeric> //std::accumulate #include <functional> //std::greater #include <chrono> //std::chrono(C++11) #include <bitset> //std::bitset #include <queue> //std::queue const static double de_PI = 3.14159265358979323846; const static int de_MOD = 1000000007; const static int de_MAX = 999999999; int Greatest_Common_Divisor(int a, int b) { while (a != 0 && b != 0) { if (a > b) { a = a - b; } else { b = b - a; } } return(a + b); } int main(void) { //std::ifstream in("123.txt"); std::cin.rdbuf(in.rdbuf()); //std::ofstream ofs("456.csv"); //std::chrono::system_clock::time_point t_st = std::chrono::system_clock::now(); unsigned int a = 0, b = 0; std::vector<unsigned int> GCD, LCM; while (std::cin >> a) { std::cin >> b; GCD.push_back(Greatest_Common_Divisor(a, b)); LCM.push_back(unsigned long long(a)*unsigned long long(b) / GCD.back()); } for (int i = 0; i < GCD.size(); i++) { std::cout << GCD[i] << " " << LCM[i] << std::endl; } //std::chrono::system_clock::time_point t_ed = std::chrono::system_clock::now(); //std::cout << std::chrono::duration_cast<std::chrono::milliseconds>(t_ed - t_st).count() << "ms" << std::endl; }
a.cc: In function 'int main()': a.cc:47:31: error: expected primary-expression before 'unsigned' 47 | LCM.push_back(unsigned long long(a)*unsigned long long(b) / GCD.back()); | ^~~~~~~~
s661868116
p00005
C++
File Edit Options Buffers Tools C++ Help const int MAX = (int)1e5 + 5; template<typename T> T gcd(T a, T b) { T c; while (a != 0) { c = a; a = b%a; b = c; } return b; } template<typename T> T lcm(T m, T n) { return ((m / gcd(m, n)) * n); } signed main() { ll a, b; while(cin >> a >> b) { cout << gcd(a,b) << " " << lcm(a,b) << endl; } return 0; }
a.cc:47:1: error: 'File' does not name a type 47 | File Edit Options Buffers Tools C++ Help | ^~~~ a.cc: In function 'int main()': a.cc:67:3: error: 'll' was not declared in this scope 67 | ll a, b; | ^~ a.cc:68:9: error: 'cin' was not declared in this scope 68 | while(cin >> a >> b) { | ^~~ a.cc:68:16: error: 'a' was not declared in this scope 68 | while(cin >> a >> b) { | ^ a.cc:68:21: error: 'b' was not declared in this scope 68 | while(cin >> a >> b) { | ^ a.cc:69:5: error: 'cout' was not declared in this scope 69 | cout << gcd(a,b) << " " << lcm(a,b) << endl; | ^~~~ a.cc:69:44: error: 'endl' was not declared in this scope 69 | cout << gcd(a,b) << " " << lcm(a,b) << endl; | ^~~~
s285375183
p00005
C++
File Edit Options Buffers Tools C++ Help const int MAX = (int)1e5 + 5; template<typename T> T gcd(T a, T b) { T c; while (a != 0) { c = a; a = b%a; b = c; } return b; } template<typename T> T lcm(T m, T n) { return ((m / gcd(m, n)) * n); } signed main() { ll a, b; while(cin >> a >> b) { cout << gcd(a,b) << " " << lcm(a,b) << endl; } return 0; }
a.cc:47:1: error: 'File' does not name a type 47 | File Edit Options Buffers Tools C++ Help | ^~~~ a.cc: In function 'int main()': a.cc:67:3: error: 'll' was not declared in this scope 67 | ll a, b; | ^~ a.cc:68:9: error: 'cin' was not declared in this scope 68 | while(cin >> a >> b) { | ^~~ a.cc:68:16: error: 'a' was not declared in this scope 68 | while(cin >> a >> b) { | ^ a.cc:68:21: error: 'b' was not declared in this scope 68 | while(cin >> a >> b) { | ^ a.cc:69:5: error: 'cout' was not declared in this scope 69 | cout << gcd(a,b) << " " << lcm(a,b) << endl; | ^~~~ a.cc:69:44: error: 'endl' was not declared in this scope 69 | cout << gcd(a,b) << " " << lcm(a,b) << endl; | ^~~~
s162673519
p00005
C++
#include<stdio.h> #include<string.h> int GCD(int x,int y) { if(y==0) return x; return GCD(y,x%y); } int LCM(int x,int y) { return x * y / GCD(x,y); } int main(void) { int a,b; while(scanf("%d %d",&a,&b) != EOF) { if(a<b){ int k = b; b = a; a = k; } printf("%d %d\n",GCD(a,b),LCM(a,b)); } } #include<stdio.h> #include<string.h> int GCD(int x,int y) { if(y==0) return x; return GCD(y,x%y); } int LCM(int x,int y) { return x * y / GCD(x,y); } int main(void) { int a,b; while(scanf("%d %d",&a,&b) != EOF) { if(a<b){ int k = b; b = a; a = k; } printf("%d %d\n",GCD(a,b),LCM(a,b)); } }
a.cc:34:5: error: redefinition of 'int GCD(int, int)' 34 | int GCD(int x,int y) | ^~~ a.cc:4:5: note: 'int GCD(int, int)' previously defined here 4 | int GCD(int x,int y) | ^~~ a.cc:41:5: error: redefinition of 'int LCM(int, int)' 41 | int LCM(int x,int y) | ^~~ a.cc:11:5: note: 'int LCM(int, int)' previously defined here 11 | int LCM(int x,int y) | ^~~ a.cc:48:5: error: redefinition of 'int main()' 48 | int main(void) | ^~~~ a.cc:18:5: note: 'int main()' previously defined here 18 | int main(void) | ^~~~
s714727322
p00005
C++
#include<iostream> using namespace std; int GCD(int n,int m){ if(n<m){ int t; t = m; m = n; n = t; } int i; while(n%m != 0){ i = n%m; n = m; m = i; } return m; } int main(){ int n,m,i=0,a[50],b[50]; while(cin >> n >> m){ a[i] = GCD(n,m); b[i] = n*m/GCD(n,m); i++; n = 0; m = 0; } for(n=0;n<i+1;n++) cout << a[n] << " " << b[n] << endl; ???return 0; }
a.cc: In function 'int main()': a.cc:29:1: error: expected primary-expression before '?' token 29 | ???return 0; | ^ a.cc:29:2: error: expected primary-expression before '?' token 29 | ???return 0; | ^ a.cc:29:3: error: expected primary-expression before '?' token 29 | ???return 0; | ^ a.cc:29:4: error: expected primary-expression before 'return' 29 | ???return 0; | ^~~~~~ a.cc:29:4: error: expected ':' before 'return' 29 | ???return 0; | ^~~~~~ | : a.cc:29:4: error: expected primary-expression before 'return' 29 | ???return 0; | ^~~~~~ a.cc:29:4: error: expected ':' before 'return' 29 | ???return 0; | ^~~~~~ | : a.cc:29:4: error: expected primary-expression before 'return' 29 | ???return 0; | ^~~~~~ a.cc:29:4: error: expected ':' before 'return' 29 | ???return 0; | ^~~~~~ | : a.cc:29:4: error: expected primary-expression before 'return' 29 | ???return 0; | ^~~~~~
s359544681
p00005
C++
#include<iostream> using namespace std; int GCD(int n,int m){ if(n<m){ int t; t = m; m = n; n = t; } int i; while(n%m != 0){ i = n%m; n = m; m = i; } return m; } int main(){ int n,m,i=0,a[50],b[50]; while(cin >> n >> m){ a[i] = GCD(n,m); b[i] = n*m/GCD(n,m); i++; n = 0; m = 0; } for(n=0;n<i+1;n++) cout << a[n] << " " << b[n] << endl; ???return 0; }
a.cc: In function 'int main()': a.cc:29:1: error: expected primary-expression before '?' token 29 | ???return 0; | ^ a.cc:29:2: error: expected primary-expression before '?' token 29 | ???return 0; | ^ a.cc:29:3: error: expected primary-expression before '?' token 29 | ???return 0; | ^ a.cc:29:4: error: expected primary-expression before 'return' 29 | ???return 0; | ^~~~~~ a.cc:29:4: error: expected ':' before 'return' 29 | ???return 0; | ^~~~~~ | : a.cc:29:4: error: expected primary-expression before 'return' 29 | ???return 0; | ^~~~~~ a.cc:29:4: error: expected ':' before 'return' 29 | ???return 0; | ^~~~~~ | : a.cc:29:4: error: expected primary-expression before 'return' 29 | ???return 0; | ^~~~~~ a.cc:29:4: error: expected ':' before 'return' 29 | ???return 0; | ^~~~~~ | : a.cc:29:4: error: expected primary-expression before 'return' 29 | ???return 0; | ^~~~~~
s375335802
p00005
C++
#include <stdio.h> #include <iostream> #include <math.h> int u(int a, int b); int l(int a, int b); int main(){ int a, b; int gcd, lcm; while(scanf("%d", &a)!=EOF){ scanf("%d", &b); gcd = u(a, b); lcd = l(a, b); std::cout << a << " " << b << std::endl; } return 0; } int u(int a, int b){ while(a==1 || b==1){ if(a>=b){ a %= b; }else{ b %= a; } } if(a==1) return b; else return a; } int l(int a, int b){ int i = 2; while(1){ if(a%i==0){ if(b%i==0) return i; else i++; }else{ i++; } } }
a.cc: In function 'int main()': a.cc:15:5: error: 'lcd' was not declared in this scope; did you mean 'lcm'? 15 | lcd = l(a, b); | ^~~ | lcm
s683112218
p00005
C++
#include <stdio.h> #include <math.h> int u(int a, int b); int l(int a, int b); int main(){ int a, b; int gcd, lcm; while(scanf("%d", &a)!=EOF){ scanf("%d", &b); //gcd = u(a, b); / lcm = l(a, b); //printf("%d %d\n",gcd, lcm); //std::cout << gcd << " " << lcm << std::endl; } return 0; } int u(int a, int b){ while(a==1 || b==1){ if(a>=b){ a = a % b; }else{ b = b % a; } } if(a==1){return b;} else{return a;} } int l(int a, int b){ int i = 2; while(1){ if(a%i==0){ if(b%i==0){return i;} else{i++;} }else{ i++; } } }
a.cc: In function 'int main()': a.cc:14:3: error: expected primary-expression before '/' token 14 | / lcm = l(a, b); | ^
s506870609
p00005
C++
#include <stdio.h> #include <math.h> int u(int a, int b); int l(int a, int b, int gcd); int main(){ int a, b; int gcd, lcm; while(scanf("%d", &a)!=EOF){ scanf("%d", &b); gcd = u(a, b); lcm = l(a, b, gcd); std::cout << gcd << " " << lcm << std::endl; } return 0; } int u(int a, int b){ while(1){ if(a==1) return b; else return a; if(a>=b){ a = a % b; }else{ b = b % a; } } } int l(int a, int b, int gcd){ return a*b/gcd; }
a.cc: In function 'int main()': a.cc:15:10: error: 'cout' is not a member of 'std' 15 | std::cout << gcd << " " << lcm << std::endl; | ^~~~ a.cc:3:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 2 | #include <math.h> +++ |+#include <iostream> 3 | a.cc:15:44: error: 'endl' is not a member of 'std' 15 | std::cout << gcd << " " << lcm << std::endl; | ^~~~ a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 2 | #include <math.h> +++ |+#include <ostream> 3 |
s478482007
p00005
C++
#include <stdio.h> #include <math.h> int u(int a, int b); int l(int a, int b, int gcd); int main(){ int a, b; int gcd, lcm; while(scanf("%d", &a)!=EOF){ scanf("%d", &b); gcd = u(a, b); lcm = l(a, b, gcd); std::cout << gcd << " " << lcm << std::endl; } return 0; } int u(int a, int b){ while(1){ if(a==1) return b; else return a; if(a>=b){ a = a % b; }else{ b = b % a; } } } int l(int a, int b, int gcd){ return a*b/gcd; }
a.cc: In function 'int main()': a.cc:15:10: error: 'cout' is not a member of 'std' 15 | std::cout << gcd << " " << lcm << std::endl; | ^~~~ a.cc:3:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 2 | #include <math.h> +++ |+#include <iostream> 3 | a.cc:15:44: error: 'endl' is not a member of 'std' 15 | std::cout << gcd << " " << lcm << std::endl; | ^~~~ a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 2 | #include <math.h> +++ |+#include <ostream> 3 |
s766357858
p00005
C++
#include <stdio.h> #include <math.h> int u(int a, int b); int l(int a, int b, int gcd); int main(){ int a, b; int gcd, lcm; while(scanf("%d", &a)!=EOF){ scanf("%d", &b); gcd = u(a, b); lcm = l(a, b, gcd); std::cout << gcd << " " << lcm << std::endl; } return 0; } int u(int a, int b){ while(1){ if(a==1) return b; else return a; if(a>=b){ a = a % b; }else{ b = b % a; } } } int l(int a, int b, int gcd){ return a * b / gcd; }
a.cc: In function 'int main()': a.cc:15:10: error: 'cout' is not a member of 'std' 15 | std::cout << gcd << " " << lcm << std::endl; | ^~~~ a.cc:3:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 2 | #include <math.h> +++ |+#include <iostream> 3 | a.cc:15:44: error: 'endl' is not a member of 'std' 15 | std::cout << gcd << " " << lcm << std::endl; | ^~~~ a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 2 | #include <math.h> +++ |+#include <ostream> 3 |
s224614669
p00005
C++
#include <iostream> using namespace std; int main(){ int a,b; while(cin >> a >> b){ int gcd = a, lcm; while(a%gcd != 0 || b%gcd != 0) gcd--; lcm = (a\gcd)*(b\gcd)*gcd; cout << gcd <<" "<< lcm << endl; } }
a.cc:9:25: error: stray '\' in program 9 | lcm = (a\gcd)*(b\gcd)*gcd; | ^ a.cc:9:33: error: stray '\' in program 9 | lcm = (a\gcd)*(b\gcd)*gcd; | ^ a.cc: In function 'int main()': a.cc:9:25: error: expected ')' before 'gcd' 9 | lcm = (a\gcd)*(b\gcd)*gcd; | ~ ^~~~ | )
s525718565
p00005
C++
#include <iostream> using namespace std; int main(){ int a,b; while(cin >> a >> b){ int gcd = a, lcm; while(a%gcd != 0 || b%gcd != 0) gcd--; lcm = (a\gcd)*(b\gcd)*gcd; cout << gcd <<" "<< lcm << endl; } return 0; }
a.cc:9:25: error: stray '\' in program 9 | lcm = (a\gcd)*(b\gcd)*gcd; | ^ a.cc:9:33: error: stray '\' in program 9 | lcm = (a\gcd)*(b\gcd)*gcd; | ^ a.cc: In function 'int main()': a.cc:9:25: error: expected ')' before 'gcd' 9 | lcm = (a\gcd)*(b\gcd)*gcd; | ~ ^~~~ | )
s769457057
p00005
C++
#include<iostream> long long gcd (long long a, b) { if(a < b) { int foo = a; a = b; b = foo; } if(a % b == 0) { return b; }else { return gcd(b, a % b); } } int main() { long long a ,b; while (scanf("%ld", &a) != EOF) { scanf("%ld", &b); long long g = gcd(a, b); printf("%ld %.3lf\n", g, a * b / g); } return 0; }
a.cc:4:29: error: 'b' has not been declared 4 | long long gcd (long long a, b) { | ^ a.cc: In function 'long long int gcd(long long int, int)': a.cc:5:10: error: 'b' was not declared in this scope 5 | if(a < b) { | ^ a.cc:11:10: error: 'b' was not declared in this scope 11 | if(a % b == 0) { | ^
s010058310
p00005
C++
#include<iostream> #include<cstdio> long long gcd (long long a, b) { if(a < b) { int foo = a; a = b; b = foo; } if(a % b == 0) { return b; }else { return gcd(b, a % b); } } int main() { long long a ,b; while (scanf("%ld", &a) != EOF) { scanf("%ld", &b); long long g = gcd(a, b); printf("%ld %.3lf\n", g, a * b / g); } return 0; }
a.cc:4:29: error: 'b' has not been declared 4 | long long gcd (long long a, b) { | ^ a.cc: In function 'long long int gcd(long long int, int)': a.cc:5:10: error: 'b' was not declared in this scope 5 | if(a < b) { | ^ a.cc:11:10: error: 'b' was not declared in this scope 11 | if(a % b == 0) { | ^
s937408199
p00005
C++
// // main.c // c // // Created by ????????? on 2016/12/10. // Copyright ?? 2016??´ ?????????. All rights reserved. // #include <stdio.h> #include "0005.h" int main(){ long long a, b, r, lcm, x, y; while (scanf("%lld %lld",&a,&b) != EOF) { x=a; y=b; for (;;) { r=x%y; if (r==0) break; x=y; y=r; } lcm=a*b/y; printf("%lld %lld\n",y,lcm); } return 0; }
a.cc:10:10: fatal error: 0005.h: No such file or directory 10 | #include "0005.h" | ^~~~~~~~ compilation terminated.
s488082940
p00005
C++
import sys def gcd(inta, intb): large = max(inta, intb) small = min(inta,intb) mod = large % small if mod ==0: return small else: return gcd(small, mod) def lcm(inta, intb, intgcd): return (inta * intb // intgcd) sets = sys.stdin.readlines() for line in sets: a, b = map(int, line.split()) c = gcd(a, b) print(c, lcm(a, b, c))
a.cc:1:1: error: 'import' does not name a type 1 | import sys | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
s668513967
p00005
C++
#include<iostream> using namespace std; int main(){ unsigned int a,b,c; int g[50],l[50]; int p; for(int i=0;i<50;i++;){ cin>>a>>b; p=a*b; while(b!=0){ c=b; b=a%b; a=c; } g[i]=a; l[i]=p/g[i]; } for(int i=0;i<50;i++;){ cout<<g[i]<<" "<<l[i]<<endl; } return(0); }
a.cc: In function 'int main()': a.cc:8:25: error: expected ')' before ';' token 8 | for(int i=0;i<50;i++;){ | ~ ^ | ) a.cc:8:26: error: expected primary-expression before ')' token 8 | for(int i=0;i<50;i++;){ | ^ a.cc:19:25: error: expected ')' before ';' token 19 | for(int i=0;i<50;i++;){ | ~ ^ | ) a.cc:19:26: error: expected primary-expression before ')' token 19 | for(int i=0;i<50;i++;){ | ^
s205903517
p00005
C++
#include<iostream> using namespace std; int Gcd(int a,int b){ int c,d; if(b>a){ d=a; a=b; b=d; } while(b!=0){ c=b; b=a%b; a=c; } int g=a; return(g); } int main(){ int m,n; long p; int k; while(cin>>m>>n){ p=m*n; k=Gcd(m,n); cout<<k<<" "<<p/k<<endl; } } }
a.cc:30:1: error: expected declaration before '}' token 30 | } | ^
s395446953
p00005
C++
#include<iostream> using namespace std; int Gcd(int a,int b){ int c,d; if(b>a){ d=a; a=b; b=d; } while(b!=0){ c=b; b=a%b; a=c; } int g=a; return(g); } int main(){ int m,n; long p; int k; while(cin>>m>>n){ p=m*n; k=Gcd(m,n); cout<<k<<" "<<p/k<<endl; } } }
a.cc:30:1: error: expected declaration before '}' token 30 | } | ^
s780461674
p00005
C++
#include<iostream> using namespace std; int main(){ int a,b;cin>>a>>b;cout<<__gcd(a,b)<<" "<<a/__gcd(a,b)*b<<endl;return 0; }
a.cc: In function 'int main()': a.cc:4:25: error: '__gcd' was not declared in this scope 4 | int a,b;cin>>a>>b;cout<<__gcd(a,b)<<" "<<a/__gcd(a,b)*b<<endl;return 0; | ^~~~~
s152794360
p00005
C++
// ConsoleApplication17.cpp : ??????????????? ??¢????????±????????§????????¨????????? ????????????????????????????????? // #include "stdafx.h" #include "iostream" using namespace std; void keisann(int a, int b) { long long ac = a; long long bc = b; bool d = true; do { a = a%b; if (a == 0) { cout << b << " "; cout << (ac*bc) / b << endl; d = false; continue; } b = b%a; if (b == 0) { cout << a << " "; cout << (ac*bc) / a << endl; d = false; continue; } } while (d == true); } int main() { int a, b; while (cin >> a, a != EOF) { cin >> b; if (a > b) { keisann(a, b); } else if (a < b) { int c = a; a = b; b = c; keisann(a, b); } else if (a == b) { cout << a << " " << a << endl; } } return 0; }
a.cc:4:10: fatal error: stdafx.h: No such file or directory 4 | #include "stdafx.h" | ^~~~~~~~~~ compilation terminated.
s700048089
p00005
C++
#include <algorithm> #include <cassert> #include <cctype> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <iterator> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; int main() { long long a, b; while (cin >> a >> b) { int A, B; A = saisho(a,b); B = saidai(a, b); cout << A << " " << B<<endl; } return 0; } int saidai(int N, int M) { int n = N, m = M; int s = 1; while (true) { if ((s*n) % m == 0) { break; } else { s++; } } return s*n; } int saisho(int N, int M) { int n = N, m = M; while (true) { if (n == 0) { return m; break; } if (m == 0) { return n; break; } if (n > m) { n -= m; } else { m -= n; } } }
a.cc: In function 'int main()': a.cc:31:21: error: 'saisho' was not declared in this scope 31 | A = saisho(a,b); | ^~~~~~ a.cc:32:21: error: 'saidai' was not declared in this scope 32 | B = saidai(a, b); | ^~~~~~
s937177859
p00005
C++
#include<iostream> using namespace std; int gcd(int a,int b){ if(b==0) return a; return gcd(b,a%d); } int main(){ while(true){ int a,b; cin >> a >> b; if(cin.eof()) break; int g = gcd(a,b); cout << g << ' ' << a/g*b << endl; } return 0; }
a.cc: In function 'int gcd(int, int)': a.cc:7:24: error: 'd' was not declared in this scope 7 | return gcd(b,a%d); | ^
s439027307
p00005
C++
#include <iostream> using namespace std; int gcd(int a,int b){ if(b==0) return a; return gcd(b,a%b); } int main(){ while(true){ int a,b; cin>a>>b; if(cin.eof()) break; cout<<n_prime[n]<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:14:20: error: no match for 'operator>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int') 14 | cin>a>>b; | ~~~^~~~~ | | | | | int | std::istream {aka std::basic_istream<char>} a.cc:14:20: note: candidate: 'operator>(int, int)' (built-in) 14 | cin>a>>b; | ~~~^~~~~ a.cc:14:20: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int' In file included from /usr/include/c++/14/string:48, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_iterator.h:462:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 462 | operator>(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:462:5: note: template argument deduction/substitution failed: a.cc:14:24: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 14 | cin>a>>b; | ^ /usr/include/c++/14/bits/stl_iterator.h:507:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 507 | operator>(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:507:5: note: template argument deduction/substitution failed: a.cc:14:24: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 14 | cin>a>>b; | ^ /usr/include/c++/14/bits/stl_iterator.h:1714:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1714 | operator>(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1714:5: note: template argument deduction/substitution failed: a.cc:14:24: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 14 | cin>a>>b; | ^ /usr/include/c++/14/bits/stl_iterator.h:1774:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1774 | operator>(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1774:5: note: template argument deduction/substitution failed: a.cc:14:24: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 14 | cin>a>>b; | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h:1058:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1058 | operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1058:5: note: template argument deduction/substitution failed: a.cc:14:24: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::pair<_T1, _T2>' 14 | cin>a>>b; | ^ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:695:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 695 | operator> (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:695:5: note: template argument deduction/substitution failed: a.cc:14:24: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 14 | cin>a>>b; | ^ /usr/include/c++/14/string_view:702:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 702 | operator> (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:702:5: note: template argument deduction/substitution failed: a.cc:14:24: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 14 | cin>a>>b; | ^ /usr/include/c++/14/string_view:710:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 710 | operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:710:5: note: template argument deduction/substitution failed: a.cc:14:24: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int' 14 | cin>a>>b; | ^ /usr/include/c++/14/bits/basic_string.h:3915:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3915 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3915:5: note: template argument deduction/substitution failed: a.cc:14:24: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 14 | cin>a>>b; | ^ /usr/include/c++/14/bits/basic_string.h:3929:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3929 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3929:5: note: template argument deduction/substitution failed: a.cc:14:24: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 14 | cin>a>>b; | ^ /usr/include/c++/14/bits/basic_string.h:3942:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3942 | operator>(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3942:5: note: template argument deduction/substitution failed: a.cc:14:24: note: mismatched types 'const _CharT*' and 'std::basic_istream<char>' 14 | cin>a>>b; | ^ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2619:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator>(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2619 | operator>(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2619:5: note: template argument deduction/substitution failed: a.cc:14:24: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::tuple<_UTypes ...>' 14 | cin>a>>b; | ^ a.cc:19:23: error: 'n_prime' was not declared in this scope 19 | cout<<n_prime[n]<<endl; | ^~~~~~~ a.cc:19:31: error: 'n' was not declared in this scope 19 | cout<<n_prime[n]<<endl; | ^
s845121069
p00005
C++
#include <iostream> using namespace std; int gcd(int a,int b){ if(b==0) return a; return gcd(b,a%b); } int main(){ while(true){ int a,b; cin>a>>b; if(cin.eof()) break; int g=gcd(a,b); cout<<g<<' '<<a/g*b<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:14:20: error: no match for 'operator>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int') 14 | cin>a>>b; | ~~~^~~~~ | | | | | int | std::istream {aka std::basic_istream<char>} a.cc:14:20: note: candidate: 'operator>(int, int)' (built-in) 14 | cin>a>>b; | ~~~^~~~~ a.cc:14:20: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int' In file included from /usr/include/c++/14/string:48, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_iterator.h:462:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 462 | operator>(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:462:5: note: template argument deduction/substitution failed: a.cc:14:24: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 14 | cin>a>>b; | ^ /usr/include/c++/14/bits/stl_iterator.h:507:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 507 | operator>(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:507:5: note: template argument deduction/substitution failed: a.cc:14:24: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 14 | cin>a>>b; | ^ /usr/include/c++/14/bits/stl_iterator.h:1714:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1714 | operator>(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1714:5: note: template argument deduction/substitution failed: a.cc:14:24: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 14 | cin>a>>b; | ^ /usr/include/c++/14/bits/stl_iterator.h:1774:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1774 | operator>(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1774:5: note: template argument deduction/substitution failed: a.cc:14:24: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 14 | cin>a>>b; | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h:1058:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1058 | operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1058:5: note: template argument deduction/substitution failed: a.cc:14:24: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::pair<_T1, _T2>' 14 | cin>a>>b; | ^ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:695:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 695 | operator> (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:695:5: note: template argument deduction/substitution failed: a.cc:14:24: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 14 | cin>a>>b; | ^ /usr/include/c++/14/string_view:702:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 702 | operator> (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:702:5: note: template argument deduction/substitution failed: a.cc:14:24: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 14 | cin>a>>b; | ^ /usr/include/c++/14/string_view:710:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 710 | operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:710:5: note: template argument deduction/substitution failed: a.cc:14:24: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int' 14 | cin>a>>b; | ^ /usr/include/c++/14/bits/basic_string.h:3915:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3915 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3915:5: note: template argument deduction/substitution failed: a.cc:14:24: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 14 | cin>a>>b; | ^ /usr/include/c++/14/bits/basic_string.h:3929:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3929 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3929:5: note: template argument deduction/substitution failed: a.cc:14:24: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 14 | cin>a>>b; | ^ /usr/include/c++/14/bits/basic_string.h:3942:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3942 | operator>(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3942:5: note: template argument deduction/substitution failed: a.cc:14:24: note: mismatched types 'const _CharT*' and 'std::basic_istream<char>' 14 | cin>a>>b; | ^ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2619:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator>(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2619 | operator>(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2619:5: note: template argument deduction/substitution failed: a.cc:14:24: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::tuple<_UTypes ...>' 14 | cin>a>>b; | ^
s627476226
p00005
C++
#include <iostream> using namespace std; int gcd(int a,int b){ if(b==0) return a; return gcd(b,a%b); } int main(){ while(true){ int a,b; cin>a>>b; if(cin.eof()) break; int g=gcd(a,b); cout<<g<<' '<<a/g*b<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:14:20: error: no match for 'operator>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int') 14 | cin>a>>b; | ~~~^~~~~ | | | | | int | std::istream {aka std::basic_istream<char>} a.cc:14:20: note: candidate: 'operator>(int, int)' (built-in) 14 | cin>a>>b; | ~~~^~~~~ a.cc:14:20: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int' In file included from /usr/include/c++/14/string:48, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_iterator.h:462:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 462 | operator>(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:462:5: note: template argument deduction/substitution failed: a.cc:14:24: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 14 | cin>a>>b; | ^ /usr/include/c++/14/bits/stl_iterator.h:507:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 507 | operator>(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:507:5: note: template argument deduction/substitution failed: a.cc:14:24: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 14 | cin>a>>b; | ^ /usr/include/c++/14/bits/stl_iterator.h:1714:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1714 | operator>(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1714:5: note: template argument deduction/substitution failed: a.cc:14:24: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 14 | cin>a>>b; | ^ /usr/include/c++/14/bits/stl_iterator.h:1774:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1774 | operator>(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1774:5: note: template argument deduction/substitution failed: a.cc:14:24: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 14 | cin>a>>b; | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h:1058:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1058 | operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1058:5: note: template argument deduction/substitution failed: a.cc:14:24: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::pair<_T1, _T2>' 14 | cin>a>>b; | ^ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:695:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 695 | operator> (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:695:5: note: template argument deduction/substitution failed: a.cc:14:24: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 14 | cin>a>>b; | ^ /usr/include/c++/14/string_view:702:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 702 | operator> (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:702:5: note: template argument deduction/substitution failed: a.cc:14:24: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 14 | cin>a>>b; | ^ /usr/include/c++/14/string_view:710:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 710 | operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:710:5: note: template argument deduction/substitution failed: a.cc:14:24: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int' 14 | cin>a>>b; | ^ /usr/include/c++/14/bits/basic_string.h:3915:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3915 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3915:5: note: template argument deduction/substitution failed: a.cc:14:24: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 14 | cin>a>>b; | ^ /usr/include/c++/14/bits/basic_string.h:3929:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3929 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3929:5: note: template argument deduction/substitution failed: a.cc:14:24: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 14 | cin>a>>b; | ^ /usr/include/c++/14/bits/basic_string.h:3942:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3942 | operator>(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3942:5: note: template argument deduction/substitution failed: a.cc:14:24: note: mismatched types 'const _CharT*' and 'std::basic_istream<char>' 14 | cin>a>>b; | ^ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2619:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator>(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2619 | operator>(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2619:5: note: template argument deduction/substitution failed: a.cc:14:24: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::tuple<_UTypes ...>' 14 | cin>a>>b; | ^
s596505806
p00005
C++
#include <iostream> using namespace std; int gcd(int m,int n){ if(b==0) return m; return gcd(n,m%n); } int main(){ while(true){ int a,b; cin>a>>b; if(cin.eof()) break; int g=gcd(a,b); cout<<g<<' '<<a/g*b<<endl; } return 0; }
a.cc: In function 'int gcd(int, int)': a.cc:5:12: error: 'b' was not declared in this scope 5 | if(b==0) | ^ a.cc: In function 'int main()': a.cc:14:20: error: no match for 'operator>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int') 14 | cin>a>>b; | ~~~^~~~~ | | | | | int | std::istream {aka std::basic_istream<char>} a.cc:14:20: note: candidate: 'operator>(int, int)' (built-in) 14 | cin>a>>b; | ~~~^~~~~ a.cc:14:20: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int' In file included from /usr/include/c++/14/string:48, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_iterator.h:462:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 462 | operator>(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:462:5: note: template argument deduction/substitution failed: a.cc:14:24: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 14 | cin>a>>b; | ^ /usr/include/c++/14/bits/stl_iterator.h:507:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 507 | operator>(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:507:5: note: template argument deduction/substitution failed: a.cc:14:24: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 14 | cin>a>>b; | ^ /usr/include/c++/14/bits/stl_iterator.h:1714:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1714 | operator>(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1714:5: note: template argument deduction/substitution failed: a.cc:14:24: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 14 | cin>a>>b; | ^ /usr/include/c++/14/bits/stl_iterator.h:1774:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1774 | operator>(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1774:5: note: template argument deduction/substitution failed: a.cc:14:24: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 14 | cin>a>>b; | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h:1058:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1058 | operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1058:5: note: template argument deduction/substitution failed: a.cc:14:24: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::pair<_T1, _T2>' 14 | cin>a>>b; | ^ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:695:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 695 | operator> (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:695:5: note: template argument deduction/substitution failed: a.cc:14:24: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 14 | cin>a>>b; | ^ /usr/include/c++/14/string_view:702:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 702 | operator> (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:702:5: note: template argument deduction/substitution failed: a.cc:14:24: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 14 | cin>a>>b; | ^ /usr/include/c++/14/string_view:710:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 710 | operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:710:5: note: template argument deduction/substitution failed: a.cc:14:24: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int' 14 | cin>a>>b; | ^ /usr/include/c++/14/bits/basic_string.h:3915:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3915 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3915:5: note: template argument deduction/substitution failed: a.cc:14:24: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 14 | cin>a>>b; | ^ /usr/include/c++/14/bits/basic_string.h:3929:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3929 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3929:5: note: template argument deduction/substitution failed: a.cc:14:24: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 14 | cin>a>>b; | ^ /usr/include/c++/14/bits/basic_string.h:3942:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3942 | operator>(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3942:5: note: template argument deduction/substitution failed: a.cc:14:24: note: mismatched types 'const _CharT*' and 'std::basic_istream<char>' 14 | cin>a>>b; | ^ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2619:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator>(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2619 | operator>(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2619:5: note: template argument deduction/substitution failed: a.cc:14:24: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::tuple<_UTypes ...>' 14 | cin>a>>b; | ^
s098891506
p00005
C++
#include <iostream> using namespace std; int gcd(int m,int n){ if(b==0) return m; return gcd(n,m%n); } int main(){ while(true){ int a,b; cin>>a>>b; if(cin.eof()) break; int g=gcd(a,b); cout<<g<<' '<<a/g*b<<endl; } return 0; }
a.cc: In function 'int gcd(int, int)': a.cc:5:12: error: 'b' was not declared in this scope 5 | if(b==0) | ^
s471482762
p00005
C++
#include <iostream> using namespace std; int gcd(int x,int y); int main(){ while(true){ int a,b; cin >> a >> b; if(cin.eof()) break; int c=gcd(a,b); cout << ' ' << a/c*b << endl; } return 0; } int gcd(int x,int y){ if(b==0) return x; return gcd(b,a%b); }
a.cc: In function 'int gcd(int, int)': a.cc:19:7: error: 'b' was not declared in this scope 19 | if(b==0) | ^ a.cc:21:15: error: 'b' was not declared in this scope 21 | return gcd(b,a%b); | ^ a.cc:21:17: error: 'a' was not declared in this scope 21 | return gcd(b,a%b); | ^
s125871500
p00005
C++
include <iostream> int GCD(int a, int b) { while (b!=0) { int r = a%b; a = b; b = r; } return a; } int main() { int a,b; while (std::cin>>a>>b) { int gcd = GCD(a,b); int lcm = a*b/gcd; std::cout << gcd << ' ' << lcm << std::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:12:14: error: 'cin' is not a member of 'std' 12 | while (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 | include <iostream> a.cc:13:13: error: 'GCD' was not declared in this scope 13 | int gcd = GCD(a,b); | ^~~ a.cc:15:8: error: 'cout' is not a member of 'std' 15 | std::cout << gcd << ' ' << lcm << std::endl; | ^~~~ a.cc:15:8: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:15:42: error: 'endl' is not a member of 'std' 15 | std::cout << gcd << ' ' << lcm << 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 | include <iostream>
s408518567
p00005
C++
#include <iostream> int GCD(int a, int b) { while (b != 0) { int r = a%b; a = b; b = r; } return a; } int main() { int a, b; while (std::cin >> a >> b) { int gcd = GCD(a, b); int lcm = round((double)a/gcd*b); std::cout << gcd << ' ' << lcm << std::endl; } return 0; }
a.cc: In function 'int main()': a.cc:14:27: error: 'round' was not declared in this scope 14 | int lcm = round((double)a/gcd*b); | ^~~~~
s649902377
p00005
C++
~/5416061-aoj-0005.rb
a.cc:1:2: error: expected class-name before '/' token 1 | ~/5416061-aoj-0005.rb | ^
s810666428
p00005
C++
ruby 5416061-aoj-0005.rb
a.cc:1:1: error: 'ruby' does not name a type 1 | ruby 5416061-aoj-0005.rb | ^~~~
s626605101
p00005
C++
#include <iostream> #include <string> #include <algorithm> #include <cstdio> #include <vector> #include <queue> #include <set> #include <numeric> #include <cmath> using namespace std; typedef long long int lld; const lld mod = 1e9+7; const lld INF = 1e9; //const lld MAXN = 1e9; int main() { lld a,b; while(cin >> a >> b;) { lld n = min(a,b); lld m = max(a,b); lld gcd = 1; for(int i = 1; i <= n; i++) { if (n % i == 0 && m % i == 0) { gcd = i; } } cout << gcd << endl; cout << n * m / gcd << endl; } return 0; }
a.cc: In function 'int main()': a.cc:22:28: error: expected ')' before ';' token 22 | while(cin >> a >> b;) | ~ ^ | ) a.cc:22:29: error: expected primary-expression before ')' token 22 | while(cin >> a >> b;) | ^
s835790183
p00005
C++
#include <iostream> #include <string> #include <vector> class GcdAndLcm { public: GcdAndLcm() : m_gcd(0), m_lcm(0) {} void Run(); private: void readData(); void GetData(std::string s, int& v1, int& v2); int calcGcd(int m, int n); int calcLcm(int m, int n); void Show(); private: std::vector<std::string> m_data; unsigned int m_gcd; unsigned int m_lcm; }; void GcdAndLcm::Run() { int val1 = 0, val2 = 0; readData(); for (unsigned int i = 0; i < m_data.size(); ++i) { GetData(m_data[i], val1, val2); m_gcd = calcGcd(val1, val2); m_lcm = calcLcm(val1, val2); Show(); } } void GcdAndLcm::readData() { std::string line; while (std::getline(std::cin, line)) { m_data.push_back(line); } } void GcdAndLcm::GetData(std::string s, int& v1, int& v2) { size_t pos = s.find(" "); char tmp[100] = { 0 }; std::strncpy(tmp, s.c_str(), pos); v1 = std::atoi(tmp); std::memset(tmp, 0x00, sizeof(tmp)); pos++; std::strncpy(tmp, s.c_str() + pos, s.size() - pos); v2 = std::atoi(tmp); } int GcdAndLcm::calcGcd(int m, int n) { if ((0 == m) || (0 == n)) return 0; while (m != n) { if (m > n) m = m - n; else n = n - m; } return m; }//gcd int GcdAndLcm::calcLcm(int m, int n) { if ((0 == m) || (0 == n)) return 0; return ((m / calcGcd(m, n)) * n); // lcm = m * n / gcd(m,n) }//lcm void GcdAndLcm::Show() { std::cout << m_gcd << " " << m_lcm << std::endl; } int main() { GcdAndLcm gcdAndLcm; gcdAndLcm.Run(); }
a.cc: In member function 'void GcdAndLcm::GetData(std::string, int&, int&)': a.cc:51:10: error: 'strncpy' is not a member of 'std' 51 | std::strncpy(tmp, s.c_str(), pos); | ^~~~~~~ a.cc:53:10: error: 'memset' is not a member of 'std'; did you mean 'wmemset'? 53 | std::memset(tmp, 0x00, sizeof(tmp)); | ^~~~~~ | wmemset a.cc:55:10: error: 'strncpy' is not a member of 'std' 55 | std::strncpy(tmp, s.c_str() + pos, s.size() - pos); | ^~~~~~~
s447893574
p00005
C++
#include <iostream> #include <string> #include <sstream> #include <vector> //typedef struct //{ // int left_val; // int right_val; //}; class GcdAndLcm { public: GcdAndLcm() : m_gcd(0), m_lcm(0) {} void Run(); private: void readData(); void GetData(std::string s, int& v1, int& v2); int calcGcd(int m, int n); int calcLcm(int m, int n); void Show(); private: std::vector<std::string> m_data; unsigned int m_gcd; unsigned int m_lcm; }; void GcdAndLcm::Run() { int val1 = 0, val2 = 0; readData(); for (unsigned int i = 0; i < m_data.size(); ++i) { GetData(m_data[i], val1, val2); m_gcd = calcGcd(val1, val2); m_lcm = calcLcm(val1, val2); Show(); } } void GcdAndLcm::readData() { std::string line; while (std::getline(std::cin, line)) { m_data.push_back(line); } } void GcdAndLcm::GetData(std::string s, int& v1, int& v2) { size_t pos = s.find(" "); char tmp[100] = { 0 }; std::strncpy(tmp, s.c_str(), pos); v1 = std::atoi(tmp); std::memset(tmp, 0x00, sizeof(tmp)); pos++; std::strncpy(tmp, s.c_str() + pos, s.size() - pos); v2 = std::atoi(tmp); } int GcdAndLcm::calcGcd(int m, int n) { if ((0 == m) || (0 == n)) return 0; while (m != n) { if (m > n) m = m - n; else n = n - m; } return m; }//gcd int GcdAndLcm::calcLcm(int m, int n) { if ((0 == m) || (0 == n)) return 0; return ((m / calcGcd(m, n)) * n); // lcm = m * n / gcd(m,n) }//lcm void GcdAndLcm::Show() { std::cout << m_gcd << " " << m_lcm << std::endl; } int main() { GcdAndLcm gcdAndLcm; gcdAndLcm.Run(); }
a.cc: In member function 'void GcdAndLcm::GetData(std::string, int&, int&)': a.cc:57:10: error: 'strncpy' is not a member of 'std' 57 | std::strncpy(tmp, s.c_str(), pos); | ^~~~~~~ a.cc:59:10: error: 'memset' is not a member of 'std'; did you mean 'wmemset'? 59 | std::memset(tmp, 0x00, sizeof(tmp)); | ^~~~~~ | wmemset a.cc:61:10: error: 'strncpy' is not a member of 'std' 61 | std::strncpy(tmp, s.c_str() + pos, s.size() - pos); | ^~~~~~~
s491235792
p00005
C++
#include <bits/stdc++.h> #include<iostream> using namespace std; int main(){ int i,a,b,c; while(cin>>a>>b){ if(a==b){ cout<<a<<" "<<a<<endl; } else{ if(a<b){ i=b-a; } else{ i=a-b; } for( int j=i;j>0;i-=2){ if(a%i==0 && b%i==0){ c=i; break; } } cout<<c<<" "<<a*b/c<<endl; } } re
a.cc: In function 'int main()': a.cc:26:5: error: 're' was not declared in this scope 26 | re | ^~ a.cc:26:7: error: expected '}' at end of input 26 | re | ^ a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s079011600
p00005
C++
#include<iostream> using namespace std; int main(){ int a,b,g,x,y,L; while(i>50){ cin>>a>>b; a=x;b=y; while(1){ if(x<y){y-x;} else if(x>y){x-y;} else if(x==y){x=g;break;} } L=(a*b)/g; cout<<g<<" "<<L<<endl; ++i; } return 0; }
a.cc: In function 'int main()': a.cc:5:7: error: 'i' was not declared in this scope 5 | while(i>50){ | ^
s793579525
p00005
C++
#include<iostream> using namespace std; int main(){ int a,b,x,y,L,i=0; while(cin>>a>>b){ x=a;y=b; while(1){ if(x<y){y=y-x;} else if(x>y){x=x-y;} else if(x==y){break;} } L=(a*b)/g; cout<<x<<" "<<L<<endl; x=0;y=0; ++i; if(i==49){break;} } return 0; }
a.cc: In function 'int main()': a.cc:12:9: error: 'g' was not declared in this scope 12 | L=(a*b)/g; | ^
s979014030
p00005
C++
#include<iostream> using namespace std; int main(){ int a,b,x,y,L,i=0; while(i=0;i<=50;++i{ cin>>a>>b; x=a;y=b; while(1){ if(x<y){y=y-x;} else if(x>y){x=x-y;} else if(x==y){break;} } L=(a*b)/x; if(x==1){cout<<y<<" "<<y<<endl;} else{cout<<y<<" "<<L<<endl;} } return 0; }
a.cc: In function 'int main()': a.cc:5:10: error: expected ')' before ';' token 5 | while(i=0;i<=50;++i{ | ~ ^ | ) a.cc:5:20: error: expected ';' before '{' token 5 | while(i=0;i<=50;++i{ | ^ | ;
s400756215
p00005
C++
#include<iostream> using namespace std; int main(){ int a,b,x,y,L,i=0; while(i=0;i<=50;++i){ cin>>a>>b; x=a;y=b; while(1){ if(x<y){y=y-x;} else if(x>y){x=x-y;} else if(x==y){break;} } L=(a*b)/x; if(x==1){cout<<y<<" "<<y<<endl;} else{cout<<y<<" "<<L<<endl;} } return 0; }
a.cc: In function 'int main()': a.cc:5:10: error: expected ')' before ';' token 5 | while(i=0;i<=50;++i){ | ~ ^ | ) a.cc:5:20: error: expected ';' before ')' token 5 | while(i=0;i<=50;++i){ | ^ | ;
s875605396
p00005
C++
#include<iostream> using namespace std; int main(){ int a,b,x,y,L,i=0; while(i=0;i<=50;++i){ cin>>a>>b; x=a;y=b; while(1){ if(x<y){y=y-x;} else if(x>y){x=x-y;} else if(x==y){break;} } L=(a*b)/x; if(x==1){cout<<y<<" "<<y<<endl;} else{cout<<y<<" "<<L<<endl;} } return 0; }
a.cc: In function 'int main()': a.cc:5:10: error: expected ')' before ';' token 5 | while(i=0;i<=50;++i){ | ~ ^ | ) a.cc:5:20: error: expected ';' before ')' token 5 | while(i=0;i<=50;++i){ | ^ | ;
s030688854
p00005
C++
#include<iostream> using namespace std; int main(){ int a,b,x,y,L,i; while(cin>>a>>b){ x=a;y=b; while(1){ if(x<y){y=y-x;x=x-y;} else if(x==y){break;} else{x=x-y;y=y-x;} } L=(a*b)/x; cout<<y<<" "<<L<<endl; ++i if(i<=50){break;} } } return 0; }
a.cc: In function 'int main()': a.cc:14:4: error: expected ';' before 'if' 14 | ++i | ^ | ; 15 | if(i<=50){break;} | ~~ a.cc: At global scope: a.cc:18:3: error: expected unqualified-id before 'return' 18 | return 0; | ^~~~~~ a.cc:19:1: error: expected declaration before '}' token 19 | } | ^
s363262011
p00005
C++
#include<iostream> #include<stdio.h> using namespace std; int main(){ int a,b,x,y,L; while(cin>>a>>b){ x=a;y=b; while(1){ if(x==y){break;} else if(x==0)break; else if(y==0)break; else if(x<y){y=y-x;x=x-y;} else{x=x-y;y=y-x;} } (float)L=((float)a*(float)b)/(float)x; cout<<y<<" ";printf("%f",L);cout<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:15:1: error: lvalue required as left operand of assignment 15 | (float)L=((float)a*(float)b)/(float)x; | ^~~~~~~~
s141128856
p00005
C++
import sys def main(): for line in sys.stdin: a,b = map(int, line.split()) if a > b: a,b = b,a p = a * b #product while True: hoge = a a = b % a b = hoge if a == 0: gcd = b break lcm = p // gcd print(gcd, lcm) if __name__ == "__main__": main()
a.cc:7:19: error: stray '#' in program 7 | p = a * b #product | ^ a.cc:1:1: error: 'import' does not name a type 1 | import sys | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
s048003418
p00005
C++
#include<stdio.h> #include<iostream> #include<iomanip> #define ll long long #define REP(i, a) for(int i=0;i<(int)a;++i) using namespace std; ll lcm(ll a, ll b) { return a * (b / __algo_gcd(a, b)); } void solver() { ll a,b; while(cin>>a>>b){ cout<<__algo_gcd(a,b)<<" "<<lcm(a,b)<<endl; } } int main() { solver(); return 0; }
a.cc: In function 'long long int lcm(long long int, long long int)': a.cc:10:21: error: '__algo_gcd' was not declared in this scope 10 | return a * (b / __algo_gcd(a, b)); | ^~~~~~~~~~ a.cc: In function 'void solver()': a.cc:16:15: error: '__algo_gcd' was not declared in this scope 16 | cout<<__algo_gcd(a,b)<<" "<<lcm(a,b)<<endl; | ^~~~~~~~~~
s477087614
p00005
C++
#include<stdio.h> #include<iostream> #include<iomanip> #define ll long long #define REP(i, a) for(int i=0;i<(int)a;++i) using namespace std; ll gcd(ll a, ll b) { if (a < b) swap(a, b); return b == 0 ? a : gcd(b, a % b); } ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); } void solver() { ll a, b; while (cin >> a >> b) { cout << __algo_gcd(a, b) << " " << lcm(a, b) << endl; } } int main() { solver(); return 0; }
a.cc: In function 'void solver()': a.cc:22:17: error: '__algo_gcd' was not declared in this scope 22 | cout << __algo_gcd(a, b) << " " << lcm(a, b) << endl; | ^~~~~~~~~~
s150213711
p00005
C++
nclude <iostream> #include <cstdio> #include <algorithm> using namespace std; int main(){ unsigned long long a,b,c,d,e,f,maxx=0,data,minn=0,data2,m=0,n=0; while (scanf("%llu %llu",&a,&b)!=EOF){ data=max(a,b) for (;;){ if (a%data==0 && b%data==0){ maxx=data; break; } data-=1; } data=min(a,b); data2=max(a,b); while(minn==0){ if (m!=0){ if (data>=data2){ n=data2; data2=data; data=n; } else{ n=data; data=data2; data2=n; } data*=2; m=1; if (data==data2) minn=data; } } cout<<maxx<<" "<<minn<<endl; maxx=0; minn=0; } return 0; }
a.cc:1:1: error: 'nclude' does not name a type 1 | nclude <iostream> | ^~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/algorithm:60, from a.cc:5: /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: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:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ In file included from /usr/include/stdio.h:34, from /usr/include/c++/14/cstdio:42, from a.cc:3: /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /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'; did you mean 'size_t'? 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /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'; did you mean 'size_t'? 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /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'; did you mean 'size_t'? 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /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:2086:26: error: 'std::size_t' has not been declared 2086 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope 2087 | struct remove_extent<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid 2087 | struct remove_extent<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared 2099 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope 2100 | struct remove_all_extents<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid 2100 | struct remove_all_extents<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared 2171 | template<std::size_t _Len> | ^~~ /usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope 2176 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^~~~ /usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^ /usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope 2202 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope 2203 | struct __attribute__((__aligned__((_Align)))) { } __align; | ^~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:65: /usr/include/c++/14/bits/stl_iterator_base_types.h:125:67: error: 'ptrdiff_t' does not name a type 125 | template<typename _Category, typename _Tp, typename _Distance = ptrdiff_t, | ^~~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_types.h:1:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' +++ |+#include <cstddef> 1 | // Types used in iterator implementation -*- C++ -*- /usr/include/c++/14/bits/stl_iterator_base_types.h:214:15: error: 'ptrdiff_t' does not name a type 214 | typedef ptrdiff_t difference_type; | ^~~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_types.h:214:15: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/bits/stl_iterator_base_types.h:225:15: error: 'ptrdiff_t' does not name a type 225 | typedef ptrdiff_t difference_type; | ^~~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_types.h:225:15: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' In file included from /usr/include/c++/14/bits/stl_algobase.h:66: /usr/include/c++/14/bits/stl_iterator_base_funcs.h:112:5: error: 'ptrdiff_t' does not name a type 112 | ptrdiff_t | ^~~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:66:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 65 | #include <debug/assertions.h> +++ |+#include <cstddef> 66 | #include <bits/stl_iterator_base_types.h> /usr/include/c++/14/bits/stl_iterator_base_funcs.h:118:5: error: 'ptrdiff_t' does not name a type 118 | ptrdiff_t | ^~~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:118:5: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' In file included from /usr/include/c++/14/bits/stl_iterator.h:67, from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/ptr_traits.h:156:47: error: 'ptrdiff_t' was not declared in this scope 156
s887643697
p00005
C++
#include<iostream> #include<stdio.h> #include<algorithm> #include<math.h> using namespace std; int main() { int a,b,a1,b1,c; while(scanf("%d%d",&a,&b)!=EOF) { if(a<b) { a1=b; b1=a; } else { a1=a; b1=b; } while(1) { r=a1%b1; if(r==0) break; else { a1=b1; b1=r; } } cout<<r<<" "<<a*b/r<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:23:25: error: 'r' was not declared in this scope 23 | r=a1%b1; | ^ a.cc:32:23: error: 'r' was not declared in this scope 32 | cout<<r<<" "<<a*b/r<<endl; | ^
s813991630
p00005
C++
#include <iostream> #include <algorithm> using namespace std; int GCD(const int& a, const 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 main()': a.cc:15:37: error: expected ';' before ')' token 15 | for (int a, b; cin >> a >> b) { | ^ | ;