submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3
values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s628382567 | p03633 | C++ | #include<bits/stdc++.h>
using namespace std;
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a)*((b)/gcd(a,b)))
int main(){
int n;
cin >> n;
vector<long long> t(n);
for (int i = 0; i < n; ++i) cin >> t[i];
long long t=1;
for (int i = 0; i < n; ++i) t=lcm(t[i],t);
cout << t << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:11:19: error: conflicting declaration 'long long int t'
11 | long long t=1;
| ^
a.cc:9:27: note: previous declaration as 'std::vector<long long int> t'
9 | vector<long long> t(n);
| ^
a.cc:3:24: error: no matching function for call to '__gcd(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type&, std::vector<long long int>&)'
3 | #define gcd(a, b) __gcd(a, b)
| ~~~~~^~~~~~
a.cc:4:29: note: in expansion of macro 'gcd'
4 | #define lcm(a, b) ((a)*((b)/gcd(a,b)))
| ^~~
a.cc:12:39: note: in expansion of macro 'lcm'
12 | for (int i = 0; i < n; ++i) t=lcm(t[i],t);
| ^~~
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:1:
/usr/include/c++/14/bits/stl_algo.h:1137:5: note: candidate: 'template<class _EuclideanRingElement> _EuclideanRingElement std::__gcd(_EuclideanRingElement, _EuclideanRingElement)'
1137 | __gcd(_EuclideanRingElement __m, _EuclideanRingElement __n)
| ^~~~~
/usr/include/c++/14/bits/stl_algo.h:1137:5: note: template argument deduction/substitution failed:
a.cc:3:24: note: deduced conflicting types for parameter '_EuclideanRingElement' ('long long int' and 'std::vector<long long int>')
3 | #define gcd(a, b) __gcd(a, b)
| ~~~~~^~~~~~
a.cc:4:29: note: in expansion of macro 'gcd'
4 | #define lcm(a, b) ((a)*((b)/gcd(a,b)))
| ^~~
a.cc:12:39: note: in expansion of macro 'lcm'
12 | for (int i = 0; i < n; ++i) t=lcm(t[i],t);
| ^~~
a.cc:13:14: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::vector<long long int>')
13 | cout << t << endl;
| ~~~~ ^~ ~
| | |
| | std::vector<long long int>
| std::ostream {aka std::basic_ostream<char>}
In file included from /usr/include/c++/14/istream:41,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'}
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]'
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ^~~~~~~~
/usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'std::ios_base& (*)(std::ios_base&)'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
174 | operator<<(long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'long int'
174 | operator<<(long __n)
| ~~~~~^~~
/usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
178 | operator<<(unsigned long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'long unsigned int'
178 | operator<<(unsigned long __n)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
182 | operator<<(bool __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'bool'
182 | operator<<(bool __n)
| ~~~~~^~~
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]'
96 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'short int'
97 | operator<<(short __n)
| ~~~~~~^~~
/usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
189 | operator<<(unsigned short __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'short unsigned int'
189 | operator<<(unsigned short __n)
| ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]'
110 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'int'
111 | operator<<(int __n)
| ~~~~^~~
/usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
200 | operator<<(unsigned int __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'unsigned int'
200 | operator<<(unsigned int __n)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
211 | operator<<(long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'long long int'
211 | operator<<(long long __n)
| ~~~~~~~~~~^~~
/usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
215 | operator<<(unsigned long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'long long unsigned int'
215 | operator<<(unsigned long long __n)
| ~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
231 | operator<<(double __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'double'
231 | operator<<(double __f)
| ~~~~~~~^~~
/usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits> |
s603665376 | p03633 | C++ | #include<bits/stdc++.h>
using namespace std;
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a)*((b)/gcd(a,b)))
#define ll long long
int main(){
int n;
cin >> n;
vector<ll> t(n);
for (int i = 0; i < n; ++i) cin >> t[i];
ll t=1;
for (int i = 0; i < n; ++i) t=lcm(t[i],t);
cout << t << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:12:12: error: conflicting declaration 'long long int t'
12 | ll t=1;
| ^
a.cc:10:20: note: previous declaration as 'std::vector<long long int> t'
10 | vector<ll> t(n);
| ^
a.cc:3:24: error: no matching function for call to '__gcd(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type&, std::vector<long long int>&)'
3 | #define gcd(a, b) __gcd(a, b)
| ~~~~~^~~~~~
a.cc:4:29: note: in expansion of macro 'gcd'
4 | #define lcm(a, b) ((a)*((b)/gcd(a,b)))
| ^~~
a.cc:13:39: note: in expansion of macro 'lcm'
13 | for (int i = 0; i < n; ++i) t=lcm(t[i],t);
| ^~~
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:1:
/usr/include/c++/14/bits/stl_algo.h:1137:5: note: candidate: 'template<class _EuclideanRingElement> _EuclideanRingElement std::__gcd(_EuclideanRingElement, _EuclideanRingElement)'
1137 | __gcd(_EuclideanRingElement __m, _EuclideanRingElement __n)
| ^~~~~
/usr/include/c++/14/bits/stl_algo.h:1137:5: note: template argument deduction/substitution failed:
a.cc:3:24: note: deduced conflicting types for parameter '_EuclideanRingElement' ('long long int' and 'std::vector<long long int>')
3 | #define gcd(a, b) __gcd(a, b)
| ~~~~~^~~~~~
a.cc:4:29: note: in expansion of macro 'gcd'
4 | #define lcm(a, b) ((a)*((b)/gcd(a,b)))
| ^~~
a.cc:13:39: note: in expansion of macro 'lcm'
13 | for (int i = 0; i < n; ++i) t=lcm(t[i],t);
| ^~~
a.cc:14:14: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::vector<long long int>')
14 | cout << t << endl;
| ~~~~ ^~ ~
| | |
| | std::vector<long long int>
| std::ostream {aka std::basic_ostream<char>}
In file included from /usr/include/c++/14/istream:41,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'}
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]'
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ^~~~~~~~
/usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'std::ios_base& (*)(std::ios_base&)'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
174 | operator<<(long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'long int'
174 | operator<<(long __n)
| ~~~~~^~~
/usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
178 | operator<<(unsigned long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'long unsigned int'
178 | operator<<(unsigned long __n)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
182 | operator<<(bool __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'bool'
182 | operator<<(bool __n)
| ~~~~~^~~
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]'
96 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'short int'
97 | operator<<(short __n)
| ~~~~~~^~~
/usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
189 | operator<<(unsigned short __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'short unsigned int'
189 | operator<<(unsigned short __n)
| ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]'
110 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'int'
111 | operator<<(int __n)
| ~~~~^~~
/usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
200 | operator<<(unsigned int __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'unsigned int'
200 | operator<<(unsigned int __n)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
211 | operator<<(long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'long long int'
211 | operator<<(long long __n)
| ~~~~~~~~~~^~~
/usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
215 | operator<<(unsigned long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'long long unsigned int'
215 | operator<<(unsigned long long __n)
| ~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
231 | operator<<(double __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'double'
231 | operator<<(double __f)
| ~~~~~~~^~~
/usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _ |
s351329681 | p03633 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
vector<int> t(n);
int ans=0;
for (int i=0;i<n;i++){
cin >> t[i];
ans=__lcm(__lcm(t[i],t[i+1]),t[i+2]);
}
cout << ans << endl;
}
| a.cc: In function 'int main()':
a.cc:11:15: error: '__lcm' was not declared in this scope
11 | ans=__lcm(__lcm(t[i],t[i+1]),t[i+2]);
| ^~~~~
a.cc:11:9: error: '__lcm' was not declared in this scope
11 | ans=__lcm(__lcm(t[i],t[i+1]),t[i+2]);
| ^~~~~
|
s042186503 | p03633 | C++ | #include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
ll gcd(ll a,ll b){
if(a%b==0){
return b;
}
else{
return gcd(b,a%b);
}
}
int main() {
ll n;
cin >> n;
vl a(n);
rep(i,n){
cin >> a[i];
}
if(n==1){
cout << a[0] << endl;
}
else{
ll G=gcd(a[0],a[1]);
ans=a[0]*a[1]/G;
FOR(i,2,n){
G=gcd(G,a[i]);
ans=a[i]*/G*ans;
}
cout << G << endl;
}
} | a.cc: In function 'int main()':
a.cc:36:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
36 | ans=a[0]*a[1]/G;
| ^~~
| abs
a.cc:39:16: error: expected primary-expression before '/' token
39 | ans=a[i]*/G*ans;
| ^
|
s976564211 | p03633 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
vector<int64_t> t(n);
int64_t max_time = 1;
for (auto i = 0; i < n; i++) {
cin >> t[i];
max_time = __detail::__lcm(max_time, t[i]);
}
cout << max_time << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:12:30: error: '__lcm' is not a member of 'std::__detail'
12 | max_time = __detail::__lcm(max_time, t[i]);
| ^~~~~
|
s199052283 | p03633 | C | #include<stdio.h>
int main(void) {
int N,i;
int T[100];
scanf("%d",&N);
for(i = 0; i < N; i++) {
scanf("%d", &T[i]);
}
long long ans = T[0];
for (i = 1; i < N; i++) {
ans = ans * T[i] * gcd(ans, T[i]);
}
printf("%lld", ans);
return 0;
}
long long gcd(long long a, int b) {
if (b == 0) return a;
return gcd(b, a % b);
}
| main.c: In function 'main':
main.c:12:36: error: implicit declaration of function 'gcd' [-Wimplicit-function-declaration]
12 | ans = ans * T[i] * gcd(ans, T[i]);
| ^~~
main.c: At top level:
main.c:18:11: error: conflicting types for 'gcd'; have 'long long int(long long int, int)'
18 | long long gcd(long long a, int b) {
| ^~~
main.c:12:36: note: previous implicit declaration of 'gcd' with type 'int()'
12 | ans = ans * T[i] * gcd(ans, T[i]);
| ^~~
|
s146716820 | p03633 | C | int main(void) {
int N,i;
int T[100];
scanf("%d",&N);
for(i = 0; i < N; i++) {
scanf("%d", &T[i]);
}
long long ans = T[0];
for (i = 1; i < N; i++) {
ans = ans * T[i] * gcd(ans, T[i]);
}
printf("%lld", ans);
return 0;
}
long long gcd(long long a, int b) {
if (b == 0) return a;
return gcd(b, a % b);
} | main.c: In function 'main':
main.c:4:5: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
4 | scanf("%d",&N);
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | int main(void) {
main.c:4:5: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
4 | scanf("%d",&N);
| ^~~~~
main.c:4:5: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:10:36: error: implicit declaration of function 'gcd' [-Wimplicit-function-declaration]
10 | ans = ans * T[i] * gcd(ans, T[i]);
| ^~~
main.c:12:9: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
12 | printf("%lld", ans);
| ^~~~~~
main.c:12:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:12:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:12:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c: At top level:
main.c:16:11: error: conflicting types for 'gcd'; have 'long long int(long long int, int)'
16 | long long gcd(long long a, int b) {
| ^~~
main.c:10:36: note: previous implicit declaration of 'gcd' with type 'int()'
10 | ans = ans * T[i] * gcd(ans, T[i]);
| ^~~
|
s692009409 | p03633 | C++ | #include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
using namespace std;
int main(){
int n; long long s = 1; scanf("%d", &n);
vector<long long> v(n);
rep(i, n){
long long a;
scanf("%ld", &a);
v[i] = a;
}
rep(i, n) s = __gcd(s, v[i]) * (v[i] / __gcd(s, v[i]) * (s / __gcd(s, v[i]));
printf("%ld\n", s);
return 0;
}
| a.cc: In function 'int main()':
a.cc:13:79: error: expected ')' before ';' token
13 | rep(i, n) s = __gcd(s, v[i]) * (v[i] / __gcd(s, v[i]) * (s / __gcd(s, v[i]));
| ~ ^
| )
|
s599814721 | p03633 | C++ | #include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
using namespace std;
int main(){
int n; long long s = 1; scanf("%d", &n);
vector<long long> v(n);{
long long a;
rep(i, n) scanf("%ld", &a);
v[i] = a;
}
rep(i, n) s = __gcd(s, v[i]) * (v[i] / __gcd(s, v[i]) * (s / __gcd(s, v[i]));
printf("%ld\n", s);
return 0;
}
| a.cc: In function 'int main()':
a.cc:10:7: error: 'i' was not declared in this scope
10 | v[i] = a;
| ^
a.cc:12:79: error: expected ')' before ';' token
12 | rep(i, n) s = __gcd(s, v[i]) * (v[i] / __gcd(s, v[i]) * (s / __gcd(s, v[i]));
| ~ ^
| )
|
s052490100 | p03633 | C++ | #include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
using namespace std;
int main(){
int n; long long s = 1; scanf("%d", &n);
vector<long long> v(n); rep(i, n) scanf("%ld", &v[i]);
rep(i, n) s = __gcd(s, v[i]) * (v[i] / __gcd(s, v[i]) * (s / __gcd(s, v[i]));
printf("%ld\n", s);
return 0;
}
| a.cc: In function 'int main()':
a.cc:8:79: error: expected ')' before ';' token
8 | rep(i, n) s = __gcd(s, v[i]) * (v[i] / __gcd(s, v[i]) * (s / __gcd(s, v[i]));
| ~ ^
| )
|
s220908890 | p03633 | C++ | #include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
using namespace std;
using lint = long long;
int main(){
int n; lint s = 1; scanf("%d", &n);
vector<lint> v(n); rep(i, n) scanf("%ld", &v[i]);
rep(i, n) s = __gcd(s, v[i]) * (v[i] / __gcd(s, v[i]) * (s / __gcd(s, v[i]));
printf("%ld\n", s);
return 0;
}
| a.cc: In function 'int main()':
a.cc:9:79: error: expected ')' before ';' token
9 | rep(i, n) s = __gcd(s, v[i]) * (v[i] / __gcd(s, v[i]) * (s / __gcd(s, v[i]));
| ~ ^
| )
|
s102015286 | p03633 | C++ | #include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
using namespace std;
using lint = long long;
int main(){
int n; lint s = 1; scanf("%d", &n);
vector<lint> v(n); rep(i, n) scanf("%ld", &v[i]);
rep(i, n) s = __gcd(s, v[i]) * (v[i] / __gcd(s, v[i]) * (s / __gcd(s, v[i]));
printf("%ld\n", s);
return 0;
}
| a.cc: In function 'int main()':
a.cc:9:79: error: expected ')' before ';' token
9 | rep(i, n) s = __gcd(s, v[i]) * (v[i] / __gcd(s, v[i]) * (s / __gcd(s, v[i]));
| ~ ^
| )
|
s394401794 | p03633 | C++ | #include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
using namespace std;
using lint = long long;
int main(){
int n; lint s = 1; scanf("%d", &n);
vector<int> v(n); rep(i, n) scanf("%d", &v[i]);
map<lint, int> m;
rep(i, n){
lint a = v[i];
for(int j = 2; j <= pow(v[i], 0.5); ++j){
lint b = 0;
while(a % j == 0){
a /= j;
++b;
}
if(b != 0) m[j] = max(m[j], b);
if(a == 1) break;
}
if(a != 1 && !m.count(a)) m[a] = 1;
}
for(auto p: m) rep(i, p.second) s *= p.first;
printf("%ld\n", s);
return 0;
}
| a.cc: In function 'int main()':
a.cc:18:28: error: no matching function for call to 'max(std::map<long long int, int>::mapped_type&, lint&)'
18 | if(b != 0) m[j] = max(m[j], b);
| ~~~^~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:18:28: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'lint' {aka 'long long int'})
18 | if(b != 0) m[j] = max(m[j], b);
| ~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:18:28: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
18 | if(b != 0) m[j] = max(m[j], b);
| ~~~^~~~~~~~~
|
s386419167 | p03633 | C++ | #include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
using namespace std;
using lint = long long;
int main(){
int n; lint s = 1; scanf("%d", &n);
vector<int> v(n); rep(i, n) scanf("%d", v[i]);
map<lint, int> m;
rep(i, n){
lint a = v[i];
for(int j = 2; j <= pow(v[i], 0.5); ++j){
lint b = 0;
while(a % j == 0){
a /= j;
++b;
}
if(b != 0) m[j] = max(m[j], b);
if(a == 1) break;
}
if(a != 1 && !m.count(a)) m[a] = 1;
}
for(auto p: m) rep(i, p.second) s *= p.first;
printf("%ld\n", s);
return 0;
}
| a.cc: In function 'int main()':
a.cc:18:28: error: no matching function for call to 'max(std::map<long long int, int>::mapped_type&, lint&)'
18 | if(b != 0) m[j] = max(m[j], b);
| ~~~^~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:18:28: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'lint' {aka 'long long int'})
18 | if(b != 0) m[j] = max(m[j], b);
| ~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:18:28: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
18 | if(b != 0) m[j] = max(m[j], b);
| ~~~^~~~~~~~~
|
s535229662 | p03633 | C++ | #include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
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*b/gcd(a,b);}
int main(){
ll n,t1,t2;
cin>>n>>t1;
if(n==1) cout>>t1>>endl;
else{
cin>>t2;
ll l=lcm(t1,t2);
rep(i,n-2){
cin>>t1;
l=lcm(l,t1);
}
cout<<l<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:12:18: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'll' {aka 'long long int'})
12 | if(n==1) cout>>t1>>endl;
| ~~~~^~~~
| | |
| | ll {aka long long int}
| std::ostream {aka std::basic_ostream<char>}
a.cc:12:18: note: candidate: 'operator>>(int, ll {aka long long int})' (built-in)
12 | if(n==1) cout>>t1>>endl;
| ~~~~^~~~
a.cc:12:18: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int'
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41,
from a.cc:1:
/usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)'
131 | operator>>(byte __b, _IntegerType __shift) noexcept
| ^~~~~~~~
/usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed:
a.cc:12:14: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte'
12 | if(n==1) cout>>t1>>endl;
| ^~~~
In file included from /usr/include/c++/14/string:55,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
835 | operator>>(basic_istream<_CharT, _Traits>& __in,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed:
a.cc:12:20: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
12 | if(n==1) cout>>t1>>endl;
| ^~
/usr/include/c++/14/bitset:1597:5: note: candidate: 'template<class _CharT, class _Traits, long unsigned int _Nb> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, bitset<_Nb>&)'
1597 | operator>>(std::basic_istream<_CharT, _Traits>& __is, bitset<_Nb>& __x)
| ^~~~~~~~
/usr/include/c++/14/bitset:1597:5: note: template argument deduction/substitution failed:
a.cc:12:20: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
12 | if(n==1) cout>>t1>>endl;
| ^~
In file included from /usr/include/c++/14/istream:1109,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)'
978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c)
| ^~~~~~~~
/usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed:
a.cc:12:20: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
12 | if(n==1) cout>>t1>>endl;
| ^~
/usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)'
849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c)
| ^~~~~~~~
/usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed:
a.cc:12:20: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
12 | if(n==1) cout>>t1>>endl;
| ^~
/usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)'
854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c)
| ^~~~~~~~
/usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed:
a.cc:12:20: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
12 | if(n==1) cout>>t1>>endl;
| ^~
/usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)'
896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed:
a.cc:12:20: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
12 | if(n==1) cout>>t1>>endl;
| ^~
/usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)'
939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed:
a.cc:12:20: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
12 | if(n==1) cout>>t1>>endl;
| ^~
/usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)'
945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed:
a.cc:12:20: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
12 | if(n==1) cout>>t1>>endl;
| ^~
/usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)'
1099 | operator>>(_Istream&& __is, _Tp&& __x)
| ^~~~~~~~
/usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = long long int&]':
a.cc:12:20: required from here
12 | if(n==1) cout>>t1>>endl;
| ^~
/usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>'
1099 | operator>>(_Istream&& __is, _Tp&& __x)
| ^~~~~~~~
/usr/include/c++/14/complex:509:5: note: candidate: 'template<class _Tp, class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, complex<_Tp>&)'
509 | operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x)
| ^~~~~~~~
/usr/include/c++/14/complex:509:5: note: template argument deduction/substitution failed:
a.cc:12:20: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
12 | if(n==1) cout>>t1>>endl;
| ^~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:143:
/usr/include/c++/14/iomanip:76:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Resetiosflags)'
76 | operator>>(basic_istream<_CharT, _Traits>& __is, _Resetiosflags __f)
| ^~~~~~~~
/usr/include/c++/14/iomanip:76:5: note: template argument deduction/substitution failed:
a.cc:12:20: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
12 | if(n==1) cout>>t1>>endl;
| ^~
/usr/include/c++/14/iomanip:106:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Setiosflags)'
106 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setiosflags __f)
| ^~~~~~~~
/usr/include/c++/14/iomanip:106:5: note: template argument deduction/substitution failed:
a.cc:12:20: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
12 | if(n==1) cout>>t1>>endl;
| ^~
/usr/include/c++/14/iomanip:137:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Setbase)'
137 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setbase __f)
| ^~~~~~~~
/usr/include/c++/14/iomanip:137:5: note: template argument deduction/substitution failed:
a.cc:12:20: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
12 | if(n==1) cout>>t1>>endl;
| ^~
/usr/include/c++/14/iomanip:177:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Setfill<_CharT>)'
177 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setfill<_CharT> __f)
| ^~~~~~~~
/usr/include/c++/14/iomanip:177:5: note: template argument deduction/substitution failed:
a.cc:12:20: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
12 | if(n==1) cout>>t1>>endl;
| ^~
/usr/include/c++/14/iomanip:207:5: note: candidate: 'template<class _CharT, class _Traits> std::bas |
s917207696 | p03633 | C++ | #include <bits/stdc++.h>
#include <boost/integer/common_factor_rt.hpp> // gcd, lcm
using namespace std;
using ll=long long int;
using ld=long double;
using VI=vector<ll>;
using VD=vector<ld>;
using VVI=vector<VI>;
using VC=vector<char>;
using VVC=vector<VC>;
using VS=vector<string>;
using PLL =pair<ll,ll>;
using PLD=pair<ld,ld>;
using VPLL=vector<PLL>;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element((x).begin(),(x).end())
#define MIN(x) *min_element((x).begin(),(x).end())
#define SORTR(x) sort((x).rbegin(),(x).rend())
#define SORT(x) sort((x).begin(),(x).end())
#define SUM(x) accumulate((x).begin(),(x).end(), 0)
#define FILL(x,a) fill(x.begin(),x.end(),a)
#define EACH(i,x) for(typeof((x).begin()) i=(x).begin(); i!=(x).end(); ++i)
const int INF = 1<<30;
const ld EPS = 1e-10;
const int MOD = int(1e9)+7;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template <class BidirectionalIterator>
bool next_partial_permutation(BidirectionalIterator first, BidirectionalIterator middle,BidirectionalIterator last){reverse(middle, last); return next_permutation(first , last);}
#define COUT(x) cout<<x<<"\n"
void Main()
{
ll N;
ll result=0;
string S;
cin>>N;
VI T(N);
REP(i, N) cin >> T[i];
result= boost::integer::lcm_range(ALL(T)).first;
cout << result << "\n";
return;
}
int main()
{
std::cin.tie(0);
std::ios_base::sync_with_stdio(false);
std::cout << std::fixed << std::setprecision(15);
Main();
}
| a.cc:2:10: fatal error: boost/integer/common_factor_rt.hpp: No such file or directory
2 | #include <boost/integer/common_factor_rt.hpp> // gcd, lcm
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
|
s728411999 | p03633 | C++ | #include <bits/stdc++.h>
#include <boost/integer/common_factor_rt.hpp> // gcd, lcm
using namespace std;
using ll=long long int;
using ld=long double;
using VI=vector<ll>;
using VD=vector<ld>;
using VVI=vector<VI>;
using VC=vector<char>;
using VVC=vector<VC>;
using VS=vector<string>;
using PLL =pair<ll,ll>;
using PLD=pair<ld,ld>;
using VPLL=vector<PLL>;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element((x).begin(),(x).end())
#define MIN(x) *min_element((x).begin(),(x).end())
#define SORTR(x) sort((x).rbegin(),(x).rend())
#define SORT(x) sort((x).begin(),(x).end())
#define SUM(x) accumulate((x).begin(),(x).end(), 0)
#define FILL(x,a) fill(x.begin(),x.end(),a)
#define EACH(i,x) for(typeof((x).begin()) i=(x).begin(); i!=(x).end(); ++i)
const int INF = 1<<30;
const ld EPS = 1e-10;
const int MOD = int(1e9)+7;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template <class BidirectionalIterator>
bool next_partial_permutation(BidirectionalIterator first, BidirectionalIterator middle,BidirectionalIterator last){reverse(middle, last); return next_permutation(first , last);}
#define COUT(x) cout<<x<<"\n"
ll LCM(VI x){ ll ret = x[0]; for(ll i = 1; i < x.size(); ++i) ret = lcm(ret, x[i]); return ret;}
ll GCD(VI x){ ll ret = x[0]; for(ll i = 1; i < x.size(); ++i) ret = gcd(ret, x[i]); return ret;}
void Main()
{
ll N;
ll result=0;
string S;
cin>>N;
VI T(N);
REP(i, N) cin >> T[i];
result=LCM(T);
cout << result << "\n";
return;
}
int main()
{
std::cin.tie(0);
std::ios_base::sync_with_stdio(false);
std::cout << std::fixed << std::setprecision(15);
Main();
}
| a.cc:2:10: fatal error: boost/integer/common_factor_rt.hpp: No such file or directory
2 | #include <boost/integer/common_factor_rt.hpp> // gcd, lcm
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
|
s197087739 | p03633 | C++ | #include "bits/stdc++.h"
#define int long long
#define For(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(obj) begin(obj), end(obj)
#define Max(x) *max_element(ALL(x))
#define Min(x) *min_element(ALL(x))
#define Lower_bound(A, key) distance(A.begin(), lower_bound(ALL(A), key))
#define Upper_bound(A, key) distance(A.begin(), upper_bound(ALL(A), key))
using namespace std;
using ll = long long;
const int MOD = (int)(1e9 + 7);
const int INF = (int)(1e13 + 7);
int bpm(int x, int y) {
if (x == 0)
return 0;
else if (y == 0) {
return 1;
}
int ans = 1;
x %= MOD;
int digit = (int)((log((double)y) / log((double)2) / 1 + 1));
for (int i = 0; i < digit; i++) {
if (((y >> i) & 1u) == 1) {
ans *= x;
ans %= MOD;
}
x = x * x;
x %= MOD;
}
return ans;
}
int gcd(int a, int b) {
if (a % b == 0) {
return (b);
} else {
return (gcd(b, a % b));
}
}
int Lcm(int a, int b) {
if (!(a % gcd(a, b))) {
return (a / gcd(a, b) * b);
} else if (!(b % gcd(a, b))) {
return (b / gcd(a, b) * a);
} else {
return a * b / gcd(a, b);
}
}
class CMultipleClocks {
public:
void solve(std::istream &cin, std::ostream &cout) {
int N;
cin >> N;
int ans = 1;
rep(i, N) {
int temp;
cin >> temp;
ans = Lcm(temp, ans);
}
cout << ans << endl;
}
};
| /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s021062607 | p03633 | Java |
public class Main {
//static boolean f;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
/* 入力の受け取り
* String s = sc.next();
* int a = sc.nextInt();
* long a = sc.nextLong();
*/
// 文字列(String)を文字(char)に分解
// char[] s_char = s.toCharArray();
int n = sc.nextInt();
long t[] = new long[n];
for(int i=0;i<n;i++)
t[i] = sc.nextLong();
long time = t[0];
if(n != 1) {
for(int i=1;i<n;i++)
time = lcm(time,t[i]);
}
System.out.println(time);
/*
* if(f)
* System.out.println("Yes");
* else
* System.out.println("No");
*/
}
// ユークリッドの互除法(最大公約数を求める)
static long gcd(long x, long y) {
return x%y==0? y : gcd(y,x%y);
}
// 最小公倍数を求める
static long lcm(long x, long y) {
return x / gcd(x, y) * y;
}
}
| Main.java:7: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:7: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
2 errors
|
s462004261 | p03633 | C++ | #include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++)
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x) (int)x.size()
#define SP(x) setprecision((int)x)
using namespace std ;
typedef long long ll;
typedef string str;
using Graph = vector<vector<int>>;
typedef vector<int> vint;
typedef vector<double> vdou ;
typedef vector<ll> vll;
typedef vector<vint> vvint;
typedef vector<str> vstr;
typedef pair<int, int> pii;
typedef vector<pii> vpii ;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} //最小公倍数
//-------------------------------------------------
//
void yes(){
cout <<"Yes"<<endl ;
}
void no(){
cout <<"No"<<endl ;
}
//-------------------------------------------------
// メモ
/*
*/
//-------------------------------------------------
int main()
{
cin.tie(0);
ios::sync_with_stdio(false);
int n ;
cin >> n ;
vll num(n) ;
REP(i,n){
cin >>> num[i] ;
}
ll ans = num[0] ;
REP(i,n-1){
ans = lcm(ans,num[i+1]) ;
}
cout << ans <<endl ;
return 0 ;
}
| a.cc: In function 'int main()':
a.cc:67:11: error: expected primary-expression before '>' token
67 | cin >>> num[i] ;
| ^
|
s976908221 | p03633 | C++ | #include <iostream>
#include <vector>
#include <string>
#include <unordered_set>
#include <unordered_map>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
using namespace std;
long long GetGCD(long long a, long long b)
{
if (a < b) {
swap(a, b);
}
while(true)
{
long long mod = a % b;
if (mod == 0) {
return b;
}
a = b;
b = mod;
}
return -1;
}
long long GetLCM(long long a, long long b)// 最小公倍数
{
long long gcd = GetGCD(a, b);
long long pA = a / gcd;
return pA * b;
}
int Work4()
{
int N = 0;
cin >> N;
vector<long long> T(N, 0);
for (int i = 0; i < N; ++i) {
cin >> T[i];
}
// sort(T.rbegin(), T.rend());
// 端から最小公倍数を求めてゆく。
long long res = T[0];
for (int i = 0; i < N; ++i) {
long long cur0 = T[i];
res = GetLCM(res, T[i]);
}
cout << res << endl;
return 0;
} | /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s550911388 | p03633 | C++ | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define ocut cout
#define ouct cout
#define itn int
ll gcd(ll a, ll b){
if (a%b == 0){
return(b);
}
else{
return(gcd(b, a%b));
}
}
ll lcm(ll a, ll b){
return a * b / gcd(a, b);
}
int main(){
ll n;
cin >> n;
ll t[n];
rep(i,n){
cin >> t[i];
}
ll to=t[0],m;
rep(i,n-1){
m=to;
m=lcm(to,t[i+1]);
to=m;
}
cout << to;
}
| a.cc:9:3: error: expected ';' before 'gcd'
9 | ll gcd(ll a, ll b){
| ^~~~
| ;
|
s016702796 | p03633 | C++ | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define ocut cout
#define ouct cout
#define itn int
ll gcd(ll a, ll b)
{
if (a%b == 0)
{
return(b);
}
else
{
return(gcd(b, a%b));
}
}
ll lcm(ll a, ll b)
{
return a * b / gcd(a, b);
}
int main(){
ll n;
cin >> n;
ll t[n];
rep(i,n){
cin >> t[i];
}
ll to=t[0],m;
rep(i,n-1){
m=to;
m=lcm(to,t[i+1]);
to=m;
}
cout << to;
}
| a.cc:9:3: error: expected ';' before 'gcd'
9 | ll gcd(ll a, ll b)
| ^~~~
| ;
|
s946236846 | p03633 | C++ | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define ocut cout
#define ouct cout
#define itn int
ll gcd(ll a, ll b)
{
if (a%b == 0)
{
return(b);
}
else
{
return(gcd(b, a%b));
}
}
ll lcm(ll a, ll b)
{
return a * b / gcd(a, b);
}
int main(){
ll n;
cin >> n;
ll t[n];
rep(i,n){
cin >> t[i];
}
ll to=t[0],m;
rep(i,n-1){
m=to;
m=lcm(to,t[i+1]);
to=m;
}
cout << to;
}
| a.cc:9:3: error: expected ';' before 'gcd'
9 | ll gcd(ll a, ll b)
| ^~~~
| ;
|
s763541168 | p03633 | C++ | 5
2
5
10
1000000000000000000
1000000000000000000 | a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 5
| ^
|
s205965714 | p03633 | C++ | #include <iostream>
#include <vector>
#include <string>
#include <unordered_set>
#include <unordered_map>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <cmath>
using namespace std;
int Work4()
{
int N = 0;
cin >> N;
vector<long long> T(N, 0);
for (int i = 0; i < N; ++i) {
cin >> T[i];
}
sort(T.rbegin(), T.rend());
// 端から最小公倍数を求めてゆく。
long long res = T[0];
for (int i = 0; i < N; ++i){
const long long cur0 = T[i];
long long cur = cur0;
if (res % cur != 0){
while ((cur % res) != 0){
cur += cur0;
}
res = cur;
}
}
cout << res << endl;
return 0;
} | /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s968317770 | p03633 | C++ | #include<iostream>
long long gcd(long long a, long long b) {
while(a) {
a %= b;
long long t = a;
a = b;
b = t;
}
return b;
}
long long lcm(long long a, long long b) {
long long gc = gcd(a, b);
return a * b / gc;
}
int main () {
int N;
long long ans = 1;
for (int i = 0; i < N; i ++) {
long long T;
cin >> T;
ans = lcm(ans, T);
}
cout << ans << endl;
}
| a.cc: In function 'int main()':
a.cc:20:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
20 | cin >> T;
| ^~~
| std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:23:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
23 | cout << ans << endl;
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:23:18: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
23 | cout << ans << endl;
| ^~~~
| std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
|
s014763617 | p03633 | C++ | #include<iostream>
long long gcd(long long a, long long b) {
while(a) {
a %= b;
swap(a, b);
}
return b;
}
long long lcm(long long a, long long b) {
long long gc = gcd(a, b);
return a * b / gc;
}
int main () {
int N;
long long ans = 1;
for (int i = 0; i < N; i ++) {
long long T;
cin >> T;
ans = lcm(ans, T);
}
cout << ans << endl;
} | a.cc: In function 'long long int gcd(long long int, long long int)':
a.cc:5:5: error: 'swap' was not declared in this scope
5 | swap(a, b);
| ^~~~
a.cc:5:5: note: suggested alternatives:
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/include/c++/14/string:68,
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/tuple:2823:5: note: 'std::swap'
2823 | swap(tuple<_Elements...>&, tuple<_Elements...>&) = delete;
| ^~~~
In file included from /usr/include/c++/14/bits/exception_ptr.h:41,
from /usr/include/c++/14/exception:166,
from /usr/include/c++/14/ios:41:
/usr/include/c++/14/bits/move.h:226:5: note: 'std::swap'
226 | swap(_Tp& __a, _Tp& __b)
| ^~~~
/usr/include/c++/14/bits/move.h:226:5: note: 'std::swap'
/usr/include/c++/14/bits/exception_ptr.h:229:5: note: 'std::__exception_ptr::swap'
229 | swap(exception_ptr& __lhs, exception_ptr& __rhs)
| ^~~~
a.cc: In function 'int main()':
a.cc:18:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
18 | cin >> T;
| ^~~
| std::cin
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:21:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
21 | cout << ans << endl;
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:21:18: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
21 | cout << ans << endl;
| ^~~~
| std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
|
s613851802 | p03633 | Java | class Main{
final static long mod = 1000000007;
//
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long[] nums = new long[n];
for(int i = 0; i < n; i++) nums[i] = sc.nextLong();
sc.close();
for(int i = 0; i < n - 1; i++){
nums[i + 1] = lcm(nums[i] , nums[i + 1]);
}
System.out.println(nums[n - 1]);
}
public static long lcm(long a, long b){
return a / gcd(a, b) * b;
}
public static long gcd(long a, long b){
while(a % b != 0){
return gcd(b, a%b);
}
return b;
}
} | Main.java:5: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:5: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
2 errors
|
s434982449 | p03633 | C++ | #include <bits/stdc++.h>
using namespace std;
long long gcd(int a, int b)
{
if (a%b == 0) {
return b;
}
else {
return (gcd(b, a%b));
}
}
lonlong lcm(int a, int b)
{
long long tmp = gcd(a, b);
return a * b / tmp;
}
int main()
{
int N;
cin >> N;
long long T[N];
for (int i = 0; i < N; ++i) {
cin >> T[i];
}
int l = lcm(T[0], T[1]);
cout << l << endl;
for (int i = 2; i < N; ++i) {
l = lcm(l, T[i]);
cout << l << endl;
}
cout << l << endl;
}
| a.cc:14:1: error: 'lonlong' does not name a type; did you mean 'ulong'?
14 | lonlong lcm(int a, int b)
| ^~~~~~~
| ulong
|
s837454565 | p03633 | C++ | #include<iostream>
#include<algorithm>
#include<functional>
using namespace std;
int main(){
long long n;
cin >> n;
long long ret=1;
function<long long(long long,long long)> gcd =
[&](long long x,long long y){
return y ? gcd(y,x%y):x;
}
function<long long(long long,long long)> lcm =
[&](long long x,long long y){
return x/gcd(x,y)*y;
}
for(int i=0;i<n;i++){
long long x;
cin >> x;
ret=lcm(ret,x);
}
cout << ret << endl;
}
| a.cc: In function 'int main()':
a.cc:14:3: error: expected ',' or ';' before 'function'
14 | function<long long(long long,long long)> lcm =
| ^~~~~~~~
a.cc:21:9: error: 'lcm' was not declared in this scope
21 | ret=lcm(ret,x);
| ^~~
|
s138931215 | p03633 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
int main(){
long long n;
cin >> n;
long long ret=1;
function<long long(long long,long long)> gcd =
[&](long long x,long long y){
return y ? gcd(y,x%y):x;
}
function<long long(long long,long long)> lcm =
[&](long long x,long long y){
return x/gcd(x,y)*y;
}
for(int i=0;i<n;i++){
long long x;
cin >> x;
ret=lcm(ret,x);
}
cout << ret << endl;
}
| a.cc: In function 'int main()':
a.cc:10:3: error: 'function' was not declared in this scope
10 | function<long long(long long,long long)> gcd =
| ^~~~~~~~
a.cc:3:1: note: 'std::function' is defined in header '<functional>'; this is probably fixable by adding '#include <functional>'
2 | #include<algorithm>
+++ |+#include <functional>
3 |
a.cc:10:12: error: expected primary-expression before 'long'
10 | function<long long(long long,long long)> gcd =
| ^~~~
a.cc:14:12: error: expected primary-expression before 'long'
14 | function<long long(long long,long long)> lcm =
| ^~~~
a.cc:21:9: error: 'lcm' was not declared in this scope
21 | ret=lcm(ret,x);
| ^~~
|
s001841799 | p03633 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
int main(){
cin >> n;
long long ret=1;
function<long long(long long,long long)> gcd =
[&](long long x,long long y){
return y ? gcd(y,x%y):x;
}
function<long long(long long,long long)> lcm =
[&](long long x,long long y){
return x/gcd(x,y)*y;
}
for(int i=0;i<n;i++){
long long x;
cin >> x;
ret=lcm(ret,x);
}
cout << ret << endl;
} | a.cc: In function 'int main()':
a.cc:7:10: error: 'n' was not declared in this scope
7 | cin >> n;
| ^
a.cc:9:3: error: 'function' was not declared in this scope
9 | function<long long(long long,long long)> gcd =
| ^~~~~~~~
a.cc:3:1: note: 'std::function' is defined in header '<functional>'; this is probably fixable by adding '#include <functional>'
2 | #include<algorithm>
+++ |+#include <functional>
3 |
a.cc:9:12: error: expected primary-expression before 'long'
9 | function<long long(long long,long long)> gcd =
| ^~~~
a.cc:13:12: error: expected primary-expression before 'long'
13 | function<long long(long long,long long)> lcm =
| ^~~~
a.cc:20:9: error: 'lcm' was not declared in this scope
20 | ret=lcm(ret,x);
| ^~~
|
s749516562 | p03633 | C++ | #include <bits/stdc++.h>
using namespace std;
#include <boost/multiprecision/cpp_int.hpp>
int main(void){
int n;
cin>>n;
boost::multiprecision::cpp_int t;
std::deque<boost::multiprecision::cpp_int> deq;
for (int i=0;i<n;i++) {
cin>>t;
deq.insert(t);
}
boost::multiprecision::cpp_int a, b;
for (int j=0;j+1<n;j++) {
a=deq[j];
b=deq[j+1];
if (a<b) {
swap(a,b);
}
while (a%b!=0) {
boost::multiprecision::cpp_int tmp=b;
b=a%b;
a=tmp;
}
deq[j+1]=( deq[j]*deq[j+1]/b );
}
cout<<deq.back()<<endl;
} | a.cc:3:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
3 | #include <boost/multiprecision/cpp_int.hpp>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
|
s800909940 | p03633 | C++ | #include <bits/stdc++.h>
using namespace std;
#include <boost/multiprecision/cpp_int.hpp>
int main(void){
int n;
cin>>n;
boost::multiprecision::cpp_int t;
std::deque<boost::multiprecision::cpp_int> deq;
for (int i=0;i<n;i++) {
cin>>t;
deq.emplace_back(t);
}
boost::multiprecision::cpp_int a, b;
for (int j=0;j+1<n;j++) {
a=deq[j];
b=deq[j+1];
if (a<b) {
swap(a,b);
}
while (a%b!=0) {
boost::multiprecision::cpp_int tmp=b;
b=a%b;
a=tmp;
}
deq[j+1]=( deq[j]*deq[j+1]/b );
}
cout<<deq.back()<<endl;
} | a.cc:3:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
3 | #include <boost/multiprecision/cpp_int.hpp>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
|
s815107882 | p03633 | C++ | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll gcd(ll a, ll b){
if(b == 0) return a;
return gcd(b,a%b);
}
ll lcm(ll a, ll b){
ll g = gcd(a,b);
return a*b/g;
}
int main(){
int n;
long long kekka;
cin >> n;
vector<long long> t(n);
rep(i,n) cin >> t.at(i);
ll ans = 1LL,k;
rep(i,n){
ans = lcm(ans,t.at(i))
}
cout << ans << endl;
}
| a.cc: In function 'int main()':
a.cc:27:27: error: expected ';' before '}' token
27 | ans = lcm(ans,t.at(i))
| ^
| ;
28 | }
| ~
|
s087170978 | p03633 | C++ | #include <bits/stdc++.h>
using namespace std;
long long GCD(long long a,long long b){
if(b==0){
return a;
}
else{
return GCD(b,b % a);
}
}
long long LCM(long long a,long long b){
return a/GCD(a,b) *b;
}
}
int main(){
long long N;
cin >> N;
long long num[N];
for(int i=0;i<N;i++){
cin >> num[i];
}
for(int i=1;i<N;i++){
num[i] = LCM(num[i],num[i-1]);
}
cout << num[N-1] << endl;
} | a.cc:14:1: error: expected declaration before '}' token
14 | }
| ^
|
s186327306 | p03633 | C++ | #include <bits/stdc++.h>
using namespace std;
long long GCD(long long a,long long b){
if(b==0){
return a;
}
else{
return GCD(b,b % a);
}
}
long long LCM(long long a,long long b)}
return a/GCD(a,b) *b;
}
}
int main(){
long long N;
cin >> N;
long long num[N];
for(int i=0;i<N;i++){
cin >> num[i];
}
for(int i=1;i<N;i++){
num[i] = LCM(num[i],num[i-1]);
}
cout << num[N-1] << endl;
} | a.cc:11:39: error: expected initializer before '}' token
11 | long long LCM(long long a,long long b)}
| ^
a.cc:11:39: error: expected declaration before '}' token
a.cc:12:3: error: expected unqualified-id before 'return'
12 | return a/GCD(a,b) *b;
| ^~~~~~
a.cc:13:1: error: expected declaration before '}' token
13 | }
| ^
a.cc:14:1: error: expected declaration before '}' token
14 | }
| ^
a.cc: In function 'int main()':
a.cc:24:14: error: 'LCM' was not declared in this scope
24 | num[i] = LCM(num[i],num[i-1]);
| ^~~
|
s173932695 | p03633 | C++ | #include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const double PI=3.141592653589;
const int INF=1000000007;
const ll LMAX=1000000000000001;
ll gcd(ll a,ll b){if(a<b)swap(a,b);ll c=a%b;while(c!=0){a=b;b=c;c=a%b;}return b;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};
int main(){
int n; cin>>n;
vector<ll> t(n);
rep(i,n) cin>>t[i];
sort(ALL(t))
ll ans=t[n-1];
bool f=1;
while(f){
f=0;
rep(i,n){
if(ans%t[i]){
f=1;break;
}
}
if(!f) cout<<ans<<endl;
else ans+=t[n-1];
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:26:15: error: expected ';' before 'll'
26 | sort(ALL(t))
| ^
| ;
27 | ll ans=t[n-1];
| ~~
a.cc:32:10: error: 'ans' was not declared in this scope; did you mean 'abs'?
32 | if(ans%t[i]){
| ^~~
| abs
a.cc:36:18: error: 'ans' was not declared in this scope; did you mean 'abs'?
36 | if(!f) cout<<ans<<endl;
| ^~~
| abs
a.cc:37:10: error: 'ans' was not declared in this scope; did you mean 'abs'?
37 | else ans+=t[n-1];
| ^~~
| abs
|
s305798455 | p03633 | Java | import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int valueLCM = 0;
ArrayList<Long> list = new ArrayList<>();
for(int i=0;i<N;i++){
list.add(sc.nextLong());
}
for(int i=0; i<list.size()-1; i++) {
if(i==0){
valueLCM = calcLCM(list.get(i),list.get(i+1));
}else{
valueLCM = calcLCM(valueLCM,list.get(i+1));
}
}
}
private static long calcLCM(long val1, long val2) {
long maxValue = Math.max(val1, val2);
long minValue = Math.min(val1, val2);
long val3 = maxValue * minValue;
if(minValue==0) return maxValue;
long temp;
while( (temp=maxValue%minValue)!=0 ) {
maxValue=minValue;
minValue=temp;
}
return val3/minValue;
}
} | Main.java:13: error: incompatible types: possible lossy conversion from long to int
valueLCM = calcLCM(list.get(i),list.get(i+1));
^
Main.java:15: error: incompatible types: possible lossy conversion from long to int
valueLCM = calcLCM(valueLCM,list.get(i+1));
^
2 errors
|
s324803982 | p03633 | C++ | #include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
using ll = long long;
int main(){
int n;
cin>>n;
ll ans = 0;
cin>>ans;
rep1(i,n){
ll tmp;
cin>>tmp;
ll m = abs(ans,tmp);
for(ll j = m; j >= 1; j--){
if(ans%j==0&&tmp%j==0){
ans = (ans/j)*tmp;
break;
}
}
}
cout<<ans<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:17:15: error: no matching function for call to 'abs(ll&, ll&)'
17 | ll m = abs(ans,tmp);
| ~~~^~~~~~~~~
In file included from /usr/include/c++/14/valarray:605,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166,
from a.cc:1:
/usr/include/c++/14/bits/valarray_after.h:445:5: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_UnClos<std::_Abs, std::_ValArray, _Tp>, _Tp> std::abs(const valarray<_Tp>&)'
445 | _DEFINE_EXPR_UNARY_FUNCTION(abs, struct std::_Abs)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:445:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/valarray_after.h:445:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_UnClos<std::_Abs, std::_Expr, _Dom>, typename _Dom::value_type> std::abs(const _Expr<_Dom1, typename _Dom1::value_type>&)'
445 | _DEFINE_EXPR_UNARY_FUNCTION(abs, struct std::_Abs)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:445:5: note: candidate expects 1 argument, 2 provided
In file included from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/complex:892:5: note: candidate: 'template<class _Tp> _Tp std::abs(const complex<_Tp>&)'
892 | abs(const complex<_Tp>& __z) { return __complex_abs(__z.__rep()); }
| ^~~
/usr/include/c++/14/complex:892:5: note: candidate expects 1 argument, 2 provided
In file included from /usr/include/c++/14/cstdlib:79,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42:
/usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)'
980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
| ^~~
/usr/include/stdlib.h:980:12: note: candidate expects 1 argument, 2 provided
In file included from /usr/include/c++/14/cstdlib:81:
/usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)'
137 | abs(__float128 __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:137:3: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)'
85 | abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
| ^~~
/usr/include/c++/14/bits/std_abs.h:85:3: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)'
79 | abs(long double __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:79:3: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)'
75 | abs(float __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:75:3: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)'
71 | abs(double __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:71:3: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)'
61 | abs(long long __x) { return __builtin_llabs (__x); }
| ^~~
/usr/include/c++/14/bits/std_abs.h:61:3: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)'
56 | abs(long __i) { return __builtin_labs(__i); }
| ^~~
/usr/include/c++/14/bits/std_abs.h:56:3: note: candidate expects 1 argument, 2 provided
|
s143447335 | p03633 | C++ | #include<bits/stdc++.h>
using namespace std;
#define int long long
int Euclid(int x,int y){
if(x < y){
const int a = x;
x = y;
y = a;
}
int b = 100000;
while(b){
b = x % y;
x = y;
y = b;
if(b == 0) break;
}
return x;
}
int lcm(int x,int y){
int g = Euclid(x,y);
return x / g * b;
}
signed main(){
int n;
cin >> n;
int ans = 1LL;
for(int i = 0; i < n; i++){
int t;
cin >> t;
ans = lcm(ans,t);
}
cout << ans << endl;
} | a.cc: In function 'long long int lcm(long long int, long long int)':
a.cc:25:20: error: 'b' was not declared in this scope
25 | return x / g * b;
| ^
|
s094052490 | p03633 | Java | import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
long [] in = new long [a];
String [] str = new String [a];
boolean b = false;
for(int i=0;i<a;i++){
in[i] = sc.nextLong();
}
Arrays.sort(in);
long ans = 0;
while(b = false){ans+=in[a-1];
for(int i=0;i<a;i++){if(ans%ln[i]==0){if(i==a-1){b = true;}
}else{break;}
}
}
System.out.println(ans);
}
}
| Main.java:15: error: cannot find symbol
for(int i=0;i<a;i++){if(ans%ln[i]==0){if(i==a-1){b = true;}
^
symbol: variable ln
location: class Main
1 error
|
s102906571 | p03633 | Java | import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
long [] in = new long [a];
String [] str = new String [a];
boolean b = false;
for(int i=0;i<a;i++){
in[i] = sc.nextLong();
}
Arrays.sort(ln);
long ans = 0;
while(b = false){ans+=ln[a-1];
for(int i=0;i<a;i++){if(ans%ln[i]==0){if(i==b-1){b = true;}
}else{break;}
}
}
System.out.println(ans);
}
}
| Main.java:12: error: cannot find symbol
Arrays.sort(ln);
^
symbol: variable ln
location: class Main
Main.java:14: error: cannot find symbol
while(b = false){ans+=ln[a-1];
^
symbol: variable ln
location: class Main
Main.java:15: error: cannot find symbol
for(int i=0;i<a;i++){if(ans%ln[i]==0){if(i==b-1){b = true;}
^
symbol: variable ln
location: class Main
Main.java:15: error: bad operand types for binary operator '-'
for(int i=0;i<a;i++){if(ans%ln[i]==0){if(i==b-1){b = true;}
^
first type: boolean
second type: int
4 errors
|
s421724667 | p03633 | Java | import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
long [] in = new long [a];
String [] str = new String [a];
boolean b = false;
for(int i=0;i<a;i++){
in[i] = sc.nextLong();
}
Arrays.sort(ln);
long ans = 0;
while(b = false){ans+=ln[a-1];
for(int i=0;i<a;i++){if(ans%ln[i]==0){if(i==b-1){b = true;}}
}else{break;}
}
System.out.println(ans);
}
}
| Main.java:16: error: 'else' without 'if'
}else{break;}
^
1 error
|
s296676201 | p03633 | Java | import java.util.*;
public class Main {
public static Long gcd(Long x,Long y){
if(x < y) return gcd(y, x);
if(y == 0) return x;
return gcd(y, x % y);
}
public static Long lcm(Long x,Long y){
return x*y/gcd(x,y);
}
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
long [] in = new long [a];
String [] str = new String [a];
for(int i=0;i<a;i++){
in[i] = sc.nextlong();
}
long ans = in[0];;
for(int i=1;i<a;i++){ans = lcm(ans,in[i]);
}
System.out.println(ans);
}
}
| Main.java:18: error: cannot find symbol
in[i] = sc.nextlong();
^
symbol: method nextlong()
location: variable sc of type Scanner
1 error
|
s341747833 | p03633 | C++ | #include <iostream>
using namespace std;
int debug=0;
int N;
long long T[100];
bool is_prime(long long n){
if (n <= 1) return false;
else if (num ==2 ) return true;
else if (num % 2==0) return false;
for(long long p = 3; p<n;++p)
if(n%p == 0 ) return false;
return true;
}
long long calc_gcm(long long m, long long n){
long long tmp;
if(debug){
cout << "calc_gcm(" << m <<"," <<n <<")" << endl;
}
if(is_prime(m)) {
if(debug) cout << "return=" << 1 << endl;
return 1;
}
while (m%n !=0 ){
tmp = n;
n = m & n;
m = tmp;
}
if(debug) cout << "return=" << n << endl;
return n;
}
int main(){
cin >> N;
for(int i=0;i<N;++i){
cin >> T[i];
}
long long lcm,gcm;
if(N==1){
lcm=T[0];
}else{
if (T[0] >= T[1])
gcm = calc_gcm(T[0],T[1]);
else
gcm = calc_gcm(T[1],T[0]);
lcm = T[0] * T[1] / gcm;
if(debug){
cout << "gcm=" << gcm << " ";
cout << "lcm=" << lcm << endl;
}
for(int i =2;i<N;++i){
if(gcm >= T[i])
gcm = calc_gcm(gcm,T[i]);
else
gcm = calc_gcm(T[i],gcm);
if(gcm == 1 ){
if(lcm < T[i]) lcm = T[i];
}else{
lcm = lcm * T[i] / gcm;
}
if(debug){
cout << i << ":" << "gcm=" << gcm << " ";
cout << i << ":" << "lcm=" << lcm << endl;
}
}
}
cout << lcm << endl;
} | a.cc: In function 'bool is_prime(long long int)':
a.cc:11:14: error: 'num' was not declared in this scope; did you mean 'enum'?
11 | else if (num ==2 ) return true;
| ^~~
| enum
|
s258869711 | p03633 | C++ | #include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
#define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define push push_back
#define solve(a) ((a) ? "Yes" : "No")
typedef vector<long long> V;
typedef vector<V> VV;
template <class T>
inline bool chmax(T &a, T b)
{
if (a < b)
{
a = b;
return 1;
}
return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
if (a > b)
{
a = b;
return 1;
}
return 0;
}
const long long INFLL = 1LL << 62;
const int INF = 1 << 30;
long long modpow(long long a, long long n, long long mod)
{
long long res = 1;
while (n > 0)
{
if (n & 1)
res = res * a % mod;
a = a * a % mod;
n >>= 1;
}
return res;
}
int main()
{
int n;
cin >> n;
vector<ll> t(n + 1, 0LL);
ll ans = 1LL;
map<ll, int> co;
int cr = 0;
ll bef;
ll test = 2LL;
rep(i, n)
{
cin >> t[i];
bef = t[i];
test = 2LL;
cr = 0;
while (bef != 1)
{
while (bef % test == 0)
{
cr++;
bef /= test;
}
co[test] += 0;
chmax(co[test], cr);
cr = 0;
test++;
if(test*test*test >bef){
if (int(sqrt(bef)) * int(sqrt(bef))==bef){
co[int(sqrt(bef))]+=0;
chmax(co[int(sqrt(bef))], 1);
}else{
co[bef] += 0;
chmax(co[bef], 1);
bef=1;
}
}
}
for (auto itr = co.begin(); itr != co.end(); itr++)
{
ans *= modpow(itr->first, itr->second, INFLL);
}
cout << ans << endl;
}
| a.cc: In function 'int main()':
a.cc:93:2: error: expected '}' at end of input
93 | }
| ^
a.cc:51:1: note: to match this '{'
51 | {
| ^
|
s770646924 | p03633 | C++ | #include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
ll N;
cin>>N;
vector<ll> T(N);
for(ll i=0;i<N;i++)
{
cin>>T[i];
}
sort(T.begin(),T.end());
for(ll i=0;i<N-1;i++)
{
ll a,b;
if(T[i]<T[i+1])
{
a=T[i+1];
b=T[i];
}
else
{
a=T[i];
b=T[i+1];
}
ll k=a%b;
while(k!=0)
{
a=b;
b=r;
k=a%b;
}
T[i+1]=T[i]/b*T[i+1];
}
cout<<T[N-1]<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:31:15: error: 'r' was not declared in this scope
31 | b=r;
| ^
|
s746978069 | p03633 | C++ | #include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
ll N;
cin>>N;
vector<ll> T(N);
for(ll i=0;i<N;i++)
{
cin>>T[i];
}
sort(T.begin(),T.end());
for(ll i=0;i<N-1;i++)
{
ll a,b;
if(T[i]<T[i+1])
{
a=T[i+1];
b=T[i];
}
else
{
a=T[i];
b=T[i+1];
}
ll k=a%b;
while(k!=0)
{
a=b;
b=r;
r=a%b;
}
T[i+1]=T[i]/b*T[i+1];
}
cout<<T[N-1]<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:31:15: error: 'r' was not declared in this scope
31 | b=r;
| ^
|
s497206384 | p03633 | C++ | b#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>
using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) v.erase(unique(v.begin(), v.end()), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;
#define MAX_V 1000000
ll gcd(ll a, ll b) {
if(b == 0) return a;
return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
return a / gcd(a, b) * b;
}
ll extend_lcm(ll a[], ll n) {
if(n < 2) return -1;
ll rsl = lcm(a[0], a[1]);
rep(i, 2, n) rsl = lcm(a[i], rsl);
return rsl;
}
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
ll t[n];
if(n == 1) {
cout << t[0] << endl;
return 0;
}
rep(i, 0, n) cin >> t[i];
cout << extend_lcm(t, n) << endl;
}
| a.cc:1:2: error: stray '#' in program
1 | b#include <iostream>
| ^
a.cc:1:1: error: 'b' does not name a type
1 | b#include <iostream>
| ^
In file included from /usr/include/c++/14/bits/char_traits.h:42,
from /usr/include/c++/14/string:42,
from a.cc:2:
/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/char_traits.h:50:
/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/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/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;
| ^~~~~~
/usr/include/c++/14/bits/char_traits.h:144:61: error: 'std::size_t' has not been declared
144 | compare(const char_type* __s1, const char_type* __s2, std::size_t __n);
| ^~~
/usr/include/c++/14/bits/char_traits.h:146:40: error: 'size_t' in namespace 'std' does not name a type
146 | static _GLIBCXX14_CONSTEXPR std::size_t
| ^~~~~~
/usr/include/c++/14/bits/char_traits.h:150:34: error: 'std::size_t' has not been declared
150 | find(const char_type* __s, std::size_t __n, const char_type& __a);
| ^~~
/usr/include/c++/14/bits/char_traits.h:153:52: error: 'std::size_t' has not been declared
153 | move(char_type* __s1, const char_type* __s2, std::size_t __n);
| ^~~
/usr/include/c++/14/bits/char_traits.h:156:52: error: 'std::size_t' has not been declared
156 | copy(char_type* __s1, const char_type* __s2, std::size_t __n);
| ^~~
/usr/include/c++/14/bits/char_traits.h:159:30: error: 'std::size_t' has not been declared
159 | assign(char_type* __s, std::size_t __n, char_type __a);
| ^~~
/usr/include/c++/14/bits/char_traits.h:187:59: error: 'std::size_t' has not been declared
187 | compare(const char_type* __s1, const char_type* __s2, std::size_t __n)
| ^~~
/usr/include/c++/14/bits/char_traits.h: In static member function 'static constexpr int __gnu_cxx::char_traits<_CharT>::compare(const char_type*, const char_type*, int)':
/usr/include/c++/14/bits/char_traits.h:189:17: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
189 | for (std::size_t __i = 0; __i < __n; ++__i)
| ^~~~~~
/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/bits/char_traits.h:189:33: error: '__i' was not declared in this scope; did you mean '__n'?
189 | for (std::size_t __i = 0; __i < __n; ++__i)
| ^~~
| __n
/usr/include/c++/14/bits/char_traits.h: At global scope:
/usr/include/c++/14/bits/char_traits.h:198:31: error: 'size_t' in namespace 'std' does not name a |
s976634622 | p03633 | Java | import java.math.BigInteger;
import java.util.Scanner;
public class A {
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
int n=in.nextInt();
BigInteger res=in.nextBigInteger();--n;
while(n--!=0){
BigInteger b=in.nextBigInteger();
res=res.multiply(b).divide(res.gcd(b));
}
System.out.print(res);
}
}
| Main.java:4: error: class A is public, should be declared in a file named A.java
public class A {
^
1 error
|
s954981301 | p03633 | C++ | #include <bits/stdc++.h>
using namespace std;
long long gcm(long long a, long long b) {
long long result = a;
long long k = 0, n = b;
do {
k = result % n;
result = n;
n = k;
} while(k != 0);
return result;
}
long long lcm(long long a, long long b) {
long long g;
g = gcm(a, b);
return a * b / g;
}
long long lcm_n(vector<long long> &numbers) {
long long l;
l = numbers[0];
for (long long i = 1; i < numbers.size(); i++) {
l = lcm(l, numbers[i]);
}
return l;
}
int main() {
int N, i;
cin >> N;
vector<long long> T[N];
for (i = 0; i < N; i++) {
cin >> T[i];
}
long long result = lcm_n(T);
cout << result << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:35:9: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::vector<long long int>')
35 | cin >> T[i];
| ~~~ ^~ ~~~~
| | |
| | std::vector<long long int>
| std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
from a.cc:1:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:24: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'bool&'
170 | operator>>(bool& __n)
| ~~~~~~^~~
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]'
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:25: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'short int&'
174 | operator>>(short& __n);
| ~~~~~~~^~~
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:34: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'short unsigned int&'
177 | operator>>(unsigned short& __n)
| ~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]'
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:23: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'int&'
181 | operator>>(int& __n);
| ~~~~~^~~
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:32: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'unsigned int&'
184 | operator>>(unsigned int& __n)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:24: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'long int&'
188 | operator>>(long& __n)
| ~~~~~~^~~
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:33: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'long unsigned int&'
192 | operator>>(unsigned long& __n)
| ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:29: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'long long int&'
199 | operator>>(long long& __n)
| ~~~~~~~~~~~^~~
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:38: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'long long unsigned int&'
203 | operator>>(unsigned long long& __n)
| ~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
219 | operator>>(float& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'float&'
219 | operator>>(float& __f)
| ~~~~~~~^~~
/usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
223 | operator>>(double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'double&'
223 | operator>>(double& __f)
| ~~~~~~~~^~~
/usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
227 | operator>>(long double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'long double&'
227 | operator>>(long double& __f)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
328 | operator>>(void*& __p)
| ^~~~~~~~
/usr/include/c++/14/istream:328:25: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'void*&'
328 | operator>>(void*& __p)
| ~~~~~~~^~~
/usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'}
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]'
126 | operator>>(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:126:32: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}
126 | operator>>(__ios_type& (*__pf)(__ios_type&))
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/istream:133:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
133 | operator>>(ios_base& (*__pf)(ios_base&))
| ^~~~~~~~
/usr/include/c++/14/istream:133:30: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'std::ios_base& (*)(std::ios_base&)'
133 | operator>>(ios_base& (*__pf)(ios_base&))
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/istream:352:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; __streambuf_type = std::basic_streambuf<char>]'
352 | operator>>(__streambuf_type* __sb);
| ^~~~~~~~
/usr/include/c++/14/istream:352:36: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'std::basic_istream<char>::__streambuf_type*' {aka 'std::basic_streambuf<char |
s614922389 | p03633 | C++ | #include<bits/stdc++.h>
using namespace std;
#define int long long int
#define until(x) while(!(x))
#define unless(x) if(!(x))
#define all(x) (x).begin(),(x).end()
int32_t main(){
int n,tmp,ans;
cin>>n;
n--;
cin>>tmp;
ans = tmp;
do {
cin>>tmp;
ans = experimental::lcm(ans,tmp);
}while(--n);
cout<<ans;
}
| a.cc: In function 'int32_t main()':
a.cc:16:23: error: 'experimental' has not been declared
16 | ans = experimental::lcm(ans,tmp);
| ^~~~~~~~~~~~
|
s910937213 | p03633 | C++ | #include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(),x.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T&a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T&a,T b){if(a>b){a=b;return 1;}return 0;}
typedef long long ll;
int n,k;
ll t[100005];
int main() {
cin >> n;
rep(i,n) cin >> t[i];
ll l=t[0];
rep(i,n){
g=__gcd(l,t[i]); l=l/g*t[i];
}
cout << l << endl;
} | a.cc: In function 'int main()':
a.cc:17:5: error: 'g' was not declared in this scope
17 | g=__gcd(l,t[i]); l=l/g*t[i];
| ^
|
s109908834 | p03633 | C++ | #include <bits/stdc++.h>
#define ll long long
#define MAX_N 101
using namespace std;
int n;
ll gcd(ll x, ll y){
if(x < y) swap(x,y);
while( y > 0 ){
ll r = x%y;
x = y;
y = r;
}
return x;
}
ll lcm(ll x, ll y){
ll aa = gcd(x,y) ;
ll bb = x/aa;
ll cc = bb*y;
return cc;
}
ll main(){
cin >> n;
ll ans = 1;
for(int i =0;i < n;i++){
ll t;
cin >>t;
ans = lcm(ans, t);
}
return ans;
}
| cc1plus: error: '::main' must return 'int'
|
s956679928 | p03633 | C++ | #include <bits/stdc++.h>
#define ll long long
#define MAX_N 101
using namespace std;
int n;
ll a[MAX_N];
ll gcd(ll x, ll y){
if(x < y) swap(x,y);
while( y > 0 ){
ll r = x%y;
x = y;
y = r;
}
return x;
}
ll lcm(ll x, ll y){
ll aa = gcd(x,y) ;
ll bb = x/aa;
ll cc = bb*y;
return cc;
}
int main(){
cin >> n;
ll ans = 1;
for(int i =0;i < n;i++){
ll t;
cin >>t;
ans = lcm(ans, t)
}
return ans;
}
| a.cc: In function 'int main()':
a.cc:31:26: error: expected ';' before '}' token
31 | ans = lcm(ans, t)
| ^
| ;
32 | }
| ~
|
s490312413 | p03633 | C++ | #include <bits/stdc++.h>
#define ll long long
#define MAX_N 101
using namespace std;
int n;
ll a[MAX_N];
ll gcd(ll x, ll y){
if(x < y) swap(x,y);
while( y > 0 ){
ll r = x%y;
x = y;
y = r;
}
return x;
}
ll lcm(ll x, ll y){
ll tt = ( x / (gcd(x,y)) ;
ll ttt = tt*y;
return ttt;
}
int main(){
cin >> n;
ll ans = 1;
for(int i =0;i < n;i++){
ll t;
cin >>t;
ans = lcm(ans, t)
}
return ans;
}
| a.cc: In function 'long long int lcm(long long int, long long int)':
a.cc:19:30: error: expected ')' before ';' token
19 | ll tt = ( x / (gcd(x,y)) ;
| ~ ^~
| )
a.cc: In function 'int main()':
a.cc:30:26: error: expected ';' before '}' token
30 | ans = lcm(ans, t)
| ^
| ;
31 | }
| ~
|
s162080689 | p03633 | C++ | #include <bits/stdc++.h>
#define ll long long
#define MAX_N 101
using namespace std;
int n;
ll a[MAX_N];
ll gcd(ll x, ll y){
if(x < y) swap(x,y);
while( y > 0 ){
ll r = x%y;
x = y;
y = r;
}
return x;
}
ll lcm(ll x, ll y){
return ll ( x / (gcd(x,y)) *y ;
}
int main(){
cin >> n;
ll ans = 1;
for(int i =0;i < n;i++){
ll t;
cin >>t;
ans = lcm(ans, t)
}
return ans;
}
| a.cc: In function 'long long int lcm(long long int, long long int)':
a.cc:2:12: error: expected primary-expression before 'long'
2 | #define ll long long
| ^~~~
a.cc:19:12: note: in expansion of macro 'll'
19 | return ll ( x / (gcd(x,y)) *y ;
| ^~
a.cc:19:11: error: expected ';' before 'long'
19 | return ll ( x / (gcd(x,y)) *y ;
| ^
| ;
a.cc:2:12: error: expected primary-expression before 'long'
2 | #define ll long long
| ^~~~
a.cc:19:12: note: in expansion of macro 'll'
19 | return ll ( x / (gcd(x,y)) *y ;
| ^~
a.cc: In function 'int main()':
a.cc:28:26: error: expected ';' before '}' token
28 | ans = lcm(ans, t)
| ^
| ;
29 | }
| ~
|
s416359788 | p03633 | C++ | #include <bits/stdc++.h>
#define ll long long
#define MAX_N 101
using namespace std;
int n;
ll a[MAX_N];
ll gcd(ll x, ll y){
if(x < y) swap(x,y);
while( y > 0 ){
ll r = x%y;
x = y;
y = r;
}
return x;
}
ll lcm(ll x, ll y){
return (ll)( x / (gcd(x,y)) *y ;
}
int main(){
cin >> n;
ll ans = 1;
for(int i =0;i < n;i++){
ll t;
cin >>t;
ans = lcm(ans, t)
}
return ans;
} | a.cc: In function 'long long int lcm(long long int, long long int)':
a.cc:19:36: error: expected ')' before ';' token
19 | return (ll)( x / (gcd(x,y)) *y ;
| ~ ^~
| )
a.cc: In function 'int main()':
a.cc:28:26: error: expected ';' before '}' token
28 | ans = lcm(ans, t)
| ^
| ;
29 | }
| ~
|
s400727980 | p03633 | C++ | #include <bits/stdc++.h>
#define ll long long
#define MAX_N 101
using namespace std;
int n;
ll a[MAX_N];
ll gcd(ll x, ll y){
if(x < y) swap(x,y);
while( y > 0 ){
ll r = x%y;
x = y;
y = r;
}
return x;
}
ll lcm(ll x, ll y){
return ( x / (gcd(x,y)) *y );
}
int main(){
cin >> n;
int ans = 1;
for(int i =0;i < n;i++){
cin >>a[i];
ans = lcm(ans, a[i])
}
return ans;
}
| a.cc: In function 'int main()':
a.cc:27:29: error: expected ';' before '}' token
27 | ans = lcm(ans, a[i])
| ^
| ;
28 | }
| ~
|
s906912055 | p03633 | C++ | #include <bits/stdc++.h>
#define ll long long
#define MAX_N 101
using namespace std;
int n;
ll a[MAX_N];
ll gcd(ll x, ll y){
if(x < y) swap(x,y);
while( y > 0 ){
ll r = x%y;
x = y;
y = r;
}
return x;
}
ll lcm(ll x, ll y){
return ( x / (gcd(x,y)) *y );
}
ll main(){
cin >> n;
ll ans = 1;
for(int i =0;i < n;i++){
cin >>a[i];
ans = lcm(ans, a[i])
}
return ans;
} | cc1plus: error: '::main' must return 'int'
a.cc: In function 'int main()':
a.cc:27:29: error: expected ';' before '}' token
27 | ans = lcm(ans, a[i])
| ^
| ;
28 | }
| ~
|
s695482664 | p03633 | C++ | #include<iostream>
using namespace std;
int main(){
int n;
cin >> n;
int a[n];
for(int i = 0; i< n ; i++){
cin >> a[i];
}
int y = 1;
for(int i = 0 ; i < n ; i++){
y = lcm(y,a[i]);
}
cout << y;
} | a.cc: In function 'int main()':
a.cc:14:13: error: 'lcm' was not declared in this scope
14 | y = lcm(y,a[i]);
| ^~~
|
s752864244 | p03633 | C++ | const gcd = (a,b)=>{
if(a%b===0){
return (b)
}
else {
return (gcd(b,a%b))
}
}
const lcm =(a,b)=>{
return a/gcd(a,b)*b
}
function main(input) {
const arr=input.split('\n')
let ans=1;
arr.forEach((el,index)=>{
if(index==1){continue}
else ans= lcm(ans,el)
})
console.log(ans)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8')); | a.cc:24:14: warning: multi-character character constant [-Wmultichar]
24 | main(require('fs').readFileSync('/dev/stdin', 'utf8'));
| ^~~~
a.cc:24:33: warning: multi-character literal with 10 characters exceeds 'int' size of 4 bytes
24 | main(require('fs').readFileSync('/dev/stdin', 'utf8'));
| ^~~~~~~~~~~~
a.cc:24:47: warning: multi-character character constant [-Wmultichar]
24 | main(require('fs').readFileSync('/dev/stdin', 'utf8'));
| ^~~~~~
a.cc:1:7: error: 'gcd' does not name a type
1 | const gcd = (a,b)=>{
| ^~~
a.cc:10:7: error: 'lcm' does not name a type
10 | const lcm =(a,b)=>{
| ^~~
a.cc:14:1: error: 'function' does not name a type; did you mean 'union'?
14 | function main(input) {
| ^~~~~~~~
| union
a.cc:24:5: error: expected constructor, destructor, or type conversion before '(' token
24 | main(require('fs').readFileSync('/dev/stdin', 'utf8'));
| ^
|
s433114936 | p03633 | C++ | const gcd = (a,b)=>{
if(a%b===0){
return (b)
}
else {
return (gcd(b,a%b))
}
}
const lcm =(a,b)=>{
return a/gcd(a,b)*b
}
function main(input) {
const arr=input.split('\n')
let ans=1;
arr.forEach((el,index)=>{
if(index==1){continue}
else ans= lcm(ans,el)
})
console.log(ans)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8')); | a.cc:24:14: warning: multi-character character constant [-Wmultichar]
24 | main(require('fs').readFileSync('/dev/stdin', 'utf8'));
| ^~~~
a.cc:24:33: warning: multi-character literal with 10 characters exceeds 'int' size of 4 bytes
24 | main(require('fs').readFileSync('/dev/stdin', 'utf8'));
| ^~~~~~~~~~~~
a.cc:24:47: warning: multi-character character constant [-Wmultichar]
24 | main(require('fs').readFileSync('/dev/stdin', 'utf8'));
| ^~~~~~
a.cc:1:7: error: 'gcd' does not name a type
1 | const gcd = (a,b)=>{
| ^~~
a.cc:10:7: error: 'lcm' does not name a type
10 | const lcm =(a,b)=>{
| ^~~
a.cc:14:1: error: 'function' does not name a type; did you mean 'union'?
14 | function main(input) {
| ^~~~~~~~
| union
a.cc:24:5: error: expected constructor, destructor, or type conversion before '(' token
24 | main(require('fs').readFileSync('/dev/stdin', 'utf8'));
| ^
|
s924231821 | p03633 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b)
{
if (a%b == 0)
{
return(b);
}
else
{
return(gcd(b, a%b));
}
}
ll lcm(ll a, ll b)
{
return a / gcd(a, b)* b ;
}
int main(){
ll n;
ll ans=1;
cin n;
for(int =0;i<n;i++){
ll t ;cin t;
ans= lcm(ans,t);
}
cout <<ans<<endl
}
| a.cc: In function 'int main()':
a.cc:24:6: error: expected ';' before 'n'
24 | cin n;
| ^~
| ;
a.cc:26:11: error: expected unqualified-id before '=' token
26 | for(int =0;i<n;i++){
| ^
a.cc:26:10: error: expected ';' before '=' token
26 | for(int =0;i<n;i++){
| ^~
| ;
a.cc:26:11: error: expected primary-expression before '=' token
26 | for(int =0;i<n;i++){
| ^
a.cc:26:14: error: 'i' was not declared in this scope
26 | for(int =0;i<n;i++){
| ^
a.cc:26:17: error: expected ')' before ';' token
26 | for(int =0;i<n;i++){
| ~ ^
| )
a.cc:26:18: error: 'i' was not declared in this scope
26 | for(int =0;i<n;i++){
| ^
a.cc:30:19: error: expected ';' before '}' token
30 | cout <<ans<<endl
| ^
| ;
31 | }
| ~
|
s470502195 | p03633 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b)
{
if (a%b == 0)
{
return(b);
}
else
{
return(gcd(b, a%b));
}
}
ll lcm(ll a, ll b)
{
return a / gcd(a, b)* b ;
}
int main(){
ll n;
ll ans=1;
cin n;
vector<ll> clock(100);
for(int =0;i<n;i++){
cin >>clock.at(i);
ans= lcm(ans,clock.at(i);
}
cout <<ans<<endl
}
| a.cc: In function 'int main()':
a.cc:24:6: error: expected ';' before 'n'
24 | cin n;
| ^~
| ;
a.cc:27:11: error: expected unqualified-id before '=' token
27 | for(int =0;i<n;i++){
| ^
a.cc:27:10: error: expected ';' before '=' token
27 | for(int =0;i<n;i++){
| ^~
| ;
a.cc:27:11: error: expected primary-expression before '=' token
27 | for(int =0;i<n;i++){
| ^
a.cc:27:14: error: 'i' was not declared in this scope
27 | for(int =0;i<n;i++){
| ^
a.cc:27:17: error: expected ')' before ';' token
27 | for(int =0;i<n;i++){
| ~ ^
| )
a.cc:27:18: error: 'i' was not declared in this scope
27 | for(int =0;i<n;i++){
| ^
a.cc:31:19: error: expected ';' before '}' token
31 | cout <<ans<<endl
| ^
| ;
32 | }
| ~
|
s495418779 | p03633 | C++ | #include <bits/stdc++.h>
using namespace std;
ll gcd(ll a, ll b)
{
if (a%b == 0)
{
return(b);
}
else
{
return(gcd(b, a%b));
}
}
ll lcm(ll a, ll b)
{
return a / gcd(a, b)* b ;
}
int main(){
ll n;
ll ans=1;
cin n;
vector<ll> clock(100);
for(int =0;i<n;i++){
cin >>clock.at(i);
ans= lcm(ans,clock.at(i);
}
cout <<ans<<endl
}
| a.cc:5:1: error: 'll' does not name a type
5 | ll gcd(ll a, ll b)
| ^~
a.cc:17:1: error: 'll' does not name a type
17 | ll lcm(ll a, ll b)
| ^~
a.cc: In function 'int main()':
a.cc:22:3: error: 'll' was not declared in this scope
22 | ll n;
| ^~
a.cc:23:5: error: expected ';' before 'ans'
23 | ll ans=1;
| ^~~~
| ;
a.cc:24:6: error: expected ';' before 'n'
24 | cin n;
| ^~
| ;
a.cc:25:12: error: template argument 2 is invalid
25 | vector<ll> clock(100);
| ^
a.cc:27:11: error: expected unqualified-id before '=' token
27 | for(int =0;i<n;i++){
| ^
a.cc:27:10: error: expected ';' before '=' token
27 | for(int =0;i<n;i++){
| ^~
| ;
a.cc:27:11: error: expected primary-expression before '=' token
27 | for(int =0;i<n;i++){
| ^
a.cc:27:14: error: 'i' was not declared in this scope
27 | for(int =0;i<n;i++){
| ^
a.cc:27:16: error: 'n' was not declared in this scope; did you mean 'yn'?
27 | for(int =0;i<n;i++){
| ^
| yn
a.cc:27:17: error: expected ')' before ';' token
27 | for(int =0;i<n;i++){
| ~ ^
| )
a.cc:27:18: error: 'i' was not declared in this scope
27 | for(int =0;i<n;i++){
| ^
a.cc:31:10: error: 'ans' was not declared in this scope; did you mean 'abs'?
31 | cout <<ans<<endl
| ^~~
| abs
|
s542706001 | p03633 | C++ | import fractions
def lcm(a, b):
return a * b // fractions.gcd(a, b)
def main():
n = int(input())
t = []
for i in range(n):
t.append(int(input()))
ans = 1
for i in range(n):
ans = lcm(ans, t[i])
print(ans)
if __name__ == '__main__':
main()
| a.cc:18:16: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
18 | if __name__ == '__main__':
| ^~~~~~~~~~
a.cc:1:1: error: 'import' does not name a type
1 | import fractions
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
|
s032755494 | p03633 | C++ | #include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b)
{
if (a%b == 0)
{
return(b);
}
else
{
return(gcd(b, a%b));
}
}
int lcm(int a, int b)
{
return a / gcd(a, b)* b ;
}
int main(){
ll n;
ll=ans=1;
cin n;
vector<int> clock(100);
for(int =0;i<n;i++){
cin >>clock.at(i);
ans= lcm(ans,clock.at(i);
}
cout <<ans<<endl
} | a.cc: In function 'int main()':
a.cc:22:3: error: 'll' was not declared in this scope
22 | ll n;
| ^~
a.cc:23:6: error: 'ans' was not declared in this scope; did you mean 'abs'?
23 | ll=ans=1;
| ^~~
| abs
a.cc:24:6: error: expected ';' before 'n'
24 | cin n;
| ^~
| ;
a.cc:27:11: error: expected unqualified-id before '=' token
27 | for(int =0;i<n;i++){
| ^
a.cc:27:10: error: expected ';' before '=' token
27 | for(int =0;i<n;i++){
| ^~
| ;
a.cc:27:11: error: expected primary-expression before '=' token
27 | for(int =0;i<n;i++){
| ^
a.cc:27:14: error: 'i' was not declared in this scope
27 | for(int =0;i<n;i++){
| ^
a.cc:27:16: error: 'n' was not declared in this scope; did you mean 'yn'?
27 | for(int =0;i<n;i++){
| ^
| yn
a.cc:27:17: error: expected ')' before ';' token
27 | for(int =0;i<n;i++){
| ~ ^
| )
a.cc:27:18: error: 'i' was not declared in this scope
27 | for(int =0;i<n;i++){
| ^
|
s495471255 | p03633 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int n;cin >> n;
vector<int> t(n);
for(int i=0;i<n;i++)cin >> t[i];
int gcd(int a,b){
if(a%b==0)return 0;
return gcd(a%b,b);
}
int lcm(int a,b){
return (a*b)/gcd(a,b);
}
int l=t[0];
for(int i=0;i<n;i++){
l = lcm(l,t[i]);
}
cout << l << endl;
} | a.cc: In function 'int main()':
a.cc:8:17: error: 'b' has not been declared
8 | int gcd(int a,b){
| ^
a.cc:8:19: error: a function-definition is not allowed here before '{' token
8 | int gcd(int a,b){
| ^
a.cc:12:17: error: 'b' has not been declared
12 | int lcm(int a,b){
| ^
a.cc:12:19: error: a function-definition is not allowed here before '{' token
12 | int lcm(int a,b){
| ^
|
s083337352 | p03633 | C++ | #include<iostream>
#define INF 10000007
typedef long long ll;
using namespace std;
ll gcd(ll a,ll b){
if (b==0)return a;
return gcd(b,a%b);
}
int main(){
ll n;
cin >> n;
ll a[n];
for(int i = 0;i < n;i++) cin >> a[i];
for(int i = 1;i < n;i++){
g = gcd(an,a[i]);
an = an*a[i]/g;
}
cout << an << endl;
}
| a.cc: In function 'int main()':
a.cc:20:4: error: 'g' was not declared in this scope
20 | g = gcd(an,a[i]);
| ^
a.cc:20:12: error: 'an' was not declared in this scope; did you mean 'a'?
20 | g = gcd(an,a[i]);
| ^~
| a
a.cc:23:11: error: 'an' was not declared in this scope; did you mean 'a'?
23 | cout << an << endl;
| ^~
| a
|
s527544840 | p03633 | C++ | #include<iostream>
using namespace std;
int main(){
ll n;
cin >> n;
ll a[n];
for(int i = 0;i < n;i++) cin >> a[i];
for(int i = 1;i < n;i++){
g = gcd(an,a[i]);
an = an*a[i]/g;
}
cout << an << endl;
} | a.cc: In function 'int main()':
a.cc:4:3: error: 'll' was not declared in this scope
4 | ll n;
| ^~
a.cc:5:10: error: 'n' was not declared in this scope
5 | cin >> n;
| ^
a.cc:6:5: error: expected ';' before 'a'
6 | ll a[n];
| ^~
| ;
a.cc:7:35: error: 'a' was not declared in this scope
7 | for(int i = 0;i < n;i++) cin >> a[i];
| ^
a.cc:9:4: error: 'g' was not declared in this scope
9 | g = gcd(an,a[i]);
| ^
a.cc:9:12: error: 'an' was not declared in this scope
9 | g = gcd(an,a[i]);
| ^~
a.cc:9:15: error: 'a' was not declared in this scope
9 | g = gcd(an,a[i]);
| ^
a.cc:9:8: error: 'gcd' was not declared in this scope
9 | g = gcd(an,a[i]);
| ^~~
a.cc:12:11: error: 'an' was not declared in this scope
12 | cout << an << endl;
| ^~
|
s028529805 | p03633 | C++ | #include<iostream>
using namespace std;
int main(){
ll n;
cin >> n;
ll a[n];
for(int i = 0;i < n;i++) cin >> a[i];
for(int i = 1;i < n;i++){
g = gcd(an,a[i]);
an = an*a[i]/g;
}
cout << an << endl; | a.cc: In function 'int main()':
a.cc:4:3: error: 'll' was not declared in this scope
4 | ll n;
| ^~
a.cc:5:10: error: 'n' was not declared in this scope
5 | cin >> n;
| ^
a.cc:6:5: error: expected ';' before 'a'
6 | ll a[n];
| ^~
| ;
a.cc:7:35: error: 'a' was not declared in this scope
7 | for(int i = 0;i < n;i++) cin >> a[i];
| ^
a.cc:9:4: error: 'g' was not declared in this scope
9 | g = gcd(an,a[i]);
| ^
a.cc:9:12: error: 'an' was not declared in this scope
9 | g = gcd(an,a[i]);
| ^~
a.cc:9:15: error: 'a' was not declared in this scope
9 | g = gcd(an,a[i]);
| ^
a.cc:9:8: error: 'gcd' was not declared in this scope
9 | g = gcd(an,a[i]);
| ^~~
a.cc:12:11: error: 'an' was not declared in this scope
12 | cout << an << endl;
| ^~
a.cc:12:22: error: expected '}' at end of input
12 | cout << an << endl;
| ^
a.cc:3:11: note: to match this '{'
3 | int main(){
| ^
|
s565368560 | p03633 | Java | import java.io.*;
import java.util.StringTokenizer;
import static java.lang.Math.*;
public class Main {
public static void main(String[] args) {
new Main().solve();
}
private void solve() {
try(InputReader in = new InputReader(System.in);
PrintWriter out = new PrintWriter(System.out)) {
int n = in.nextInt();
long[] t = new long[n];
for (int i = 0; i < t.length; i++) {
t[i] = in.nextLong();
}
long ans = 1;
for (int i = 0; i < t.length; i++) {
ans = lcm(ans, t[i]);
}
out.println(ans);
}
catch(IOException e) {
System.err.println(e);
}
}
long gdc(long a, long b) {
if(b == 0) return a;
return gdc(b, a % b);
}
long lcm(long a, long b) {
return b / gdc(a, b) * a;
}
int atoi(String s) { return Integer.parseInt(s); }
long atol(String s) { return Long.parseLong(s); }
static class InputReader implements AutoCloseable {
public BufferedReader br;
public StringTokenizer st;
public InputReader(InputStream stream) {
br = new BufferedReader(new InputStreamReader(stream), 32768);
st = null;
}
public String nextLine() throws IOException {
return br.readLine();
}
public String next() {
if (st == null || !st.hasMoreTokens()) {
try { st = new StringTokenizer(br.readLine());
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
return st.nextToken();
}
public int nextInt() { return Integer.parseInt(next()); }
public long nextLong() { return Long.parseLong(next()); }
int[] mapInt(int len) {
int[] ret = new int[len];
for (int i = 0; i < len; i++) ret[i] = Integer.parseInt(next());
return ret;
}
long[] mapLong(int len) {
long[] ret = new long[len];
for (int i = 0; i < len; i++) ret[i] = Long.parseLong(next());
return ret;
}
@Override public void close() throws IOException { br.close(); }
} | Main.java:77: error: reached end of file while parsing
}
^
1 error
|
s075835996 | p03633 | Java | import java.io.*;
import java.util.StringTokenizer;
import static java.lang.Math.*;
public class Main {
public static void main(String[] args) {
new Main().solve();
}
private void solve() {
try(InputReader in = new InputReader(System.in);
PrintWriter out = new PrintWriter(System.out)) {
int n = in.nextInt();
long[] t = new long[n];
for (int i = 0; i < t.length; i++) {
t[i] = in.nextLong();
}
long ans = 1;
for (int i = 0; i < t.length; i++) {
ans = lcm(ans, t[i]);
}
out.println(ans);
}
catch(IOException e) {
System.err.println(e);
}
}
long gdc(long a, long b) {
if(b == 0) return a;
return gdc(b, a % b);
}
long lcm(long a, long b) {
return b / gdc(a, b) * a;
}
int atoi(String s) { return Integer.parseInt(s); }
long atol(String s) { return Long.parseLong(s); }
static class InputReader implements AutoCloseable {
public BufferedReader br;
public StringTokenizer st;
public InputReader(InputStream stream) {
br = new BufferedReader(new InputStreamReader(stream), 32768);
st = null;
}
public String nextLine() throws IOException {
return br.readLine();
}
public String next() {
if (st == null || !st.hasMoreTokens()) {
try { st = new StringTokenizer(br.readLine());
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
return st.nextToken();
}
public int nextInt() { return Integer.parseInt(next()); }
public long nextLong() { return Long.parseLong(next()); }
int[] mapInt(int len) {
int[] ret = new int[len];
for (int i = 0; i < len; i++) ret[i] = Integer.parseInt(next());
return ret;
}
long[] mapLong(int len) {
long[] ret = new long[len];
for (int i = 0; i < len; i++) ret[i] = Long.parseLong(next());
return ret;
}
@Override public void close() throws IOException { br.close(); }
} | Main.java:77: error: reached end of file while parsing
}
^
1 error
|
s807180532 | p03633 | C | #include <iostream>
using namespace std;
typedef long long ll;
ll gcd(ll x, ll y) {
x = min(x, y), y = max(x, y);
if (y % x == 0)
return x;
else
return gcd(x, y % x);
}
ll lcm(ll x, ll y) {
ll g = gcd(x, y);
return x * (y / g);
}
int main() {
ll n, *t; cin >> n; t = new ll[n];
for (int i = 0; i < n; i++)
cin >> t[i];
ll ans = t[0];
for (int i = 1; i < n; i++) {
ans = lcm(ans, t[i]);
}
cout << ans << endl;
return 0;
} | main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s326037248 | p03633 | C++ |
{
scanf("%d",&t[i]);
if(i==1)
{
ans = __lcm(t[i],t[i-1]);
}
else if(i>1)
{
ans = __lcm(ans,t[i]);
}
}
printf("%d",ans);
} | a.cc:2:10: error: expected unqualified-id before '{' token
2 | {
| ^
a.cc:13:16: error: expected constructor, destructor, or type conversion before '(' token
13 | printf("%d",ans);
| ^
a.cc:14:1: error: expected declaration before '}' token
14 | }
| ^
|
s515822786 | p03633 | C++ | #include<bits/stdc++.h>
using namespace std;
unsigned long long f(unsigned long long a,unsigned long long b)
{
unsigned long long ml=a;
while(ml>0)
{
ml
}
}
main()
{
int n;
cin >> n;
long long ar[n];
for(int i=0;i<n;i++)
{
cin >> ar[i];
}
for(int i=1;i<n;i++)
{
ar[i]=ar[i]/__gcd(ar[i],ar[i-1]) * ar[i-1];
}
cout << ar[n-1];
} | a.cc: In function 'long long unsigned int f(long long unsigned int, long long unsigned int)':
a.cc:10:19: error: expected ';' before '}' token
10 | ml
| ^
| ;
11 | }
| ~
a.cc:13:1: warning: no return statement in function returning non-void [-Wreturn-type]
13 | }
| ^
a.cc: At global scope:
a.cc:16:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
16 | main()
| ^~~~
|
s244639639 | p03633 | C++ | #include<bits/stdc++.h>
#define ll long long
using namespace std;
ll gcdab(ll a,ll b)
{
if(b==0)return a;
return gcdab(b,a%b);
}
int main()
{
ll n;
cin>>n;
ll arr[n];
for(ll i=0;i<n;i++)
cin>>arr[i];
int ll=arr[0];
for(ll i=1;i<n;i++)
{
ans= ans/gcdab(ans,arr[i]);
ans=ans*arr[i];
}
cout<<ans<<endl;
} | a.cc: In function 'int main()':
a.cc:19:9: error: expected unqualified-id before '=' token
19 | int ll=arr[0];
| ^
a.cc:23:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
23 | ans= ans/gcdab(ans,arr[i]);
| ^~~
| abs
a.cc:30:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
30 | cout<<ans<<endl;
| ^~~
| abs
|
s943979432 | p03633 | C++ | #include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) {
if (a < b) swap(a, b);
ll r = a % b;
while (r != 0) {
a = b;i
b = r;
r = a % b;
}
return b;
}
ll lcm(ll a, ll b) {
return a / gcd(a, b) * b;
}
int main() {
int N; cin >> N;
vector<ll> T(N);
REP(i, 0, N) cin >> T[i];
ll ans = T[0];
REP(i, 1, N) {
ans = lcm(ans, T[i]);
}
cout << ans << endl;
return 0;
} | a.cc: In function 'll gcd(ll, ll)':
a.cc:10:15: error: 'i' was not declared in this scope
10 | a = b;i
| ^
|
s655103463 | p03633 | Java | import java.util.*;
class Main{
static long gcd (long m, long n) {
if(m<n) return gcd(n,m);
if(n==0) return m;
return gcd(n,m%n);
}
static long lcm(long m,long n){
return m/gcd(m,n)*n;
}
public static void main(String[] args){
Scanner scan=new Scanner(System.in);
int N=scan.nextInt();
long[] T=new long[N];
for(int i=0;i<N;i++){
T[i]=scan.nextLong();
}
if(N==1){
tmp=T[0];
}
else{
long tmp=lcm(T[0],T[1]);
for(int i=2;i<N;i++){
tmp=lcm(tmp,T[i]);
}
}
System.out.println(tmp);
}
} | Main.java:19: error: cannot find symbol
tmp=T[0];
^
symbol: variable tmp
location: class Main
Main.java:28: error: cannot find symbol
System.out.println(tmp);
^
symbol: variable tmp
location: class Main
2 errors
|
s625793675 | p03633 | C | v#include<stdio.h>
int main(void){
int num=0;
int clock[num];
int i=0;
int max=0;
int c=0;
int result=0;
scanf("%d",&num);
for(i=0;i<num;i++){
scanf("%d",clock[i]);
if(clock[i]>max){max=clock[i];}
}
for(i=0;i<1000;i++){
for(int k=0;k<num;k++){
if((max*i)%clock[k]==0){
c=0;
}
else{c=1;}
}
if(c==1){c==0;}
else{break;result=max*i;}
}
printf("%d",result);
}
| main.c:1:2: error: stray '#' in program
1 | v#include<stdio.h>
| ^
main.c:1:1: error: unknown type name 'v'
1 | v#include<stdio.h>
| ^
main.c:1:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
1 | v#include<stdio.h>
| ^
|
s195621140 | p03633 | C++ | #include<stdio.h>
#include<math.h>
int main(void){
int num=0;//個数
float time[num];
int count=0;
scanf("%d",&num);
for(int k=0;k<num;k++){
scanf("%f",&time[k]);
}
for(int i=0;i<=1000000000000000000;i++){
for(int m=0;m<num;m++){
if(i%time[m]==0){
count+=1;
}
}
if(count==num){
printf("%d",i);
break;
}
}
}
| a.cc: In function 'int main()':
a.cc:16:29: error: invalid operands of types 'int' and 'float' to binary 'operator%'
16 | if(i%time[m]==0){
| ~^~~~~~~~
| | |
| int float
|
s103652577 | p03633 | C++ | #include<stdio.h>
#include<math.h>
int main(void){
int num=0;//個数
float time[num];
int count=0;
scanf("%d",num);
for(int k=0;k<num;k++){
scanf("%f",time[k]);
}
for(int i=0;i<=1000000000000000000;i++){
for(int m=0;m<num;m++){
if(i%time[m]==0){
count+=1;
}
}
if(count==num){
printf("%d",i);
break;
}
}
} | a.cc: In function 'int main()':
a.cc:16:29: error: invalid operands of types 'int' and 'float' to binary 'operator%'
16 | if(i%time[m]==0){
| ~^~~~~~~~
| | |
| int float
|
s619109637 | p03633 | C++ | #include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << endl;
#define CFYN(n) cout << ( (n) ? "YES":"NO") << endl;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
ll gcd(ll a,ll b){
if (a % b == 0) {
return b;
} else {
return gcd(b,a%b);
}
}
ll lcm(ll x, ll y) {
return x*y / gcd(x,y);
}
int main(void)
{
IOS
int n; cin >> n;
vector<int> v(n);
REP(i,n) cin >> v[i];
ll ans = 1;
REP(i,n) {
if (ans < v[i]) swap(ans,v[i]);
if (ans % v[i] != 0) ans = lcm(ans,v[i]);
}
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:33:29: error: no matching function for call to 'swap(ll&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
33 | if (ans < v[i]) swap(ans,v[i]);
| ~~~~^~~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:77,
from a.cc:1:
/usr/include/c++/14/any:430:15: note: candidate: 'void std::swap(any&, any&)' (near match)
430 | inline void swap(any& __x, any& __y) noexcept { __x.swap(__y); }
| ^~~~
/usr/include/c++/14/any:430:15: note: conversion of argument 2 would be ill-formed:
/usr/include/c++/14/any:430:15: error: cannot bind non-const lvalue reference of type 'std::any&' to an rvalue of type 'std::any'
/usr/include/c++/14/any:191:7: note: after user-defined conversion: 'std::any::any(_Tp&&) [with _Tp = int&; _VTp = int; _Mgr = _Manager_internal<int>; typename std::enable_if<(is_copy_constructible_v<_VTp> && (! __is_in_place_type_v<_VTp>)), bool>::type <anonymous> = true]'
191 | any(_Tp&& __value)
| ^~~
In file included from /usr/include/c++/14/exception:166,
from /usr/include/c++/14/stdexcept:38,
from /usr/include/c++/14/system_error:43,
from /usr/include/c++/14/bits/ios_base.h:46,
from /usr/include/c++/14/streambuf:43,
from /usr/include/c++/14/bits/streambuf_iterator.h:35,
from /usr/include/c++/14/iterator:66,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54:
/usr/include/c++/14/bits/exception_ptr.h:229:5: note: candidate: 'void std::__exception_ptr::swap(exception_ptr&, exception_ptr&)'
229 | swap(exception_ptr& __lhs, exception_ptr& __rhs)
| ^~~~
/usr/include/c++/14/bits/exception_ptr.h:229:25: note: no known conversion for argument 1 from 'll' {aka 'long long int'} to 'std::__exception_ptr::exception_ptr&'
229 | swap(exception_ptr& __lhs, exception_ptr& __rhs)
| ~~~~~~~~~~~~~~~^~~~~
In file included from /usr/include/c++/14/future:51,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:176:
/usr/include/c++/14/bits/std_thread.h:328:3: note: candidate: 'void std::swap(thread&, thread&)'
328 | swap(thread& __x, thread& __y) noexcept
| ^~~~
/usr/include/c++/14/bits/std_thread.h:328:16: note: no known conversion for argument 1 from 'll' {aka 'long long int'} to 'std::thread&'
328 | swap(thread& __x, thread& __y) noexcept
| ~~~~~~~~^~~
In file included from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/sstream:1204:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(basic_stringbuf<_CharT, _Traits, _Alloc>&, basic_stringbuf<_CharT, _Traits, _Alloc>&)'
1204 | swap(basic_stringbuf<_CharT, _Traits, _Allocator>& __x,
| ^~~~
/usr/include/c++/14/sstream:1204:5: note: template argument deduction/substitution failed:
a.cc:33:29: note: mismatched types 'std::__cxx11::basic_stringbuf<_CharT, _Traits, _Alloc>' and 'll' {aka 'long long int'}
33 | if (ans < v[i]) swap(ans,v[i]);
| ~~~~^~~~~~~~~~
/usr/include/c++/14/sstream:1212:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(basic_istringstream<_CharT, _Traits, _Allocator>&, basic_istringstream<_CharT, _Traits, _Allocator>&)'
1212 | swap(basic_istringstream<_CharT, _Traits, _Allocator>& __x,
| ^~~~
/usr/include/c++/14/sstream:1212:5: note: template argument deduction/substitution failed:
a.cc:33:29: note: mismatched types 'std::__cxx11::basic_istringstream<_CharT, _Traits, _Allocator>' and 'll' {aka 'long long int'}
33 | if (ans < v[i]) swap(ans,v[i]);
| ~~~~^~~~~~~~~~
/usr/include/c++/14/sstream:1219:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(basic_ostringstream<_CharT, _Traits, _Allocator>&, basic_ostringstream<_CharT, _Traits, _Allocator>&)'
1219 | swap(basic_ostringstream<_CharT, _Traits, _Allocator>& __x,
| ^~~~
/usr/include/c++/14/sstream:1219:5: note: template argument deduction/substitution failed:
a.cc:33:29: note: mismatched types 'std::__cxx11::basic_ostringstream<_CharT, _Traits, _Allocator>' and 'll' {aka 'long long int'}
33 | if (ans < v[i]) swap(ans,v[i]);
| ~~~~^~~~~~~~~~
/usr/include/c++/14/sstream:1226:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(basic_stringstream<_CharT, _Traits, _Allocator>&, basic_stringstream<_CharT, _Traits, _Allocator>&)'
1226 | swap(basic_stringstream<_CharT, _Traits, _Allocator>& __x,
| ^~~~
/usr/include/c++/14/sstream:1226:5: note: template argument deduction/substitution failed:
a.cc:33:29: note: mismatched types 'std::__cxx11::basic_stringstream<_CharT, _Traits, _Allocator>' and 'll' {aka 'long long int'}
33 | if (ans < v[i]) swap(ans,v[i]);
| ~~~~^~~~~~~~~~
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181:
/usr/include/c++/14/bits/regex.h:896:5: note: candidate: 'template<class _Ch_type, class _Rx_traits> void std::__cxx11::swap(basic_regex<_Ch_type, _Rx_traits>&, basic_regex<_Ch_type, _Rx_traits>&)'
896 | swap(basic_regex<_Ch_type, _Rx_traits>& __lhs,
| ^~~~
/usr/include/c++/14/bits/regex.h:896:5: note: template argument deduction/substitution failed:
a.cc:33:29: note: mismatched types 'std::__cxx11::basic_regex<_Ch_type, _Rx_traits>' and 'll' {aka 'long long int'}
33 | if (ans < v[i]) swap(ans,v[i]);
| ~~~~^~~~~~~~~~
/usr/include/c++/14/bits/regex.h:2230:5: note: candidate: 'template<class _Bi_iter, class _Alloc> void std::__cxx11::swap(match_results<_BiIter, _Alloc>&, match_results<_BiIter, _Alloc>&)'
2230 | swap(match_results<_Bi_iter, _Alloc>& __lhs,
| ^~~~
/usr/include/c++/14/bits/regex.h:2230:5: note: template argument deduction/substitution failed:
a.cc:33:29: note: mismatched types 'std::__cxx11::match_results<_BiIter, _Alloc>' and 'll' {aka 'long long int'}
33 | if (ans < v[i]) swap(ans,v[i]);
| ~~~~^~~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:61,
from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/move.h:226:5: note: candidate: 'template<class _Tp> std::_Require<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&)'
226 | swap(_Tp& __a, _Tp& __b)
| ^~~~
/usr/include/c++/14/bits/move.h:226:5: note: template argument deduction/substitution failed:
a.cc:33:29: note: deduced conflicting types for parameter '_Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
33 | if (ans < v[i]) swap(ans,v[i]);
| ~~~~^~~~~~~~~~
/usr/include/c++/14/bits/move.h:250:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> std::__enable_if_t<((bool)std::__is_swappable<_Tp>::value)> std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm])'
250 | swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
| ^~~~
/usr/include/c++/14/bits/move.h:250:5: note: template argument deduction/substitution failed:
a.cc:33:29: note: mismatched types '_Tp [_Nm]' and 'll' {aka 'long long int'}
33 | if (ans < v[i]) swap(ans,v[i]);
| ~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1089:5: note: candidate: 'template<class _T1, class _T2> typename std::enable_if<std::__and_<std::__is_swappable<_T1>, std::__is_swappable<_T2> >::value>::type std::swap(pair<_T1, _T2>&, pair<_T1, _T2>&)'
1089 | swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:1089:5: note: template argument deduction/substitution failed:
a.cc:33:29: note: mismatched types 'std::pair<_T1, _T2>' and 'll' {aka 'long long int'}
33 | if (ans < v[i]) swap(ans,v[i]);
| ~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1106:5: note: candidate: 'template<class _T1, class _T2> typename std::enable_if<(! std::__and_<std::__is_swappable<_T1>, std::__is_swappable<_T2> >::value)>::type std::swap(pair<_T1, _T2>&, pair<_T1, _T2>&)' (deleted)
1106 | swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete;
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:1106:5: note: template argument deduction/substitution failed:
a.cc:33:29: note: mismatched types 'std::pair<_T1, _T2>' and 'll' {aka 'long long int'}
33 | if (ans < v[i]) swap(ans,v[i]);
| ~~~~^~~~~~~~~~
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/basic_string.h:4039:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> void std::swap(__cxx11::basic_string<_CharT, _Traits, _Allocator>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
4039 | swap(basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4039:5: note: template argument deduction/substitution failed:
a.cc:33:29: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'll' {aka 'long long int'}
33 | if (ans < v[i]) swap(ans,v[i]);
| ~~~~^~~~~~~~~~
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:2805:5: |
s004730558 | p03633 | C++ | //うしさん
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
using db = double;
using vll = vector<long long>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
#define che(a,string) cout<<"//"<<string <<"=="<<(a)<<"//" <<endl;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b) for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n) For(i, 0, n)
#define leftunique(a) {SORT(a);(a).erase(unique((a).begin(),(a).end()),(a).end());}
//leftuniqueは配列から同じ要素のものを取り除く 例 4 6 2 1 3 4 1 2 なら 1 2 3 4 6 になる
#define debug(x) cout << #x << " = " << (x) << endl;
bool IsInt(double a){int b = a/1;if(a==b){return true;}else {return false;}}
bool coY() {cout <<"Yes"<<endl;}
bool coN(){cout <<"No"<<endl;}
const int mod = 1e9 + 7;
const ll INF = 1LL << 60;
//ここから書き始める
int main()
{
cout <<setprecision(10);
int N;
int64 T[100];
cin >> N;
rep(i,N) cin >> T[i];
int64 gcd = 1;
rep(i,N){
gcd = T[i] /__gcd(T[i],gcd) * gcd;
}
cout << gcd << endl;
}
| a.cc: In function 'bool coY()':
a.cc:20:32: warning: no return statement in function returning non-void [-Wreturn-type]
20 | bool coY() {cout <<"Yes"<<endl;}
| ^
a.cc: In function 'bool coN()':
a.cc:21:30: warning: no return statement in function returning non-void [-Wreturn-type]
21 | bool coN(){cout <<"No"<<endl;}
| ^
a.cc: In function 'int main()':
a.cc:30:9: error: 'int64' was not declared in this scope
30 | int64 T[100];
| ^~~~~
a.cc:33:25: error: 'T' was not declared in this scope
33 | rep(i,N) cin >> T[i];
| ^
a.cc:34:14: error: expected ';' before 'gcd'
34 | int64 gcd = 1;
| ^~~~
| ;
a.cc:36:23: error: 'T' was not declared in this scope
36 | gcd = T[i] /__gcd(T[i],gcd) * gcd;
| ^
a.cc:38:14: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and '<unresolved overloaded function type>')
38 | cout << gcd << endl;
| ~~~~~^~~~~~
In file included from /usr/include/c++/14/istream:41,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
from a.cc:2:
/usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'}
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]'
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ^~~~~~~~
/usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::ios_base& (*)(std::ios_base&)'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
174 | operator<<(long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long int'
174 | operator<<(long __n)
| ~~~~~^~~
/usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
178 | operator<<(unsigned long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long unsigned int'
178 | operator<<(unsigned long __n)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
182 | operator<<(bool __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'bool'
182 | operator<<(bool __n)
| ~~~~~^~~
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]'
96 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short int'
97 | operator<<(short __n)
| ~~~~~~^~~
/usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
189 | operator<<(unsigned short __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short unsigned int'
189 | operator<<(unsigned short __n)
| ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]'
110 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'int'
111 | operator<<(int __n)
| ~~~~^~~
/usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
200 | operator<<(unsigned int __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'unsigned int'
200 | operator<<(unsigned int __n)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
211 | operator<<(long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long int'
211 | operator<<(long long __n)
| ~~~~~~~~~~^~~
/usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
215 | operator<<(unsigned long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long unsigned int'
215 | operator<<(unsigned long long __n)
| ~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
231 | operator<<(double __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'double'
231 | operator<<(double __f)
| ~~~~~~~^~~
/usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
235 | operator<<(float __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'float'
235 | operator<<(float __f)
| ~~~~~~^~~
/usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
243 | operator<<(long double __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long double'
243 | operator<< |
s710338023 | p03633 | C++ |
using namespace std;
using ll =long long;
using db = double;
using vll = vector<long long>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
#define che(a,string) cout<<"//"<<string <<"=="<<(a)<<"//" <<endl;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b) for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n) For(i, 0, n)
#define leftunique(a) {SORT(a);(a).erase(unique((a).begin(),(a).end()),(a).end());}
//leftuniqueは配列から同じ要素のものを取り除く 例 4 6 2 1 3 4 1 2 なら 1 2 3 4 6 になる
#define debug(x) cout << #x << " = " << (x) << endl;
bool IsInt(double a){int b = a/1;if(a==b){return true;}else {return false;}}
bool coY() {cout <<"Yes"<<endl;}
bool coN(){cout <<"No"<<endl;}
const int mod = 1e9 + 7;
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
using db = double;
using vll = vector<long long>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
#define che(a,string) cout<<"//"<<string <<"=="<<(a)<<"//" <<endl;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b) for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n) For(i, 0, n)
#define leftunique(a) {SORT(a);(a).erase(unique((a).begin(),(a).end()),(a).end());}
//leftuniqueは配列から同じ要素のものを取り除く 例 4 6 2 1 3 4 1 2 なら 1 2 3 4 6 になる
#define debug(x) cout << #x << " = " << (x) << endl;
bool IsInt(double a){int b = a/1;if(a==b){return true;}else {return false;}}
bool coY() {cout <<"Yes"<<endl;}
bool coN(){cout <<"No"<<endl;}
const int mod = 1e9 + 7;
const ll INF = 1LL << 60;
//ここから書き始める
int main()
{
cout <<setprecision(10);
int N;
int64 T[100];
cin >> N;
rep(i,N) cin >> T[i];
int64 gcd = 1;
rep(i,N){
gcd = T[i] /__gcd(T[i],gcd) * gcd;
}
cout << gcd << endl;
}
| a.cc:5:13: error: 'vector' does not name a type
5 | using vll = vector<long long>;
| ^~~~~~
a.cc: In function 'bool coY()':
a.cc:18:13: error: 'cout' was not declared in this scope
18 | bool coY() {cout <<"Yes"<<endl;}
| ^~~~
a.cc:1:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 |
a.cc:18:27: error: 'endl' was not declared in this scope
18 | bool coY() {cout <<"Yes"<<endl;}
| ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
+++ |+#include <ostream>
1 |
a.cc:18:32: warning: no return statement in function returning non-void [-Wreturn-type]
18 | bool coY() {cout <<"Yes"<<endl;}
| ^
a.cc: In function 'bool coN()':
a.cc:19:12: error: 'cout' was not declared in this scope
19 | bool coN(){cout <<"No"<<endl;}
| ^~~~
a.cc:19:12: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:19:25: error: 'endl' was not declared in this scope
19 | bool coN(){cout <<"No"<<endl;}
| ^~~~
a.cc:19:25: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
a.cc:19:30: warning: no return statement in function returning non-void [-Wreturn-type]
19 | bool coN(){cout <<"No"<<endl;}
| ^
a.cc: At global scope:
a.cc:28:31: error: redefinition of 'template<class T> bool chmin(T&, T)'
28 | template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
| ^~~~~
a.cc:7:31: note: 'template<class T> bool chmin(T&, T)' previously declared here
7 | template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
| ^~~~~
a.cc:29:31: error: redefinition of 'template<class T> bool chmax(T&, T)'
29 | template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
| ^~~~~
a.cc:8:31: note: 'template<class T> bool chmax(T&, T)' previously declared here
8 | template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
| ^~~~~
a.cc:38:6: error: redefinition of 'bool IsInt(double)'
38 | bool IsInt(double a){int b = a/1;if(a==b){return true;}else {return false;}}
| ^~~~~
a.cc:17:6: note: 'bool IsInt(double)' previously defined here
17 | bool IsInt(double a){int b = a/1;if(a==b){return true;}else {return false;}}
| ^~~~~
a.cc:39:6: error: redefinition of 'bool coY()'
39 | bool coY() {cout <<"Yes"<<endl;}
| ^~~
a.cc:18:6: note: 'bool coY()' previously defined here
18 | bool coY() {cout <<"Yes"<<endl;}
| ^~~
a.cc: In function 'bool coY()':
a.cc:39:32: warning: no return statement in function returning non-void [-Wreturn-type]
39 | bool coY() {cout <<"Yes"<<endl;}
| ^
a.cc: At global scope:
a.cc:40:6: error: redefinition of 'bool coN()'
40 | bool coN(){cout <<"No"<<endl;}
| ^~~
a.cc:19:6: note: 'bool coN()' previously defined here
19 | bool coN(){cout <<"No"<<endl;}
| ^~~
a.cc: In function 'bool coN()':
a.cc:40:30: warning: no return statement in function returning non-void [-Wreturn-type]
40 | bool coN(){cout <<"No"<<endl;}
| ^
a.cc: At global scope:
a.cc:41:11: error: redefinition of 'const int mod'
41 | const int mod = 1e9 + 7;
| ^~~
a.cc:20:11: note: 'const int mod' previously defined here
20 | const int mod = 1e9 + 7;
| ^~~
a.cc: In function 'int main()':
a.cc:49:9: error: 'int64' was not declared in this scope
49 | int64 T[100];
| ^~~~~
a.cc:52:25: error: 'T' was not declared in this scope
52 | rep(i,N) cin >> T[i];
| ^
a.cc:53:14: error: expected ';' before 'gcd'
53 | int64 gcd = 1;
| ^~~~
| ;
a.cc:55:23: error: 'T' was not declared in this scope
55 | gcd = T[i] /__gcd(T[i],gcd) * gcd;
| ^
a.cc:57:14: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and '<unresolved overloaded function type>')
57 | cout << gcd << endl;
| ~~~~~^~~~~~
In file included from /usr/include/c++/14/istream:41,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
from a.cc:21:
/usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'}
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]'
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ^~~~~~~~
/usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::ios_base& (*)(std::ios_base&)'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
174 | operator<<(long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long int'
174 | operator<<(long __n)
| ~~~~~^~~
/usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
178 | operator<<(unsigned long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long unsigned int'
178 | operator<<(unsigned long __n)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
182 | operator<<(bool __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'bool'
182 | operator<<(bool __n)
| ~~~~~^~~
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]'
96 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short int'
97 | operator<<(short __n)
| ~~~~~~^~~
/usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
189 | operator<<(unsigned short __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short unsigned int'
189 | operator<<(unsigned short __n)
| ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]'
110 | basic |
s784693358 | p03633 | C++ | #include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,j,n) for (int i = j; i < (n); ++i)
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b)
{
if (a%b==0)
{
return(b);
}
else
{
return(gcd(b,a%b));
}
}
int main(){
ll n;
cin >> n;
ll t[n];
rep(i,n){
cin>>t[i];
}
ll c = t[0]/gcd(t[0],t[1]);
c*=*t[1];
REP(i,2,n){
ll d = t[i]/gcd(c,t[i]);
d*=c;
c = d;
}
cout<< c<<endl;
} | a.cc: In function 'int main()':
a.cc:28:8: error: invalid type argument of unary '*' (have 'll' {aka 'long long int'})
28 | c*=*t[1];
| ^~~~~
|
s670537826 | p03633 | C++ | #include<cstdio>
#include<numeric>
using namespace std;
int n;
long int multi_lcm(int n, long int t[n],int i, long int ans){
if (i == n) return ans;
ans = lcm(ans,t[i]);
return multi_lcm(n, t, i+1, ans);
}
int main(){
scanf("%d", &n);
long int t[n];
for (int i = 0; i < n; i++){
scanf("%ld", &t[i]);
}
long int ans = t[0];
ans = multi_lcm(n, t, 1, ans);
printf("%ld\n", ans);
} | a.cc:7:39: error: use of parameter outside function body before ']' token
7 | long int multi_lcm(int n, long int t[n],int i, long int ans){
| ^
a.cc:7:40: error: expected ')' before ',' token
7 | long int multi_lcm(int n, long int t[n],int i, long int ans){
| ~ ^
| )
a.cc:7:41: error: expected unqualified-id before 'int'
7 | long int multi_lcm(int n, long int t[n],int i, long int ans){
| ^~~
|
s823059035 | p03633 | C++ | #include<cstdio>
#include<numeric>
using namespace std;
int n;
long int multi_lcm(int n, long int t[n],int i, long int ans){
if (i == n) return ans;
ans = lcm(ans,t[i]);
return multi_lcm(n, t, i+1, ans);
}
int main(){
scanf("%d", &n);
long int t[n];
for (int i = 0; i < n; i++){
scanf("%ld", &t[i]);
}
long int ans = t[0];
ans = multi_lcm(n, t, 1, ans);
printf("%ld\n", ans);
} | a.cc:7:39: error: use of parameter outside function body before ']' token
7 | long int multi_lcm(int n, long int t[n],int i, long int ans){
| ^
a.cc:7:40: error: expected ')' before ',' token
7 | long int multi_lcm(int n, long int t[n],int i, long int ans){
| ~ ^
| )
a.cc:7:41: error: expected unqualified-id before 'int'
7 | long int multi_lcm(int n, long int t[n],int i, long int ans){
| ^~~
|
s762857125 | p03633 | C++ | #include<iostream>
#include<cmath>
#include<algorithm>
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll cmd(ll a, ll b){
return b==0?a:cmd(b,a%b);}
ll gcd(ll a , ll b){
ll k = cmd(a,b);
return (a/k)*b;
}
ll a[10000]={0};
int main(){
ll n,num=1;
cin >>n;
for(l i=1;i<=n;i++){
cin >>a[i];
}
for(int i=1;i<=n;i++){
num=gcd(a[i],num);
}
cout<<num<<endl;
}
| a.cc: In function 'int main()':
a.cc:18:9: error: 'l' was not declared in this scope
18 | for(l i=1;i<=n;i++){
| ^
a.cc:18:15: error: 'i' was not declared in this scope
18 | for(l i=1;i<=n;i++){
| ^
|
s358331787 | p03633 | C++ | #include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <math.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <sstream>
#include <iostream>
#include <time.h>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <string.h>
#define sf scanf
#define pf printf
#define lf double
#define ll long long
#define p123 printf("123\n");
#define pn printf("\n");
#define pk printf(" ");
#define p(n) printf("%d",n);
#define pln(n) printf("%d\n",n);
#define s(n) scanf("%d",&n);
#define ss(n) scanf("%s",n);
#define ps(n) printf("%s",n);
#define sld(n) scanf("%lld",&n);
#define pld(n) printf("%lld",n);
#define slf(n) scanf("%lf",&n);
#define plf(n) printf("%lf",n);
#define sc(n) scanf("%c",&n);
#define pc(n) printf("%c",n);
#define gc getchar();
#define re(n,a) memset(n,a,sizeof(n));
#define len(a) strlen(a)
using namespace std;
//https://codeforces.com/contest/1228/problems
//https://codeforces.com/contest/1228/submit
/*int main() {
int n;
s(n)
int count0 = 0;
int count1 = 0;
int x;
for(int i = 0; i < n; i ++) {
s(x)
if(x % 4 == 0) {
count0 ++;
}else if(x % 2 == 0){
count1 ++;
}
}
n -= count0*3;
if(n <= 0) {
puts("Yes");
} else {
n ++;
if(n <= count1){
puts("Yes");
}else{
puts("No");
}
}
return 0;
}
*/
#include<iostream>
#include<cmath>
#include<algorithm>
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll cmd(ll a, ll b){
return b==0?a:cmd(b,a%b);}
ll gcd(ll a , ll b){
ll k = cmd(a,b);
return (a/k)*b;
}
ll a[10000]={0};
int main(){
ll n,num=1;
cin >>n;
for(ll i=1;i<=n;i++){
cin >>a[i];
}
num=gcd(a[1],a[2]);
for(ll i=1;i<=n;i++){
num=gcd(a[i],num);
}
cout<<num<<endl;
}
| In file included from /usr/include/c++/14/chrono:41,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:172,
from a.cc:76:
/usr/include/c++/14/bits/chrono.h:1387:5: error: declaration of 'operator""scanf' as non-function
1387 | operator""s(long double __secs)
| ^~~~~~~~
/usr/include/c++/14/bits/chrono.h:1387:15: error: expected primary-expression before 'long'
1387 | operator""s(long double __secs)
| ^
/usr/include/c++/14/bits/chrono.h:1388:5: error: expected unqualified-id before '{' token
1388 | { return chrono::duration<long double>{__secs}; }
| ^
/usr/include/c++/14/bits/chrono.h:1393:7: error: declaration of 'operator""scanf' as non-function
1393 | operator""s()
| ^~~~~~~~
a.cc:29:27: error: expected primary-expression before ')' token
29 | #define s(n) scanf("%d",&n);
| ^
/usr/include/c++/14/bits/chrono.h:1394:7: error: expected unqualified-id before '{' token
1394 | { return __check_overflow<chrono::seconds, _Digits...>(); }
| ^
a.cc:29:20: error: expected identifier before string constant
29 | #define s(n) scanf("%d",&n);
| ^~~~
a.cc:29:20: error: expected ',' or '...' before string constant
In file included from /usr/include/c++/14/random:48,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:179:
/usr/include/c++/14/bits/random.h:2372:9: error: expected unqualified-id before '{' token
2372 | { return _M_s; }
| ^
a.cc:29:20: error: expected identifier before string constant
29 | #define s(n) scanf("%d",&n);
| ^~~~
a.cc:29:20: error: expected ',' or '...' before string constant
/usr/include/c++/14/bits/random.h:2417:7: error: expected unqualified-id before '{' token
2417 | { return _M_param.s(); }
| ^
/usr/include/c++/14/bits/random.h: In member function 'std::lognormal_distribution<_RealType>::result_type std::lognormal_distribution<_RealType>::operator()(_UniformRandomNumberGenerator&, const param_type&)':
a.cc:29:27: error: expected primary-expression before ')' token
29 | #define s(n) scanf("%d",&n);
| ^
a.cc:29:28: error: expected ')' before ';' token
29 | #define s(n) scanf("%d",&n);
| ^
/usr/include/c++/14/bits/random.h:2460:26: note: to match this '('
2460 | { return std::exp(__p.s() * _M_nd(__urng) + __p.m()); }
| ^
/usr/include/c++/14/bits/random.h:2460:60: error: expected ';' before ')' token
2460 | { return std::exp(__p.s() * _M_nd(__urng) + __p.m()); }
| ^
/usr/include/c++/14/bits/random.h: At global scope:
a.cc:27:21: error: expected identifier before string constant
27 | #define p(n) printf("%d",n);
| ^~~~
a.cc:27:21: error: expected ',' or '...' before string constant
/usr/include/c++/14/bits/random.h:3751:7: error: expected unqualified-id before '{' token
3751 | { return _M_p; }
| ^
a.cc:27:21: error: expected identifier before string constant
27 | #define p(n) printf("%d",n);
| ^~~~
a.cc:27:21: error: expected ',' or '...' before string constant
/usr/include/c++/14/bits/random.h:3802:5: error: expected unqualified-id before '{' token
3802 | { return _M_param.p(); }
| ^
/usr/include/c++/14/bits/random.h: In member function 'std::bernoulli_distribution::result_type std::bernoulli_distribution::operator()(_UniformRandomNumberGenerator&, const param_type&)':
a.cc:27:27: error: expected primary-expression before ')' token
27 | #define p(n) printf("%d",n);
| ^
/usr/include/c++/14/bits/random.h: At global scope:
a.cc:27:21: error: expected identifier before string constant
27 | #define p(n) printf("%d",n);
| ^~~~
a.cc:27:21: error: expected ',' or '...' before string constant
/usr/include/c++/14/bits/random.h:3986:9: error: expected unqualified-id before '{' token
3986 | { return _M_p; }
| ^
a.cc:27:21: error: expected identifier before string constant
27 | #define p(n) printf("%d",n);
| ^~~~
a.cc:27:21: error: expected ',' or '...' before string constant
/usr/include/c++/14/bits/random.h:4046:7: error: expected unqualified-id before '{' token
4046 | { return _M_param.p(); }
| ^
a.cc:27:21: error: expected identifier before string constant
27 | #define p(n) printf("%d",n);
| ^~~~
a.cc:27:21: error: expected ',' or '...' before string constant
/usr/include/c++/14/bits/random.h:4226:9: error: expected unqualified-id before '{' token
4226 | { return _M_p; }
| ^
a.cc:27:21: error: expected identifier before string constant
27 | #define p(n) printf("%d",n);
| ^~~~
a.cc:27:21: error: expected ',' or '...' before string constant
/usr/include/c++/14/bits/random.h:4275:7: error: expected unqualified-id before '{' token
4275 | { return _M_param.p(); }
| ^
a.cc:27:21: error: expected identifier before string constant
27 | #define p(n) printf("%d",n);
| ^~~~
a.cc:27:21: error: expected ',' or '...' before string constant
/usr/include/c++/14/bits/random.h:4445:9: error: expected unqualified-id before '{' token
4445 | { return _M_p; }
| ^
/usr/include/c++/14/bits/random.h:4471:53: error: expected unqualified-id before ')' token
4471 | : _M_param(__p), _M_gd(__p.k(), (1.0 - __p.p()) / __p.p())
| ^
/usr/include/c++/14/bits/random.h:4471:64: error: expected unqualified-id before ')' token
4471 | : _M_param(__p), _M_gd(__p.k(), (1.0 - __p.p()) / __p.p())
| ^
a.cc:27:21: error: expected identifier before string constant
27 | #define p(n) printf("%d",n);
| ^~~~
a.cc:27:21: error: expected ',' or '...' before string constant
/usr/include/c++/14/bits/random.h:4493:7: error: expected unqualified-id before '{' token
4493 | { return _M_param.p(); }
| ^
/usr/include/c++/14/bits/random.h: In constructor 'std::negative_binomial_distribution<_IntType>::negative_binomial_distribution(const param_type&)':
a.cc:27:27: error: expected primary-expression before ')' token
27 | #define p(n) printf("%d",n);
| ^
a.cc:27:28: error: expected ')' at end of input
27 | #define p(n) printf("%d",n);
| ^
/usr/include/c++/14/bits/random.h:4471:39: note: to match this '('
4471 | : _M_param(__p), _M_gd(__p.k(), (1.0 - __p.p()) / __p.p())
| ^
a.cc:27:28: error: expected ')' at end of input
27 | #define p(n) printf("%d",n);
| ^
/usr/include/c++/14/bits/random.h:4471:29: note: to match this '('
4471 | : _M_param(__p), _M_gd(__p.k(), (1.0 - __p.p()) / __p.p())
| ^
a.cc:27:28: error: expected '{' at end of input
27 | #define p(n) printf("%d",n);
| ^
/usr/include/c++/14/bits/random.tcc: In member function 'void std::bernoulli_distribution::__generate_impl(_ForwardIterator, _ForwardIterator, _UniformRandomNumberGenerator&, const param_type&)':
a.cc:27:27: error: expected primary-expression before ')' token
27 | #define p(n) printf("%d",n);
| ^
/usr/include/c++/14/bits/random.tcc: In function 'std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const bernoulli_distribution&)':
a.cc:27:27: error: expected primary-expression before ')' token
27 | #define p(n) printf("%d",n);
| ^
/usr/include/c++/14/bits/random.tcc: In function 'std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const geometric_distribution<_IntType>&)':
a.cc:27:27: error: expected primary-expression before ')' token
27 | #define p(n) printf("%d",n);
| ^
In file included from /usr/include/c++/14/random:50:
/usr/include/c++/14/bits/random.tcc: In member function 'std::negative_binomial_distribution<_IntType>::result_type std::negative_binomial_distribution<_IntType>::operator()(_UniformRandomNumberGenerator&, const param_type&)':
/usr/include/c++/14/bits/random.tcc:1175:35: error: expected primary-expression before '(' token
1175 | _M_gd(__urng, param_type(__p.k(), (1.0 - __p.p()) / __p.p()));
| ^
a.cc:27:27: error: expected primary-expression before ')' token
27 | #define p(n) printf("%d",n);
| ^
a.cc:27:28: error: expected ')' before ';' token
27 | #define p(n) printf("%d",n);
| ^
/usr/include/c++/14/bits/random.tcc:1175:45: note: to match this '('
1175 | _M_gd(__urng, param_type(__p.k(), (1.0 - __p.p()) / __p.p()));
| ^
a.cc:27:28: error: expected ')' before ';' token
27 | #define p(n) printf("%d",n);
| ^
/usr/include/c++/14/bits/random.tcc:1175:35: note: to match this '('
1175 | _M_gd(__urng, param_type(__p.k(), (1.0 - __p.p()) / __p.p()));
| ^
/usr/include/c++/14/bits/random.tcc:1175:59: error: expected primary-expression before ')' token
1175 | _M_gd(__urng, param_type(__p.k(), (1.0 - __p.p()) / __p.p()));
| ^
/usr/include/c++/14/bits/random.tcc:1175:70: error: expected primary-expression before ')' token
1175 | _M_gd(__urng, param_type(__p.k(), (1.0 - __p.p()) / __p.p()));
| ^
/usr/include/c++/14/bits/random.tcc: In member function 'void std::negative_binomial_distribut |
s047375033 | p03633 | C++ | /// Author: Sarfaraz Alam
# include <bits/stdc++.h>
# define pb push_back
# define ll long long
# define fi first
# define se second
# define all(vc) vc.begin(),vc.end()
//# define speed ios_base::sync_with_stdio(false);cin.tie(Nint128_t);cout.tie(Nint128_t)
# define DEBUG
typedef unsigned long long int ull;
using namespace std;
#include<string>
#include<cmath>
const int N = 1e5 + 7;
const int mod = 1e9 + 7;
int128_t gcd(int128_t a, int128_t b)
{
if(a == 0)
return b;
gcd(b%a, a);
}
int128_t lcm(int128_t a, int128_t b)
{
return (a*b)/gcd(a,b);
}
int main()
{
// speed;
#ifdef DEBUGfd
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
#endif // DEBUG
//Code begins
int n;
cin>>n;
int128_t a[n];
for(int i = 0; i<n; i++)
cin>>a[i];
sort(a, a+n);
int128_t last = a[0];
for(int i = 1; i<n; i++)
{
last = lcm(a[i], last);
// cout<<"last value : "<<last<<endl;
}
cout<<last<<endl;
// cout<<lcm(1000,1000);
return 0;
}
| a.cc:18:1: error: 'int128_t' does not name a type; did you mean 'int8_t'?
18 | int128_t gcd(int128_t a, int128_t b)
| ^~~~~~~~
| int8_t
a.cc:26:1: error: 'int128_t' does not name a type; did you mean 'int8_t'?
26 | int128_t lcm(int128_t a, int128_t b)
| ^~~~~~~~
| int8_t
a.cc: In function 'int main()':
a.cc:44:5: error: 'int128_t' was not declared in this scope; did you mean 'int8_t'?
44 | int128_t a[n];
| ^~~~~~~~
| int8_t
a.cc:46:10: error: 'a' was not declared in this scope
46 | cin>>a[i];
| ^
a.cc:47:10: error: 'a' was not declared in this scope
47 | sort(a, a+n);
| ^
a.cc:48:13: error: expected ';' before 'last'
48 | int128_t last = a[0];
| ^~~~~
| ;
a.cc:51:7: error: 'last' was not declared in this scope
51 | last = lcm(a[i], last);
| ^~~~
a.cc:54:11: error: 'last' was not declared in this scope
54 | cout<<last<<endl;
| ^~~~
|
s003369505 | p03633 | C++ | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define co(a) cout<<a<<endl
#define sz size()
#define bgn begin()
#define en end()
#define pb(a) push_back(a)
#define pop pop_back
#define V vector
#define P pair
#define V2(a,b,c) V<V<int>> a(b,V<int>(c))
#define V2a(a,b,c,d) V<V<int>> a(b,V<int>(c,d))
#define incin(a) int a; cin>>a
#define yuko(a) setprecision(a)
//#define min min<int>
//#define max max<int>
template<class T>
void cou(vector<vector<T>> a){
int b=a.size();
int c=a[0].size();
fo(i,b){
fo(j,c){
cout<<a[i][j];
if(j==c-1)
cout<<endl;
else
cout<<' ';
}
}
}
/*template<>
void cou(vector<vector<char>> a){
int b=a.size();
int c=a[0].size();
fo(i,b){
fo(j,c){
cout<<a[i][j];
if(j==c-1)
cout<<endl;
else
cout<<' ';
}
}
}*/
int wari(int a,int b) {
if(a%b==0)
return a/b;
else
return a/b+1;
}
int keta(int a){
double b=a;
b=log10(b);
int c=b;
return c+1;
}
int souwa(int a){
return a*(a+1)/2;
}
/*int lcm(int a,int b){
int d=a,e=b,f;
if(a<b)
swap(a,b);
int c,m=1;
while(m){
c=a%b;
if(c==0){
f=b;
m--;
}
else{
a=b;
b=c;
}
}
return d*e/f;
}
int gcm(int a,int b){
int d=a,e=b,f;
if(a<b)
swap(a,b);
int c,m=1;
while(m){
c=a%b;
if(c==0){
f=b;
m--;
}
else{
a=b;
b=c;
}
}
return f;
}*/
bool prime(int a){
if(a<2)
return false;
else if(a==2)
return true;
else if(a%2==0)
return false;
double b=sqrt(a);
for(int i=3;i<=b;i+=2){
if(a%i==0){
return false;
}
}
return true;
}
struct Union{
vector<int> par;
Union(int a){
par= vector<int>(a,-1);
}
int find(int a){
if(par[a]<0)
return x;
else
return par[a]=find(par[a]);
}
bool same(int a,int b){
return find(a)==find(b);
}
int Size(int a){
return -par[find(a)];
}
void unite(int a,int b){
a=find(a);
b=find(b);
if(a==b)
return;
if(Size(b)>Size(a))
swap<int>(a,b);
par[a]+=par[b];
par[b]=a;
}
};
int ketas(int a){
string b=to_string(a);
int c=0;
fo(i,keta(a)){
c+=b[i]-'0';
}
return c;
}
int gcm(int a,int b){
if(b==0)
return a;
return gcm(b,a%b);
}
int lcm(int a,int b){
return a*b/gcm(a,b);
}
/*struct aa{
vector<int> gt;
aa(int n){
gt= vector<int>(n, 1);
}
void c(V<int> d,int b){
if(d[b]==0){
gt[d[b]-1]++;
gt[gt.sz-1]++;
}
else{
gt[d[b]-1]++;
c(d,d[d[b]]-1);
}
}
void cok(int a){
cout<<gt[a-1]<<endl;
fo(i,a-1)
cout<<gt[i]<<endl;
}
};
*/
signed main(){
int a;
cin>>a;
int b,c;
cin>>b;
fo(i,a-1){
cin>>c;
b=lcm(b,c);
}
cout<<b<<endl;
}
| a.cc: In member function 'long long int Union::find(long long int)':
a.cc:124:14: error: 'x' was not declared in this scope
124 | return x;
| ^
|
s363818639 | p03633 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n;
ll t,l=1;
for (int i=0;i<n;i++) {
cin>>t;
l=__lcm(l,t);
}
cout<<l<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:10:11: error: '__lcm' was not declared in this scope
10 | l=__lcm(l,t);
| ^~~~~
|
s944507410 | p03633 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
long long t[n];
long long maxx = -1;
for(int i=0; i<n; i++){
cin >> t[i];
maxx = max(maxx, t[i]);
}
bool prime = true;
for(int i=0; i<n; i++){
for(int j=0; j<n; j++){
if(i != j){
if(t[i] % t[j] == 0){
prime = false;
break;
}
}
}
}
if(prime){
__int64 ans = 1;
for(int i=0; i<n; i++) ans *= t[i];
cout << ans << endl;
return 0;
}
long long mul = 1;
while(maxx <= 1e18){
long long temp = maxx * 1ll * mul;
bool ok = true;
for(int i=0; i<n; i++){
if(temp % t[i] != 0){
ok = false;
break;
}
}
if(ok){
cout << temp << endl;
return 0;
}
mul++;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:28:5: error: '__int64' was not declared in this scope; did you mean '__ynf64'?
28 | __int64 ans = 1;
| ^~~~~~~
| __ynf64
a.cc:29:28: error: 'ans' was not declared in this scope; did you mean 'abs'?
29 | for(int i=0; i<n; i++) ans *= t[i];
| ^~~
| abs
a.cc:30:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
30 | cout << ans << endl;
| ^~~
| abs
|
s612707619 | p03633 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
__int64 t[n];
__int64 maxx = -1;
for(int i=0; i<n; i++){
cin >> t[i];
maxx = max(maxx, t[i]);
}
__int64 mul = 1;
while(maxx <= 1e18){
__int64 temp = maxx * 1ll * mul;
bool ok = true;
for(int i=0; i<n; i++){
if(temp % t[i] != 0){
ok = false;
break;
}
}
if(ok){
cout << temp << endl;
return 0;
}
mul++;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:10:3: error: '__int64' was not declared in this scope; did you mean '__ynf64'?
10 | __int64 t[n];
| ^~~~~~~
| __ynf64
a.cc:11:10: error: expected ';' before 'maxx'
11 | __int64 maxx = -1;
| ^~~~~
| ;
a.cc:13:12: error: 't' was not declared in this scope
13 | cin >> t[i];
| ^
a.cc:14:5: error: 'maxx' was not declared in this scope
14 | maxx = max(maxx, t[i]);
| ^~~~
a.cc:16:10: error: expected ';' before 'mul'
16 | __int64 mul = 1;
| ^~~~
| ;
a.cc:17:9: error: 'maxx' was not declared in this scope
17 | while(maxx <= 1e18){
| ^~~~
a.cc:18:12: error: expected ';' before 'temp'
18 | __int64 temp = maxx * 1ll * mul;
| ^~~~~
| ;
a.cc:21:10: error: 'temp' was not declared in this scope; did you mean 'tm'?
21 | if(temp % t[i] != 0){
| ^~~~
| tm
a.cc:21:17: error: 't' was not declared in this scope
21 | if(temp % t[i] != 0){
| ^
a.cc:27:15: error: 'temp' was not declared in this scope; did you mean 'tm'?
27 | cout << temp << endl;
| ^~~~
| tm
a.cc:30:5: error: 'mul' was not declared in this scope; did you mean 'fmul'?
30 | mul++;
| ^~~
| fmul
|
s954480756 | p03633 | C++ | #include<bits/stdc++.h>
using namespace std;
using ll=long long;
using vec=vector<ll>;
using mat=vector<vec>;
#define For(i,a,b) for(i=a;i<b;i++)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define all(v) (v).begin(),(v).end()
#define vsort(v) sort(all(v))
#define mod 1000000007
using data=pair<ll,ll>;
long mmid(long a,long b,long c){return a<b?(b<c?b:max(a,c)):(b>c?b:min(a,c));}
ll modinv(ll a){ ll b=mod,u=1,v=0,t; while(b){ t=a/b; a-=t*b; swap(a,b); u-=t*v; swap(u,v); } return (u+mod)%mod; }
ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}
ll modncr(ll n,ll r){ ll i,plus=1; rep(i,r){ plus=(plus*(n-i))%mod; plus=moddevide(plus,i+1); } return plus; }
ll gcd(ll a, ll b) { if(a<b) return euclidean_gcd(b, a); ll r; while ((r=a%b)){a=b;b=r;} return b; }
ll countdigits(ll n){ ll ans=0; while(n){n/=10;ans++;} return ans; }
ll sumdigits(ll n){ ll ans=0; while(n){ans+=n%10;n/=10;} return ans; }
void printmap(vector<ll>& a,ll H,ll W){ ll i,j; For(i,0,H+2){ For(j,0,W+2){cout<<a[i*(W+2)+j];} cout<<endl; } } void inputmap(vector<ll>& a,ll H,ll W){ ll i,j; string ss; For(i,1,H+1){ cin>>ss; For(j,1,W+1){ if(ss[j-1]=='#'){ a[i*(W+2)+j]=1; }else{ a[i*(W+2)+j]=0; } } } }
int main(){
ll i,j,N,K,a;
string ss;
cin>>N;
vec v(N);
cin>>a;
rep1(i,N){
cin>>K;
a=a*K/gcd(a,K)
}
cout<<a<<endl;
return 0;
}
| a.cc: In function 'll gcd(ll, ll)':
a.cc:17:37: error: 'euclidean_gcd' was not declared in this scope
17 | ll gcd(ll a, ll b) { if(a<b) return euclidean_gcd(b, a); ll r; while ((r=a%b)){a=b;b=r;} return b; }
| ^~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:29:19: error: expected ';' before '}' token
29 | a=a*K/gcd(a,K)
| ^
| ;
30 | }
| ~
|
s218527471 | p03633 | C++ | #include <bits/stdc++.h>
using namespace std;
//char型から数値型に変換する関数(z.at(i)などに使用)
int ctoi(char c){
if(c>='0'&&c<='9'){
return c-'0';
}
return 0;
}
//1~10000の階乗(を1000000007で割ったあまり)を求める関数
int fact(int64_t x){
int64_t y=1;
for(int64_t i=1;i<=x;i++){
y*=i;
y%=1000000007;
}
return y;
}
//入力した2つの値の最小公倍数を求める関数
int64_t lcm(int64_t x,int64_t y){
int64_t z=x*y;
if(x<y){
int64_t ex=x;
x=y;
y=ex;
}
int64_t r=x%y;
while(r!=0){
x=y;
y=r;
r=x%y;
}
return z/y;
}
//入力した2つの値の最大公約数を求める関数は__gcd(x,y);
int main() {
int64_t n;
cin>>n;
vector<int64_t> t(n);
for(int i=0;i<n;i++){
cin>>t.at(i);
int ans=t.at(0);
for(int i=1;i<n;i++){
ans=lcm(ans,t.at(i));
}
cout<<ans;
}
| a.cc: In function 'int main()':
a.cc:47:2: error: expected '}' at end of input
47 | }
| ^
a.cc:36:12: note: to match this '{'
36 | int main() {
| ^
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.