submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s080398050
p03633
C++
// ProblemURL : https://atcoder.jp/contests/abc070/tasks/abc070_c // --------------------------------------------- package main import ( "bufio" "fmt" "math" "os" "strconv" ) func abs(x int) int { if x < 0 { return -x } return x } func larger(a, b int) int { if a > b { return a } return b } func smaller(a, b int) int { if a < b { return a } return b } func largest(a, b, c int) (lgst int) { if a > b { lgst = a } else { lgst = b } if c > lgst { lgst = c } return } func smallerst(a, b, c int) (slst int) { if a < b { slst = a } else { slst = b } if c < slst { slst = c } return } func max(a []int) (idx, val int) { if len(a) == 0 { panic("func max: argument slice length must not be zero") } val = a[0] for i, aa := range a { if aa > val { idx, val = i, aa } } return } func min(a []int) (idx, val int) { if len(a) == 0 { panic("func min: argument slice length must not be zero") } val = a[0] for i, aa := range a { if aa < val { idx, val = i, aa } } return } func sum(a []int) int { res := 0 for _, v := range a { res += v } return res } func isEven(n int) bool { return n&1 == 0 } func isOdd(n int) bool { return n&1 == 1 } func swap(a int, b int) (int, int) { return b, a } func calcMod(n int) int { return n % mod } func sigma(x int) int { return x * (x + 1) / 2 } func powInt(a, b int) int { return int(math.Pow(float64(a), float64(b))) } func ceil(x float64) int { return int(math.Ceil(x)) } func intsCopy(a []int) []int { return append([]int(nil), a...) } func intsClear(a []int) []int { return a[:0] } func intsReverse(a []int) { for i, j := 0, len(a)-1; i < j; i, j = i+1, j-1 { a[i], a[j] = a[j], a[i] } return } func fill(a []int, val int) { for i := 0; i < len(a); i++ { a[i] = val } return } func intsPeekBack(a []int) int { if len(a) == 0 { panic("func peekBack: zero length slice") } return a[len(a)-1] } func intsPeekFront(a []int) int { if len(a) == 0 { panic("func peekFront: zero length slice") } return a[0] } func intsPopBack(a []int) (int, []int) { if len(a) == 0 { panic("func popBack: zero length slice") } return a[len(a)-1], a[:len(a)-1] } func intsPopFront(a []int) (int, []int) { if len(a) == 0 { panic("func popFront: zero length slice") } return a[0], a[1:] } func intsPushBack(a []int, x int) []int { return append(a, x) } func intsPushFront(a []int, x int) []int { return append([]int{x}, a...) } func gcd(a, b int) int { if a <= 0 || b <= 0 { panic("the args of gcd() must be positive number") } for b != 0 { a, b = b, a%b } return a } func lcm(a, b int) int { return a / gcd(a, b) * b } func lcmOfSlice(a []int) int { l := a[0] for i := 1; i < len(a); i++ { l = lcm(l, a[i]) } return l } var ( sc = bufio.NewScanner(os.Stdin) bw = bufio.NewWriter(os.Stdout) ) func init() {} func ru() (n int) { sc.Scan() if err := sc.Err(); err != nil { panic(err) } for _, v := range sc.Bytes() { n = n*10 + int(v-48) } return } func ri() (n int) { sc.Scan() if err := sc.Err(); err != nil { panic(err) } b := sc.Bytes() neg := false if b[0] == 45 { neg = true } for _, v := range b { n = n*10 + int(v-48) } if neg { n = -n } return } func ri64() (n int64) { sc.Scan() if err := sc.Err(); err != nil { panic(err) } b := sc.Bytes() neg := false if b[0] == 45 { neg = true } for _, v := range b { n = n*10 + int64(v-48) } if neg { n = -n } return } func rf() float64 { sc.Scan() if err := sc.Err(); err != nil { panic(err) } f, err := strconv.ParseFloat(sc.Text(), 64) if err != nil { panic(err) } return f } func rs() string { sc.Scan() if err := sc.Err(); err != nil { panic(err) } return sc.Text() } func rb() []byte { sc.Scan() if err := sc.Err(); err != nil { panic(err) } return sc.Bytes() } func rr() []rune { sc.Scan() if err := sc.Err(); err != nil { panic(err) } return []rune(sc.Text()) } func ris(n int) []int { s := make([]int, n) for i := range s { s[i] = ri() } return s } func ri64s(n int) []int64 { s := make([]int64, n) for i := range s { s[i] = ri64() } return s } func pf(format string, a ...interface{}) { if _, err := fmt.Fprintf(bw, format, a...); err != nil { panic(err) } } func pln(a ...interface{}) { if _, err := fmt.Fprintln(bw, a...); err != nil { panic(err) } } func pall(a []int) { for _, v := range a { fmt.Fprintln(bw, v) } } func pallol(a []int) { s := fmt.Sprint(a) if _, err := fmt.Fprintln(bw, s[1:len(s)-1]); err != nil { panic(err) } } func dbg(a ...interface{}) { if _, err := fmt.Fprintln(os.Stderr, a...); err != nil { panic(err) } } func main() { sc.Split(bufio.ScanWords) sc.Buffer(make([]byte, 1e7), 1e7) solve() bw.Flush() } const ( // maxInt64 = 9223372036854775807 // 9e18 // maxInt32 = 2147483647 // 2e9 // maxUint64 = 18446744073709551615 // 1e19 inf = 1 << 60 mod = 1e9 + 7 ) type pair struct{ a, b int } type point struct{ x, y int } func solve() { pln(lcmOfSlice(ris(ri()))) }
a.cc:3:1: error: 'package' does not name a type 3 | package main | ^~~~~~~ a.cc:19:1: error: 'func' does not name a type 19 | func larger(a, b int) int { | ^~~~ a.cc:25:1: error: 'func' does not name a type 25 | func smaller(a, b int) int { | ^~~~ a.cc:31:1: error: 'func' does not name a type 31 | func largest(a, b, c int) (lgst int) { | ^~~~ a.cc:42:1: error: 'func' does not name a type 42 | func smallerst(a, b, c int) (slst int) { | ^~~~ a.cc:53:1: error: 'func' does not name a type 53 | func max(a []int) (idx, val int) { | ^~~~ a.cc:65:1: error: 'func' does not name a type 65 | func min(a []int) (idx, val int) { | ^~~~ a.cc:77:1: error: 'func' does not name a type 77 | func sum(a []int) int { | ^~~~ a.cc:84:1: error: 'func' does not name a type 84 | func isEven(n int) bool { return n&1 == 0 } | ^~~~ a.cc:85:1: error: 'func' does not name a type 85 | func isOdd(n int) bool { return n&1 == 1 } | ^~~~ a.cc:86:1: error: 'func' does not name a type 86 | func swap(a int, b int) (int, int) { return b, a } | ^~~~ a.cc:87:1: error: 'func' does not name a type 87 | func calcMod(n int) int { return n % mod } | ^~~~ a.cc:88:1: error: 'func' does not name a type 88 | func sigma(x int) int { return x * (x + 1) / 2 } | ^~~~ a.cc:89:1: error: 'func' does not name a type 89 | func powInt(a, b int) int { return int(math.Pow(float64(a), float64(b))) } | ^~~~ a.cc:90:1: error: 'func' does not name a type 90 | func ceil(x float64) int { return int(math.Ceil(x)) } | ^~~~ a.cc:91:1: error: 'func' does not name a type 91 | func intsCopy(a []int) []int { return append([]int(nil), a...) } | ^~~~ a.cc:92:1: error: 'func' does not name a type 92 | func intsClear(a []int) []int { return a[:0] } | ^~~~ a.cc:93:1: error: 'func' does not name a type 93 | func intsReverse(a []int) { | ^~~~ a.cc:99:1: error: 'func' does not name a type 99 | func fill(a []int, val int) { | ^~~~ a.cc:105:1: error: 'func' does not name a type 105 | func intsPeekBack(a []int) int { | ^~~~ a.cc:111:1: error: 'func' does not name a type 111 | func intsPeekFront(a []int) int { | ^~~~ a.cc:117:1: error: 'func' does not name a type 117 | func intsPopBack(a []int) (int, []int) { | ^~~~ a.cc:123:1: error: 'func' does not name a type 123 | func intsPopFront(a []int) (int, []int) { | ^~~~ a.cc:129:1: error: 'func' does not name a type 129 | func intsPushBack(a []int, x int) []int { return append(a, x) } | ^~~~ a.cc:130:1: error: 'func' does not name a type 130 | func intsPushFront(a []int, x int) []int { return append([]int{x}, a...) } | ^~~~ a.cc:131:1: error: 'func' does not name a type 131 | func gcd(a, b int) int { | ^~~~ a.cc:140:1: error: 'func' does not name a type 140 | func lcm(a, b int) int { return a / gcd(a, b) * b } | ^~~~ a.cc:141:1: error: 'func' does not name a type 141 | func lcmOfSlice(a []int) int { | ^~~~ a.cc:149:5: error: expected constructor, destructor, or type conversion before '(' token 149 | var ( | ^ a.cc:155:1: error: 'func' does not name a type 155 | func ru() (n int) { | ^~~~ a.cc:165:1: error: 'func' does not name a type 165 | func ri() (n int) { | ^~~~ a.cc:183:1: error: 'func' does not name a type 183 | func ri64() (n int64) { | ^~~~ a.cc:201:1: error: 'func' does not name a type 201 | func rf() float64 { | ^~~~ a.cc:212:1: error: 'func' does not name a type 212 | func rs() string { | ^~~~ a.cc:219:1: error: 'func' does not name a type 219 | func rb() []byte { | ^~~~ a.cc:226:1: error: 'func' does not name a type 226 | func rr() []rune { | ^~~~ a.cc:233:1: error: 'func' does not name a type 233 | func ris(n int) []int { | ^~~~ a.cc:240:1: error: 'func' does not name a type 240 | func ri64s(n int) []int64 { | ^~~~ a.cc:247:1: error: 'func' does not name a type 247 | func pf(format string, a ...interface{}) { | ^~~~ a.cc:247:40: error: expected unqualified-id before ')' token 247 | func pf(format string, a ...interface{}) { | ^ a.cc:252:1: error: 'func' does not name a type 252 | func pln(a ...interface{}) { | ^~~~ a.cc:252:26: error: expected unqualified-id before ')' token 252 | func pln(a ...interface{}) { | ^ a.cc:257:1: error: 'func' does not name a type 257 | func pall(a []int) { | ^~~~ a.cc:262:1: error: 'func' does not name a type 262 | func pallol(a []int) { | ^~~~ a.cc:268:1: error: 'func' does not name a type 268 | func dbg(a ...interface{}) { | ^~~~ a.cc:268:26: error: expected unqualified-id before ')' token 268 | func dbg(a ...interface{}) { | ^ a.cc:273:1: error: 'func' does not name a type 273 | func main() { | ^~~~ a.cc:284:12: error: expected ')' before '=' token 284 | inf = 1 << 60 | ^~ | ) a.cc:280:7: note: to match this '(' 280 | const ( | ^ a.cc:289:1: error: 'type' does not name a type; did you mean 'typeof'? 289 | type point struct{ x, y int } | ^~~~ | typeof a.cc:291:1: error: 'func' does not name a type 291 | func solve() { | ^~~~
s677283668
p03633
C++
#include <bits/stdc++.h> #define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)using ll=long long; using ld=long double; using namespace std; ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; } ll t[110]; int main(){ ll n,tmp=0,cnt=0; cin>>n; rep(i,0,n)cin>>t[i]; cnt=t[0]; rep(i,1,n)tmp=cnt*t[i]/GCD(cnt,t[i]); cout<<tmp; }
a.cc:5:1: error: 'll' does not name a type; did you mean 'ld'? 5 | ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; } | ^~ | ld a.cc:6:1: error: 'll' does not name a type; did you mean 'ld'? 6 | ll t[110]; | ^~ | ld a.cc: In function 'int main()': a.cc:8:3: error: 'll' was not declared in this scope; did you mean 'ld'? 8 | ll n,tmp=0,cnt=0; | ^~ | ld a.cc:9:8: error: 'n' was not declared in this scope; did you mean 'yn'? 9 | cin>>n; | ^ | yn a.cc:10:7: error: expected ';' before 'i' 10 | rep(i,0,n)cin>>t[i]; | ^ a.cc:2:27: note: in definition of macro 'rep' 2 | #define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)using ll=long long; | ^ a.cc:10:7: error: 'i' was not declared in this scope 10 | rep(i,0,n)cin>>t[i]; | ^ a.cc:2:35: note: in definition of macro 'rep' 2 | #define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)using ll=long long; | ^ a.cc:10:18: error: 't' was not declared in this scope; did you mean 'tm'? 10 | rep(i,0,n)cin>>t[i]; | ^ | tm a.cc:10:20: error: 'i' was not declared in this scope 10 | rep(i,0,n)cin>>t[i]; | ^ a.cc:11:3: error: 'cnt' was not declared in this scope; did you mean 'int'? 11 | cnt=t[0]; | ^~~ | int a.cc:12:7: error: expected ';' before 'i' 12 | rep(i,1,n)tmp=cnt*t[i]/GCD(cnt,t[i]); | ^ a.cc:2:27: note: in definition of macro 'rep' 2 | #define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)using ll=long long; | ^ a.cc:12:13: error: 'tmp' was not declared in this scope; did you mean 'tm'? 12 | rep(i,1,n)tmp=cnt*t[i]/GCD(cnt,t[i]); | ^~~ | tm a.cc:12:26: error: 'GCD' was not declared in this scope 12 | rep(i,1,n)tmp=cnt*t[i]/GCD(cnt,t[i]); | ^~~
s535190825
p03633
C++
#include<iostream> #include<vector> #include<algorithm> #define _USE_MATH_DEFINES #include<math.h> using namespace std; #define rep(i,n) for(int i=0;i<(n);++i) vector<__int64> t; __int64 ans = 1; __int64 gcd(__int64 a, __int64 b) { if (b == 0) { return a; } return gcd(b, a % b); } void kbs(int n) { rep(i, n) { ans = ans / gcd(ans, t[i]) * t[i]; } } int main() { int n; cin >> n; t.resize(n); rep(i, n) { cin >> t[i]; } kbs(n); cout << ans << endl; }
a.cc:8:8: error: '__int64' was not declared in this scope; did you mean '__ynf64'? 8 | vector<__int64> t; | ^~~~~~~ | __ynf64 a.cc:8:15: error: template argument 1 is invalid 8 | vector<__int64> t; | ^ a.cc:8:15: error: template argument 2 is invalid a.cc:9:1: error: '__int64' does not name a type; did you mean '__int64_t'? 9 | __int64 ans = 1; | ^~~~~~~ | __int64_t a.cc:10:1: error: '__int64' does not name a type; did you mean '__int64_t'? 10 | __int64 gcd(__int64 a, __int64 b) { | ^~~~~~~ | __int64_t a.cc: In function 'void kbs(int)': a.cc:18:17: error: 'ans' was not declared in this scope; did you mean 'abs'? 18 | ans = ans / gcd(ans, t[i]) * t[i]; | ^~~ | abs a.cc:18:39: error: invalid types 'int[int]' for array subscript 18 | ans = ans / gcd(ans, t[i]) * t[i]; | ^ a.cc:18:29: error: 'gcd' was not declared in this scope 18 | ans = ans / gcd(ans, t[i]) * t[i]; | ^~~ a.cc:18:47: error: invalid types 'int[int]' for array subscript 18 | ans = ans / gcd(ans, t[i]) * t[i]; | ^ a.cc: In function 'int main()': a.cc:24:11: error: request for member 'resize' in 't', which is of non-class type 'int' 24 | t.resize(n); | ^~~~~~ a.cc:26:25: error: invalid types 'int[int]' for array subscript 26 | cin >> t[i]; | ^ a.cc:29:17: error: 'ans' was not declared in this scope; did you mean 'abs'? 29 | cout << ans << endl; | ^~~ | abs
s056635100
p03633
C++
#include <bits/stdc++.h> using namespace std; 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; cin >> N; ll ans = 1LL, t; for (int i = 0; i < N; i++) { cin >> t; ans = lcm(ans, t); } cout << ans << endl; return 0; }
a.cc: In function 'll lcm(ll, ll)': a.cc:17:3: error: expected ',' or ';' before 'return' 17 | return a*b / g; | ^~~~~~ a.cc:18:1: warning: no return statement in function returning non-void [-Wreturn-type] 18 | } | ^
s080844482
p03633
C++
#include <iostream> #include <vector> using namespace std; long Gcd(long a,long b){ if(b==0)return a; return gcd(b,a%b); } int main(){ int N; cin >> N; int tmp0; cin >> tmp0; long ans=tmp0; long a; for(int i=1;i<N;i++){ long tmp; cin >> tmp; a=tmp; long gcd=Gcd(a,ans); if(gcd!=0){ ans=a/gcd*ans; }else{ ans = a > ans ? a : ans; } } cout << ans; }
a.cc: In function 'long int Gcd(long int, long int)': a.cc:8:10: error: 'gcd' was not declared in this scope; did you mean 'Gcd'? 8 | return gcd(b,a%b); | ^~~ | Gcd
s136220537
p03633
C++
#include <iostream> #include <vector> using namespace std; int Gcd(int a,int b){ int tmp=0; if(b>a){ tmp=b; b=a; a=tmp; } while (a % b != 0) { tmp = b; b = a % b; a = tmp; } return b; } int main(){ int N; cin >> N; vector<int> a; int tmp0; cin >> tmp0; a.push_back(tmp0); int ans; for(int i=1;i<N;i++){ int tmp; cin >> tmp; a.push_back(tmp); ans=a[i]*a[i-1]/Gcd(a[i],a[i-1]); } cout << ans; } }
a.cc:39:3: error: expected declaration before '}' token 39 | } | ^
s454880693
p03633
C++
#include <iostream> #include <vector> using namespace std; int Gcd(int a,int b){ if(b>a){ int tmp=b; b=a; a=tmp; } while (a % b != 0) { tmp = b; b = a % b; a = tmp; } return n; } int main(){ int N; cin >> N; vector<int> a; int tmp0; cin >> tmp0; a.push_back(tmp0); int ans; for(int i=1;i<N;i++){ int tmp; cin >> tmp; a.push_back(tmp); ans=a[i]*a[i-1]/Gcd(a[i],a[i-1]); } cout << ans; } }
a.cc: In function 'int Gcd(int, int)': a.cc:14:17: error: 'tmp' was not declared in this scope; did you mean 'tm'? 14 | tmp = b; | ^~~ | tm a.cc:18:16: error: 'n' was not declared in this scope 18 | return n; | ^ a.cc: At global scope: a.cc:38:3: error: expected declaration before '}' token 38 | } | ^
s718786723
p03633
C++
#include <iostream> #include <vector> using namespace std; int Gcd(int a,int b){ if(b>a){ int tmp=b; b=a; a=tmp; } while (a % b != 0) { temp = n; n = m % n; m = temp; } return n; } int main(){ int N; cin >> N; vector<int> a; int tmp0; cin >> tmp0; a.push_back(tmp0); int ans; for(int i=1;i<N;i++){ int tmp; cin >> tmp; a.push_back(tmp); ans=a[i]*a[i-1]/Gcd(a[i],a[i-1]); } cout << ans; } }
a.cc: In function 'int Gcd(int, int)': a.cc:14:17: error: 'temp' was not declared in this scope; did you mean 'tm'? 14 | temp = n; | ^~~~ | tm a.cc:14:24: error: 'n' was not declared in this scope 14 | temp = n; | ^ a.cc:15:21: error: 'm' was not declared in this scope 15 | n = m % n; | ^ a.cc:18:16: error: 'n' was not declared in this scope 18 | return n; | ^ a.cc: At global scope: a.cc:38:3: error: expected declaration before '}' token 38 | } | ^
s943709779
p03633
C++
#include<iostream> #include<string> #include<vector> #include<algorithm> #include<bits/stdc++.h> #include<cmath> #include<bitset> #define ll long long #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define FFOR(i,a,b) for(int i=(a);i<=(b);++i) #define REP(i,n) FOR(i,0,n) #define RREP(i,n) FFOR(i,0,n) #define SORT(V) sort((V).begin(),(V).end()) #define REVERSE(V) reverse((V).begin(),(V).end()) #define INF ((1LL<<62)-(1LL<<31)) #define MOD 1000000007 using namespace std; ll GCD(ll a,ll b){ if(b==0) return b; else return GCD(b,a%b); } ll LCM(ll a,ll b){ ll g=GCD(a,b); return a/g*b; } void main(){ ll N; cin>>N; ll T[N]; REP(i,N) cin>>T[i]; ll ans=T[0]; FOR(i,1,N){ ans=LCM(ans,T[i]); } cout<<ans<<endl; }
a.cc:29:1: error: '::main' must return 'int' 29 | void main(){ | ^~~~
s005897711
p03633
C++
#include<iostream> #include<string> #include<vector> #include<algorithm> #include<bits/stdc++.h> #include<cmath> #include<bitset> #define ll long long #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define FFOR(i,a,b) for(int i=(a);i<=(b);++i) #define REP(i,n) FOR(i,0,n) #define RREP(i,n) FFOR(i,0,n) #define SORT(V) sort((V).begin(),(V).end()) #define REVERSE(V) reverse((V).begin(),(V).end()) #define INF ((1LL<<62)-(1LL<<31)) #define MOD 1000000007 using namespace std; ll GCD(ll a,ll b){ if(b==0) return b; else return GCD(b,a%b); } ll LCM(ll a,ll b){ ll g=GCD(a,b); return a/g*b; } ll main(){ ll N; cin>>N; ll T[N]; REP(i,N) cin>>T[i]; ll ans=T[0]; FOR(i,1,N){ ans=LCM(ans,T[i]); } cout<<ans<<endl; }
cc1plus: error: '::main' must return 'int'
s843489438
p03633
C++
#include<iostream> #include<string> #include<vector> #include<algorithm> #include<bits/stdc++.h> #include<cmath> #include<bitset> #define ll long long #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define FFOR(i,a,b) for(int i=(a);i<=(b);++i) #define REP(i,n) FOR(i,0,n) #define RREP(i,n) FFOR(i,0,n) #define SORT(V) sort((V).begin(),(V).end()) #define REVERSE(V) reverse((V).begin(),(V).end()) #define INF ((1LL<<62)-(1LL<<31)) #define MOD 1000000007 using namespace std; void ll GCD(ll a,ll b){ if(b==0) return b; return gcd(b,a%b); } void ll LCM(ll a,ll b){ ll g=gcd(a,b); return a/g*b; } int main(){ ll N; cin>>N; ll T[N]; REP(i,N) cin>>T[i]; ll ans=T[0]; FOR(i,1,N){ ans=LCM(ans,T[i]); } cout<<ans<<endl; }
a.cc:8:17: error: 'long long' specified with 'void' 8 | #define ll long long | ^~~~ a.cc:19:6: note: in expansion of macro 'll' 19 | void ll GCD(ll a,ll b){ | ^~ a.cc: In function 'void GCD(long long int, long long int)': a.cc:20:19: error: return-statement with a value, in function returning 'void' [-fpermissive] 20 | if(b==0) return b; | ^ a.cc:21:13: error: return-statement with a value, in function returning 'void' [-fpermissive] 21 | return gcd(b,a%b); | ~~~^~~~~~~ a.cc: At global scope: a.cc:8:17: error: 'long long' specified with 'void' 8 | #define ll long long | ^~~~ a.cc:24:6: note: in expansion of macro 'll' 24 | void ll LCM(ll a,ll b){ | ^~ a.cc: In function 'void LCM(long long int, long long int)': a.cc:26:13: error: return-statement with a value, in function returning 'void' [-fpermissive] 26 | return a/g*b; | ~~~^~ a.cc: In function 'int main()': a.cc:36:12: error: void value not ignored as it ought to be 36 | ans=LCM(ans,T[i]); | ~~~^~~~~~~~~~
s800443155
p03633
C++
#include<iostream> #include<string> #include<vector> #include<algorithm> #include<bits/stdc++.h>https://atcoder.jp/contests/abc070/submissions/me #include<cmath> #include<bitset> #define ll long long #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define FFOR(i,a,b) for(int i=(a);i<=(b);++i) #define REP(i,n) FOR(i,0,n) #define RREP(i,n) FFOR(i,0,n) #define SORT(V) sort((V).begin(),(V).end()) #define REVERSE(V) reverse((V).begin(),(V).end()) #define INF ((1LL<<62)-(1LL<<31)) #define MOD 1000000007 using namespace std; void ll GCD(ll a,ll b){ if(b==0) return b; return gcd(b,a%b); } void ll LCM(ll a,ll b){ ll g=gcd(a,b); return a/g*b; } int main(){ ll N; cin>>N; ll T[N]; REP(i,N) cin>>T[i]; ll ans=T[0]; FOR(i,1,N){ ans=LCM(ans,T[i]); } cout<<ans<<endl; }
a.cc:5:29: warning: extra tokens at end of #include directive 5 | #include<bits/stdc++.h>https://atcoder.jp/contests/abc070/submissions/me | ^ a.cc:5:9: fatal error: bits/stdc++.h>http: No such file or directory 5 | #include<bits/stdc++.h>https://atcoder.jp/contests/abc070/submissions/me | ^~~~~~~~~~~~~~~~~~~~ compilation terminated.
s707153783
p03633
C++
#include<iostream> #include<string> #include<vector> #include<algorithm> #include<bits/stdc++.h>https://atcoder.jp/contests/abc070/submissions/me #include<cmath> #include<bitset> #define ll long long #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define FFOR(i,a,b) for(int i=(a);i<=(b);++i) #define REP(i,n) FOR(i,0,n) #define RREP(i,n) FFOR(i,0,n) #define SORT(V) sort((V).begin(),(V).end()) #define REVERSE(V) reverse((V).begin(),(V).end()) #define INF ((1LL<<62)-(1LL<<31)) #define MOD 1000000007 using namespace std; void GCD(ll a,ll b){ if(b==0) return b; return gcd(b,a%b); } void LCM(ll a,ll b){ ll g=gcd(a,b); return a/g*b; } int main(){ ll N; cin>>N; ll T[N]; REP(i,N) cin>>T[i]; ll ans=T[0]; FOR(i,1,N){ ans=LCM(ans,T[i]); } cout<<ans<<endl; }
a.cc:5:29: warning: extra tokens at end of #include directive 5 | #include<bits/stdc++.h>https://atcoder.jp/contests/abc070/submissions/me | ^ a.cc:5:9: fatal error: bits/stdc++.h>http: No such file or directory 5 | #include<bits/stdc++.h>https://atcoder.jp/contests/abc070/submissions/me | ^~~~~~~~~~~~~~~~~~~~ compilation terminated.
s255908063
p03633
C++
#include<iostream> #include<string> #include<vector> #include<algorithm> #include<bits/stdc++.h>https://atcoder.jp/contests/abc070/submissions/me #include<cmath> #include<bitset> #define ll long long #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define FFOR(i,a,b) for(int i=(a);i<=(b);++i) #define REP(i,n) FOR(i,0,n) #define RREP(i,n) FFOR(i,0,n) #define SORT(V) sort((V).begin(),(V).end()) #define REVERSE(V) reverse((V).begin(),(V).end()) #define INF ((1LL<<62)-(1LL<<31)) #define MOD 1000000007 using namespace std; ll GCD(ll a,ll b){ if(b==0) return b; return gcd(b,a%b); } ll LCM(ll a,ll b){ ll g=gcd(a,b); return a/g*b; } int main(){ ll N; cin>>N; ll T[N]; REP(i,N) cin>>T[i]; ll ans=T[0]; FOR(i,1,N){ ans=LCM(ans,T[i]); } cout<<ans<<endl; }
a.cc:5:29: warning: extra tokens at end of #include directive 5 | #include<bits/stdc++.h>https://atcoder.jp/contests/abc070/submissions/me | ^ a.cc:5:9: fatal error: bits/stdc++.h>http: No such file or directory 5 | #include<bits/stdc++.h>https://atcoder.jp/contests/abc070/submissions/me | ^~~~~~~~~~~~~~~~~~~~ compilation terminated.
s312475826
p03633
C++
#include <bits/stdc++.h> using namespace std; { template <class M, class N> constexpr common_type_t<M, N> lcm(M m, N n); } int neko(int N){ vector<int64_t> t(N); for(int i=0;i<N;i++){ cin>>t.at(i); } if(N==2){ return lcm(t.at(0),t.at(1)); } int64_t z=neko(N-1); return lcm(z,t.at(N)); } int main() { int N; cin >> N; if(N==1){ int64_t a; cin>>a; cout<<a; } else{ cout<<neko(N); } }
a.cc:2:22: error: expected unqualified-id before '{' token 2 | using namespace std; { | ^
s628456703
p03633
C++
#include <bits/stdc++.h> using namespace std { template <class M, class N> constexpr common_type_t<M, N> lcm(M m, N n); } int neko(int N){ vector<int64_t> t(N); for(int i=0;i<N;i++){ cin>>t.at(i); } if(N==2){ return lcm(t.at(0),t.at(1)); } int64_t z=neko(N-1); return lcm(z,t.at(N)); } int main() { int N; cin >> N; if(N==1){ int64_t a; cin>>a; cout<<a; } else{ cout<<neko(N); } }
a.cc:2:20: error: expected ';' before '{' token 2 | using namespace std { | ^~ | ; a.cc:2:21: error: expected unqualified-id before '{' token 2 | using namespace std { | ^
s978441947
p03633
C++
#include <bits/stdc++.h> using namespace std { template <class M, class N> constexpr common_type_t<M, N> gcd(M m, N n); template <class M, class N> constexpr common_type_t<M, N> lcm(M m, N n); } int neko(int N){ vector<int64_t> t(N); for(int i=0;i<N;i++){ cin>>t.at(i); } if(N==2){ return lcm(t.at(0),t.at(1)); } int64_t z=neko(N-1); return lcm(z,t.at(N)); } int main() { int N; cin >> N; if(N==1){ int64_t a; cin>>a; cout<<a; } else{ cout<<neko(N); } }
a.cc:2:20: error: expected ';' before '{' token 2 | using namespace std { | ^~ | ; a.cc:2:21: error: expected unqualified-id before '{' token 2 | using namespace std { | ^
s646695038
p03633
C++
#include <bits/stdc++.h> using namespace std; int neko(int N){ vector<int64_t> t(N); for(int i=0;i<N;i++){ cin>>t.at(i); } if(N==2){ return lcm(t.at(0),t.at(1)); } int64_t z=neko(N-1); return lcm(z,t.at(N)) } int main() { int N; cin >> N; if(N==1){ int64_t a; cin>>a; cout<<a; } else{ cout<<neko(N); } }
a.cc: In function 'int neko(int)': a.cc:12:24: error: expected ';' before '}' token 12 | return lcm(z,t.at(N)) | ^ | ; 13 | } | ~
s271747013
p03633
C++
#include <bits/stdc++.h> using namespace std; int neko(int N){ vector<int64_t> t(N); for(int i=0;i<N;i++){ cin>>t.at(i); } if(N==2){ return lcm(a.at(0),a.at(1)); } int64_t t=neko(N-1); return lcm(t,a.at(N)) } int main() { int N; cin >> N; if(N==1){ int64_t a; cin>>a; cout<<a; } else{ cout<<neko(N); } }
a.cc: In function 'int neko(int)': a.cc:9:16: error: 'a' was not declared in this scope 9 | return lcm(a.at(0),a.at(1)); | ^ a.cc:11:11: error: conflicting declaration 'int64_t t' 11 | int64_t t=neko(N-1); | ^ a.cc:4:19: note: previous declaration as 'std::vector<long int> t' 4 | vector<int64_t> t(N); | ^ a.cc:12:16: error: 'a' was not declared in this scope 12 | return lcm(t,a.at(N)) | ^ a.cc:12:24: error: expected ';' before '}' token 12 | return lcm(t,a.at(N)) | ^ | ; 13 | } | ~
s982700359
p03633
C++
#include <bits/stdc++.h> using namespace std; int neko(int N){ vector<int64_t> t(N); for(int i=0;i<N;i++){ cin>>t.at(i); } if(N==1){ return lcm(a.at(0),a.at(1)); } int64_t t=neko(N-1); return lcm(t,a.at(N)) } int main() { int N; cin >> N; if(N==1){ cout<<a.at(0); } else{ cout<<neko(N); } }
a.cc: In function 'int neko(int)': a.cc:9:16: error: 'a' was not declared in this scope 9 | return lcm(a.at(0),a.at(1)); | ^ a.cc:11:11: error: conflicting declaration 'int64_t t' 11 | int64_t t=neko(N-1); | ^ a.cc:4:19: note: previous declaration as 'std::vector<long int> t' 4 | vector<int64_t> t(N); | ^ a.cc:12:16: error: 'a' was not declared in this scope 12 | return lcm(t,a.at(N)) | ^ a.cc:12:24: error: expected ';' before '}' token 12 | return lcm(t,a.at(N)) | ^ | ; 13 | } | ~ a.cc: In function 'int main()': a.cc:18:9: error: 'a' was not declared in this scope 18 | cout<<a.at(0); | ^
s832328649
p03633
C++
#include <bits/stdc++.h> using namespace std; int neko(int N){ if(N==1){ return lcm(a.at(0),a.at(1)); } int64_t t=neko(N-1); return lcm(t,a.at(N)) } int main() { int N; cin >> N; vector<int64_t> t(N); for(int i=0;i<N;i++){ cin>>t.at(i); } if(N==1){ cout<<a.at(0); } else{ cout<<neko(N); } }
a.cc: In function 'int neko(int)': a.cc:5:16: error: 'a' was not declared in this scope 5 | return lcm(a.at(0),a.at(1)); | ^ a.cc:8:16: error: 'a' was not declared in this scope 8 | return lcm(t,a.at(N)) | ^ a.cc:8:24: error: expected ';' before '}' token 8 | return lcm(t,a.at(N)) | ^ | ; 9 | } | ~ a.cc: In function 'int main()': a.cc:18:9: error: 'a' was not declared in this scope 18 | cout<<a.at(0); | ^
s213844601
p03633
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<unsigned long long> T(N); for (int i=0; i<N; ++i) { cin >> T[i]; } sort(T.begin(), T.end()); unsigned long long max_t = T.end(); unsigned long long cur_t = max_t; unsigned long long interval = T.begin(); while (true) { int cnt = 0; for (int i=0; i<N; ++i) { if (cur_t % T[i] == 0) { ++cnt; } } if (cnt == N) { break; } cur_t += interval; } cout << cur_t << endl; }
a.cc: In function 'int main()': a.cc:13:35: error: cannot convert 'std::vector<long long unsigned int>::iterator' to 'long long unsigned int' in initialization 13 | unsigned long long max_t = T.end(); | ~~~~~^~ | | | std::vector<long long unsigned int>::iterator a.cc:15:40: error: cannot convert 'std::vector<long long unsigned int>::iterator' to 'long long unsigned int' in initialization 15 | unsigned long long interval = T.begin(); | ~~~~~~~^~ | | | std::vector<long long unsigned int>::iterator
s661316329
p03633
C++
#include <bits/stdc++.h> using namespace std ; #define DEBUG(x) cout << '>' << #x << ':' << x << endl; #define mem(x,val) memset((x),(val),sizeof(x)) #define all(x) x.begin(),x.end() #define pb push_back #define mp make_pair #define PI acos(-1.0) #define N 111111 const int INF = 1 << 30 ; typedef unsigned long long ull ; typedef pair < int , int > pii ; ll a[N] ; int main(){ int n ; ll ans = 1 , x = 1; scanf("%d", &n) ; for(int i = 0 ;i<n ;i++){ scanf("%d", &a[i]) ; ll y = _gcd(ans, x) ; x/=y ; ans*=(x*a[i]) ; } cout << ans << endl ; return 0 ; }
a.cc:16:1: error: 'll' does not name a type; did you mean 'ull'? 16 | ll a[N] ; | ^~ | ull a.cc: In function 'int main()': a.cc:20:3: error: 'll' was not declared in this scope; did you mean 'ull'? 20 | ll ans = 1 , x = 1; | ^~ | ull a.cc:24:18: error: 'a' was not declared in this scope 24 | scanf("%d", &a[i]) ; | ^ a.cc:25:7: error: expected ';' before 'y' 25 | ll y = _gcd(ans, x) ; | ^~ | ; a.cc:26:5: error: 'x' was not declared in this scope 26 | x/=y ; | ^ a.cc:26:8: error: 'y' was not declared in this scope 26 | x/=y ; | ^ a.cc:27:5: error: 'ans' was not declared in this scope; did you mean 'abs'? 27 | ans*=(x*a[i]) ; | ^~~ | abs a.cc:29:11: error: 'ans' was not declared in this scope; did you mean 'abs'? 29 | cout << ans << endl ; | ^~~ | abs
s858608484
p03633
C
#include<stdio.h> #include<stdlib.h> #include<string.h> #define df 0 int dc=100000; #define MAX 100010 typedef long int li; li gcd(li a,li b){ if(b==0)return a; return gcd(b,a%b); } #define lcm(a,b) ((a)/gcd(a,b)*(b)) int main(){ if(df)printf("*** debug mode ***\n"); int n,m=1,i; scanf("%d",&n); for(i=0;i<n;i++){ li a; scanf("%ld",&a); m=lcm(m,a); } printf("%d",); return 0; } /// confirm df==0 ///
main.c: In function 'main': main.c:24:15: error: expected expression before ')' token 24 | printf("%d",); | ^
s978827251
p03633
C++
#include<bits/stdc++.h> using namespace std; #define ALL(v) (v).begin(),(v).end() #define REP(i,p,n) for(int i=p;i<(int)(n);++i) #define rep(i,n) REP(i,0,n) #define INF 999999999 typedef long long ll; using VI = vector<int>; using Int = long long int; ll gcd(ll a,ll b){ return b ? gcd(b,a%b) : a; } ll lcm(ll a,ll b){ return a*b/gcd(a,b); } int main(){ int n;cin >> n; vector<ll> a(n); rep(i,n) cin >> a[i]; ll m =a[0]; rep(i,n) m = lcm(m,a[i]); cout << m << endl; }*
a.cc:24:3: error: expected unqualified-id at end of input 24 | }* | ^
s238135104
p03633
C++
#include<bits/stdc++.h> using namespace std; #define ALL(v) (v).begin(),(v).end() #define REP(i,p,n) for(int i=p;i<(int)(n);++i) #define rep(i,n) REP(i,0,n) #define INF 999999999 using LL = long long; using VI = vector<int>; int gcd(Int a, Int b) { return b != 0 ? gcd(b, a % b) : a; } int lcm(Int a, Int b) { return a / gcd(a, b)*b; } int main(){ int n;cin >> n; int ans; rep(i,n){ int a; cin >> a; if(i==0) ans = a; else ans = lcm(a,ans) } cout << ans << endl; return 0; }
a.cc:9:9: error: 'Int' was not declared in this scope; did you mean 'int'? 9 | int gcd(Int a, Int b) { | ^~~ | int a.cc:9:16: error: 'Int' was not declared in this scope; did you mean 'int'? 9 | int gcd(Int a, Int b) { | ^~~ | int a.cc:9:21: error: expression list treated as compound expression in initializer [-fpermissive] 9 | int gcd(Int a, Int b) { | ^ a.cc:12:9: error: 'Int' was not declared in this scope; did you mean 'int'? 12 | int lcm(Int a, Int b) { | ^~~ | int a.cc:12:16: error: 'Int' was not declared in this scope; did you mean 'int'? 12 | int lcm(Int a, Int b) { | ^~~ | int a.cc:12:21: error: expression list treated as compound expression in initializer [-fpermissive] 12 | int lcm(Int a, Int b) { | ^ a.cc: In function 'int main()': a.cc:22:16: error: reference to 'lcm' is ambiguous 22 | else ans = lcm(a,ans) | ^~~ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:58, from a.cc:1: /usr/include/c++/14/numeric:188:5: note: candidates are: 'template<class _Mn, class _Nn> constexpr std::common_type_t<_Mn, _Nn> std::lcm(_Mn, _Nn)' 188 | lcm(_Mn __m, _Nn __n) noexcept | ^~~ a.cc:12:5: note: 'int lcm' 12 | int lcm(Int a, Int b) { | ^~~
s509484228
p03633
C++
#include<bits/stdc++.h> using namespace std; int main(){ int a; cin>>a; unsigned long long int c,d,e; vector<unsigned long long int> b(a); vector<unsigned long long int> f=b; for(int i=0;i<a;i++) cin>>b.at(i); for(int i=0;i<a-1;i++){ c=max(b.at(i),b.at(i+1)); d=min(b.at(i),b.at(i+1)); e=c%d; if(e==0) b.at(i+1)=f.at(i)*f.at(i+1)/e; else{ b.at(i)=d; b.at(i+1)=e; i--; } } cout<<b.at(a-1)<<endl;
a.cc: In function 'int main()': a.cc:24:25: error: expected '}' at end of input 24 | cout<<b.at(a-1)<<endl; | ^ a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s746374343
p03633
C++
テンプレ #include<bits/stdc++.h> using namespace std; #define REP(i,m,n) for(int i=(m);i<(n);i++) #define rep(i,n) REP(i,0,n) typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; const int inf=1e9+7; ll GCD(ll p,ll q){ if(p<q)swap(p,q); if(q==0)return p; return GCD(q,p%q); } ll LCM(ll p,ll q){ return p*q/GCD(p,q); } int main(){ int n;cin>>n; ll ans=1; rep(i,n){ ll t;cin>>t; ans=LCM(ans,t); } cout<<ans<<endl; }
a.cc:1:1: error: '\U000030c6\U000030f3\U000030d7\U000030ec' does not name a type 1 | テンプレ | ^~~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:2: /usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity 164 | __is_null_pointer(std::nullptr_t) | ^ /usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)' 159 | __is_null_pointer(_Type) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'? 164 | __is_null_pointer(std::nullptr_t) | ^~~~~~~~~ In file included from /usr/include/c++/14/cstddef:50, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41: /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here 443 | typedef decltype(nullptr) nullptr_t; | ^~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'? 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here 443 | typedef decltype(nullptr) 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)> | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared 2086 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope 2087 | struct remove_extent<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid 2087 | struct remove_extent<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared 2099 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope 2100 | struct remove_all_extents<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid 2100 | struct remove_all_extents<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared 2171 | template<std::size_t _Len> | ^~~ /usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope 2176 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^~~~ /usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^ /usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope 2202 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope 2203 | struct __attribute__((__aligned__((_Align)))) { } __align; | ^~~~~~ In file included from /usr/include/c++/14/bits/stl_tempbuf.h:59, from /usr/include/c++/14/bits/stl_algo.h:69, from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive] 132 | __attribute__((__externally_visible__)); | ^ /usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive] 134 | __attribute__((__externally_visible__)); |
s905662785
p03633
C++
テンプレ #include<bits/stdc++.h> using namespace std; #define REP(i,m,n) for(int i=(m);i<(n);i++) #define rep(i,n) REP(i,0,n) typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; const int inf=1e9+7; ll GCD(ll p,ll q){ if(p<q)swap(p,q); if(q==0)return p; return GCD(q,p%q); } ll LCM(ll p,ll q){ return p*q/GCD(p*q); } int main(){ int n;cin>>n; ans=1; rep(i,n){ ll t;cin>>t; ans=LCM(ans,t); } cout<<ans<<endl; }
a.cc:1:1: error: '\U000030c6\U000030f3\U000030d7\U000030ec' does not name a type 1 | テンプレ | ^~~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:2: /usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity 164 | __is_null_pointer(std::nullptr_t) | ^ /usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)' 159 | __is_null_pointer(_Type) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'? 164 | __is_null_pointer(std::nullptr_t) | ^~~~~~~~~ In file included from /usr/include/c++/14/cstddef:50, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41: /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here 443 | typedef decltype(nullptr) nullptr_t; | ^~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'? 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here 443 | typedef decltype(nullptr) 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)> | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared 2086 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope 2087 | struct remove_extent<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid 2087 | struct remove_extent<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared 2099 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope 2100 | struct remove_all_extents<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid 2100 | struct remove_all_extents<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared 2171 | template<std::size_t _Len> | ^~~ /usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope 2176 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^~~~ /usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^ /usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope 2202 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope 2203 | struct __attribute__((__aligned__((_Align)))) { } __align; | ^~~~~~ In file included from /usr/include/c++/14/bits/stl_tempbuf.h:59, from /usr/include/c++/14/bits/stl_algo.h:69, from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive] 132 | __attribute__((__externally_visible__)); | ^ /usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive] 134 | __attribute__((__externally_visible__)); |
s983168467
p03633
C++
テンプレ #include<bits/stdc++.h> using namespace std; #define REP(i,m,n) for(int i=(m);i<(n);i++) #define rep(i,n) REP(i,0,n) typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; const int inf=1e9+7; ll GCD(llp,llq){ if(p<q)swap(p,q); if(q==0)return p; return GCD(q,p%q); } ll LCM(ll p,ll q){ return p*q/GCD(p*q); } int main(){ int n;cin>>n; ans=1; rep(i,n){ ll t;cin>>t; ans=LCM(ans,t); } cout<<ans<<endl; }
a.cc:1:1: error: '\U000030c6\U000030f3\U000030d7\U000030ec' does not name a type 1 | テンプレ | ^~~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:2: /usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity 164 | __is_null_pointer(std::nullptr_t) | ^ /usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)' 159 | __is_null_pointer(_Type) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'? 164 | __is_null_pointer(std::nullptr_t) | ^~~~~~~~~ In file included from /usr/include/c++/14/cstddef:50, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41: /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here 443 | typedef decltype(nullptr) nullptr_t; | ^~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'? 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here 443 | typedef decltype(nullptr) 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)> | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared 2086 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope 2087 | struct remove_extent<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid 2087 | struct remove_extent<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared 2099 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope 2100 | struct remove_all_extents<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid 2100 | struct remove_all_extents<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared 2171 | template<std::size_t _Len> | ^~~ /usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope 2176 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^~~~ /usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^ /usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope 2202 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope 2203 | struct __attribute__((__aligned__((_Align)))) { } __align; | ^~~~~~ In file included from /usr/include/c++/14/bits/stl_tempbuf.h:59, from /usr/include/c++/14/bits/stl_algo.h:69, from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive] 132 | __attribute__((__externally_visible__)); | ^ /usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive] 134 | __attribute__((__externally_visible__)); |
s015232801
p03633
C++
#include <bits/stdc++.h> #define rep(i,n) for(int i=0; i<n; i++) #define int long long #define P pair<long,long> using namespace std; inline int lcm(int a,int b){ if(a<b) swap(a,b); int n=a,m=b; while(a%b!=0){ int t=b; b=a%b; a=t; } return n/b*m; } signed main(){ int a; vector<int> b(a); rep(i,a) cin>>b.at(i); int c=lcm(b.at(0),b.at(1)); rep(i,a-1) int t; t=lcm(c,b.at(i+1)); c=t; cout<<c; }
a.cc: In function 'int main()': a.cc:26:5: error: 't' was not declared in this scope 26 | t=lcm(c,b.at(i+1)); | ^ a.cc:26:18: error: 'i' was not declared in this scope 26 | t=lcm(c,b.at(i+1)); | ^
s988699606
p03633
C++
#include <bits/stdc++.h> #define rep(i,n) for(int i=0; i<n; i++) #define int long long #define P pair<long,long> using namespace std; inline int lcm(int a,int b){ if(a<b) swap(a,b); int n=a,m=b; while(a%b!=0){ int t=b; b=a%b; a=t; } return n/b*m; } signed main(){ int a; vector<int> b(a); rep(i,a) cin>>b.at(i); int c=lcm(b.at(0),b.at(1)); rep(i,a-1) t=lcm(c,b.at(i+1)); c=t; cout<<c; }
a.cc: In function 'int main()': a.cc:25:5: error: 't' was not declared in this scope 25 | t=lcm(c,b.at(i+1)); | ^ a.cc:26:7: error: 't' was not declared in this scope 26 | c=t; | ^
s733643603
p03633
C++
#include <bits/stdc++.h> #define rep(i,n) for(int i=0; i<n; i++) #define int long long #define P pair<long,long> using namespace std; inline int lcm(int a,int b){ if(a<b) swap(a,b); int n=a,m=b; while(a%b!=0){ int t=b; b=a%b; a=t; } return n/b*m; } signed main(){ int a; vector<int> b(a); rep(i,a) cin>>b.at(i); int c=lcm(b.at(0),b.at(1)); rep(i,a-1) t=lcm(c,b.at(i+1)) c=t; cout<<c; }
a.cc: In function 'int main()': a.cc:25:5: error: 't' was not declared in this scope 25 | t=lcm(c,b.at(i+1)) | ^
s992586723
p03633
C++
#include <bits/stdc++.h> #define rep(i,n) for(int i=0; i<n; i++) #define int long long #define P pair<long,long> using namespace std; inline int lcm(int a,int b){ if(a<b) swap(a,b); int n=a,m=b; while(a%b!=0){ int t=b; b=a%b; a=t; } return n/b*m; } signed main(){ int a; vector<int> b(a); rep(i,a) cin>>b.at(i); rep(i,a-1) lcm(b.at(i),b.at(i+1))=b.at(i+1); cout<<b.at(a); }
a.cc: In function 'int main()': a.cc:24:8: error: lvalue required as left operand of assignment 24 | lcm(b.at(i),b.at(i+1))=b.at(i+1); | ~~~^~~~~~~~~~~~~~~~~~~
s296196730
p03633
C++
#include <bits/stdc++.h> #define rep(i,n) for(int i=0; i<n; i++) #define int long long #define P pair<long,long> using namespace std; inline int lcm(int a,int b){ if(a<b) swap(a,b); int n=a,m=b; while(a%b!=0){ int t=b; b=a%b; a=t; } return n/b*m; } signed main(){ int a; vector b(a); rep(i,a) cin>>b.at(i); rep(i,a-1) lcm(b.at(i),b.at(i+1))=b.at(i+1); cout<<b.at(a); }
a.cc: In function 'int main()': a.cc:20:13: error: class template argument deduction failed: 20 | vector b(a); | ^ a.cc:20:13: error: no matching function for call to 'vector(long long int&)' In file included from /usr/include/c++/14/vector:66, from /usr/include/c++/14/functional:64, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53, from a.cc:1: /usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate: 'template<class _Tp, class _Alloc, class _InputIterator, class> vector(_InputIterator, _InputIterator, const _Alloc&)-> std::vector<_Tp, _Alloc>' 707 | vector(_InputIterator __first, _InputIterator __last, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::initializer_list<_Tp>, const _Alloc&)-> std::vector<_Tp, _Alloc>' 678 | vector(initializer_list<value_type> __l, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:678:7: note: template argument deduction/substitution failed: a.cc:20:13: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 20 | vector b(a); | ^ /usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&, std::__type_identity_t<_Alloc>&)-> std::vector<_Tp, _Alloc>' 659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&, const _Alloc&, std::false_type)-> std::vector<_Tp, _Alloc>' 640 | vector(vector&& __rv, const allocator_type& __m, false_type) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate expects 3 arguments, 1 provided /usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&, const _Alloc&, std::true_type)-> std::vector<_Tp, _Alloc>' 635 | vector(vector&& __rv, const allocator_type& __m, true_type) noexcept | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate expects 3 arguments, 1 provided /usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate: 'template<class _Tp, class _Alloc> vector(const std::vector<_Tp, _Alloc>&, std::__type_identity_t<_Alloc>&)-> std::vector<_Tp, _Alloc>' 624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&)-> std::vector<_Tp, _Alloc>' 620 | vector(vector&&) noexcept = default; | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:620:7: note: template argument deduction/substitution failed: a.cc:20:13: note: mismatched types 'std::vector<_Tp, _Alloc>' and 'long long int' 20 | vector b(a); | ^ /usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate: 'template<class _Tp, class _Alloc> vector(const std::vector<_Tp, _Alloc>&)-> std::vector<_Tp, _Alloc>' 601 | vector(const vector& __x) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:601:7: note: template argument deduction/substitution failed: a.cc:20:13: note: mismatched types 'const std::vector<_Tp, _Alloc>' and 'long long int' 20 | vector b(a); | ^ /usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::size_t, const _Tp&, const _Alloc&)-> std::vector<_Tp, _Alloc>' 569 | vector(size_type __n, const value_type& __value, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::size_t, const _Alloc&)-> std::vector<_Tp, _Alloc>' 556 | vector(size_type __n, const allocator_type& __a = allocator_type()) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:556:7: note: template argument deduction/substitution failed: a.cc:20:13: note: couldn't deduce template parameter '_Tp' 20 | vector b(a); | ^ /usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate: 'template<class _Tp, class _Alloc> vector(const _Alloc&)-> std::vector<_Tp, _Alloc>' 542 | vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:542:7: note: template argument deduction/substitution failed: a.cc:20:13: note: couldn't deduce template parameter '_Tp' 20 | vector b(a); | ^ /usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate: 'template<class _Tp, class _Alloc> vector()-> std::vector<_Tp, _Alloc>' 531 | vector() = default; | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate expects 0 arguments, 1 provided /usr/include/c++/14/bits/stl_vector.h:428:11: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>)-> std::vector<_Tp, _Alloc>' 428 | class vector : protected _Vector_base<_Tp, _Alloc> | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:428:11: note: template argument deduction/substitution failed: a.cc:20:13: note: mismatched types 'std::vector<_Tp, _Alloc>' and 'long long int' 20 | vector b(a); | ^ /usr/include/c++/14/bits/stl_vector.h:2033:5: note: candidate: 'template<class _InputIterator, class _ValT, class _Allocator, class, class> std::vector(_InputIterator, _InputIterator, _Allocator)-> vector<_ValT, _Allocator>' 2033 | vector(_InputIterator, _InputIterator, _Allocator = _Allocator()) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:2033:5: note: candidate expects 2 arguments, 1 provided
s264764432
p03633
C
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <string.h> #include <stdlib.h> #include <math.h> /* define */ #define Yes(X) puts ( X ? "Yes" : "No") #define YES(X) puts ( X ? "YES" : "NO") #define FOR(i, a, b) for ( int i = a; i < b ; i++) #define REP(i, n) for ( int i = 0; i < n ; i++) #define max(a, b) (((a) > (b)) ? (a) : (b)) #define min(a, b) (((a) < (b)) ? (a) : (b)) #define max3(a, b, c) ((max((a), (b)) > (c)) ? max((a), (b)) : (c)) #define min3(a, b, c) ((min((a), (b)) < (c)) ? min((a), (b)) : (c)) /* const */ const int MOD = (int)1e9 + 7; /* alias */ typedef long long ll; typedef unsigned u; /* function */ int cmp(const void *a, const void *b) { return *(int*)a - *(int*)b; } int cmp2(const void *a, const void *b) { return *(int*)b - *(int*)a; } int gcd(int a, int b) { if (b != 0)gcd(b, a % b); return a; } ll gcd(ll a, ll b) { if (b == 0) gcd(b, a % b); return a; } int lcm(int a, int b) { return a / gcd(a, b) * b; } ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } /* main */ int main() { ll n, t, r = 1; scanf("%lld", &n); REP(i, n) { scanf("%lld", &t); r = lcm(t, r); } printf("%lld", r); return 0; }
main.c:36:4: error: conflicting types for 'gcd'; have 'll(ll, ll)' {aka 'long long int(long long int, long long int)'} 36 | ll gcd(ll a, ll b) { | ^~~ main.c:32:5: note: previous definition of 'gcd' with type 'int(int, int)' 32 | int gcd(int a, int b) { | ^~~ main.c:43:4: error: conflicting types for 'lcm'; have 'll(ll, ll)' {aka 'long long int(long long int, long long int)'} 43 | ll lcm(ll a, ll b) { | ^~~ main.c:40:5: note: previous definition of 'lcm' with type 'int(int, int)' 40 | int lcm(int a, int b) { | ^~~
s944942553
p03633
C++
#include <bits/stdc++.h> #define mod 1000000007 using namespace std; typedef long long ll; ll gcd(ll a, ll b){ if(b == 0) return a; else return gcd(b, b%a); } ll lcm(ll a, ll b){ ll g = gcd(a, b); return a / g * b; } int main(void){ int N; cin >> N; ll ans = 1LL; for(int i=0; i<N; i++){ ll T; cin >> T; ans = lcm(ans, T) } cout << ans; return 0; }
a.cc: In function 'int main()': a.cc:31:34: error: expected ';' before '}' token 31 | ans = lcm(ans, T) | ^ | ; 32 | } | ~
s398797030
p03633
C++
#include <bits/stdc++.h> #define mod 1000000007 using namespace std; typedef long long ll; int main(void){ int N, count; cin >> N; ll int T[N]; for(int i=0; i<N; i++) cin >> T[i]; sort(T, T+N, greater<int>()); for(ll int i=T[0];;i*=T[0]){ count++; for(int j=0; j<N; j++){ if(i%T[j] == 0) count++; } if(count == N){ cout << i; break; } } return 0; }
a.cc: In function 'int main()': a.cc:14:9: error: two or more data types in declaration of 'T' 14 | ll int T[N]; | ^~ a.cc:17:24: error: 'T' was not declared in this scope 17 | cin >> T[i]; | ^ a.cc:19:14: error: 'T' was not declared in this scope 19 | sort(T, T+N, greater<int>()); | ^ a.cc:21:13: error: two or more data types in declaration of 'i' 21 | for(ll int i=T[0];;i*=T[0]){ | ^~ a.cc:21:28: error: 'i' was not declared in this scope 21 | for(ll int i=T[0];;i*=T[0]){ | ^
s151138190
p03633
C++
#include <iostream> #include <cstdio> #include <string> #include <algorithm> #include <cmath> #include <vector> #define rep(i, n) for(int i = 0; i < n; i++) using namespace std; typedef long long ll; ll gcd(ll x, ll y) { if(y == 0) { return x; } else { return gcd(y, x%y); } } ll lcm(ll x, ll y) { ll g = gcd(x, y); return a / g * b; } int main() { int N; cin >> N; ll ans = 1LL; rep(i, N) { ll T; cin >> T; ans = lcm(ans, T); } cout << ans; cout << endl; return 0; }
a.cc: In function 'll lcm(ll, ll)': a.cc:22:12: error: 'a' was not declared in this scope 22 | return a / g * b; | ^ a.cc:22:20: error: 'b' was not declared in this scope 22 | return a / g * b; | ^
s702846966
p03633
C++
#include <bits/stdc++.h> #define rep(i,n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; ll gcd(ll a, llb) { if (b == 0) return a; return gcd(b, a%b); } ll lcm(ll a, ll b) { ll g = gcd(a, b); return a/g*b; int main() { int N; cin >> N; ll ans = 1ll; rep (i,N) { ll T; cin >> T; ans = lcm(ans, T); } cout << ans << endl; return 0; }
a.cc:6:14: error: 'llb' has not been declared 6 | ll gcd(ll a, llb) { | ^~~ a.cc: In function 'll gcd(ll, int)': a.cc:7:7: error: 'b' was not declared in this scope 7 | if (b == 0) return a; | ^ a.cc:8:14: error: 'b' was not declared in this scope 8 | return gcd(b, a%b); | ^ a.cc: In function 'll lcm(ll, ll)': a.cc:15:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 15 | int main() { | ^~ a.cc:15:9: note: remove parentheses to default-initialize a variable 15 | int main() { | ^~ | -- a.cc:15:9: note: or replace parentheses with braces to value-initialize a variable a.cc:15:12: error: a function-definition is not allowed here before '{' token 15 | int main() { | ^ a.cc:28:2: error: expected '}' at end of input 28 | } | ^ a.cc:11:20: note: to match this '{' 11 | ll lcm(ll a, ll b) { | ^
s793632447
p03633
C++
#include<iostream> #include <vector> #include <algorithm> using namespace std; typedef long long int ll; ll lcm(ll a,ll b){ ll ans = a * b / gcd(a, b); return ans; } ll gcd(ll a,ll b){ if(b==0) return a; return gcd(b, a % b); } int main(){ int N; cin >> N; ll T,ans=1LL; for (int i = 0; i < N;i++){ cin >> T; ans = lcm(ans, T); } cout << ans << endl; return 0; }
a.cc: In function 'll lcm(ll, ll)': a.cc:11:22: error: 'gcd' was not declared in this scope 11 | ll ans = a * b / gcd(a, b); | ^~~
s956714801
p03633
C++
#include<iostream> #include <vector> #include <algorithm> using namespace std; typedef long long int ll; ll lcm(ll a,b){ ll ans = a * b / gcd(a, b); return ans; } ll gcd(ll a,b){ if(b==0) return a; return gcd(b, a % b); } int main(){ int N; cin >> N; ll T,ans=1LL; for (int i = 0; i < N;i++){ cin >> T; ans = lcm(ans, T); } cout << ans << endl; return 0; }
a.cc:9:13: error: 'b' has not been declared 9 | ll lcm(ll a,b){ | ^ a.cc: In function 'll lcm(ll, int)': a.cc:11:18: error: 'b' was not declared in this scope 11 | ll ans = a * b / gcd(a, b); | ^ a.cc:11:22: error: 'gcd' was not declared in this scope 11 | ll ans = a * b / gcd(a, b); | ^~~ a.cc: At global scope: a.cc:14:13: error: 'b' has not been declared 14 | ll gcd(ll a,b){ | ^ a.cc: In function 'll gcd(ll, int)': a.cc:15:8: error: 'b' was not declared in this scope 15 | if(b==0) | ^ a.cc:17:16: error: 'b' was not declared in this scope 17 | return gcd(b, a % b); | ^
s539948586
p03633
C++
#include <iostream> using namespace std; using ll = long long; ll gcd(ll a,ll b){ if(b == 0) return a; else return gcd(b,a % b); } ll lcm(ll a,ll b){ ll g = gcd(a,b); return a / g * b; } int main(void){ int N; cin >> N; ll ans = 1LL; for(int i=0;i<N;i++){ ll t; cin >> t; ans = lcm(ans,t) } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:24:21: error: expected ';' before '}' token 24 | ans = lcm(ans,t) | ^ | ; 25 | } | ~
s653760663
p03633
C++
#include <bits/stdc++.h> #define REP(i, n) for(ll i = 0; i < (ll)n; i++) #define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++) #define ALL(obj) (obj).begin(), (obj).end() #define INF 1000000000000000 using namespace std; typedef long long ll; typedef double db; typedef string str; typedef pair<ll, ll> p; constexpr int MOD = 1000000007; 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; } void print(const std::vector<int> &v) { std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; }); std::cout << std::endl; } static int dp[50000][100000]; int main() { REP(i, 50000) { REP(j, 100000) { dp[i][j] = 1; } } cout << "hoge" << endl; } int gcd(int a, int b) { for(;;) { if(a == 0) return b; b %= a; if(b == 0) return a; a %= b; } } int lcm(int a, int b) { int temp = gcd(a, b); return temp ? (a / temp * b) : 0; } int main() { int N; cin >> N; vector<int> t(N); REP(i, N) { cin >> t[i]; } int result = std::accumulate(t, t + N, 1, lcm); std::cout << result << '\n'; }
a.cc:57:5: error: redefinition of 'int main()' 57 | int main() { | ^~~~ a.cc:33:5: note: 'int main()' previously defined here 33 | int main() { | ^~~~ a.cc: In function 'int main()': a.cc:63:39: error: no match for 'operator+' (operand types are 'std::vector<int>' and 'int') 63 | int result = std::accumulate(t, t + N, 1, lcm); | ~ ^ ~ | | | | | int | std::vector<int> In file included from /usr/include/c++/14/bits/stl_algobase.h:67, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_iterator.h:627:5: note: candidate: 'template<class _Iterator> constexpr std::reverse_iterator<_Iterator> std::operator+(typename reverse_iterator<_Iterator>::difference_type, const reverse_iterator<_Iterator>&)' 627 | operator+(typename reverse_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:627:5: note: template argument deduction/substitution failed: a.cc:63:41: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int' 63 | int result = std::accumulate(t, t + N, 1, lcm); | ^ /usr/include/c++/14/bits/stl_iterator.h:1798:5: note: candidate: 'template<class _Iterator> constexpr std::move_iterator<_IteratorL> std::operator+(typename move_iterator<_IteratorL>::difference_type, const move_iterator<_IteratorL>&)' 1798 | operator+(typename move_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1798:5: note: template argument deduction/substitution failed: a.cc:63:41: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int' 63 | int result = std::accumulate(t, t + N, 1, lcm); | ^ In file included from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/basic_string.h:3598:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3598 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3598:5: note: template argument deduction/substitution failed: a.cc:63:41: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 63 | int result = std::accumulate(t, t + N, 1, lcm); | ^ /usr/include/c++/14/bits/basic_string.h:3616:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3616 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3616:5: note: template argument deduction/substitution failed: a.cc:63:41: note: mismatched types 'const _CharT*' and 'std::vector<int>' 63 | int result = std::accumulate(t, t + N, 1, lcm); | ^ /usr/include/c++/14/bits/basic_string.h:3635:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3635 | operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3635:5: note: template argument deduction/substitution failed: a.cc:63:41: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 63 | int result = std::accumulate(t, t + N, 1, lcm); | ^ /usr/include/c++/14/bits/basic_string.h:3652:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3652 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3652:5: note: template argument deduction/substitution failed: a.cc:63:41: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 63 | int result = std::accumulate(t, t + N, 1, lcm); | ^ /usr/include/c++/14/bits/basic_string.h:3670:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT)' 3670 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3670:5: note: template argument deduction/substitution failed: a.cc:63:41: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 63 | int result = std::accumulate(t, t + N, 1, lcm); | ^ /usr/include/c++/14/bits/basic_string.h:3682:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3682 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3682:5: note: template argument deduction/substitution failed: a.cc:63:41: note: 'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 63 | int result = std::accumulate(t, t + N, 1, lcm); | ^ /usr/include/c++/14/bits/basic_string.h:3689:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3689 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3689:5: note: template argument deduction/substitution failed: a.cc:63:41: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 63 | int result = std::accumulate(t, t + N, 1, lcm); | ^ /usr/include/c++/14/bits/basic_string.h:3696:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3696 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3696:5: note: template argument deduction/substitution failed: a.cc:63:41: note: 'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 63 | int result = std::accumulate(t, t + N, 1, lcm); | ^ /usr/include/c++/14/bits/basic_string.h:3719:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3719 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3719:5: note: template argument deduction/substitution failed: a.cc:63:41: note: mismatched types 'const _CharT*' and 'std::vector<int>' 63 | int result = std::accumulate(t, t + N, 1, lcm); | ^ /usr/include/c++/14/bits/basic_string.h:3726:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3726 | operator+(_CharT __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3726:5: note: template argument deduction/substitution failed: a.cc:63:41: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 63 | int result = std::accumulate(t, t + N, 1, lcm); | ^ /usr/include/c++/14/bits/basic_string.h:3733:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const _CharT*)' 3733 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3733:5: note: template argument deduction/substitution failed: a.cc:63:41: note: 'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 63 | int result = std::accumulate(t, t + N, 1, lcm); | ^ /usr/include/c++/14/bits/basic_string.h:3740:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, _CharT)' 3740 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3740:5: note: template argument d
s361225138
p03633
C++
#include <bits/stdc++.h> using namespace std; int main(){ long n,a,r,x; cin >> n; vector<long> vec(n); for(int i=0;i<n;i++){ cin >> vc.at(i); } sort(vec.begin(), vec.end()); a = vec.at(0); for(int i=0;i<n;i++){ if(vec.at(i)%a == 0){ a = vec.at(i); } else { x = vec.at(i)*a; r=vec.at(i)%a; while(r !=0){ vec.at(i) = a; a = r; r = vec.at(i)%a; } a = x/a; } } cout << a << endl; }
a.cc: In function 'int main()': a.cc:9:12: error: 'vc' was not declared in this scope; did you mean 'vec'? 9 | cin >> vc.at(i); | ^~ | vec
s703897824
p03633
C++
#include <iostream> #define int unsigned long long #include <math.h> using namespace std; int n; int res = 1LL; int32_t main() { cin >> n; for (int i=1; i<=n; i++) { int x; cin >> x; res = __gcd(x, res); } cout << res; return 0; }
In file included from /usr/include/math.h:275, from /usr/include/c++/14/cmath:47, from /usr/include/c++/14/math.h:36, from a.cc:3: a.cc:2:27: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:27: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:27: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:27: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:27: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:27: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:22: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:27: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:22: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:27: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:27: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:27: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:22: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:27: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:22: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:27: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:13: error: duplicate 'unsigned' 2 | #define int unsigned long long | ^~~~~~~~ a.cc:2:13: error: duplicate 'unsigned' 2 | #define int unsigned long long | ^~~~~~~~ a.cc:2:13: error: duplicate 'unsigned' 2 | #define int unsigned long long | ^~~~~~~~ a.cc:2:13: error: duplicate 'unsigned' 2 | #define int unsigned long long | ^~~~~~~~ a.cc:2:13: error: duplicate 'unsigned' 2 | #define int unsigned long long | ^~~~~~~~ a.cc:2:13: error: duplicate 'unsigned' 2 | #define int unsigned long long | ^~~~~~~~ a.cc:2:13: error: duplicate 'unsigned' 2 | #define int unsigned long long | ^~~~~~~~ a.cc:2:13: error: duplicate 'unsigned' 2 | #define int unsigned long long | ^~~~~~~~ a.cc:2:27: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:27: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:27: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:27: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:27: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:27: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:22: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:27: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:22: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:27: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:27: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:27: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:22: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:27: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:22: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:27: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:13: error: duplicate 'unsigned' 2 | #define int unsigned long long | ^~~~~~~~ a.cc:2:13: error: duplicate 'unsigned' 2 | #define int unsigned long long | ^~~~~~~~ a.cc:2:13: error: duplicate 'unsigned' 2 | #define int unsigned long long | ^~~~~~~~ a.cc:2:13: error: duplicate 'unsigned' 2 | #define int unsigned long long | ^~~~~~~~ a.cc:2:13: error: duplicate 'unsigned' 2 | #define int unsigned long long | ^~~~~~~~ a.cc:2:13: error: duplicate 'unsigned' 2 | #define int unsigned long long | ^~~~~~~~ a.cc:2:13: error: duplicate 'unsigned' 2 | #define int unsigned long long | ^~~~~~~~ a.cc:2:13: error: duplicate 'unsigned' 2 | #define int unsigned long long | ^~~~~~~~ a.cc:2:27: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:27: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:27: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:27: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:27: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:27: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:22: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:27: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:22: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:27: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:27: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:27: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:22: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:27: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:22: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:27: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:13: error: duplicate 'unsigned' 2 | #define int unsigned long long | ^~~~~~~~ a.cc:2:13: error: duplicate 'unsigned' 2 | #define int unsigned long long | ^~~~~~~~ a.cc:2:13: error: duplicate 'unsigned' 2 | #define int unsigned long long | ^~~~~~~~ a.cc:2:13: error: duplicate 'unsigned' 2 | #define int unsigned long long | ^~~~~~~~ a.cc:2:13: error: duplicate 'unsigned' 2 | #define int unsigned long long | ^~~~~~~~ a.cc:2:13: error: duplicate 'unsigned' 2 | #define int unsigned long long | ^~~~~~~~ a.cc:2:13: error: duplicate 'unsigned' 2 | #define int unsigned long long | ^~~~~~~~ a.cc:2:13: error: duplicate 'unsigned' 2 | #define int unsigned long long | ^~~~~~~~ a.cc:2:27: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:27: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:27: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:27: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:27: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:27: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:22: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:27: error: 'long long long' is too long for GCC 2 | #define int unsigned long long | ^~~~ a.cc:2:22: error: 'long long long' is too long for GCC 2 | #define int unsigned long long |
s069103203
p03633
C++
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main(void){ int N; cin >> N; vector<long>num(N,0); for(int i=0;i<N;i++){ cin >> num[i]; } sort(num.begin(),num.end()); int p = 1; long num_max = num[N - 1] while(1){ int ans = 0; num[N - 1] = num_max * p; for(int i=0;i<N-1;i++){ if(num[N - 1] % num[i] == 0) ans++; } if(ans == N - 1) break; } cout << num[N - 1] << endl; return 0; }
a.cc: In function 'int main()': a.cc:19:3: error: expected ',' or ';' before 'while' 19 | while(1){ | ^~~~~
s736265936
p03633
C++
#include<iostream> #include<vector> #define ll long long using namespace std; ll gcd(ll x,ll y) { if(y%x==0) return x; else return gcd(y%x,x); } ll lcm(ll x, ll y) { if(y%x==0) return y; return (x*y)/gcd(x,y); } int main() { ll n,x;cin>>n; vector<ll>v; while(n--) { cin>>x; v.push_back(x); } sort(v.begin(),v.end()); //for(int i=0;i<v.size();i++) cout<<v[i]<<" "; ll big = v[v.size()-1]; ll small = v[0]; //cout<<big<<" "<<small<<endl; ll ans = lcm(small,big); cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:25:5: error: 'sort' was not declared in this scope; did you mean 'short'? 25 | sort(v.begin(),v.end()); | ^~~~ | short
s216775674
p03633
C++
#include<iostream> #include<vector> #define ll long long using namespace std; ll gcd(ll x,ll y) { if(y%x==0) return x; else return gcd(y%x,x); } ll lcm(ll x, ll y) { if(y%x==0) return y; return (x*y)/gcd(x,y); } int main() { ll n,x;cin>>n; vector<ll>v; while(n--) { cin>>x; v.push_back(x); } sort(v.begin(),v.end()); //for(int i=0;i<v.size();i++) cout<<v[i]<<" "; ll big = v[v.size()-1]; ll small = v[0]; //cout<<big<<" "<<small<<endl; ll ans = lcm(small,big); cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:25:5: error: 'sort' was not declared in this scope; did you mean 'short'? 25 | sort(v.begin(),v.end()); | ^~~~ | short
s345111863
p03633
C++
#include<bits/stdc++.h> using namespace std; #define all(a) (a).begin(),(a).end() typedef long long ll; ll mod=1000000007; string s; ll gcd(ll a, ll b){ if(b==0) return a; return gcd(b, a%b); } ll lcm(ll a, ll b){ ll gcd = gcd(a,b); return a * b/gcd; } int main() { int n; cin >> n; ll out=1; for (int i=0;i<n;++i){ ll t; cin>>t; out = lcm(out,t); } cout << out << endl; return 0; }
a.cc: In function 'll lcm(ll, ll)': a.cc:14:15: error: 'gcd' cannot be used as a function 14 | ll gcd = gcd(a,b); | ~~~^~~~~
s561120630
p03633
C++
#include <bits/stdc++.h> #define INF (1<<30) #define MOD 1000000007 #define l_ength size using namespace std; ll lcm( ll x, ll y ){ return x/__gcd(x, y)*y; } int main(){ int n; cin >> n; vector<ll> t(n); for( auto &k : t ) cin >> k; for( int i = 1; i < n; ++i ){ t[i] = lcm( t[i-1], t[i] ); } cout << t[n-1] << endl; return 0; }
a.cc:7:1: error: 'll' does not name a type 7 | ll lcm( ll x, ll y ){ | ^~ a.cc: In function 'int main()': a.cc:13:16: error: 'll' was not declared in this scope 13 | vector<ll> t(n); | ^~ a.cc:13:18: error: template argument 1 is invalid 13 | vector<ll> t(n); | ^ a.cc:13:18: error: template argument 2 is invalid a.cc:14:24: error: 'begin' was not declared in this scope 14 | for( auto &k : t ) cin >> k; | ^ a.cc:14:24: note: suggested alternatives: In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166, from a.cc:1: /usr/include/c++/14/valarray:1238:5: note: 'std::begin' 1238 | begin(const valarray<_Tp>& __va) noexcept | ^~~~~ In file included from /usr/include/c++/14/filesystem:53, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200: /usr/include/c++/14/bits/fs_dir.h:608:3: note: 'std::filesystem::__cxx11::begin' 608 | begin(recursive_directory_iterator __iter) noexcept | ^~~~~ a.cc:14:24: error: 'end' was not declared in this scope 14 | for( auto &k : t ) cin >> k; | ^ a.cc:14:24: note: suggested alternatives: /usr/include/c++/14/valarray:1265:5: note: 'std::end' 1265 | end(const valarray<_Tp>& __va) noexcept | ^~~ /usr/include/c++/14/bits/fs_dir.h:613:3: note: 'std::filesystem::__cxx11::end' 613 | end(recursive_directory_iterator) noexcept | ^~~ a.cc:16:18: error: invalid types 'int[int]' for array subscript 16 | t[i] = lcm( t[i-1], t[i] ); | ^ a.cc:16:30: error: invalid types 'int[int]' for array subscript 16 | t[i] = lcm( t[i-1], t[i] ); | ^ a.cc:16:38: error: invalid types 'int[int]' for array subscript 16 | t[i] = lcm( t[i-1], t[i] ); | ^ a.cc:18:18: error: invalid types 'int[int]' for array subscript 18 | cout << t[n-1] << endl; | ^
s791304681
p03633
C++
a
a.cc:1:1: error: 'a' does not name a type 1 | a | ^
s379924523
p03633
C++
#include <iostream> #include <vector> #include <stdio.h> #include <cmath> using namespace std; #include "utils.h" #include "integer.h" int main () { int N; cin >> N; uint64_t t; cin >> t; uint64_t res = t; rep(i, N-1) { uint64_t t; cin >> t; res = lcm (res, t); } printf("%ld\n", res); return 0; }
a.cc:8:10: fatal error: utils.h: No such file or directory 8 | #include "utils.h" | ^~~~~~~~~ compilation terminated.
s183830247
p03633
Java
/* * @Author Silviase(@silviasetitech) * For ProCon */ import java.util.*; import java.lang.*; import java.math.*; class Main{ static int n; static long[] times; static int m; static long ans; static int[] rate; static int var; static int ansmin; static int ansmax; static int[] w; static int[] ww; static boolean[] visit; public static void main(String[] args){ Scanner sc = new Scanner(System.in); n = sc.nextInt(); ans = 1; times = new long[n]; for (int i = 0; i < n; i++) { times[i] = sc.nextLong(); } for (int i = 0; i < n; i++) { ans = lcd(ans , times[i]); } System.out.println(ans); sc.close(); } public static long gcd(long a, long b) { if (a < b) { long tmpp = a; a = b; b = tmpp; } if (b == 0) { return a; }else{ return gcd(b, a%b); } } public static long lcm(long a, long b) { long gcd = gcd(a,b); return a/gcd*b; } public static void dfs(int placenow) { // if went all -> success! // if not went all -> fail... /* dfs Go All Place that there is way to and not having been yet. if island 1 is start point, dfs(1); if there is way to island 2 and island 3, - island 2 changes non-visited -> visited, and dfs(2). - island 3 changes non-visited -> visited, and dfs(3). */ visit[placenow] = true; boolean success = true; for (int i = 0; i < n; i++) { if (visit[i] == false) { // not go all place success = false; break; } } if (success) { ans++; visit[placenow] = false; return; } for (int i = 0; i < m; i++) { if (w[i] == placenow && visit[ww[i]] == false ) { dfs(ww[i]); }else if(ww[i] == placenow && visit[w[i]] == false){ dfs(w[i]); }else{ continue; } } visit[placenow] = false; return; } }
Main.java:33: error: cannot find symbol ans = lcd(ans , times[i]); ^ symbol: method lcd(long,long) location: class Main 1 error
s868094851
p03633
C++
#include <iostream> #include <vector> #include <algorithm> using ll = long long using namespace std; ll gcd( ll m, ll n ) { if (n == 0) return m; else return gcd(n, m%n); }//gcd //********************************************************* // 最小公倍数(Least Common Multiple)を返す。 // 引数に0がある場合は0を返す。 //********************************************************* ll lcm( ll m, ll n ) { ll g = gcd(m, n); return (m / g * n); // lcm = m * n / gcd(m,n) }//lcm int main() { ll N; cin>>N; ll ans = 1; for (ll n = 0; n < N; n++) { ll T; cin>>T; ans = lcm(ans, T); } cout<<ans<<endl; return 0; }
a.cc:5:21: error: expected ';' before 'using' 5 | using ll = long long | ^ | ; 6 | using namespace std; | ~~~~~ a.cc:8:1: error: 'll' does not name a type 8 | ll gcd( ll m, ll n ) | ^~ a.cc:18:1: error: 'll' does not name a type 18 | ll lcm( ll m, ll n ) | ^~ a.cc: In function 'int main()': a.cc:25:5: error: 'll' was not declared in this scope 25 | ll N; | ^~ a.cc:26:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 26 | cin>>N; | ^~~ | 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:26:10: error: 'N' was not declared in this scope 26 | cin>>N; | ^ a.cc:27:7: error: expected ';' before 'ans' 27 | ll ans = 1; | ^~~~ | ; a.cc:28:12: error: expected ';' before 'n' 28 | for (ll n = 0; n < N; n++) { | ^~ | ; a.cc:28:20: error: 'n' was not declared in this scope 28 | for (ll n = 0; n < N; n++) { | ^ a.cc:29:11: error: expected ';' before 'T' 29 | ll T; | ^~ | ; a.cc:30:14: error: 'T' was not declared in this scope 30 | cin>>T; | ^ a.cc:31:9: error: 'ans' was not declared in this scope; did you mean 'abs'? 31 | ans = lcm(ans, T); | ^~~ | abs a.cc:31:15: error: 'lcm' was not declared in this scope 31 | ans = lcm(ans, T); | ^~~ a.cc:33:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 33 | 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:33:11: error: 'ans' was not declared in this scope; did you mean 'abs'? 33 | cout<<ans<<endl; | ^~~ | abs a.cc:33:16: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 33 | 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) | ^~~~
s611180854
p03633
C++
#include <bits/stdc++.h> #include <math.h> using namespace std; using ll=long long; ll gcd(ll a,ll b){ if(b == 0) return a; return gcd(b,a%b); } int main() { int N; cin>>N; vector<int> vec(N); vector<int> sub(N); for(int i=0; i<N; i++){ cin>>vec[i]; sub[i]=vec[i]; } //入力終わり //最小公倍数=a*b/最大公約数 for(int j=0; j<N-1; j++){ int k=0; k=gcd(vec[j+1],sub[j]) //最小公倍数 sub[j+1]=vec[j+1]*sub[j]/k; } cout<<sub[j+1]<<endl; }
a.cc: In function 'int main()': a.cc:24:39: error: expected ';' before 'sub' 24 | k=gcd(vec[j+1],sub[j]) | ^ | ; 25 | //最小公倍数 26 | sub[j+1]=vec[j+1]*sub[j]/k; | ~~~ a.cc:28:19: error: 'j' was not declared in this scope 28 | cout<<sub[j+1]<<endl; | ^
s305339978
p03633
C++
#include <bits/stdc++.h> #include <math.h> using namespace std; typedef long long ll; int main() { int N; cin>>N; vector<int> vec(N); vector<int> sub(N); for(int i=0; i<N; i++){ cin>>vec[i]; sub[i]=vec[i]; } //入力終わり function gcd($a, $b) { if ($b === 0) return $a; return gcd($b, $a % $b); } //最小公倍数=a*b/最大公約数 for(int j=0; j<N-1; j++){ int k=0; k=gcd(vec[j+1],sub[j]) //最小公倍数 sub[j+1]=vec[j+1]*sub[j]/k; } cout<<sub[j+1]<<endl; }
a.cc: In function 'int main()': a.cc:15:22: error: '$a' was not declared in this scope 15 | function gcd($a, $b) { | ^~ a.cc:15:26: error: '$b' was not declared in this scope 15 | function gcd($a, $b) { | ^~ a.cc:15:30: error: expected ',' or ';' before '{' token 15 | function gcd($a, $b) { | ^ a.cc:28:19: error: 'j' was not declared in this scope 28 | cout<<sub[j+1]<<endl; | ^
s294336616
p03633
C++
#include<iostream> #include<cmath> #include<numeric> #include<string> #include<algorithm> #include<vector> #define rep(i,n) for(int i=0;i<n;i++) #define rep1(i,n) for(int i=1;i<n;i++) #define int64 long long #define yokuwaruprime (10*10*10*10*10*10*10*10*10+7) using namespace std; int64 gcd(int64 a,int64 b){ if(a<b){ int64 tmp=a; a=b; b=tmp; } int64 r=a%b; while(r!=0){ a=b; b=r; r=a%b; } return b; } int main(){ int64 n; cin>>n; int64 t[n]; rep(i,n){ cin>>t[i]; } int64 ans-t[0]; rep(i,n){ ans=ans*t[i]/gcd(ans,t[i]); } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:33:12: error: expected initializer before '-' token 33 | int64 ans-t[0]; | ^ a.cc:35:5: error: 'ans' was not declared in this scope; did you mean 'abs'? 35 | ans=ans*t[i]/gcd(ans,t[i]); | ^~~ | abs a.cc:37:9: error: 'ans' was not declared in this scope; did you mean 'abs'? 37 | cout<<ans<<endl; | ^~~ | abs
s302166548
p03633
C++
#include "stdc++.h" #define FOR(i,a,b) for(int i=(a); i<int(b); ++i) #define RFOR(i,a,b) for(int i=(b)-1; i>=int(a); --i) #define rep(i,n) FOR(i,0,n) #define rep1(i,n) FOR(i,1,int(n)+1) #define rrep(i, n) RFOR(i, 0, n) #define rrep1(i, n) RFOR(i, 1, int(n) + 1) #define all(c) begin(c), end(c) #define al(d) d.begin(),d.end() using namespace std; template <typename T> void putv(vector<T>& V){ // cout << "The elements in the vector are: " << endl; for(auto x: V) cout << x << " "; cout << endl; } template <class T> vector<T> getv(int n){ vector<T> vec; rep(i,n){ T input; cin >> input; vec.emplace_back(input); } return vec; } unsigned long long gcd(const unsigned long long a, const unsigned long long b); unsigned long long lcm(const unsigned long long a, const unsigned long long b); unsigned long long lcmv(vector<long long> vec); int main(){ int N; cin >> N; vector<long long> t = getv<long long>(N); // putv(t); if(N==1) cout << t[0] << endl; else cout << lcmv(t) << endl; } unsigned long long gcd(const unsigned long long a, const unsigned long long b){ return (b==0) ? a : gcd(b,a%b); } unsigned long long lcm(const unsigned long long a, const unsigned long long b){ return a*(b/gcd(a,b)); } unsigned long long lcmv(vector<long long> vec){ int t = vec.size(); if(t==2) return lcm(vec[0],vec[1]); long long v = vec[t-1]; vec.pop_back(); return lcm(lcmv(vec),v); }
a.cc:1:10: fatal error: stdc++.h: No such file or directory 1 | #include "stdc++.h" | ^~~~~~~~~~ compilation terminated.
s243418408
p03633
C++
#include "/Users/krzmknt/Dropbox/Workspace/C++/bits/template.h" #include "/Users/krzmknt/Dropbox/Workspace/C++/graph/template.h" unsigned long long gcd(const unsigned long long a, const unsigned long long b); unsigned long long lcm(const unsigned long long a, const unsigned long long b); unsigned long long lcmv(vector<long long> vec); int main(){ int N; cin >> N; vector<long long> t = getv<long long>(N); // putv(t); if(N==1) cout << t[0] << endl; else cout << lcmv(t) << endl; } unsigned long long gcd(const unsigned long long a, const unsigned long long b){ return (b==0) ? a : gcd(b,a%b); } unsigned long long lcm(const unsigned long long a, const unsigned long long b){ return a*(b/gcd(a,b)); } unsigned long long lcmv(vector<long long> vec){ int t = vec.size(); if(t==2) return lcm(vec[0],vec[1]); long long v = vec[t-1]; vec.pop_back(); return lcm(lcmv(vec),v); }
a.cc:1:10: fatal error: /Users/krzmknt/Dropbox/Workspace/C++/bits/template.h: No such file or directory 1 | #include "/Users/krzmknt/Dropbox/Workspace/C++/bits/template.h" | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated.
s973330013
p03633
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll GCD(ll x, ll y){ if(x%y == 0) return y; return GCD(y, x%y); } int main(){ ll n; cin >> n; vector<ll> v(n); for(int i=0; i<n; i++) cin >> v[i]; if(n == 1){ cout << v[0] << endl; return 0; } ll lcd = v[0]; for(int i=1; i<n; i++){ ll gcd = GCD(lcm, v[i]); lcm = lcm / gcd * v[i]; } cout << lcm << endl; return 0; }
a.cc: In function 'int main()': a.cc:24:21: error: cannot resolve overloaded function 'lcm' based on conversion to type 'll' {aka 'long long int'} 24 | ll gcd = GCD(lcm, v[i]); | ~~~^~~~~~~~~~~ a.cc:25:19: error: invalid operands of types '<unresolved overloaded function type>' and 'll' {aka 'long long int'} to binary 'operator/' 25 | lcm = lcm / gcd * v[i]; | ~~~~^~~~~ a.cc:27:10: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and '<unresolved overloaded function type>') 27 | cout << lcm << 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:1: /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<<(long double __f) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 301 | operator<<(const void* __p) | ^~~~~~~~ /usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from '<unresolved overloaded function
s403629653
p03633
C++
#include <bits/stdc++.h> using namespace std; unsigned long long calcGCD(unsigned long long x, unsigned long long y) { if (x < y) { x, y = y, x; } unsigned long long remainder = x % y; while (remainder != 0) { x = y; y = remainder; remainder = x % y; } return y; } unsigned unsigned long long calcMultiGCD(std::vector<unsigned long long> x) { unsigned long long gcd = calcGCD(x[0], x[1]); for (unsigned long long i = 2; i < x.size(); i++) { gcd = calcGCD(gcd, x[i]); } return gcd; } unsigned long long calcLCM(unsigned long long x, unsigned long long y) { return x * y / calcGCD(x, y); } unsigned long long calcMultiLCM(std::vector<unsigned long long> x) { unsigned long long lcm = calcLCM(x[0], x[1]); for (unsigned long long i = 2; i < x.size(); i++) { lcm = calcLCM(lcm, x[i]); } return lcm; } int main() { int N; cin >> N; vector<unsigned long long> T(N); for (int i = 0; i < N; i++) { cin >> T[i]; } cout << calcMultiLCM(T) << endl; }
a.cc:20:10: error: duplicate 'unsigned' 20 | unsigned unsigned long long calcMultiGCD(std::vector<unsigned long long> x) | ^~~~~~~~ | --------
s419298408
p03633
C++
#include<iostream> #include<iomanip> #include<vector> #include<string> #include<math.h> #include<algorithm> #include<numeric> #include<list> #include<stack> using namespace std; typedef long long LL; typedef unsigned long long ULL; typedef vector<LL> VLL; typedef vector<ULL> VULL; class MYCP { public: static const LL MOD_CONST_ATCODER = 1000 * 1000 * 1000 + 7; static LL DebugFlag; //数値を区切って文字列にする static string MakeString_LongLong(vector<long long> const& numbers, string const& str) { if (numbers.size() == 0)return ""; string result = "" + to_string(numbers[0]); for (long long i = 1; i < numbers.size(); i++) { result += str; result += to_string(numbers[i]); } return result; } //空白で区切る為のオーバーロード static string MakeString_LongLong(vector<long long> const& numbers) { if (numbers.size() == 0)return ""; string result = "" + to_string(numbers[0]); for (long long i = 1; i < numbers.size(); i++) { result += " "; result += to_string(numbers[i]); } return result; } //文字列の配列を改行を挟んでまとめる static string MakeString_VectorString(vector<string> const& str) { string result = ""; for (long long i = 0; i < str.size(); i++) { result += str[i] + "\n"; } return result; } //文字列を必要な個数だけ読み取る static vector<string> MyReadLineSplit(LL n) { vector<string> str(n); for (long long i = 0; i < n; i++) { std::cin >> str[i]; } return str; } //数値を必要な個数だけ読み取る static vector<long long> ReadInts(long long number) { vector<long long> a(number); for (int i = 0; i < number; i++) { std::cin >> a[i]; } return a; } //渡された自然数が素数ならtureを返す static bool PrimeCheck_Int(long long number) { if (number < 2)return false; for (ULL i = 2; i*i <= number; i++) { if (number%i == 0)return false; } return true; } //渡された数値以下の素数表を作る static vector<long long> MakePrimeList(long long n) { vector<long long> list; LL i, j, p; bool flag; for (i = 2; i <= n; i++) { flag = true; for (j = 0; j < list.size(); j++) { if (!(list[j] * list[j] <= i))break; if (i%list[j] == 0) { flag = false; break; } } if (flag)list.push_back(i); } return list; } //文字列の分割 static vector<string> split(string const& str, char sep) { vector<std::string> v; // 分割結果を格納するベクター auto first = str.begin(); // テキストの最初を指すイテレータ while (first != str.end()) { // テキストが残っている間ループ auto last = first; // 分割文字列末尾へのイテレータ while (last != str.end() && *last != sep) // 末尾 or セパレータ文字まで進める last++; v.push_back(string(first, last)); // 分割文字を出力 if (last != str.end()) last++; first = last; // 次の処理のためにイテレータを設定 } return v; } //合計を求める static LL Sum(vector<LL> a) { LL i, sum = 0; for (i = 0; i < a.size(); i++) { sum += a[i]; } return sum; } //小文字ならtrueを返す static bool Komoji(char a) { if (a >= 'a'&&a <= 'z')return true; return false; } //大文字ならtrueを返す static bool Oomoji(char a) { if (a >= 'A'&&a <= 'Z')return true; return false; } //切り上げの整数値割り算 static LL KiriageWarizan(LL a, LL b) { LL result = a / b; if (a%b > 0)result++; return result; } //最大公約数 static LL GreatestCommonFactor(LL a, LL b) { LL temp; if (a < b) { temp = b; b = a; a = temp; } while (true) { temp = a % b; a = b; b = temp; if (b == 0)break; } return a; } //最小公倍数 static LL LeastCommonMultiple(LL a, LL b) { return (a / GreatestCommonFactor(a, b))*b; } //素因数分解 static vector<VLL> PrimeFactorization(LL n) { VLL p_list, s_list; LL i, j, k, count; for (i = 2; n > 1; i++) { if (i*i > n) { p_list.push_back(n); s_list.push_back(1); break; } if (n%i == 0) { count = 0; while (n%i == 0) { n /= i; count++; } p_list.push_back(i); s_list.push_back(count); } } vector<VLL> result; result.push_back(p_list); result.push_back(s_list); return result; } //組み合わせ nCr static LL Combination(LL n, LL r) { r = min(r, n - r); VLL p(n + 1, 0); LL i, j, k, a, b, c; for (i = 1; i <= r; i++) { auto temp = MYCP::PrimeFactorization(i); for (j = 0; j < temp[0].size(); j++) { p[temp[0][j]] -= temp[1][j]; } a = i + n - r; temp = MYCP::PrimeFactorization(a); for (j = 0; j < temp[0].size(); j++) { p[temp[0][j]] += temp[1][j]; } } LL result = 1; for (i = 0; i < p.size(); i++) { if (p[i] > 0) { for (j = 0; j < p[i]; j++) { result *= i; result %= MYCP::MOD_CONST_ATCODER; } } } return result; } //符号 static LL sign(LL x) { if (x > 0)return 1; if (x < 0)return -1; return 0; } //円周率 static double PI() { return (double)3.1415926535898; } //指定した桁でdoubleを出す static void CoutDoubleKeta(double a, LL keta) { cout << setprecision(keta) << a << flush; } //数値の出力 static void CoutVectorLL(VLL list) { LL i, j, k, n; n = list.size(); for (i = 0; i < n - 1; i++) { cout << list[i] << " "; } cout << list[n - 1] << flush; } //デバッグ用出力 static LL DebugPrintf(string output) { if (MYCP::DebugFlag != 0) { std::cout << output << endl; } return MYCP::DebugFlag; } //デバッグ用入力 static LL DebugCin() { LL a; if (MYCP::DebugFlag != 0) { cin >> a; } return a; } }; LL MYCP::DebugFlag = 0; //累積和を求めるクラス class Ruisekiwa { private: vector<LL> list; public: void MakeArray(vector<LL> data) { LL i; list = data; list.push_back(0); list[0] = 0; for (i = 1; i < list.size(); i++) { list[i] = list[i - 1] + data[i - 1]; } } LL Sum(LL start, LL end) { if (end < start) { std::cout << "startがendより大きいです"; return 0; } if (start < 0 || end >= list.size()) { std::cout << "範囲が異常"; return 0; } return list[end] - list[start]; } }; //n進数を管理するクラス class N_Number { public: N_Number(LL n, LL keta) { this->N_Shinsuu = n; VLL temp(keta, 0); this->numbers = temp; } //数を足す void plus(LL a) { if (a < 0) { a *= (-1); this->minus(a); return; } this->numbers[0] += a; LL size = this->numbers.size(); for (LL i = 0; i < size; i++) { if (i + 1 < size) { this->numbers[i + 1] += this->numbers[i] / this->N_Shinsuu; } this->numbers[i] %= this->N_Shinsuu; } } //全ての桁が同じ数字になっていればその数字を返す。それ以外の場合は -1 を返す LL check() { LL a = this->numbers[0]; for (LL i = 0; i < this->numbers.size(); i++) { if (this->numbers[i] != a)return -1; } return a; } LL getNumber(LL keta) { return this->numbers[keta]; } LL getKeta() { return this->numbers.size(); } LL getShinsuu() { return this->N_Shinsuu; } void setNumber(LL keta, LL number) { if (0 <= number && number < this->getShinsuu()) { if (0 <= keta && keta < this->getKeta()) { this->numbers[keta] = number; return; } } cout << "er" << endl; } void setAllNumbers(LL number) { LL size = this->getKeta(), i; for (i = 0; i < size; i++) { this->setNumber(i, number); } } string to_string_KetaSoroe() { string s = ""; for (LL i = this->getKeta() - 1; i >= 0; i--) { s += to_string(this->getNumber(i)); } return s; } private: void minus(LL a) { LL i, j, k, zettaiti = abs(a); k = MYCP::KiriageWarizan(zettaiti, this->N_Shinsuu); j = k * (this->N_Shinsuu - 1); for (i = 0; i < this->getKeta(); i++) { this->numbers[i] += j; } this->numbers[0] += k - a; this->plus(0); } VLL numbers; LL N_Shinsuu; }; //UnionFind class Union_Find { private: VLL tree; VLL count; LL root(LL a) { if (this->tree[a] == a)return a; return this->tree[a] = this->root(this->tree[a]); } public: Union_Find(LL n) { VLL set(n); this->tree = set; this->count = set; for (LL i = 0; i < n; i++) { this->tree[i] = i; this->count[i] = 1; } } void unite(LL a, LL b) { LL x, y; if (!this->Check(a,b)) { x = this->getCount(a) + getCount(b); y = this->root(a); this->count[y] = x; y = this->root(b); this->count[y] = x; } x = this->root(a); y = this->root(b); this->tree[x] = y; } bool Check(LL a, LL b) { return this->root(a) == this->root(b); } LL getCount(LL index) { LL temp = this->root(index); return this->count[temp]; } }; //ここからメイン int main(void) { MYCP::DebugFlag = 0; LL i, j, k, n, m; cin >> n; auto t = MYCP::ReadInts(n); k = t[0]; for (i = 0; i < n; i++) { k = MYCP::LeastCommonMultiple(k, a[i]); } cout << k << endl; return 0; }
a.cc: In function 'int main()': a.cc:515:50: error: 'a' was not declared in this scope 515 | k = MYCP::LeastCommonMultiple(k, a[i]); | ^
s570218623
p03633
C++
#include <iostream> using namespace std; gcd(int i,int j){ int M=max(i,j); int m=min(i,j); if(M%m!=0){ return gcd(m,M%m); }else return m; } int main() { int n; cin>>n; int c[n]; int g=c[0]; for(int i=1;i<n;i++){ g=gcd(g,c[i]); } int ans=g; for(int i=0;i<n;i++){ ans*=(c[i]/g); } coutMMans; return 0; }
a.cc:3:1: error: ISO C++ forbids declaration of 'gcd' with no type [-fpermissive] 3 | gcd(int i,int j){ | ^~~ a.cc: In function 'int main()': a.cc:22:9: error: 'coutMMans' was not declared in this scope 22 | coutMMans; | ^~~~~~~~~
s817847553
p03633
C++
use std::collections::HashMap; fn collect_primes(n: u64) -> HashMap<u64, u32> { let mut primes = HashMap::<u64, u32>::new(); let mut cur = n; let mut i = 2_u64; if n == 1 { primes.insert(1, 1); return primes; } while i != cur { if cur % i == 0 { *(primes.entry(i).or_insert(0)) += 1; cur /= i; continue; } i += 1; } // primes.entry(cur).and_modify(|i| *i=*i+1).or_insert(1); if primes.get(&i).is_some() { let v = primes.get_mut(&i).unwrap(); *v = *v + 1; } else { primes.insert(cur, 1); } primes } fn union_primes(l: HashMap<u64, u32>, r: HashMap<u64,u32>) -> HashMap<u64,u32>{ let mut nprimes = l.clone(); for p1 in l.keys() { let lp = l.get(p1).unwrap(); let rp = r.get(p1).unwrap_or(&0); if lp > rp { nprimes.insert(*p1, *lp); } else { nprimes.insert(*p1, *rp); } } for p2 in r.keys() { let n = *(nprimes.get(p2).unwrap_or(&0)); let rp = r.get(p2).unwrap(); if n < *rp { nprimes.entry(*p2).or_insert(*rp); } } nprimes } macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes .by_ref() .map(|r|r.unwrap() as char) .skip_while(|c|c.is_whitespace()) .take_while(|c|!c.is_whitespace()) .collect() }; input_inner!{next, $($r)*} }; } macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} }; } macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; } fn main() { input! { n : usize, tx : [[u64; 1]; n], } let mut base = HashMap::<u64,u32>::new(); for i in 0 .. n { let prime = collect_primes( tx[i][0] ); base = union_primes(base, prime); // println!("{:?}", base); } let mut ans = 1u64; for (k,v) in base.iter() { ans *= (*k).pow(*v); } println!("{}", ans) }
a.cc:88:10: error: too many decimal points in number 88 | (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() | ^~~~~~~ a.cc:1:1: error: 'use' does not name a type 1 | use std::collections::HashMap; | ^~~ a.cc:3:1: error: 'fn' does not name a type 3 | fn collect_primes(n: u64) -> HashMap<u64, u32> { | ^~ a.cc:30:1: error: 'fn' does not name a type 30 | fn union_primes(l: HashMap<u64, u32>, r: HashMap<u64,u32>) -> HashMap<u64,u32>{ | ^~ a.cc:51:1: error: 'macro_rules' does not name a type 51 | macro_rules! input { | ^~~~~~~~~~~ a.cc:72:1: error: 'macro_rules' does not name a type 72 | macro_rules! input_inner { | ^~~~~~~~~~~ a.cc:82:1: error: 'macro_rules' does not name a type 82 | macro_rules! read_value { | ^~~~~~~~~~~ a.cc:105:1: error: 'fn' does not name a type 105 | fn main() { | ^~
s385085126
p03633
C++
use std::collections::HashMap; fn collect_primes(n: u64) -> HashMap<u64, u32> { let mut primes = HashMap::<u64, u32>::new(); let mut cur = n; let mut i = 2_u64; if n == 1 { primes.insert(1, 1); return primes; } while i != cur { if cur % i == 0 { *(primes.entry(i).or_insert(0)) += 1; cur /= i; continue; } i += 1; } primes.entry(cur).and_modify(|i| *i=*i+1).or_insert(1); primes } fn union_primes(l: HashMap<u64, u32>, r: HashMap<u64,u32>) -> HashMap<u64,u32>{ let mut nprimes = l.clone(); for p1 in l.keys() { let lp = l.get(p1).unwrap(); let rp = r.get(p1).unwrap_or(&0); if lp > rp { nprimes.insert(*p1, *lp); } else { nprimes.insert(*p1, *rp); } } for p2 in r.keys() { let n = *(nprimes.get(p2).unwrap_or(&0)); let rp = r.get(p2).unwrap(); if n < *rp { nprimes.entry(*p2).or_insert(*rp); } } nprimes } macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes .by_ref() .map(|r|r.unwrap() as char) .skip_while(|c|c.is_whitespace()) .take_while(|c|!c.is_whitespace()) .collect() }; input_inner!{next, $($r)*} }; } macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} }; } macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; } fn main() { input! { n : usize, tx : [[u64; 1]; n], } let mut base = HashMap::<u64,u32>::new(); for i in 0 .. n { let prime = collect_primes( tx[i][0] ); base = union_primes(base, prime); println!("{:?}", base); } let mut ans = 1u64; for (k,v) in base.iter() { ans *= (*k).pow(*v); } println!("{}", ans) }
a.cc:81:10: error: too many decimal points in number 81 | (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() | ^~~~~~~ a.cc:1:1: error: 'use' does not name a type 1 | use std::collections::HashMap; | ^~~ a.cc:3:1: error: 'fn' does not name a type 3 | fn collect_primes(n: u64) -> HashMap<u64, u32> { | ^~ a.cc:23:1: error: 'fn' does not name a type 23 | fn union_primes(l: HashMap<u64, u32>, r: HashMap<u64,u32>) -> HashMap<u64,u32>{ | ^~ a.cc:44:1: error: 'macro_rules' does not name a type 44 | macro_rules! input { | ^~~~~~~~~~~ a.cc:65:1: error: 'macro_rules' does not name a type 65 | macro_rules! input_inner { | ^~~~~~~~~~~ a.cc:75:1: error: 'macro_rules' does not name a type 75 | macro_rules! read_value { | ^~~~~~~~~~~ a.cc:98:1: error: 'fn' does not name a type 98 | fn main() { | ^~
s462321421
p03633
C++
#include <iostream> using namespace std; long long int gcd(long long int a, long long int b){ if(a < b){ swap(a, b) } while(a%b == 0){ b = a%b; swap(a,b); } return a; } int main(){ int n, i; long long int t, time = 1; cin >> n; for (i=0; i<n; i++){ cin >> t; time *= t/gcd(time, t); } cout << time; return 0; }
a.cc: In function 'long long int gcd(long long int, long long int)': a.cc:6:19: error: expected ';' before '}' token 6 | swap(a, b) | ^ | ; 7 | } | ~
s195972681
p03633
C++
#include <iostream> using namespace std; long long int gcd(long long int a, long long int b){ long long int tem, lcm; if(a > b){ tem = a; a = b b = tem; } while(a!=b){ tem = a; a = b; b = tem%b; } return a; } int main(){ int n, i; long long int t, time = 1; cin >> n; for (i=0; i<n; i++){ cin >> t time *= t/gcd(time, t) } cout << time; return 0; }
a.cc: In function 'long long int gcd(long long int, long long int)': a.cc:8:14: error: expected ';' before 'b' 8 | a = b | ^ | ; 9 | b = tem; | ~ a.cc: In function 'int main()': a.cc:24:17: error: expected ';' before 'time' 24 | cin >> t | ^ | ; 25 | time *= t/gcd(time, t) | ~~~~
s796617518
p03633
C++
#include <iostream> using namespace std; typedef long long int ll; ll gcd(ll n,ll m){ while(n!=m){ if(n<m){ swap(n,m); } else if(n>m){ gcd(n,m)=gcd(n-m,m); } else{ ll gcd(n,m)=n; } } return n; } ll lcm(ll n,ll m){ return n*m/gcd(n,m); } int main(){ int n; cin >> n; ll a[n]; for(int i=0;i<n;i++){ cin >> a[i]; } ll ans=1; for(int i=0;i<n;i++){ ans=lcm(ans,a[i]); } cout << ans << endl; }
a.cc: In function 'll gcd(ll, ll)': a.cc:12:10: error: lvalue required as left operand of assignment 12 | gcd(n,m)=gcd(n-m,m); | ~~~^~~~~ a.cc:15:17: error: expression list treated as compound expression in initializer [-fpermissive] 15 | ll gcd(n,m)=n; | ^ a.cc:15:18: error: expected ',' or ';' before '=' token 15 | ll gcd(n,m)=n; | ^
s718208586
p03633
C++
#include <iostream> using namespace std; typedef long long int ll; ll gcd(ll n,ll m){ while(n!=m){ if(n<m){ swap(n,m); } else if(n>m){ gcd(n,m)=gcd(n-m,m); } else{ gcd(n,m)=n; } } return n; } ll lcm(ll n,ll m){ return n*m/gcd(n,m); } int main(){ int n; cin >> n; ll a[n]; for(int i=0;i<n;i++){ cin >> a[i]; } ll ans=1; for(int i=0;i<n;i++){ ans=lcm(ans,a[i]); } cout << ans << endl; }
a.cc: In function 'll gcd(ll, ll)': a.cc:12:10: error: lvalue required as left operand of assignment 12 | gcd(n,m)=gcd(n-m,m); | ~~~^~~~~ a.cc:15:10: error: lvalue required as left operand of assignment 15 | gcd(n,m)=n; | ~~~^~~~~
s375056123
p03633
C++
#include <iostream> using namespace std; typedef long long int ll; ll gcd(ll n,ll m){ while(n!=m){ if(n<m){ swap(n,m); } else { gcd(n,m)=gcd(n-m,m); } } return n; } ll lcm(ll n,ll m){ return n*m/gcd(n,m); } int main(){ int n; cin >> n; ll a[n]; for(int i=0;i<n;i++){ cin >> a[i]; } ll ans=1; for(int i=0;i<n;i++){ ans=lcm(ans,a[i]); } cout << ans << endl; }
a.cc: In function 'll gcd(ll, ll)': a.cc:12:10: error: lvalue required as left operand of assignment 12 | gcd(n,m)=gcd(n-m,m); | ~~~^~~~~
s872727209
p03633
C++
#include <bits/stdc++.h> using namespace std; int gcd(int a,int b){ if(b == 0) return a; return gcd(b,a%b); } int lcm(int a,int b){ int g = gcd(a,b); return a / g * b; } int main(){ int n; cin >> n; int p[110]; for (int i = 0; i < n; ++i){ cin >> p[i]; } sort(p, p + n, greater<int>()); int gr = a[0]; for (int i = 0; i < n; ++i){ if (p[i] % p[i + 1] == 0 ){ gr = gr; } else{ gr = lcm(p[i],p[i+1]); } } cout << gr << endl; }
a.cc: In function 'int main()': a.cc:26:12: error: 'a' was not declared in this scope 26 | int gr = a[0]; | ^
s890320906
p03633
C++
return m; #include <bits/stdc++.h> using namespace std; int gcd(int a,int b){ if(b == 0) return a; return gcd(b,a%b); } int lcm(int a,int b){ int g = gcd(a,b); return a / g * b; } int main(){ int n; cin >> n; int a[110]; for (int i = 0; i < n; ++i){ cin >> a[i]; } sort(a, a + n, greater<int>()); int gr = a[0]; for (int i = 0; i < n; ++i){ if (a[i] % a[i + 1] == 0 ){ gr = gr; } else{ gr = lcm(a[i],a[i+1]); } } cout << gr << endl; }
a.cc:3:9: error: expected unqualified-id before 'return' 3 | return m; | ^~~~~~
s810897858
p03633
C++
#include <bits/stdc++.h> using namespace std; int ggd(int number1,int number2){ int m = number1; int n = number2; if(number2 > number1){ m = number2; n = number1; } while(m != n){ int temp = n; n = m - n; m = temp; } return m; } int lcm(int number1,int number2){ return number1 * number2 / ggd(number1,number2); } int main(){ int n; cin >> n; int a[110]; for (int i = 0; i < n; ++i){ cin >> a[i]; } sort(a, a + n, greater<int>()); int gr = a[0]; if (a[i] % a[i + 1] == 0 ){ gr = gr; } else{ gr = lcm(a[i],a[i+1]); } } cout << gr << endl; }
a.cc: In function 'int main()': a.cc:38:11: error: 'i' was not declared in this scope 38 | if (a[i] % a[i + 1] == 0 ){ | ^ a.cc: At global scope: a.cc:47:6: error: 'cout' does not name a type 47 | cout << gr << endl; | ^~~~ a.cc:49:3: error: expected declaration before '}' token 49 | } | ^
s856694584
p03633
C++
#include <bits/stdc++.h> using namespace std; int ggd(int number1,int number2){ int m = number1; int n = number2; if(number2 > number1){ m = number2; n = number1; } while(m != n){ int temp = n; n = m - n; m = temp; } return m; } int lcm(int number1,int number2){ return number1 * number2 / ggd(number1,number2); } int main(){ int n; cin >> n; int a[110]; for (int i = 0; i < n; ++i){ cin >> a[i]; } int gr = a[i]; sort(a, a + n, greater<int>()); for (int i = 0; i < n; ++i){ if (a[i] % a[i + 1] == 0 ){ gr = gr; } else{ gr = lcm(a[i],a[i+1]); } } cout << gr << endl; }
a.cc: In function 'int main()': a.cc:34:14: error: 'i' was not declared in this scope 34 | int gr = a[i]; | ^
s972863956
p03633
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; int a[110]; for (int i = 0; i < n; ++i){ cin >> a[i]; } int gr, r; sort(a, a + n, greater<int>()); for (int i = 0; i < n; ++i){ if (a[i] % a[i + 1] == 0 ){ gr = a[i]; else{ int x = a[i]*a[i+1]; r = a[i] % a[i + 1]; while( r != 0){ a[i] = a[i+1]; a[i+1] = r; r = a[i] % a[i+1]; } gr = x/a[i+1]; } } } cout << gr << endl; }
a.cc: In function 'int main()': a.cc:19:5: error: expected '}' before 'else' 19 | else{ | ^~~~ a.cc:17:31: note: to match this '{' 17 | if (a[i] % a[i + 1] == 0 ){ | ^ a.cc: At global scope: a.cc:35:2: error: 'cout' does not name a type 35 | cout << gr << endl; | ^~~~ a.cc:37:1: error: expected declaration before '}' token 37 | } | ^
s229596927
p03633
C++
import math def lcm(a, b): return a * b / math.gcd(a, b) n = int(input()) list = [int(input()) for i in range(n)] if n == 1: print(list[0]) exit(1) num = list[0] for i in range(1, n): if (num % list[i] == 0): continue elif (list[i] % num == 0): num = list[i] continue else: num = lcm(num, list[i]) print(int(num))
a.cc:1:1: error: 'import' does not name a type 1 | import math | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
s646123500
p03633
C
#include <iostream> #include <algorithm> typedef long long ll; using namespace std; ll gcd(ll x, ll y){ return x ? gcd(y%x,x) : y; } ll lcm(ll x,ll y){ return x/gcd(x,y)*y; } int main(){ int n,i; cin >> n; ll ret=1,t; for(i=0;i<n;i++){ cin >> t; ret = lcm(ret,t); } cout << ret << endl; return 0; }
main.c:1:10: fatal error: iostream: No such file or directory 1 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s137878954
p03633
C++
#include <iostream> #include <algorithm> using namespace std; typedef ll long long ll gcd(ll x, ll y){ return x ? gcd(y%x,x) : y; } ll lcm(ll x,ll y){ x = max(x,y); y = min(x,y); return x/gcd(x,y)*y; } int main(){ int n,i; cin >> n; ll ret=1,t; for(i=0;i<n;i++){ cin >> t; ret = lcm(ret,t); } cout << ret << endl; return 0; }
a.cc:4:9: error: 'll' does not name a type 4 | typedef ll long long | ^~ a.cc:9:1: error: 'll' does not name a type 9 | ll lcm(ll x,ll y){ | ^~ a.cc: In function 'int main()': a.cc:17:3: error: 'll' was not declared in this scope 17 | ll ret=1,t; | ^~ a.cc:19:12: error: 't' was not declared in this scope 19 | cin >> t; | ^ a.cc:20:5: error: 'ret' was not declared in this scope 20 | ret = lcm(ret,t); | ^~~ a.cc:20:11: error: 'lcm' was not declared in this scope 20 | ret = lcm(ret,t); | ^~~ a.cc:22:11: error: 'ret' was not declared in this scope 22 | cout << ret << endl; | ^~~
s479672160
p03633
C++
#include <iostream> #include <algorithm> using namespace std; #typedef ll long long ll gcd(ll x, ll y){ return x ? gcd(y%x,x) : y; } ll lcm(ll x,ll y){ x = max(x,y); y = min(x,y); return x/gcd(x,y)*y; } int main(){ int n,i; cin >> n; ll ret=1,t; for(i=0;i<n;i++){ cin >> t; ret = lcm(ret,t); } cout << ret << endl; return 0; }
a.cc:4:2: error: invalid preprocessing directive #typedef 4 | #typedef ll long long | ^~~~~~~ a.cc:5:1: error: 'll' does not name a type 5 | ll gcd(ll x, ll y){ | ^~ a.cc:9:1: error: 'll' does not name a type 9 | ll lcm(ll x,ll y){ | ^~ a.cc: In function 'int main()': a.cc:17:3: error: 'll' was not declared in this scope 17 | ll ret=1,t; | ^~ a.cc:19:12: error: 't' was not declared in this scope 19 | cin >> t; | ^ a.cc:20:5: error: 'ret' was not declared in this scope 20 | ret = lcm(ret,t); | ^~~ a.cc:20:11: error: 'lcm' was not declared in this scope 20 | ret = lcm(ret,t); | ^~~ a.cc:22:11: error: 'ret' was not declared in this scope 22 | cout << ret << endl; | ^~~
s639770063
p03633
C++
#include<iostream> #include<vector> using namespace std; int sashoba (int a, int b) { int res = 1; for (int i = 1; i <= min(a, b); i ++) { if (a % i == 0 && b % i == 0) res = i; } int ans = (a * b) / res; return ans; } int main () { int N; cin >> N; vector<int>a(N); for(int i = 0; i < N; i ++) { cin >> a[i]; } sort(a.begin(), a.end()); int ans = a[N]; for (i = N - 2; i >= 0; i --) { if (ans % a[i] != 0) ans = sashoba(ans, a[i]); } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:19:3: error: 'sort' was not declared in this scope; did you mean 'short'? 19 | sort(a.begin(), a.end()); | ^~~~ | short a.cc:21:8: error: 'i' was not declared in this scope 21 | for (i = N - 2; i >= 0; i --) { | ^
s680619456
p03633
C++
/* #include <vector> #include <iostream> #include <algorithm> #include <string> #include <set> #include <vector> #include <queue> #include <numeric> */ #include <bits/stdc++.h> using namespace std; std::ostream &operator<<(std::ostream &dest, __int128_t value) { std::ostream::sentry s(dest); if (s) { __uint128_t tmp = value < 0 ? -value : value; char buffer[128]; char *d = std::end(buffer); do { --d; *d = "0123456789"[tmp % 10]; tmp /= 10; } while (tmp != 0); if (value < 0) { --d; *d = '-'; } int len = std::end(buffer) - d; if (dest.rdbuf()->sputn(d, len) != len) { dest.setstate(std::ios_base::badbit); } } return dest; } __int128 gcd(__int128 x, __int128 y){ __int128 r; while ((r = x % y) != 0){ x = y; y = r; } return y; } __int128 lcm(__int128 x, __int128 y){ return (x * y / gcd(x, y)); } int main(){ int n; cin >> n; __int128 ct = 1; for (int i = 0; i < n; ++i) { __int128 t; cin >> t; ct = lcm(ct, t); } cout << ct << endl; return 0; }
a.cc: In function 'int main()': a.cc:58:21: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and '__int128') 58 | cin >> t; | ~~~ ^~ ~ | | | | | __int128 | 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:11: /usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed: a.cc:58:24: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type '__int128' 58 | cin >> t; | ^ /usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed: a.cc:58:24: error: cannot bind non-const lvalue reference of type 'short int&' to a value of type '__int128' 58 | cin >> t; | ^ /usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed: a.cc:58:24: error: cannot bind non-const lvalue reference of type 'short unsigned int&' to a value of type '__int128' 58 | cin >> t; | ^ /usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed: a.cc:58:24: error: cannot bind non-const lvalue reference of type 'int&' to a value of type '__int128' 58 | cin >> t; | ^ /usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed: a.cc:58:24: error: cannot bind non-const lvalue reference of type 'unsigned int&' to a value of type '__int128' 58 | cin >> t; | ^ /usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed: a.cc:58:24: error: cannot bind non-const lvalue reference of type 'long int&' to a value of type '__int128' 58 | cin >> t; | ^ /usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed: a.cc:58:24: error: cannot bind non-const lvalue reference of type 'long unsigned int&' to a value of type '__int128' 58 | cin >> t; | ^ /usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed: a.cc:58:24: error: cannot bind non-const lvalue reference of type 'long long int&' to a value of type '__int128' 58 | cin >> t; | ^ /usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed: a.cc:58:24: error: cannot bind non-const lvalue reference of type 'long long unsigned int&' to a value of type '__int128' 58 | cin >> t; | ^ /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>]' (near match) 219 | operator>>(float& __f) | ^~~~~~~~ /usr/include/c++/14/istream:219:7: note: conversion of argument 1 would be ill-formed: a.cc:58:24: error: cannot bind non-const lvalue reference of type 'float&' to a value of type '__int128' 58 | cin >> t; | ^ /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>]' (near match) 223 | operator>>(double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:223:7: note: conversion of argument 1 would be ill-formed: a.cc:58:24: error: cannot bind non-const lvalue reference of type 'double&' to a value of type '__int128' 58 | cin >> t; | ^ /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>]' (near match) 227 | operator>>(long double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:227:7: note: conversion of argument 1 would be ill-formed: a.cc:58:24: error: cannot bind non-const lvalue reference of type 'long double&' to a value of type '__int128' 58 | cin >> t; | ^ /usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed: a.cc:58:24: error: invalid conversion from '__int128' to 'void*' [-fpermissive] 58 | cin >> t; | ^ | | | __int128 a.cc:58:24: error: cannot bind rvalue '(void*)((long int)t)' to 'void*&' /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>]' (near match) 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:122:7: note: conversion of argument 1 would be ill-formed: a.cc:58:24: error: invalid conversion from '__int128' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} [-fpermissive] 58 | cin >> t; | ^ | | | __int128 /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>]' (near match) 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:126:7: note: conversion of argument 1 would be ill-formed: a.cc:58:24: error: invalid conversion from '__int128' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} [-fpermissive] 58 | cin >> t; | ^ | | |
s745662383
p03633
C++
#include <vector> #include <iostream> #include <algorithm> #include <string> #include <set> #include <vector> #include <queue> #include <numeric> #include <bits/stdc++.h> using namespace std; __int128 gcd(__int128 x, __int128 y){ __int128 r; while ((r = x % y) != 0){ x = y; y = r; } return y; } __int128 lcm(__int128 x, __int128 y){ return (x * y / gcd(x, y)); } int main(){ int n; cin >> n; __int128 ct = 1; for (int i = 0; i < n; ++i) { __int128 t; cin >> t; ct = lcm(ct, t); } cout << ct << endl; return 0; }
a.cc: In function 'int main()': a.cc:34:21: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and '__int128') 34 | cin >> t; | ~~~ ^~ ~ | | | | | __int128 | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/14/iostream:42, from a.cc:3: /usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed: a.cc:34:24: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type '__int128' 34 | cin >> t; | ^ /usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed: a.cc:34:24: error: cannot bind non-const lvalue reference of type 'short int&' to a value of type '__int128' 34 | cin >> t; | ^ /usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed: a.cc:34:24: error: cannot bind non-const lvalue reference of type 'short unsigned int&' to a value of type '__int128' 34 | cin >> t; | ^ /usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed: a.cc:34:24: error: cannot bind non-const lvalue reference of type 'int&' to a value of type '__int128' 34 | cin >> t; | ^ /usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed: a.cc:34:24: error: cannot bind non-const lvalue reference of type 'unsigned int&' to a value of type '__int128' 34 | cin >> t; | ^ /usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed: a.cc:34:24: error: cannot bind non-const lvalue reference of type 'long int&' to a value of type '__int128' 34 | cin >> t; | ^ /usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed: a.cc:34:24: error: cannot bind non-const lvalue reference of type 'long unsigned int&' to a value of type '__int128' 34 | cin >> t; | ^ /usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed: a.cc:34:24: error: cannot bind non-const lvalue reference of type 'long long int&' to a value of type '__int128' 34 | cin >> t; | ^ /usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed: a.cc:34:24: error: cannot bind non-const lvalue reference of type 'long long unsigned int&' to a value of type '__int128' 34 | cin >> t; | ^ /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>]' (near match) 219 | operator>>(float& __f) | ^~~~~~~~ /usr/include/c++/14/istream:219:7: note: conversion of argument 1 would be ill-formed: a.cc:34:24: error: cannot bind non-const lvalue reference of type 'float&' to a value of type '__int128' 34 | cin >> t; | ^ /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>]' (near match) 223 | operator>>(double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:223:7: note: conversion of argument 1 would be ill-formed: a.cc:34:24: error: cannot bind non-const lvalue reference of type 'double&' to a value of type '__int128' 34 | cin >> t; | ^ /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>]' (near match) 227 | operator>>(long double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:227:7: note: conversion of argument 1 would be ill-formed: a.cc:34:24: error: cannot bind non-const lvalue reference of type 'long double&' to a value of type '__int128' 34 | cin >> t; | ^ /usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed: a.cc:34:24: error: invalid conversion from '__int128' to 'void*' [-fpermissive] 34 | cin >> t; | ^ | | | __int128 a.cc:34:24: error: cannot bind rvalue '(void*)((long int)t)' to 'void*&' /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>]' (near match) 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:122:7: note: conversion of argument 1 would be ill-formed: a.cc:34:24: error: invalid conversion from '__int128' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} [-fpermissive] 34 | cin >> t; | ^ | | | __int128 /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>]' (near match) 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:126:7: note: conversion of argument 1 would be ill-formed: a.cc:34:24: error: invalid conversion from '__int128' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} [-fpermissive] 34 | cin >> t; | ^ | | | __int128 /usr/include/c++/14/istream:133:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_
s227850977
p03633
C++
#include <iostream> #include <numeric> #include <string> #include <vector> #include <algorithm> #include <sstream> #include <iterator> #include <math.h> #include <cmath> #include <set> #include <bitset> #include <boost/math/common_factor_rt.hpp> #define ll long long using namespace std; ll t[105] = {}; int main() { ll n; cin >> 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; } int dsum(ll a) { int ans = 0; while (a != 0) { ans += a % 10; a /= 10; } return ans; }
a.cc:12:10: fatal error: boost/math/common_factor_rt.hpp: No such file or directory 12 | #include <boost/math/common_factor_rt.hpp> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated.
s488742800
p03633
Java
import java.util.Arrays; import java.util.Scanner; class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); //文字の入力 int n = sc.nextInt(); long[] T = new long[n]; long x=1L; for(int i = 0;i < n;i++){ T[i] = sc.nextLong(); } Arrays.sort(T); for(int i = 0;i < n-1;i++){ x = lcm(T[i], T[i+1]); } System.out.println(ans); } static long lcm (long a, long b) { if(a*b < Math.max(a, b)){ return Math.max(a, b); } long temp = 1L; long c = (long)a; c *= (long)b; while((temp = a%b)!=0) { a = (long)b; b = (long)temp; } return (long)(c/b); } }
Main.java:26: error: cannot find symbol System.out.println(ans); ^ symbol: variable ans location: class Main 1 error
s730662067
p03633
C
#include <stdio.h> int main() { int n,i; lonf long int p,q,tmp,r; long long int t[101]; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d\n",&t[i]); } p=t[0]; for(i=0;i<n;i++){ q = p * t[i]; if(p<t[i]){ tmp = p; p = t[i]; t[i] = tmp; } r = p % t[i]; while(r!=0){ p = t[i]; t[i] = r; r = p % t[i]; } p=q/t[i]; } printf("%d",p); return 0; }
main.c: In function 'main': main.c:5:9: error: 'lonf' undeclared (first use in this function) 5 | lonf long int p,q,tmp,r; | ^~~~ main.c:5:9: note: each undeclared identifier is reported only once for each function it appears in main.c:5:13: error: expected ';' before 'long' 5 | lonf long int p,q,tmp,r; | ^~~~~ | ; main.c:11:9: error: 'p' undeclared (first use in this function) 11 | p=t[0]; | ^ main.c:13:17: error: 'q' undeclared (first use in this function) 13 | q = p * t[i]; | ^ main.c:15:17: error: 'tmp' undeclared (first use in this function) 15 | tmp = p; | ^~~ main.c:19:17: error: 'r' undeclared (first use in this function) 19 | r = p % t[i]; | ^
s907610232
p03633
C
#include <stdio.h> int main() { int n,i,x,y,tmp,r; int t[101]; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d\n",&t[i]); } x=t[0]; for(i=1;i<n;i++){ y=x; if(t[i]<y){ tmp=t[i]; t[i]=y; y=tmp; } r=t[i]%y; while(r!=0){ t[i]=y; y=r; r=t[i]%y; } x=x/y; } printf("%d",x) return 0; }
main.c: In function 'main': main.c:26:23: error: expected ';' before 'return' 26 | printf("%d",x) | ^ | ; 27 | return 0; | ~~~~~~
s550365761
p03633
C++
# coding: utf-8 def gcd (a, b): if b == 0: return a else: return gcd(b, a % b) n = int(input()) t = [] for i in range(0, n): t.append(int(input())) ans = 1 for i in range(0, n): ans = ans * t[i] / gcd(ans, t[i]) print("{}".format(ans))
a.cc:1:3: error: invalid preprocessing directive #coding 1 | # coding: utf-8 | ^~~~~~ a.cc:3:1: error: 'def' does not name a type 3 | def gcd (a, b): | ^~~
s679841554
p03633
C++
#include <bits/stdc++.h> using namespace std; gcd(long long x,long long y){ long long c=max(x,y),d=min(x,y); if(d==0)return c; return gcd(d,c%d); } long long b(long long p,long long q){ return p/gcd(p,q)*q; } int main(){ int N; cin >> N; vector<long long> t(100); for(int i=0;i<N;i++){ cin >> t[i]; } long long current = t[0]; for(int i=1;i<N;i++){ current = b(current,t[i]); } cout << current <<endl; return 0; }
a.cc:5:1: error: ISO C++ forbids declaration of 'gcd' with no type [-fpermissive] 5 | gcd(long long x,long long y){ | ^~~
s749354971
p03633
C++
#include <bits/stdc++.h> using namespace std; template <typename _Ty> ostream &operator<<(ostream &ostr, const vector<_Ty> &v) { if (v.empty()) { ostr << "{ }"; return ostr; } ostr << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) { ostr << ", " << *itr; } ostr << "}"; return ostr; } int N; vector<int> t(100); int b(int p,int q){ int a(int x,int y){ int a=max(x,y),b=min(x,y); if(b==0)return a; return a(b,a%b) } return p*q/a(p,q) } int main(){ cin >> N; for(int i=0;i<N;i++){ cin >> t[i]; } int current = t[0]; for(int i=1;i<N;i++){ current = b(current,t[i]); } cout << current <<endl; return 0; }
a.cc: In function 'int b(int, int)': a.cc:24:21: error: a function-definition is not allowed here before '{' token 24 | int a(int x,int y){ | ^ a.cc:29:14: error: 'a' was not declared in this scope 29 | return p*q/a(p,q) | ^ a.cc:29:20: error: expected ';' before '}' token 29 | return p*q/a(p,q) | ^ | ; 30 | } | ~
s573636797
p03633
C
#include<iostream> using namespace std; long long gcd(long long a, long long b) { return b==0?a:gcd(b,a%b); } int main() { int t; long long a,s=1; cin >> t; while(t--){ cin>>a; s=s/gcd(s,a)*a; } cout<<s<<endl; return 0; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s149975855
p03633
C++
#include <bits/stdc++.h> namespace IntegerMath { int64_t sqrt(int64_t x) { return static_cast<int64_t>( ::floorl( ::sqrtl( static_cast<long double>(x) ) ) ); } int64_t log2(int64_t x) { return static_cast<int64_t>( ::floorl( ::log2l( static_cast<long double>(x) ) ) ); } int64_t log10(int64_t x) { return static_cast<int64_t>( ::floorl( ::log10l( static_cast<long double>(x) ) ) ); } uint64_t gcd(uint64_t a, uint64_t b) { uint64_t n = std::min(a, b), m = std::max(a, b); return (n == 0) ? m : gcd(m % n, n); } uint64_t lcm(uint64_t a, uint64_t b) { return (a * b) / gcd(a, b); } }; int main() { uint64_t N; std::cin >> N; uint64_t T; std::cin >> T; for (uint64_t n = 1; n < N; ++n) { uint64_t t; std::cin >> t; T = IntegerMath::lcm(t, T); } std::cout << t << std::endl; return 0; }
a.cc: In function 'int main()': a.cc:56:16: error: 't' was not declared in this scope 56 | std::cout << t << std::endl; | ^
s520129314
p03633
C++
#include <bits/stdc++.h> namespace IntegerMath { int64_t sqrt(int64_t x) { return static_cast<int64_t>( ::floorl( ::sqrtl( static_cast<long double>(x) ) ) ); } int64_t log2(int64_t x) { return static_cast<int64_t>( ::floorl( ::log2l( static_cast<long double>(x) ) ) ); } int64_t log10(int64_t x) { return static_cast<int64_t>( ::floorl( ::log10l( static_cast<long double>(x) ) ) ); }   uint64_t gcd(uint64_t a, uint64_t b) { uint64_t n = std::min(a, b), m = std::max(a, b); return (n == 0) ? m : gcd(m % n, n); } uint64_t lcm(uint64_t a, uint64_t b) { return (a * b) / gcd(a, b); } }; int main() { uint64_t N; std::cin >> N; uint64_t x = 1; for (uint64_t n = 0; n < N; ++n) { uint64_t T; std::cin >> T; x = IntegerMath::lcm(x, T); } std::cout << x << std::endl; return 0; }
a.cc:28:1: error: extended character   is not valid in an identifier 28 |   | ^ a.cc:28:1: error: '\U00003000' does not name a type 28 |   | ^~ a.cc: In function 'uint64_t IntegerMath::lcm(uint64_t, uint64_t)': a.cc:37:22: error: 'gcd' was not declared in this scope; did you mean 'std::gcd'? 37 | return (a * b) / gcd(a, b); | ^~~ | std::gcd In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:58, from a.cc:1: /usr/include/c++/14/numeric:173:5: note: 'std::gcd' declared here 173 | gcd(_Mn __m, _Nn __n) noexcept | ^~~
s379133441
p03633
C++
#include <bits/stdc++.h> namespace IntegerMath { int64_t sqrt(int64_t x) { return static_cast<int64_t>( ::floorl( ::sqrtl( static_cast<long double>(x) ) ) ); } int64_t log2(int64_t x) { return static_cast<int64_t>( ::floorl( ::log2l( static_cast<long double>(x) ) ) ); } int64_t log10(int64_t x) { return static_cast<int64_t>( ::floorl( ::log10l( static_cast<long double>(x) ) ) ); }   uint64_t gcd(uint64_t a, uint64_t b) { uint64_t n = std::min(a, b), m = std::max(a, b); return (n == 0) ? m : gcd(m % n, n); } uint64_t lcm(uint64_t a, uint64_t b) { return (a * b) / gcd(a, b); } }; int main() { uint64_t N; std::cin >> N; uint64_t x = 1; for (uint64_t n = 0; n < N; ++n) { uint64_t T; std::cin >> T; x = lcm(x, T); } std::cout << x << std::endl; return 0; }
a.cc:28:1: error: extended character   is not valid in an identifier 28 |   | ^ a.cc:28:1: error: '\U00003000' does not name a type 28 |   | ^~ a.cc: In function 'uint64_t IntegerMath::lcm(uint64_t, uint64_t)': a.cc:37:22: error: 'gcd' was not declared in this scope; did you mean 'std::gcd'? 37 | return (a * b) / gcd(a, b); | ^~~ | std::gcd In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:58, from a.cc:1: /usr/include/c++/14/numeric:173:5: note: 'std::gcd' declared here 173 | gcd(_Mn __m, _Nn __n) noexcept | ^~~ a.cc: In function 'int main()': a.cc:52:9: error: 'lcm' was not declared in this scope 52 | x = lcm(x, T); | ^~~ a.cc:52:9: note: suggested alternatives: /usr/include/c++/14/numeric:188:5: note: 'std::lcm' 188 | lcm(_Mn __m, _Nn __n) noexcept | ^~~ a.cc:35:12: note: 'IntegerMath::lcm' 35 | uint64_t lcm(uint64_t a, uint64_t b) | ^~~
s916673456
p03633
Java
package cproblems; import java.util.Arrays; import java.util.Comparator; import java.util.Scanner; public class ABC070Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); long ans = 0; Long[] t = new Long[n]; for (int i = 0; i < n; i++) { t[i] = scan.nextLong(); } Arrays.sort(t, Comparator.reverseOrder()); ans = lcm(t[0], t[1]); for (int i = 2; i < n; i++) { ans = lcm(ans, t[i]); } System.out.println(ans); } public static long gcd(long a, long b) { long temp; while (a % b != 0) { temp = b; b = a % b; a = temp; } return b; } public static long lcm(long a, long b) { long g = gcd(a, b); return a / g * b; } }
Main.java:7: error: class ABC070Main is public, should be declared in a file named ABC070Main.java public class ABC070Main { ^ 1 error
s754879229
p03633
C++
#include<bits/stdc++.h> using namespace std; #define ED return 0; #define UP(a,b) ((a+(b-1))/b) #define SORT(vec) sort(vec.begin(),vec.end()); #define DOUBLECHANGE(count) cout << setprecision(count); #define REV(vec) reverse(vec.begin(),vec.end()); #define ipow(x,y) long(pow(x,y)) const long long mod = 1000000007; int gcd(int a, int b){ if(b == 0) return a; return gcd(b, a % b); } int main() { cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; vector<unsigned long long int> vec (N); for(int i = 0;i < N;i++){ cin >> vec.at(i); } if(N == 1){ cout << vec.at(0) << endl; ED } SORT(vec); REV(vec); for(long long int i = vec.at(0);true;i += vec.at(0)){ if(i > 100000 && i < 1000000){ vec.at(0) *= vec.at(1) } bool ans = true; for(int j = 1;j < N;j++){ if(i % vec.at(j) != 0){ ans = false; break; } } if(ans){ cout << i << endl; ED } } }
a.cc: In function 'int main()': a.cc:33:35: error: expected ';' before '}' token 33 | vec.at(0) *= vec.at(1) | ^ | ; 34 | } | ~
s441446919
p03633
C++
#include<bits/stdc++.h> using namespace std; #define ED return 0; #define UP(a,b) ((a+(b-1))/b) #define SORT(vec) sort(vec.begin(),vec.end()); #define DOUBLECHANGE(count) cout << setprecision(count); #define REV(vec) reverse(vec.begin(),vec.end()); #define ipow(x,y) long(pow(x,y)) const long long mod = 1000000007; int gcd(int a, int b){ if(b == 0) return a; return gcd(b, a % b); } int main() { cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; vector<unsigned long long int> vec (N); for(int i = 0;i < N;i++){ cin >> vec.at(i); } if(N == 1){ cout << vec.at(0) << endl; ED } SORT(vec); REV(vec); for(long long int i = vec.at(0);true;i += vec.at(0)){ if(i > 100000 && i < 1000000){ i *= 100000000 } bool ans = true; for(int j = 1;j < N;j++){ if(i % vec.at(j) != 0){ ans = false; break; } } if(ans){ cout << i << endl; ED } } }
a.cc: In function 'int main()': a.cc:33:27: error: expected ';' before '}' token 33 | i *= 100000000 | ^ | ; 34 | } | ~
s413562818
p03633
C++
#include<bits/stdc++.h> using namespace std; #define ED return 0; #define UP(a,b) ((a+(b-1))/b) #define SORT(vec) sort(vec.begin(),vec.end()); #define DOUBLECHANGE(count) cout << setprecision(count); #define REV(vec) reverse(vec.begin(),vec.end()); #define ipow(x,y) long(pow(x,y)) const long long mod = 1000000007; int gcd(int a, int b){ if(b == 0) return a; return gcd(b, a % b); } int main() { cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; vector<unsigned long long int> vec (N); for(int i = 0;i < N;i++){ cin >> vec.at(i); } if(N == 1){ cout << vec.at(0) << endl; ED } SORT(vec); REV(vec); for(long long int i = vec.at(0);true;i += vec.at(0)){ if(i > 100000 && i < 1000000){ i *= 1000000000000 } bool ans = true; for(int j = 1;j < N;j++){ if(i % vec.at(j) != 0){ ans = false; break; } } if(ans){ cout << i << endl; ED } } }
a.cc: In function 'int main()': a.cc:33:31: error: expected ';' before '}' token 33 | i *= 1000000000000 | ^ | ; 34 | } | ~
s813962306
p03633
C++
#include <vector> #include <numeric> #include <iostream> using ll = long long; using namespace std; int main(){ ll n; vector<ll> t(n); for(int i=0; i<n;++i){ cin>> t[i]; } ll gcds=t[0]; for(int i=1; i<n;++i){ gcds = __gcd(t[i],t[i-1]); } ll ans = t[0]; for(int i=1;i<n;++i){ ans=t[i]/gcds*t[i-1]; } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:14:18: error: '__gcd' was not declared in this scope; did you mean 'std::__detail::__gcd'? 14 | gcds = __gcd(t[i],t[i-1]); | ^~~~~ | std::__detail::__gcd In file included from a.cc:2: /usr/include/c++/14/numeric:134:5: note: 'std::__detail::__gcd' declared here 134 | __gcd(_Tp __m, _Tp __n) | ^~~~~
s260143429
p03633
C++
#include <bits/stdc++.h> using namespace std; int main(){ long long ans=1,n,array[100]; cin>>n; for(int i=0;i<n;i++){ array[i]; } for(int i=0;i<n;i++){ ans=__lcm(ans,array[i]); } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:11:9: error: '__lcm' was not declared in this scope 11 | ans=__lcm(ans,array[i]); | ^~~~~