submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s723359760
p03964
Java
import java.util.Scanner; public class Main{ static Long T[]; static Long A[]; static Long TA[]; static Long TT[]; static int N; static Long ans=0; public static void main(String args[]){ Scanner sc = new Scanner(System.in); N = sc.nextInt(); T = new Long[N]; TT = new Long[N]; TA = new Long[N]; A = new Long[N]; for(int i=0;i<N;i++){ T[i] = sc.nextLong(); A[i] = sc.nextLong(); } TT[0] = T[0]; TA[0] = A[0]; ans += T[0]+A[0]; for(int i=0;i<N-1;i++){ update(i); } System.out.println(ans); } static void update(int m){ Long k = Math.max((TT[m] + T[m+1] - 1) / T[m+1], (TA[m] + A[m+1] - 1) / A[m+1]); ans += T[m+1]*k-TT[m]-TA[m]+A[m+1]*k; TT[m+1] = T[m+1]*k; TA[m+1] = A[m+1]*k; } }
Main.java:9: error: incompatible types: int cannot be converted to Long static Long ans=0; ^ 1 error
s119743228
p03964
Java
import java.util.Scanner; public class Main{ static int T[]; static int A[]; static Long TA[]; static Long TT[]; static int N; static int ans=0; public static void main(String args[]){ Scanner sc = new Scanner(System.in); N = sc.nextInt(); T = new int[N]; TT = new Long[N]; TA = new Long[N]; A = new int[N]; for(int i=0;i<N;i++){ T[i] = sc.nextInt(); A[i] = sc.nextInt(); } TT[0] = T[0]; TA[0] = A[0]; ans += T[0]+A[0]; for(int i=0;i<N-1;i++){ update(i); } System.out.println(ans); } static void update(int m){ int k = Math.max((TT[m] + T[m+1] - 1) / T[m+1], (TA[m] + A[m+1] - 1) / A[m+1]); ans += T[m+1]*k-TT[m]-TA[m]+A[m+1]*k; TT[m+1] = T[m+1]*k; TA[m+1] = A[m+1]*k; } }
Main.java:22: error: incompatible types: int cannot be converted to Long TT[0] = T[0]; ^ Main.java:23: error: incompatible types: int cannot be converted to Long TA[0] = A[0]; ^ Main.java:33: error: incompatible types: possible lossy conversion from long to int int k = Math.max((TT[m] + T[m+1] - 1) / T[m+1], (TA[m] + A[m+1] - 1) / A[m+1]); ^ Main.java:35: error: incompatible types: int cannot be converted to Long TT[m+1] = T[m+1]*k; ^ Main.java:36: error: incompatible types: int cannot be converted to Long TA[m+1] = A[m+1]*k; ^ 5 errors
s267870876
p03964
C++
using namespace std; #include<bits/stdc++.h> #define BEGIN ios_base::sync_with_stdio(0);cin.tie(0) #define END return EXIT_SUCCESS #define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++) #define REP(I,N) FOR(I,0,N) #define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++) #define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--) #define IN(P) cin>>(P) #define IN2(P1,P2) cin>>(P1)>>(P2) #define IN3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3) #define INS(I,N,V) REP(I,N) cin>>V[I] #define INS2(I,N,V1,V2) REP(I,N) cin>>V1[I]>>V2[I]; #define INS3(I,N,V1,V2,V3) REP(I,N) cin>>V1[I]>>V2[I]>>V3[I]; #define OUT(P) cout<<P<<endl #define OUT2(P1,P2) cout<<P1<<" "<<P2<<endl #define OUT3(P1,P2,P3) cout<<P1<<" "<<P2<<" "<<P3<<endl #define OUTS(I,N,V) REP(I,N) cout<<V[i]<<endl #define ALL(C) (C).begin(),(C).end() #define RALL(C) (C).rbegin(),(C).rend() #define mp make_pair #define pb push_back typedef unsigned long ul; typedef unsigned int ui; template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } unsigned long long N,A,B,i,x,y,n; inline void solve(){ IN(N); A=1;B=1; REP(i,N){ IN2(x,y); n=max(ceil((double)A/(double)x),ceil((double)B/(double)y)); A=n*x; B=n*y; } } OUT(A+B); } int main(int argc,char**argv){ BEGIN; solve(); END; }
a.cc:15:16: error: 'cout' does not name a type 15 | #define OUT(P) cout<<P<<endl | ^~~~ a.cc:40:3: note: in expansion of macro 'OUT' 40 | OUT(A+B); | ^~~ a.cc:41:1: error: expected declaration before '}' token 41 | } | ^
s304534223
p03964
C++
from math import * N = int(input()) T = [] A = [] for i in range(0, N): ti, ai = [int(x) for x in input().split()] T.append(ti) A.append(ai) prevT = T[0] prevA = A[0] for i in range(1, N): nextfacT = int(ceil(prevT / T[i])) nextfacA = int(ceil(prevA / A[i])) nextfac = max(nextfacT, nextfacA) while(nextfac * T[i] < prevT and nextfac * A[i] < prevA): nextfac += 1 prevT = nextfac * T[i] prevA = nextfac * A[i] print(prevA+prevT)
a.cc:1:1: error: 'from' does not name a type 1 | from math import * | ^~~~
s007495005
p03964
C++
#pragma comment(linker, "/stack:20000000") #pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx") #include<bits/stdc++.h> /*#include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/tree_policy.hpp> #include<ext/pb_ds/detail/standard_policies.hpp>*/ #define sz(s) (int)(s.size()) #define all(s) s.begin(), s.end() #define rep(a, b, c) for(int a = b; a <= c; ++a) #define per(a, b, c) for(int a = b; a >= c; --a) #define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); using namespace std; //using namespace __gnu_pbds; typedef unsigned long long ull; typedef long long ll; /*typedef tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;*/ //find_by_order() order_of_key() const double eps = 1e-7; const int mod = 1e9+7, MXN = 5e5+17; const int dx[] = {0,0,1,-1}, dy[] = {1,-1,0,0}; template<typename T>inline bool updmin(T &a, const T &b) {return a > b ? a = b,1 : 0;} template<typename T>inline bool updmax(T &a, const T &b) {return a < b ? a = b,1 : 0;} int32_t main() { _ #ifdef DanQQQQQ freopen(".in","r",stdin); freopen(".out","w",stdout); #endif int n; cin >> n; int t[n+5]; memset(t,0,sizeof t); int a[n+5]; memset(a,0,sizeof a); rep(i,1,n) cin >> t[i] >> a[i]; int T = 1, A = 1, kol = 1; rep(i,1,n) { k = max((T+t[i]-1)/t[i],(A+a[i]-1)/a[i]); T = kol*t[i], A = k*a[i]; } cout << T+A << endl; return 0; }
a.cc: In function 'int32_t main()': a.cc:45:17: error: 'k' was not declared in this scope 45 | k = max((T+t[i]-1)/t[i],(A+a[i]-1)/a[i]); | ^
s527869623
p03964
C++
#include <bits/stdc++.h> #define full(c) c.begin(), c.end() #define vector2d(name, type, h, w, init) vector<vector<type>> name(h, vector<type>(w, init)) typedef signed long long int ll; typedef unsigned long long int ull; const int PRIME=1000000007; using namespace std; int main(){ ll n,ca,ct; cin>>n; cin>>ct>>ca; n--; while(n--){ //cout<<ct<<ca<<endl; ll a,t,m; cin>>t>>a; na=a; nt=t; while(na<ca || nt<ct) na+=a, nt+=t; ct=nt; ca=na; } cout<<ca+ct<<endl; return 0; }
a.cc: In function 'int main()': a.cc:18:5: error: 'na' was not declared in this scope; did you mean 'a'? 18 | na=a; | ^~ | a a.cc:19:5: error: 'nt' was not declared in this scope; did you mean 't'? 19 | nt=t; | ^~ | t
s444098440
p03964
Java
import java.util.Scanner; public class Main { @SuppressWarnings("resource") public static void main(String args[]) { Scanner scanner = new Scanner(System.in); int n=scanner.nextInt(); long t[]=new long[n]; long a[]=new long[n]; for(int i=0;i<n;i++) { t[i]=scanner.nextInt(); a[i]=scanner.nextInt(); } for(int i=1;i<n;i++) { long p=Math.max(brd_t/t[i], brd_a/a[i]); t[i]*=p; a[i]*=p; } System.out.println(t[n-1]+a[n-1]); } }
Main.java:15: error: cannot find symbol long p=Math.max(brd_t/t[i], brd_a/a[i]); ^ symbol: variable brd_t location: class Main Main.java:15: error: cannot find symbol long p=Math.max(brd_t/t[i], brd_a/a[i]); ^ symbol: variable brd_a location: class Main 2 errors
s162256423
p03964
C++
#include<bits/stdc++.h> using namespace std; int main(){ long long x,y; int n,t,a; scanf("%d",&n); scanf("%lld %lld",&x,&y); for (int i=1;i<n;i++) { scanf("%d %d",&t,&a); if (x<=t && y<=a) { x=t; y=a; } else { long long tk=t*max(x/t,y/a); long long ak=a*max(x/t,y/a); // for(int j=0;;j++) { // if (tk+(t*j)>=x && ak+(a*j)>=y) { x=tk+(t*j); y=ak+(a*j); // break; // } // } } } printf("%lld\n",x+y); return 0; }
a.cc: In function 'int main()': a.cc:20:29: error: 'j' was not declared in this scope 20 | x=tk+(t*j); | ^
s955839903
p03964
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >>N; int a,af,b,bf; cin >> af>>bf; for(int i=1;i<N;i++){ cin >> a>> b; for(int j=1;j<1001;j++){ if(a*j>=af %% b*j>=bf){ af = a*j; bf = b*j; } } } cout << af+bf << endl; }
a.cc: In function 'int main()': a.cc:12:19: error: expected primary-expression before '%' token 12 | if(a*j>=af %% b*j>=bf){ | ^
s862869836
p03964
Java
class Main{ public static void main(String[] args) { Scanner sc=new Scanner(System.in); int reports=sc.nextInt(); long takahashi=sc.nextLong(); long aoki=sc.nextLong(); for(int i=1; i<reports; i++) { long next_takahashi=sc.nextLong(); long next_aoki=sc.nextLong(); long multiplier=Math.max(takahashi/next_takahashi, aoki/next_aoki); while(next_aoki*multiplier>aoki || next_takahashi*multiplier>takahashi) { multiplier++; } takahashi=next_takahashi*multiplier; aoki=next_aoki*multiplier; } System.out.println(takahashi+aoki); } }
Main.java:3: error: cannot find symbol Scanner sc=new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:3: error: cannot find symbol Scanner sc=new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors
s723779623
p03964
C++
#include<iostream> int routine(int t,int a,int num){ int i=1; int n=a+t; while(n>=num){ n=n*i; i++; } return n; } int main(){ int t,a; int turn; int num; int i=1; std::cin>>turn; while(turn!=i){ std::cin>>t>>a; n=routine(t,a,num); i++; } std::cout<<n<<std::endl; }
a.cc: In function 'int main()': a.cc:23:5: error: 'n' was not declared in this scope 23 | n=routine(t,a,num); | ^ a.cc:27:14: error: 'n' was not declared in this scope 27 | std::cout<<n<<std::endl; | ^
s484363022
p03964
C++
#include <cstdint> #include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { int n; cin >> n; vector<pair<int64_t,int64_t>> t; for (int i = 0; i < n; ++i) { int64_t ti, ai; cin >> ti >> ai; t.push_back(make_pair(ti, ai)); } auto p = t[0]; for (int i = 1; i < t.size(); ++i) { auto pn = t[i]; int64_t mul1 = p.first / pn.first; int64_t mul2 = p.second / pn.second; if (p.first % pn.first != 0) mul1++; if (p.second % pn.second != 0) mul2++; int64_t mul = max(1LL, max(mul1, mul2)); pn.first *= mul; pn.second *= mul; p = pn; } cout << p.first + p.second << endl; }
a.cc: In function 'int main()': a.cc:27:34: error: no matching function for call to 'max(long long int, const long int&)' 27 | int64_t mul = max(1LL, max(mul1, mul2)); | ~~~^~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:3: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:27:34: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long int') 27 | int64_t mul = max(1LL, max(mul1, mul2)); | ~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:5: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:27:34: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 27 | int64_t mul = max(1LL, max(mul1, mul2)); | ~~~^~~~~~~~~~~~~~~~~~~~~~
s265484434
p03964
C++
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { int n; cin >> n; vector<pair<int64_t,int64_t>> t; for (int i = 0; i < n; ++i) { int64_t ti, ai; cin >> ti >> ai; t.push_back(make_pair(ti, ai)); } auto p = t[0]; for (int i = 1; i < t.size(); ++i) { auto pn = t[i]; int64_t mul1 = p.first / pn.first; int64_t mul2 = p.second / pn.second; if (p.first % pn.first != 0) mul1++; if (p.second % pn.second != 0) mul2++; int64_t mul = max(1LL, max(mul1, mul2)); pn.first *= mul; pn.second *= mul; p = pn; } cout << p.first + p.second << endl; }
a.cc: In function 'int main()': a.cc:26:34: error: no matching function for call to 'max(long long int, const long int&)' 26 | int64_t mul = max(1LL, max(mul1, mul2)); | ~~~^~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:2: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:26:34: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long int') 26 | int64_t mul = max(1LL, max(mul1, mul2)); | ~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:4: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:26:34: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 26 | int64_t mul = max(1LL, max(mul1, mul2)); | ~~~^~~~~~~~~~~~~~~~~~~~~~
s385192369
p03964
C++
#include<bits/stdc++.h> using namespace std; int main() { long long N,T,A,t,a; cin>>N; t=a=1; for(long long n=0;n<N;n++) { cin>>T>>A; long long k=max((t+T-1)/T), ((a+A-1)/A); t=k*T; a=k*A; } cout<<t+A<<endl; return 0; }
a.cc: In function 'int main()': a.cc:11:32: error: no matching function for call to 'max(long long int)' 11 | long long k=max((t+T-1)/T), ((a+A-1)/A); | ~~~^~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 1 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: template argument deduction/substitution failed: a.cc:11:32: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 11 | long long k=max((t+T-1)/T), ((a+A-1)/A); | ~~~^~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate expects 2 arguments, 1 provided
s446250546
p03964
C++
#include<bits/stdc++.h> using namespace std; int main(){ long long N,T,A,t,a; cin>>N; t-a=l; for(long long n=0;n<N;n++){ cin>>T>>A; long long n=max((t+T-l)/T,(a+A-l)/A); t=k*T; a=k*A; } cout<<t+a<<endl; return 0; }
a.cc: In function 'int main()': a.cc:6:13: error: 'l' was not declared in this scope 6 | t-a=l; | ^ a.cc:9:19: error: redeclaration of 'long long int n' 9 | long long n=max((t+T-l)/T,(a+A-l)/A); | ^ a.cc:7:23: note: 'long long int n' previously declared here 7 | for(long long n=0;n<N;n++){ | ^ a.cc:10:11: error: 'k' was not declared in this scope 10 | t=k*T; | ^
s542867860
p03964
C++
#include <iostream> using namespace std; int main(){ long long N,T,A,t,a; cin>>N; t=a=1; for(long long n=0;n<N;n++) { cin>>T>>A; long long k=max((t+T-1)/T,(A+a-1)/A) t=k*T; a=A*k; cout<<t<<" "<<a<<endl; } cout<<t+a<<endl; }
a.cc: In function 'int main()': a.cc:11:17: error: expected ',' or ';' before 't' 11 | t=k*T; | ^
s428351630
p03964
C++
#include <iostream> using namespace std; int main(){ long long N,T,A,t,a; cin>>N; t=a=1; for(long long n=0;n<N;n++) { cin>>T>>A; long long T=max((t+T-1)/T,(A+a-1)/A) t=k*T; a=A*k; cout<<t<<" "<<a<<endl; } cout<<t+a<<endl; }
a.cc: In function 'int main()': a.cc:11:17: error: expected ',' or ';' before 't' 11 | t=k*T; | ^ a.cc:12:21: error: 'k' was not declared in this scope 12 | a=A*k; | ^
s425084284
p03964
C++
#include "bits/stdc++.h" using namespace std; int main(){ int n;cin>>n;--n; int a,b,t,s,tmpa,tmpb;cin>>a>>b; for(int i=0;i<n;++i){ cin>>t>>s;tmpa=t,tmpb=s; int m=max((a+t-1)/t,(b+s-1)/s)); a=m*t;b=m*s; }cout<<a+b; }
a.cc: In function 'int main()': a.cc:8:39: error: expected ',' or ';' before ')' token 8 | int m=max((a+t-1)/t,(b+s-1)/s)); | ^
s422386319
p03964
C++
#include "bits/stdc++.h" using namespace std; int main(){ int n;cin>>n;--n; int a,b,t,s,tmpa,tmpb;cin>>a>>b; for(int i=0;i<n;++i){ cin>>t>>s;tmpa=t,tmpb=s; int m=max((a+t-1)/t),(b+s-1)/s)); a=m*t;b=m*s; }cout<<a+b; }
a.cc: In function 'int main()': a.cc:8:18: error: no matching function for call to 'max(int)' 8 | int m=max((a+t-1)/t),(b+s-1)/s)); | ~~~^~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 1 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: template argument deduction/substitution failed: a.cc:8:18: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 8 | int m=max((a+t-1)/t),(b+s-1)/s)); | ~~~^~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate expects 2 arguments, 1 provided
s413947454
p03964
C++
#include "bits/stdc++.h" using namespace std; int main(){ int n;cin>>n;--n; int a,b,t,s,tmpa,tmpb;cin>>a>>b; for(int i=0;i<n;++i){ cin>>t>>s;tmpa=t,tmpb=s; int m=max((a+t-1)/t),ceil((b+s-1)/s)); a=m*t;b=m*s; }cout<<a+b; }
a.cc: In function 'int main()': a.cc:8:18: error: no matching function for call to 'max(int)' 8 | int m=max((a+t-1)/t),ceil((b+s-1)/s)); | ~~~^~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 1 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: template argument deduction/substitution failed: a.cc:8:18: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 8 | int m=max((a+t-1)/t),ceil((b+s-1)/s)); | ~~~^~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate expects 2 arguments, 1 provided
s366869540
p03964
C++
4 1 1 1 1 1 5 1 100
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 4 | ^
s723266755
p03964
C++
#include<iostream> #include<vector> using namespace std; long minCommonMulti(long a,long b){ long n = 2; vector<long> v; //从2开始寻找可以被整除的数 ,一个数可以被整除多次 while(b>1 || a>1){ bool devided=0;//本轮是否有被整除,无论哪个都可以 if( b /n * n == b){ b=b/n; devided=1; } if( a /n * n == a){ a=a/n; devided=1; } if(devided){ //只要有被整除,就记录下载,2可能会被整除多次 v.push_back(n); }else{ //如果当前不能被整除了,那就继续找下一个 n++; } } long result = 1; for(int i=0;i<v.size();i++){ result *= v[i]; } return result; } bool allOne(long[] nums){ for(int i=0;i<nums.length();i++){ if(nums[i] != 1){ return 0; } } return 1; } long minCommonMulti(long[] nums){ long n = 2; vector<long> v; //从2开始寻找可以被整除的数 ,一个数可以被整除多次 while(!allOne(nums)){//只要还有一个1,就得继续下去 bool devided=0;//本轮是否有被整除,无论哪个都可以 for(int i=0;i<nums.length();i++){ if( nums[i] /n * n == nums[i]){ nums[i]=nums[i]/n; devided=1; } } if(devided){ //只要有被整除,就记录下载,2可能会被整除多次 v.push_back(n); }else{ //如果当前不能被整除了,那就继续找下一个 n++; } } long result = 1; for(int i=0;i<v.size();i++){ result *= v[i]; } return result; } int main(){ int n; cin>>n; long a[n],b[n]; for(int i=0;i<n;i++){ c>>a[i]>>b[i]; } long ra=minCommonMulti(a); long rb=minCommonMulti(b); cout<<ra+rab; }
a.cc:36:20: error: expected ',' or '...' before 'nums' 36 | bool allOne(long[] nums){ | ^~~~ a.cc: In function 'bool allOne(long int*)': a.cc:37:23: error: 'nums' was not declared in this scope 37 | for(int i=0;i<nums.length();i++){ | ^~~~ a.cc: At global scope: a.cc:45:28: error: expected ',' or '...' before 'nums' 45 | long minCommonMulti(long[] nums){ | ^~~~ a.cc: In function 'long int minCommonMulti(long int*)': a.cc:50:23: error: 'nums' was not declared in this scope 50 | while(!allOne(nums)){//只要还有一个1,就得继续下去 | ^~~~ a.cc: In function 'int main()': a.cc:81:17: error: 'c' was not declared in this scope 81 | c>>a[i]>>b[i]; | ^ a.cc:85:18: error: 'rab' was not declared in this scope; did you mean 'rb'? 85 | cout<<ra+rab; | ^~~ | rb
s881333092
p03964
C++
import math N = int(input()) T = 1 A = 1 for i in range(N): ti, ai = map(int, input().split()) m = max(math.ceil(T / min(T, ti)), math.ceil(A / min(A, ai))) T = ti * m A = ai * m print(int(T + A))
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'
s287923159
p03964
C++
#include<bits/stdc++.h> using namespace std; int main(){ int N; cin>>N; unsigned long long A,B; cin>>A>>B; for(int i=1;i<N;i++){ //cout<<A<<","<<B<<endl; unsigned long long t,s; cin>>t>>s; long long c=max((A+t-1)/t,(B+s-1)/s); A=t*max(c,1); B=s*max(c,1); } cout<<(unsigned long long)(A+B)<<endl; //cout<<(unsigned long long)1000000000000000000<<endl; return 0; }
a.cc: In function 'int main()': a.cc:14:12: error: no matching function for call to 'max(long long int&, int)' 14 | A=t*max(c,1); | ~~~^~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:14:12: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 14 | A=t*max(c,1); | ~~~^~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:14:12: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 14 | A=t*max(c,1); | ~~~^~~~~ a.cc:15:12: error: no matching function for call to 'max(long long int&, int)' 15 | B=s*max(c,1); | ~~~^~~~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:15:12: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 15 | B=s*max(c,1); | ~~~^~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:15:12: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 15 | B=s*max(c,1); | ~~~^~~~~
s508617140
p03964
C++
#include <bits/stdc++.h> #define FOR(I,X,Y) for(int (I)=(X);(I)<(Y);(I)++) #define REP(I,X,Y) for(int (I)=(Y)-1;(I)>=(X);(I)--) #define ALL(X) (X).begin(),(X).end() #define INF 1000000007 #define LINF 1000000000000000007 typedef long long ll; using namespace std; int main(){ ll N,T,A,t=1,a=1,q; cin >> N; FOR(i,0,N){ cin >> T >> A; q = max((T+t-1)/T,(A+a-1)/A); t = q*T; a = q*A; cerr << t << " " << a << endl; } cout << t+a << endl;
a.cc: In function 'int main()': a.cc:20:23: error: expected '}' at end of input 20 | cout << t+a << endl; | ^ a.cc:10:11: note: to match this '{' 10 | int main(){ | ^
s858209494
p03964
C++
#include<cstdio> #include<algorithm> using namespace std; typedef long long LL; inline LL gcd(LL a,LL b) { return !b?a:gcd(b,a%b); } int main() { int n; scanf("%d",&n); LL a,b,A=1,B=1; LL G; for(int i=1;i<=n;i++) { scanf("%lld %lld",&a,&b); if(a>A && b>B) A=a,B=b; else { G=max((A/a)+(A%a?1:0),B/b+(B%b?1:0); A=a*G,B=b*G; } } printf("%lld\n",A+B); }
a.cc: In function 'int main()': a.cc:23:60: error: expected ')' before ';' token 23 | G=max((A/a)+(A%a?1:0),B/b+(B%b?1:0); | ~ ^ | )
s711045025
p03964
C++
N = int(input()) TA = [] for i in range(N): TA.append(list(map(int, input().split()))) t_real = [TA[0][0]] a_real = [TA[0][1]] for i in range(1,N): t_cand = (t_real[i-1]//TA[i][0] + bool(t_real[i-1]%TA[i][0])) * TA[i][0] a_cand = (a_real[i-1]//TA[i][1] + bool(a_real[i-1]%TA[i][1])) * TA[i][1] if t_cand//TA[i][0] * TA[i][1] >= TA[i-1][1]: t_real.append(t_cand) a_real.append(t_cand//TA[i][0] * TA[i][1]) elif a_cand//TA[i][1] * TA[i][0] >= TA[i-1][0]: a_real.append(a_cand) t_real.append(a_cand//TA[i][1] * TA[i][0]) else: print("error") print(t_real[-1]+a_real[-1])
a.cc:1:1: error: 'N' does not name a type 1 | N = int(input()) | ^
s114480866
p03964
C++
#include <iostream> using namespace std; int main() { int n; cin >> n; int t[1010], a[1010]; for (int i = 0; i < n; ++i) { cin >> t[i] >> a[i]; } int vt = t[0]; int va = a[0]; for (int i = 0; i < n; ++i) { if (vt * a[i] < va * t[i]) { while (1) { vt++; if (vt * a[i] = va * t[i]) break; } } else if (vt * a[i] > va * t[i]) { while (1) { va++; if (vt * a[i] = va * t[i]) break; } } } cout << vt + va << endl; return 0; }
a.cc: In function 'int main()': a.cc:20:16: error: lvalue required as left operand of assignment 20 | if (vt * a[i] = va * t[i]) | ~~~^~~~~~ a.cc:26:16: error: lvalue required as left operand of assignment 26 | if (vt * a[i] = va * t[i]) | ~~~^~~~~~
s661766799
p03964
C++
#include <bits/stdc++.h> #define int long long using namespace std; int main() { int n; cin>>n; long long r=0,l=0; cin>>l>>r; for (int i = 1; i < n; ++i) { int ll,rr; cin>>ll>>rr; int ra = max(int((r + rr - 1) / rr), int((l + ll - 1) / ll)); l=ll*ra; r=rr*ra; } cout<<r+l<<endl; return 0; }
cc1plus: error: '::main' must return 'int' a.cc: In function 'int main()': a.cc:2:13: error: expected primary-expression before 'long' 2 | #define int long long | ^~~~ a.cc:14:22: note: in expansion of macro 'int' 14 | int ra = max(int((r + rr - 1) / rr), int((l + ll - 1) / ll)); | ^~~ a.cc:2:13: error: expected primary-expression before 'long' 2 | #define int long long | ^~~~ a.cc:14:46: note: in expansion of macro 'int' 14 | int ra = max(int((r + rr - 1) / rr), int((l + ll - 1) / ll)); | ^~~
s547294036
p03964
C++
#include <iostream> #include <cmath> #include <algorithm> using namespace std; int main(){ int n; cin >> n; long long int T = 1, A = 1; long long int sum = T + A; for(int i = 0; i < n; i++){ long long int t, a; cin >> t; cin >> a; long long int k = max(1+((A-1)/a), 1+((B-1)/b)); T = k * t; A = k * a; //cout << "t,a:" << T << " " << A << "\n"; sum = T + A; } cout << sum << "\n"; return 0; }
a.cc: In function 'int main()': a.cc:15:48: error: 'B' was not declared in this scope 15 | long long int k = max(1+((A-1)/a), 1+((B-1)/b)); | ^ a.cc:15:53: error: 'b' was not declared in this scope 15 | long long int k = max(1+((A-1)/a), 1+((B-1)/b)); | ^
s074478976
p03964
C++
#include <bits/stdc++.h> using namespace std; typedef unsigned long long ull; typedef long long ll; typedef pair<int, int> P; map <int,int> mp; vector<int> V; list<int> L; stack<int> S; queue<int> Q; deque<int> dq; #define INF (1<<30) #define INFLL (1ll<<60) #define EPS (1e-10) static const int MAX=100000; static const int MOD=1e9+7; static const int NMAX=50; static const int MMAX=50; int N ll T[2],A[2],k1,k2; ll sum; int main(){ cin.tie(0); ios::sync_with_stdio(false); cin>>N; cin>>T[0]>>A[0]; N--; while(N--){ cin>>T[1]>>A[1]; k1=(T[0]%T[1]?T[0]/T[1]+1:T[0]/T[1]); k2=(A[0]%A[1]?A[0]/A[1]+1:A[0]/A[1]); T[1]*=max(k1,k2); A[1]*=max(k1,k2); swap(T[0],T[1]); swap(A[0],A[1]); } cout<<T[0]+A[0]<<"\n"; return 0; }
a.cc:20:1: error: expected initializer before 'll' 20 | ll T[2],A[2],k1,k2; | ^~ a.cc: In function 'int main()': a.cc:25:10: error: 'N' was not declared in this scope 25 | cin>>N; | ^ a.cc:26:10: error: 'T' was not declared in this scope 26 | cin>>T[0]>>A[0]; | ^ a.cc:26:16: error: 'A' was not declared in this scope 26 | cin>>T[0]>>A[0]; | ^ a.cc:31:9: error: 'k1' was not declared in this scope; did you mean 'y1'? 31 | k1=(T[0]%T[1]?T[0]/T[1]+1:T[0]/T[1]); | ^~ | y1 a.cc:32:9: error: 'k2' was not declared in this scope 32 | k2=(A[0]%A[1]?A[0]/A[1]+1:A[0]/A[1]); | ^~
s624297181
p03964
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main(){ ll n; cin >> n; ll a,b; ll x=1,y-1; for(int i=0;i<n;i++){ cin >> a >> b; ll k=max((x+a-1)/a,(y+b-1)/b); x=a*k; y=b*k; } cout << x + y << endl; return 0; }
a.cc: In function 'int main()': a.cc:11:13: error: expected initializer before '-' token 11 | ll x=1,y-1; | ^ a.cc:15:29: error: 'y' was not declared in this scope 15 | ll k=max((x+a-1)/a,(y+b-1)/b); | ^ a.cc:20:17: error: 'y' was not declared in this scope 20 | cout << x + y << endl; | ^
s280192424
p03964
C++
//C++14 (Clang 3.8.0) #include <vector> #include <list> #include <map> #include <set> #include <queue> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <cstdlib> #include <ctime> #include <string> #include <climits> using namespace std; typedef long long ll; typedef pair<int,int> P; const int maxn=500001; P a[maxn],b[maxn]; vector<ll> divisor(ll x){ vector<ll> res; for(ll i=1LL;i*i<=x;i++){ if(x%i==0){ res.push_back(i); if(i!=x/i)res.push_back(x/i); } } return res; } int main(){ ll n; cin>>n; ll s1=1LL,s2=1LL; for(int i=0;i<n;i++){ ll tmp1,tmp2; cin>>tmp1>>tmp2; ll nn=max((tmp1+s1-1)/tmp1,(tmp2+s2-1)/tmp2) s1=nn*tmp1; s2=nn*tmp2; } cout<<s1+s2<<endl; }
a.cc: In function 'int main()': a.cc:48:5: error: expected ',' or ';' before 's1' 48 | s1=nn*tmp1; | ^~
s747750869
p03964
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int n; cin >> n; vector<ll> T(n), A(n); for (int i = 0; i < n; ++i) cin >> T[i] >> A[i]; ll t = 1; a = 1; for (int i = 0; i < n; ++i) { ll j = (t+T[i]-1)/T[i]; j = max(j, (a+A[i]-1)/A[i]); t = T[i]*j, a = A[i]*j; } cout << t+a << endl; return 0; }
a.cc: In function 'int main()': a.cc:9:13: error: 'a' was not declared in this scope 9 | ll t = 1; a = 1; | ^
s780036937
p03964
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int n; cin >> n; vector<ll> a(n), t(n); for (int i = 0; i < n; ++i) cin >> a[i] >> t[i]; ll ansa = 0, anst = 0; for (int i = 0; i < n; ++i) { int j = (ansa+a[i]-1)/a[i]; j = max(j, (anst+t[i]-1)/t[i]); ansa = j*ansa, anst = j*anst; } cout << ansa + anst << endl; return 0; }
a.cc: In function 'int main()': a.cc:12:12: error: no matching function for call to 'max(int&, ll)' 12 | j = max(j, (anst+t[i]-1)/t[i]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:12:12: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'}) 12 | j = max(j, (anst+t[i]-1)/t[i]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:12:12: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 12 | j = max(j, (anst+t[i]-1)/t[i]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~
s745193159
p03964
C++
#include<stdio.h> #include <algorithm> #include <cassert> #include <cctype> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <iterator> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <iomanip> #include <stack> #include <string> #include <vector> using namespace std; #define ll long long #define ld long double #define rep(a,t) for(int a=0;a<t;a++) #define forever while(true) #define Sort(a) sort(a.begin(),a.end()) #define Reverse(a) reverse(a.begin(),a.end()) #define pb push_back long gcd(long a, long b) { if (b == 0) { return a; } return gcd(b, a % b); } long lcm(long a, long b) { return a / gcd(a, b)*b; } int ceil(double a) { if ((double)((int)a) == a) { return (int)a; } return (int)a+1; } int main() { cin.tie(0); ios::sync_with_stdio(false); int n1; cin >> n1; int left = 0; int right = 0; rep(i, n1) { int x, y; cin >> x >> y; int n = max(ceil(left / (double)x), ceil(right / (double)y)); left = n*x; right = n*y; } cout << left + right << endl; return 0; }
a.cc:38:5: error: ambiguating new declaration of 'int ceil(double)' 38 | int ceil(double a) { | ^~~~ In file included from /usr/include/features.h:523, from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33, from /usr/include/stdio.h:28, from a.cc:1: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:192:1: note: old declaration 'double ceil(double)' 192 | __MATHCALLX (ceil,, (_Mdouble_ __x), (__const__)); | ^~~~~~~~~~~
s469471456
p03964
C++
#include<bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0;i<(n);i++) #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define ROF(i,a,b) for(int i=(a)-1;i>=(b);i--) #define all(a) (a).begin(),(a).end() #define rall(a) (a).rbegin(),(a).rend() //sortで大きい順 #define UNIQUE(v) v.erase(unique(all(v)),v.end()) #define SUM(a) accumlate(all(a),0) #define pb push_back #define fst first #define snd second typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<string> vs; typedef pair<int,int> pii; typedef long long ll; main(){ ll n; cin >> n; ll a = 1, b = 1; ll x, y; ll m; rep(i,n){ cin >> x >> y; m = max((a + x -1) / x, (b + y - 1) / y); m = max(m, 1); //cout << m << endl; a = m * x; b = m * y; } cout << a + b << endl; }
a.cc:20:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 20 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:29:12: error: no matching function for call to 'max(ll&, int)' 29 | m = max(m, 1); | ~~~^~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:29:12: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 29 | m = max(m, 1); | ~~~^~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:29:12: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 29 | m = max(m, 1); | ~~~^~~~~~
s723720811
p03964
C++
#include<bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0;i<(n);i++) #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define ROF(i,a,b) for(int i=(a)-1;i>=(b);i--) #define all(a) (a).begin(),(a).end() #define rall(a) (a).rbegin(),(a).rend() //sortで大きい順 #define UNIQUE(v) v.erase(unique(all(v)),v.end()) #define SUM(a) accumlate(all(a),0) #define pb push_back #define fst first #define snd second typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<string> vs; typedef pair<int,int> pii; typedef long long ll; main(){ int n; cin >> n; ll a = 1, b = 1; int x, y; int m; rep(i,n){ cin >> x >> y; m = max((a + x -1) / x, (b + y - 1) / y); //m = max(m, 1); //cout << m << endl; a = m * x; b = m * y; } ll ans = a + b cout << ans << endl; }
a.cc:20:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 20 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:34:3: error: expected ',' or ';' before 'cout' 34 | cout << ans << endl; | ^~~~
s021689075
p03964
C++
#include <bits/stdc++.h> using namespace std; int main(){ long long int N,i,j,k,A = 1,B = 1; cin >> N; int n[N][2]; for(i = 0; i < N; i++) { cin >> n[i][0] >> n[i][1]; } long long int a = n[0][0],b = n[0][1]; for(i = 1; i < N; i++) { for(j = 0; j < 1000; j++) { if (n[i][1] * a * A > n[i][0] * b * B) { (b * B)++; } else if (n[i][1] * a * A < n[i][0] * b * B) { (a * A)++; } else { break; } if(j == 999) { for(k = 0; k < 1000; k++) { if( (a + A) % i == 0 && (b * B) % i == 0) { a /= i; b /= i; A *= i; B *= i; } } } } } cout << a * A + b * B << endl; return 0; }
a.cc: In function 'int main()': a.cc:17:20: error: lvalue required as increment operand 17 | (b * B)++; | ~~~^~~~ a.cc:19:20: error: lvalue required as increment operand 19 | (a * A)++; | ~~~^~~~
s121673762
p03964
C
#include<stdio.h> int main(void){ int n,i; long long t,a,anst=1,ansa=1,tt,ta; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%lld %lld",&t,&a); if(anst%t)tt=anst/t+1; else tt=anst/t; if(ansa%a)ta=ansa/a+1; else ta=ansa/a; if(tt>ta){ anst=t*tt; ansa=a*tt } else{ anst=t*ta; ansa=a*ta; } } printf("%lld\n",anst+ansa); return 0; }
main.c: In function 'main': main.c:14:10: error: expected ';' before '}' token 14 | ansa=a*tt | ^ | ; 15 | } | ~
s361391947
p03964
C++
=#include <iostream> #include <string> #include <vector> #include <algorithm> #include <queue> #include <set> #include <map> using namespace std; long long N; long long T[1010]; long long A[1010]; int main() { cin >> N; for(long long i = 0;i < N;i++) { cin >> T[i] >> A[i]; } for(long long i = 1;i < N;i++) { /* while(T[i - 1] > T[i] || A[i - 1] > A[i]) { T[i] += t; A[i] += a; } */ long long tc ,ac; tc = T[i - 1] / T[i]; if(T[i - 1] % T[i] != 0) tc++; ac = A[i - 1] / A[i]; if(A[i - 1] % A[i] != 0) ac++; long long c; bool t = T[i - 1] < T[i] * ac; bool a = A[i - 1] < A[i] * tc; if(t && a) { if(T[i] * ac - T[i - 1] + A[i] * ac - A[i - 1] > T[i] * tc - T[i - 1] + A[i] * tc - A[i - 1]) { c = tc; } else { c = ac; } } else if(t) { c = ac; } else { c = tc; } T[i] *= c; A[i] *= c; } cout << T[N - 1] + A[N - 1] << endl; return 0; }
a.cc:1:2: error: stray '#' in program 1 | =#include <iostream> | ^ a.cc:1:1: error: expected unqualified-id before '=' token 1 | =#include <iostream> | ^ In file included from /usr/include/c++/14/bits/char_traits.h:42, from /usr/include/c++/14/string:42, from a.cc:2: /usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type 68 | typedef ptrdiff_t streamsize; // Signed integral type | ^~~~~~~~~ /usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 40 | #include <cwchar> // For mbstate_t +++ |+#include <cstddef> 41 | In file included from /usr/include/c++/14/bits/char_traits.h:50: /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std' 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ In file included from /usr/include/wchar.h:35, from /usr/include/c++/14/cwchar:44, from /usr/include/c++/14/bits/postypes.h:40: /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared 2086 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope 2087 | struct remove_extent<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid 2087 | struct remove_extent<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared 2099 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope 2100 | struct remove_all_extents<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid 2100 | struct remove_all_extents<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared 2171 | template<std::size_t _Len> | ^~~ /usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope 2176 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^~~~ /usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^ /usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope 2202 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope 2203 | struct __attribute__((__aligned__((_Align)))) { } __align; | ^~~~~~ /usr/include/c++/14/bits/char_traits.h:144:61: error: 'std::size_t' has not been declared 144 | compare(const char_type* __s1, const char_type* __s2, std::size_t __n); | ^~~ /usr/include/c++/14/bits/char_traits.h:146:40: error: 'size_t' in namespace 'std' does not name a type 146 | static _GLIBCXX14_CONSTEXPR std::size_t | ^~~~~~ /usr/include/c++/14/bits/char_traits.h:150:34: error: 'std::size_t' has not been declared 150 | find(const char_type* __s, std::size_t __n, const char_type& __a); | ^~~ /usr/include/c++/14/bits/char_traits.h:153:52: error: 'std::size_t' has not been declared 153 | move(char_type* __s1, const char_type* __s2, std::size_t __n); | ^~~ /usr/include/c++/14/bits/char_traits.h:156:52: error: 'std::size_t' has not been declared 156 | copy(char_type* __s1, const char_type* __s2, std::size_t __n); | ^~~ /usr/include/c++/14/bits/char_traits.h:159:30: error: 'std::size_t' has not been declared 159 | assign(char_type* __s, std::size_t __n, char_type __a); | ^~~ /usr/include/c++/14/bits/char_traits.h:187:59: error: 'std::size_t' has not been declared 187 | compare(const char_type* __s1, const char_type* __s2, std::size_t __n) | ^~~ /usr/include/c++/14/bits/char_traits.h: In static member function 'static constexpr int __gnu_cxx::char_traits<_CharT>::compare(const char_type*, const char_type*, int)': /usr/include/c++/14/bits/char_traits.h:189:17: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 189 | for (std::size_t __i = 0; __i < __n; ++__i) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/bits/char_traits.h:189:33: error: '__i' was not declared in this scope; did you mean '__n'? 189 | for (std::size_t __i = 0; __i < __n; ++__i) | ^~~ | __n /usr/include/c++/14/bits/char_traits.h: At global scope: /usr/include/c++/14/bits/char_traits.h:198:31: error: 'size_t' in namespace 'std'
s712246594
p03964
C++
nclude <iostream> #include <numeric> using namespace std; int main(){ int t ; int count = 0; // for reading in values int first; int second; cin >> t ; int* arrayT = new int[t]; int* arrayA = new int[t]; while (count < t){ cin >> first >> second; arrayT[count] = first; arrayA[count] = second; count++; } //current number of votes for t and a int Tvotes; int Avotes; Tvotes = arrayT[0]; Avotes = arrayA[0]; // votes cannot decrease can only increase // loop thru all the steps for(int a = 1; a < t ; a++ ){ int currA = arrayA[a]; int prevA = Avotes; int currT = arrayT[a]; int prevT = Tvotes; // true is t is bigger false is a bigger bool currW = (currT >= currA)? true : false; bool prevW = (prevT >= prevA)? true : false; double DcurrA = arrayA[a]; double DprevA = Avotes; double DcurrT = arrayT[a]; double DprevT = Tvotes; bool TTT = (currT >= Tvotes)? true : false; bool AAA = (currA >= Avotes)? true : false; double Tratio = DprevT / DcurrT; double Aratio = DprevA / DcurrA; // 1 if(currT == currA){ if(prevW){ Avotes = Tvotes; continue; } else{ Tvotes = Avotes; continue; } } //2 // when both are more than before, u add em, so the same if (TTT && AAA){ Avotes = currA; Tvotes = currT; continue; } //3 //both less // if(!TTT && !AAA){ // if(Tratio > Aratio){ // for (int a = 1; Tratio; a++){ // if (currT * a >= Tvotes){ // Avotes = currA * a; // Tvotes = currT * a; // break; // } // } // continue; // } // if(Tratio < Aratio){ // for (int a = 1; Tratio; a++){ // if (currA * a >= Avotes){ // Avotes = currA * a; // Tvotes = currT * a; // break; // } // } // continue; // // } // } //if one is less than the other mess with the smaller one // ttt is saying that curr t greater than previous // check if both are less and if both are more, so this time its a jumble if (Aratio == Tratio){ continue; } if(Aratio > Tratio){ for (int a = 1; true; a++){ if (currA * a >= Avotes){ Avotes = currA * a; Tvotes = currT * a; break; } } continue; } if(Tratio > Aratio){ for (int a = 1; true; a++){ if (currT * a >= Tvotes){ Avotes = currA * a; Tvotes = currT * a; break; } } continue; } } cout << Avotes + Tvotes; delete[] arrayT; delete[] arrayA; return 0; }
a.cc:1:1: error: 'nclude' does not name a type 1 | nclude <iostream> | ^~~~~~ In file included from /usr/include/c++/14/bits/stl_iterator_base_types.h:67, from /usr/include/c++/14/numeric:61, from a.cc:2: /usr/include/c++/14/type_traits:295:27: error: 'size_t' has not been declared 295 | template <typename _Tp, size_t = sizeof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std' 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:984:26: error: 'size_t' has not been declared 984 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std' 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std' 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std' 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std' 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1451:32: error: 'size_t' was not declared in this scope 1451 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 63 | #include <bits/version.h> +++ |+#include <cstddef> 64 | /usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid 1451 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared 1453 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope 1454 | struct extent<_Tp[_Size], 0> | ^~~~~ /usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid 1454 | struct extent<_Tp[_Size], 0> | ^ /usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~ /usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid 1455 | : public integral_constant<size_t, _Size> { }; | ^ /usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid /usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared 1457 | template<typename _Tp, unsigned _Uint, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope 1458 | struct extent<_Tp[_Size], _Uint> | ^~~~~ /usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid 1458 | struct extent<_Tp[_Size], _Uint> | ^ /usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope 1463 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid 1463 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type 1857 | { static constexpr size_t __size = sizeof(_Tp); }; | ^~~~~~ /usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~~~~ /usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~ /usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp' 1860 | struct __select; | ^~~~~~~~ /usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared 1862 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^~~ /usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^ /usr/include/c++/14/type_traits:1866:14: error: 'size_t' has not been declared 1866 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1867:23: error: '_Sz' was not declared in this scope 1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false> | ^~~ /usr/include/c++/14/type_traits:1867:58: error: template argument 1 is invalid 1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false> | ^ /usr/include/c++/14/type_traits:1868:18: error: '_Sz' was not declared in this scope 1868 | : __select<_Sz, _List<_UInts...>> | ^~~ /usr/include/c++/14/type_traits:1868:38: error: template argument 1 is invalid 1868 | : __select<_Sz, _List<_UInts...>> | ^~ /usr/include/c++/14/type_traits:1859:60: error: '__size' is not a member of 'std::__make_unsigned_selector_base::_List<unsigned char, short unsigned int, unsigned int, long unsigned int, long long unsigned int>' 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> |
s131318254
p03964
C++
int main(){ int t ; int count = 0; // for reading in values int a; int b; cin >> t ; int* arrayT = new int[t]; int* arrayA = new int[t]; while (count < t){ cin >> a >> b; arrayT[count] = a; arrayA[count] = b; count++; } //current number of votes for t and a int Tvotes; int Avotes; Tvotes = arrayT[0]; Avotes = arrayA[0]; // votes cannot decrease can only increase // loop thru all the steps for(int a = 1; a < t ; a++ ){ int currA = arrayA[a]; int prevA = Avotes; int currT = arrayT[a]; int prevT = Tvotes; // true is t is bigger false is a bigger bool currW = (currT >= currA)? true : false; bool prevW = (prevT >= prevA)? true : false; double DcurrA = arrayA[a]; double DprevA = Avotes; double DcurrT = arrayT[a]; double DprevT = Tvotes; bool TTT = (currT >= Tvotes)? true : false; bool AAA = (currA >= Avotes)? true : false; double Tratio = DprevT / DcurrT; double Aratio = DprevA / DcurrA; // 1 if(currT == currA){ if(prevW){ Avotes = Tvotes; continue; } else{ Tvotes = Avotes; continue; } } //2 // when both are more than before, u add em, so the same if (TTT && AAA){ Avotes = currA; Tvotes = currT; continue; } //3 //both less if(!TTT && !AAA){ if(Tratio > Aratio){ for (int a = 1; Tratio; a++){ if (currT * a >= Tvotes){ Avotes = currA * a; Tvotes = currT * a; break; } continue; }} else{ for (int a = 1; Tratio; a++){ if (currA * a >= Avotes){ Avotes = currA * a; Tvotes = currT * a; break; } continue; } } } //if one is less than the other mess with the smaller one if(!TTT && Aratio > Tratio){ for (int a = 1; !TTT; a++){ if (currT * a >= Tvotes){ Avotes = currA * a; Tvotes = currT * a; break; } } continue; } if(!AAA && Tratio > Aratio){ for (int a = 1; !AAA; a++){ if (currA * a >= Avotes){ Avotes = currA * a; Tvotes = currT * a; break; } } continue; } // if t is greater mess with a if(currW) { for (int a = 1; currW; a++){ if (currA * a >= Avotes){ Avotes = currA * a; Tvotes = currT * a; break; } } continue; }else{ for (int a = 1; !currW; a++){ if (currT * a >= Tvotes){ Avotes = currA * a; Tvotes = currT * a; break; } } continue;} } cout << Avotes + Tvotes; delete[] arrayT; delete[] arrayA; return 0; }
a.cc: In function 'int main()': a.cc:11:3: error: 'cin' was not declared in this scope 11 | cin >> t ; | ^~~ a.cc:160:1: error: 'cout' was not declared in this scope; did you mean 'count'? 160 | cout << Avotes + Tvotes; | ^~~~ | count
s578224978
p03964
C++
#include <iostream> #include <numeric> using namespace std; int main(){ int t ; int count = 0; // for reading in values int a; int b; cin >> t ; int* arrayT = new int[t]; int* arrayA = new int[t]; while (count < t){ cin >> a >> b; arrayT[count] = a; arrayA[count] = b; count++; } //current number of votes for t and a int Tvotes; int Avotes; Tvotes = arrayT[0]; Avotes = arrayA[0]; // votes cannot decrease can only increase // loop thru all the steps for(int a = 1; a < t ; a++ ){ int currA = arrayA[a]; int prevA = Avotes; int currT = arrayT[a]; int prevT = Tvotes; // true is t is bigger false is a bigger bool currW = (currT >= currA)? true : false; bool prevW = (prevT >= prevA)? true : false; if(currT == currA){ if(prevW){ Avotes = Tvotes; continue; } else{ Tvotes = Avotes; continue; } } double DcurrA = arrayA[a]; double DprevA = Avotes; double DcurrT = arrayT[a]; double DprevT = Tvotes; bool TTT = (currT >= Tvotes)? true : false; bool AAA = (currA >= Avotes)? true : false; double Tratio = DprevT / DcurrT; double Aratio = DprevA / DcurrA; if(Tratio > Aratio){ for (int a = 1; Tratio; a++){ if (currT * a >= Tvotes){ Avotes = currA * a; Tvotes = currT * a; break; } continue; } else{ for (int a = 1; Tratio; a++){ if (currA * a >= Avotes){ Avotes = currA * a; Tvotes = currT * a; break; } continue; } } } if (!TTT || !AAA){ if(!TTT){ for (int a = 1; !TTT; a++){ if (currT * a >= Tvotes){ Avotes = currA * a; Tvotes = currT * a; break; } continue; } } if(!AAA){ for (int a = 1; !AAA; a++){ if (currA * a >= Avotes){ Avotes = currA * a; Tvotes = currT * a; break; } continue; } } } // if t is greater mess with a if(currW) { for (int a = 1; currW; a++){ if (currA * a >= Avotes){ Avotes = currA * a; Tvotes = currT * a; break; } } continue; }else{ for (int a = 1; !currW; a++){ if (currT * a >= Tvotes){ Avotes = currA * a; Tvotes = currT * a; break; } } continue;} // when both are more than before, u add em, so the same if (TTT && AAA){ Avotes = currA; Tvotes = currT; continue; } } cout << Avotes + Tvotes; delete[] arrayT; delete[] arrayA; return 0; }
a.cc: In function 'int main()': a.cc:86:1: error: expected '}' before 'else' 86 | else{ | ^~~~ a.cc:77:20: note: to match this '{' 77 | if(Tratio > Aratio){ | ^ a.cc:99:6: error: 'TTT' was not declared in this scope 99 | if (!TTT || !AAA){ | ^~~ a.cc:99:14: error: 'AAA' was not declared in this scope 99 | if (!TTT || !AAA){ | ^~~ a.cc:102:9: error: 'currT' was not declared in this scope 102 | if (currT * a >= Tvotes){ | ^~~~~ a.cc:103:16: error: 'currA' was not declared in this scope 103 | Avotes = currA * a; | ^~~~~ a.cc:113:9: error: 'currA' was not declared in this scope 113 | if (currA * a >= Avotes){ | ^~~~~ a.cc:115:16: error: 'currT' was not declared in this scope 115 | Tvotes = currT * a; | ^~~~~ a.cc:123:4: error: 'currW' was not declared in this scope 123 | if(currW) { | ^~~~~ a.cc:125:9: error: 'currA' was not declared in this scope 125 | if (currA * a >= Avotes){ | ^~~~~ a.cc:127:16: error: 'currT' was not declared in this scope 127 | Tvotes = currT * a; | ^~~~~ a.cc:132:1: error: continue statement not within a loop 132 | continue; | ^~~~~~~~ a.cc:135:9: error: 'currT' was not declared in this scope 135 | if (currT * a >= Tvotes){ | ^~~~~ a.cc:136:16: error: 'currA' was not declared in this scope 136 | Avotes = currA * a; | ^~~~~ a.cc:141:1: error: continue statement not within a loop 141 | continue;} | ^~~~~~~~ a.cc:146:5: error: 'TTT' was not declared in this scope 146 | if (TTT && AAA){ | ^~~ a.cc:146:12: error: 'AAA' was not declared in this scope 146 | if (TTT && AAA){ | ^~~ a.cc:147:12: error: 'currA' was not declared in this scope 147 | Avotes = currA; | ^~~~~ a.cc:148:12: error: 'currT' was not declared in this scope 148 | Tvotes = currT; | ^~~~~ a.cc:149:3: error: continue statement not within a loop 149 | continue; | ^~~~~~~~ a.cc: At global scope: a.cc:155:1: error: 'cout' does not name a type 155 | cout << Avotes + Tvotes; | ^~~~ a.cc:156:1: error: expected unqualified-id before 'delete' 156 | delete[] arrayT; | ^~~~~~ a.cc:157:1: error: expected unqualified-id before 'delete' 157 | delete[] arrayA; | ^~~~~~ a.cc:158:3: error: expected unqualified-id before 'return' 158 | return 0; | ^~~~~~ a.cc:159:1: error: expected declaration before '}' token 159 | } | ^
s388861796
p03964
C++
int main() { int n; long int a, b; long int ca, cb, sa, sb, ma, mb; long int mag; cin >> n; cin >> a >> b; n--; ca = a, cb = b; for (unsigned i = 0; i < n; i++) { cin >> a >> b; sa = ca / a, ma = ca % a; sb = cb / b, mb = cb % b; if (ma != 0) sa++; if (mb != 0) sb++; mag = max(sa, sb); ca = a * mag, cb = b * mag; } cout << ca + cb << endl; return 0; }
a.cc: In function 'int main()': a.cc:6:3: error: 'cin' was not declared in this scope 6 | cin >> n; | ^~~ a.cc:18:11: error: 'max' was not declared in this scope; did you mean 'mag'? 18 | mag = max(sa, sb); | ^~~ | mag a.cc:21:3: error: 'cout' was not declared in this scope 21 | cout << ca + cb << endl; | ^~~~ a.cc:21:22: error: 'endl' was not declared in this scope 21 | cout << ca + cb << endl; | ^~~~
s694915579
p03964
Java
import java.util.Scanner; public class Prob3 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] original = new int[2]; int[] multiples = new int[2]; int[] manipulate = new int[2]; int t = sc.nextInt(); original[0] = sc.nextInt(); original[1] = sc.nextInt(); int numvotes = original[0] + original[1]; for (int i = 0; i < t - 1; i++) { manipulate[0] = sc.nextInt(); manipulate[1] = sc.nextInt(); if (manipulate[0] > original[0] && manipulate[1] > original[1]) { numvotes += (manipulate[1] - original[1]) + (manipulate[0] - original[0]); original[0] = manipulate[0]; original[1] = manipulate[1]; continue; } if (manipulate[0] == original[0] && manipulate[1] == original[1]) continue; multiples[0] = manipulate[0]; multiples[1] = manipulate[1]; int n = 1; while (multiples[0] < original[0] || multiples[1] < original[1]) { multiples = multiply(manipulate, n); n++; } numvotes += (multiples[1] - original[1]) + (multiples[0] - original[0]); original[0] = multiples[0]; original[1] = multiples[1]; } System.out.println(numvotes); } public static int[] multiply(int[] input, int n) { int[] output = {input[0], input[1]}; for (int i = 0; i < input.length; i++) { output[i] *= n; } return output; } }
Main.java:3: error: class Prob3 is public, should be declared in a file named Prob3.java public class Prob3 { ^ 1 error
s265990186
p03964
C++
#include <iostream> #include <numeric> using namespace std; //A // int main(){ // int a,b,c,d,e,f; // int t; // int count = 0; // // cin >> t ; // int* array = new int[t]; // while (count != t){ // cin >> a >> b; // array[count] = a % b; // count++; // } // // // // for (int a = 0; a < t ; a++){ // cout << array[a] << endl; // } // return 0; // } int main(){ int t ; int count = 0; int Avotes; int Tvotes; int yolo; int a; int b; cin >> t ; int* arrayT = new int[t]; int* arrayA = new int[t]; while (count != t){ cin >> a >> b; arrayT[count] = a; arrayA[count] = b; count++; } Tvotes = arrayT[0]; Avotes = arrayA[0]; for (int a = 1; a < count; a++){ int currentT = arrayT[a]; int prevT = arrayT[a-1]; int currentA = arrayA[a]; int prevA = arrayA[a-1]; int totalCurr = currentT + currentA; int totalPrev = prevT + prevA; int min = lcd(totalCurr, totalPrev) int lol = min / totalCurr; Avotes = currentA * lol; Tvotes = currentT * lol; } yolo = Avotes + Tvotes; cout << yolo; return 0; }
a.cc: In function 'int main()': a.cc:59:15: error: 'lcd' was not declared in this scope 59 | int min = lcd(totalCurr, totalPrev) | ^~~ a.cc:63:25: error: 'lol' was not declared in this scope 63 | Avotes = currentA * lol; | ^~~
s706251412
p03964
C++
#include <iostream> #include <string> #include <algorithm> #include <cmath> using namespace std; int main() { int N, T[1000], A[1000]; cin >> N; for(int i=0; i<N; i++) cin >> T[i] >> A[i]; long long a = T[0], b = A[0]; for(int i=1; i<N; i++){ long long n = max(ceil(1.0 * a/(1LL*T[i])), ceil(1.0 * b/(1LL*A[i])); a = n * T[i]; b = n * A[i]; } cout << a + b << endl; return 0; }
a.cc: In function 'int main()': a.cc:16:77: error: expected ')' before ';' token 16 | long long n = max(ceil(1.0 * a/(1LL*T[i])), ceil(1.0 * b/(1LL*A[i])); | ~ ^ | )
s337966293
p03964
C++
#include <iostream> #include<sstream> #include<vector> #include<iterator> #include<numeric> using namespace std; int main(void) { int N; cin >> N; long long cnt[2]; cin >> cnt[0] >> cnt[1]; for(int i=1; i<N; i++) { int T, A; cin >> T >> A; long long n = max(ceil(1.0*cnt[0]/T), ceil(1.0*cnt[1]/A)); cnt[0] = T * n; cnt[1] = A * n; } cout << accumulate(begin(cnt), end(cnt), 0) << endl; return 0; }
a.cc: In function 'int main()': a.cc:21:35: error: 'ceil' was not declared in this scope 21 | long long n = max(ceil(1.0*cnt[0]/T), ceil(1.0*cnt[1]/A)); | ^~~~
s461594023
p03964
C++
#include<iostream> #include<string> #include<vector> #include<algorithm> using namespace std; #define out(s) cout<<(s)<<endl; using ll = long long; int main() { int N; ll ans; ll T_sum, A_sum; cin >> N; cin >> T_sum >> A_sum; for (size_t i = 0; i < N-1; i++) { int Ti, Ai; cin >> Ti >> Ai; int x, y, k; k = ceil(max((double)T_sum / Ti, (double)A_sum / Ai)); x = Ti*k - T_sum; y = Ai*k - A_sum; T_sum += x; A_sum += y; } ans = T_sum + A_sum; out(ans); return 0; }
a.cc: In function 'int main()': a.cc:21:21: error: 'ceil' was not declared in this scope 21 | k = ceil(max((double)T_sum / Ti, (double)A_sum / Ai)); | ^~~~
s463671917
p03964
C++
import java.util.*; public class Main { public static void main(String []args){ Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] t = new int[n]; int[] a = new int[n]; for (int i = 0; i < n; i++) { t[i] = in.nextInt(); a[i] = in.nextInt(); } long tt = t[0]; long aa = a[0]; long base = 1; for (int i = 1; i < n; i++) { while (base * t[i] < tt || base * a[i] < aa) { base++; } tt = base * t[i]; aa = base * a[i]; } while (1 < base && tt <= (base - 1) * t[n - 1] && aa <= (base - 1) * a[n - 1]) { base--; } System.out.println(base * t[n - 1] + base * a[n - 1]); } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.*; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: expected unqualified-id before 'public' 3 | public class Main { | ^~~~~~
s149383818
p03964
Java
import java.util.*; public class Main { private static Scanner sc = new Scanner(System.in); public static void main(String[] args){ int n = sc.nextInt(); long t = sc.nextLong(); long a = sc.nextLong(); long nt = 0,na = 0; for (int i = 1;i < n;i++) { T = sc.nextLong(); A= sc.nextLong(); long m = Math.max((t-1)/T+1,(a-1)/A+1); t = T*m; a = A*m; } System.out.println(t+a); } }
Main.java:11: error: cannot find symbol T = sc.nextLong(); ^ symbol: variable T location: class Main Main.java:12: error: cannot find symbol A= sc.nextLong(); ^ symbol: variable A location: class Main Main.java:13: error: cannot find symbol long m = Math.max((t-1)/T+1,(a-1)/A+1); ^ symbol: variable T location: class Main Main.java:13: error: cannot find symbol long m = Math.max((t-1)/T+1,(a-1)/A+1); ^ symbol: variable A location: class Main Main.java:14: error: cannot find symbol t = T*m; ^ symbol: variable T location: class Main Main.java:15: error: cannot find symbol a = A*m; ^ symbol: variable A location: class Main 6 errors
s204513170
p03964
Java
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); long[] t = new long[N]; long[] a = new long[N]; for(int i = 0; i < N; i++) { t[i] = sc.nextLong(); a[i] = sc.nextLong(); } // i回目の投票時が(t[i]k,a[i]k)としたときのkの最小値 long[] dp = new long[N]; dp[0] = 1; for(int i = 1; i < N; i++) { BigDecimal t1 = new BigDecimal(t[i - 1] * dp[i - 1]); BigDecimal t2 = new BigDecimal(t[i]); BigDecimal a1 = new BigDecimal(a[i - 1] * dp[i - 1]); BigDecimal a2 = new BigDecimal(a[i]); long k1 = (long)Math.ceil((t1.divide(t2)).doubleValue()); long k2 = (long)Math.ceil((a1.divide(a2)).doubleValue()); dp[i] = Math.max(k1, k2); } System.out.println(dp[N - 1] * (t[N - 1] + a[N - 1])); } }
Main.java:17: error: cannot find symbol BigDecimal t1 = new BigDecimal(t[i - 1] * dp[i - 1]); ^ symbol: class BigDecimal location: class Main Main.java:17: error: cannot find symbol BigDecimal t1 = new BigDecimal(t[i - 1] * dp[i - 1]); ^ symbol: class BigDecimal location: class Main Main.java:18: error: cannot find symbol BigDecimal t2 = new BigDecimal(t[i]); ^ symbol: class BigDecimal location: class Main Main.java:18: error: cannot find symbol BigDecimal t2 = new BigDecimal(t[i]); ^ symbol: class BigDecimal location: class Main Main.java:19: error: cannot find symbol BigDecimal a1 = new BigDecimal(a[i - 1] * dp[i - 1]); ^ symbol: class BigDecimal location: class Main Main.java:19: error: cannot find symbol BigDecimal a1 = new BigDecimal(a[i - 1] * dp[i - 1]); ^ symbol: class BigDecimal location: class Main Main.java:20: error: cannot find symbol BigDecimal a2 = new BigDecimal(a[i]); ^ symbol: class BigDecimal location: class Main Main.java:20: error: cannot find symbol BigDecimal a2 = new BigDecimal(a[i]); ^ symbol: class BigDecimal location: class Main 8 errors
s403551815
p03964
C++
#include<bits/stdc++.h>using namespace std;main(){long long n,t[1000],a[1000],j;cin>>n>>t[0]>>a[0];for(int i=1;i<n;i++){cin>>t[i]>>a[i];j=max((a[i-1]-1)/a[i],(t[i-1]-1)/t[i])+1;a[i]*=j;t[i]*=j;}cout<<a[n-1]+t[n-1]<<endl;}
a.cc:1:30: warning: extra tokens at end of #include directive 1 | #include<bits/stdc++.h>using namespace std;main(){long long n,t[1000],a[1000],j;cin>>n>>t[0]>>a[0];for(int i=1;i<n;i++){cin>>t[i]>>a[i];j=max((a[i-1]-1)/a[i],(t[i-1]-1)/t[i])+1;a[i]*=j;t[i]*=j;}cout<<a[n-1]+t[n-1]<<endl;} | ^~~~~~~~~ a.cc:1:9: fatal error: bits/stdc++.h>usin: No such file or directory 1 | #include<bits/stdc++.h>using namespace std;main(){long long n,t[1000],a[1000],j;cin>>n>>t[0]>>a[0];for(int i=1;i<n;i++){cin>>t[i]>>a[i];j=max((a[i-1]-1)/a[i],(t[i-1]-1)/t[i])+1;a[i]*=j;t[i]*=j;}cout<<a[n-1]+t[n-1]<<endl;} | ^~~~~~~~~~~~~~~~~~~~ compilation terminated.
s188354059
p03964
C++
#include<bits/stdc++.h>using namespace std;main(){long long n,t[1000],a[1000],j;cin>>n>>t[0]>>a[0];for(int i=1;i<n;i++){cin>>t[i]>>a[i];j=max((a[i-1]-1)/a[i],(t[i-1]-1)/t[i])+1;a[i]*=j;t[i]*=j;}cout<<a[n-1]+t[n-1]<<endl;}
a.cc:1:30: warning: extra tokens at end of #include directive 1 | #include<bits/stdc++.h>using namespace std;main(){long long n,t[1000],a[1000],j;cin>>n>>t[0]>>a[0];for(int i=1;i<n;i++){cin>>t[i]>>a[i];j=max((a[i-1]-1)/a[i],(t[i-1]-1)/t[i])+1;a[i]*=j;t[i]*=j;}cout<<a[n-1]+t[n-1]<<endl;} | ^~~~~~~~~ a.cc:1:9: fatal error: bits/stdc++.h>usin: No such file or directory 1 | #include<bits/stdc++.h>using namespace std;main(){long long n,t[1000],a[1000],j;cin>>n>>t[0]>>a[0];for(int i=1;i<n;i++){cin>>t[i]>>a[i];j=max((a[i-1]-1)/a[i],(t[i-1]-1)/t[i])+1;a[i]*=j;t[i]*=j;}cout<<a[n-1]+t[n-1]<<endl;} | ^~~~~~~~~~~~~~~~~~~~ compilation terminated.
s179727770
p03964
C++
#include<bits/stdc++.h> using namespace std; int main(){ long long n,t[1000]={},a[1000]={}; cin>>n; for(int i=0;i<n;i++){ cin>>t[i]>>a[i]; if(i) long long j=1; if((a[i-1]-1)/a[i]>(t[i-1]-1)/t[i]) j+=(a[i-1]-1)/a[i]; else j+=(t[i-1]-1)/t[i]; a[i]*=j; t[i]*=j; } cout<<a[n-1]+t[n-1]<<endl; return 0; }
a.cc: In function 'int main()': a.cc:10:40: error: 'j' was not declared in this scope 10 | if((a[i-1]-1)/a[i]>(t[i-1]-1)/t[i]) j+=(a[i-1]-1)/a[i]; | ^ a.cc:11:9: error: 'j' was not declared in this scope 11 | else j+=(t[i-1]-1)/t[i]; | ^ a.cc:12:10: error: 'j' was not declared in this scope 12 | a[i]*=j; | ^
s201805079
p03964
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n; int t[1000]={},a[1000]={}; cin>>n; for(int i=0;i<n;i++){ cin>>t[i]>>a[i]; if(i) if(a[i-1]>a[i] || t[i-1]>t[i]){ if(a[i-1]/a[i]>=t[i-1]/t[i])j=a[i-1]/a[i]; else j=t[i-1]/t[i]; a[i]*=j+1; t[i]*=j+1; } } cout<<a[n-1]+t[n-1]<<endl; return 0; }
a.cc: In function 'int main()': a.cc:11:33: error: 'j' was not declared in this scope 11 | if(a[i-1]/a[i]>=t[i-1]/t[i])j=a[i-1]/a[i]; | ^ a.cc:12:10: error: 'j' was not declared in this scope 12 | else j=t[i-1]/t[i]; | ^ a.cc:13:11: error: 'j' was not declared in this scope 13 | a[i]*=j+1; | ^
s547655702
p03964
Java
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int[] t = new int[N]; int[] a = new int[N]; for(int i = 0; i < N; i++) { t[i] = sc.nextInt(); a[i] = sc.nextInt(); } // dp[i]はi回目までの投票数の最小値を表す long[] dp = new long[N]; dp[0] = t[0] + a[0]; for(int i = 1; i < N; i++) { long tnum = (dp[i - 1] / (long)(t[i - 1] + a[i - 1])) * t[i - 1]); long anum = (dp[i - 1] / (long)(t[i - 1] + a[i - 1])) * a[i - 1]); long rate = Math.max((long)Math.ceil((double)tnum / (double)t[i]), (long)Math.ceil((double)anum / (double)a[i])); dp[i] = rate * (long)(t[i] + a[i]); } System.out.println(dp[N - 1]); } }
Main.java:17: error: ';' expected long tnum = (dp[i - 1] / (long)(t[i - 1] + a[i - 1])) * t[i - 1]); ^ Main.java:18: error: ';' expected long anum = (dp[i - 1] / (long)(t[i - 1] + a[i - 1])) * a[i - 1]); ^ 2 errors
s516394455
p03964
Java
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int[] t = new int[N]; int[] a = new int[N]; for(int i = 0; i < N; i++) { t[i] = sc.nextInt(); a[i] = sc.nextInt(); } // dp[i]はi回目までの投票数の最小値を表す long[] dp = new long[N]; dp[0] = t[0] + a[0]; for(int i = 1; i < N; i++) { long t = (dp[i - 1] * t[i - 1]) / (long)(t[i - 1] + a[i - 1]); long a = (dp[i - 1] * a[i - 1]) / (long)(t[i - 1] + a[i - 1]); long rate = Math.max((long)Math.ceil((double)t / (double)t[i]), (long)Math.ceil((double)a / (double)a[i])); dp[i] = rate * (long)(t[i] + a[i]); } System.out.println(dp[N - 1]); } }
Main.java:17: error: variable t is already defined in method main(String[]) long t = (dp[i - 1] * t[i - 1]) / (long)(t[i - 1] + a[i - 1]); ^ Main.java:17: error: array required, but long found long t = (dp[i - 1] * t[i - 1]) / (long)(t[i - 1] + a[i - 1]); ^ Main.java:17: error: array required, but long found long t = (dp[i - 1] * t[i - 1]) / (long)(t[i - 1] + a[i - 1]); ^ Main.java:18: error: variable a is already defined in method main(String[]) long a = (dp[i - 1] * a[i - 1]) / (long)(t[i - 1] + a[i - 1]); ^ Main.java:18: error: array required, but long found long a = (dp[i - 1] * a[i - 1]) / (long)(t[i - 1] + a[i - 1]); ^ Main.java:18: error: array required, but long found long a = (dp[i - 1] * a[i - 1]) / (long)(t[i - 1] + a[i - 1]); ^ Main.java:18: error: array required, but long found long a = (dp[i - 1] * a[i - 1]) / (long)(t[i - 1] + a[i - 1]); ^ Main.java:19: error: array required, but long found long rate = Math.max((long)Math.ceil((double)t / (double)t[i]), (long)Math.ceil((double)a / (double)a[i])); ^ Main.java:19: error: array required, but long found long rate = Math.max((long)Math.ceil((double)t / (double)t[i]), (long)Math.ceil((double)a / (double)a[i])); ^ Main.java:20: error: array required, but long found dp[i] = rate * (long)(t[i] + a[i]); ^ Main.java:20: error: array required, but long found dp[i] = rate * (long)(t[i] + a[i]); ^ 11 errors
s415675970
p03964
C++
//#define _GRIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; // 基本テンプレート #pragma region MACRO #define P(x) cout << (x) << endl #define p(x) cout << (x) #define PED cout << "\n" #define rep(i,n) for(int i=0; i<(int)n; ++i) #define REP(i,x,n) for(int i=x; i<(int)n; ++i) #define repi(i,n) for(int i=0; i<=(int)n; ++i) #define REPI(i,x,n) for(int i=x; i<=(int)n; ++i) #define ILP while(true) #define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i) #define ALL(c) (c).begin(), (c).end() #define mp make_pair #pragma endregion // 型 #pragma region TYPE_DEF typedef long long ll; typedef pair<int, int> pii; typedef pair<string, string> pss; typedef pair<string, int> psi; typedef pair<int, string> pis; typedef vector<int> vi; typedef vector<double> vd; typedef vector<long double> vld; typedef vector<long> vl; typedef vector<long long> vll; typedef vector<string> vs; #pragma endregion // Effective std #pragma region ESTD template<typename C, typename T> int count(C& c, T t) { return count(ALL(c), t); } template<typename C, typename F> int count_if(C& c, F f) { return count_if(ALL(c), f); } template<typename C, typename T> void erase(C& c, T t) { remove(ALL(c), t), c.end(); } template<typename C> void remove(vector<C>& c, unsigned int index) { c.erase(c.begin()+index); } template<typename C, typename T, typename U> void replace(C& c, T t, U u) { replace(ALL(c), t, u); } template<typename C, typename F, typename U> void replace_if(C& c, F f, U u) { (ALL(c), f, u); } template<typename C> void reverse(C& c) { reverse(ALL(c)); } template<typename C> void sort(C& c) { sort(ALL(c)); } template<typename C, typename Pred> void sort(C& c, Pred p) { sort(ALL(c), p); } #pragma endregion // 定数 #pragma region CONST_VAL constexpr int PI = (2*acos(0.0)); constexpr int EPS = (1e-9); constexpr int MOD = (int)(1e9+7); constexpr int INF = 100000000; #pragma endregion #define int ll int main() { int n; cin >> n; int a=1; int b=1; rep(i,n) { int x, y; cin >> x >> y; int n = max(a/x+(a%x>0), b/y+(b%y>0)); a = x*n; b = y*n; } cout << a + b << endl; return 0; }
a.cc:57:13: error: '::main' must return 'int' 57 | #define int ll | ^~ a.cc:58:1: note: in expansion of macro 'int' 58 | int main() | ^~~
s364466914
p03964
C++
//ABC 049-C #define _USE_MATH_DEFINES #include <iostream> #include <cmath> #include <stdlib.h> #include <algorithm> #include <cstdio> #include <vector> #include <cstring> #include <numeric> #include <string> #include <map> #include <sstream> using namespace std; int main() { int N, j = 1, long long voteT[1001], voteA[1001], T[1001], A[1001]; cin >> N; T[0] = 0; A[0] = 0; voteT[0] = 1; voteA[0] = 1; for (int i = 1; i <= N; i++) { cin >> T[i] >> A[i]; j = ceil((double)voteT[i-1]/T[i]); if(j < ceil((double)voteA[i-1]/A[i])){ j = ceil((double)voteA[i-1]/A[i]); } if(j == 0) j = 1; voteT[i] = T[i]*j; voteA[i] = A[i]*j; } cout << voteT[N] + voteA[N] << endl; }
a.cc: In function 'int main()': a.cc:19:9: error: expected unqualified-id before 'long' 19 | long long voteT[1001], voteA[1001], T[1001], A[1001]; | ^~~~ a.cc:21:9: error: 'T' was not declared in this scope 21 | T[0] = 0; | ^ a.cc:22:9: error: 'A' was not declared in this scope 22 | A[0] = 0; | ^ a.cc:23:9: error: 'voteT' was not declared in this scope 23 | voteT[0] = 1; | ^~~~~ a.cc:24:9: error: 'voteA' was not declared in this scope 24 | voteA[0] = 1; | ^~~~~
s407988347
p03964
C++
#include <cstdio> #include <iostream> #include <string> #include <vector> #include <algorithm> #include <map> using namespace std; long long T[10000] = {}, A[10000] = {}; long long main(){ long long N; cin >> N; for (long long i = 0; i < N; i++) { cin >> T[i] >> A[i]; } long long T1 = T[0], T2 = A[0]; for (long long i = 1; i < N; i++) { long long tmp1 = T1 / T[i]; long long tmp2 = T2 / A[i]; if (T1%T[i] != 0) { tmp1++; } if (T1%A[i] != 0) { tmp2++; } long long tmp = max(tmp1, tmp2); T1 = T[i] * tmp; T2 = A[i] * tmp; } cout << T1 + T2 << endl; return 0; }
cc1plus: error: '::main' must return 'int'
s874558734
p03964
C++
#include <iostream> #include <vector> #include <cstdio> #include <cmath> using namespace std; u_int64_t ceilDiv(u_int64_t a, u_int64_t b) { return (a / b) + (a % b == 0 ? 0 : 1); } int main() { int N; u_int64_t T = 1; u_int64_t A = 1; u_int64_t t; u_int64_t a; cin >> N; for (int i = 0; i < N; i++) { cin >> t >> a; uint_64_t v = max(ceilDiv(T, t), ceilDiv(A, a)); T = t * v; A = a * v; } cout << T + A << endl; return 0; }
a.cc: In function 'int main()': a.cc:27:9: error: 'uint_64_t' was not declared in this scope; did you mean 'u_int64_t'? 27 | uint_64_t v = max(ceilDiv(T, t), ceilDiv(A, a)); | ^~~~~~~~~ | u_int64_t a.cc:29:17: error: 'v' was not declared in this scope 29 | T = t * v; | ^
s032481115
p03964
C++
#include <iostream> #include <vector> #include <cstdio> using namespace std; int div(int a, int b) { return (a / b) + (a % b == 0 ? 0 : 1); } int main() { int N; int A = 1; int T = 1; int a[1000]; int t[1000]; cin >> N; for (int i = 0; i < N; i++) { cin >> a[i] >> t[i]; } for (int i = 0; i < N; i++) { int v = max(div(A, a[i]), div(T, t[i])); A = a[i] * v; T = t[i] * v; } cout << A + T << endl; return 0; }
a.cc:7:5: error: ambiguating new declaration of 'int div(int, int)' 7 | int div(int a, int b) | ^~~ In file included from /usr/include/c++/14/cstdlib:79, from /usr/include/c++/14/ext/string_conversions.h:43, from /usr/include/c++/14/bits/basic_string.h:4154, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/stdlib.h:992:14: note: old declaration 'div_t div(int, int)' 992 | extern div_t div (int __numer, int __denom) | ^~~ a.cc: In function 'int main()': a.cc:29:20: error: cannot convert 'const div_t' to 'int' in initialization 29 | int v = max(div(A, a[i]), div(T, t[i])); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | const div_t In file included from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&) [with _Tp = div_t]': a.cc:29:20: required from here /usr/include/c++/14/bits/stl_algobase.h:262:15: error: no match for 'operator<' (operand types are 'const div_t' and 'const div_t') 262 | if (__a < __b) | ~~~~^~~~~ In file included from /usr/include/c++/14/string:48: /usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 448 | operator<(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_algobase.h:262:15: note: 'const div_t' is not derived from 'const std::reverse_iterator<_Iterator>' 262 | if (__a < __b) | ~~~~^~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 493 | operator<(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_algobase.h:262:15: note: 'const div_t' is not derived from 'const std::reverse_iterator<_Iterator>' 262 | if (__a < __b) | ~~~~^~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1694 | operator<(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_algobase.h:262:15: note: 'const div_t' is not derived from 'const std::move_iterator<_IteratorL>' 262 | if (__a < __b) | ~~~~^~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1760 | operator<(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_algobase.h:262:15: note: 'const div_t' is not derived from 'const std::move_iterator<_IteratorL>' 262 | if (__a < __b) | ~~~~^~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_algobase.h:262:15: note: 'const div_t' is not derived from 'const std::pair<_T1, _T2>' 262 | if (__a < __b) | ~~~~^~~~~
s416644106
p03964
C
#include <stdio.h> int main() { long long n, t[1001], a[1001]; scanf("%lld", &n); for (int i=1;i<=n;i++) { scanf("%lld %lld", &t[i], &a[i]); } long long ttotal=1, atotal=1; for (int i=1;i<=n;i++) { if (t[i] < a[i]) { if(a[i] / t[i] > atotal / total){ while (ttotal % t[i] != 0) { ttotal++; } atotal = ttotal / t[i] * a[i]; } else { while (atotal % a[i] != 0) { atotal++; } ttotal = atotal / a[i] * t[i]; } } else if (t[i] > a[i]) { if(t[i] / a[i] > ttotal / atotal){ while (atotal % a[i] != 0) { atotal++; } ttotal = atotal / a[i] * t[i]; } else{ while (ttotal % t[i] != 0) { ttotal++; } atotal = ttotal / t[i] * a[i]; } } else { if (ttotal > atotal) { atotal = ttotal; } else { ttotal = atotal; } } } printf("%lld\n", ttotal+atotal); return 0; }
main.c: In function 'main': main.c:12:43: error: 'total' undeclared (first use in this function); did you mean 'atotal'? 12 | if(a[i] / t[i] > atotal / total){ | ^~~~~ | atotal main.c:12:43: note: each undeclared identifier is reported only once for each function it appears in
s088150879
p03964
C++
#include <stdio.h> int main(){ int n, t[1001], a[1001]; scanf("%d", &n); for(int i=1;i<=n;i++){ scanf("%d %d", &t[i], &a[i]); } int ttotal=1, atotal=1; for(int i=1;i<=n;i++){ if(t[i] < a[i]){ while(ttotal / atotal != t[i]/a[i]) { ttotal++; } } else if(t[i] > a[i]){ while(ttotal / atotal != t[i]/a[i]){ atotal++; } } else{ if(ttotal > atotal){ while(ttotal / atotal != t[i]/a[i]){ atotal++; } else{ while(ttotal / atotal != t[i]/a[i]){ ttotal++; } } } } } printf("%d\n", ttotal+atotal); return 0; }
a.cc: In function 'int main()': a.cc:26:17: error: expected '}' before 'else' 26 | else{ | ^~~~ a.cc:22:36: note: to match this '{' 22 | if(ttotal > atotal){ | ^ a.cc: At global scope: a.cc:35:7: error: expected constructor, destructor, or type conversion before '(' token 35 | printf("%d\n", ttotal+atotal); | ^ a.cc:36:1: error: expected unqualified-id before 'return' 36 | return 0; | ^~~~~~ a.cc:37:1: error: expected declaration before '}' token 37 | } | ^
s767905289
p03964
C++
#include <iostream> #include <algorithm> #define ll long long using namespace std; int main(){ int n; ll t[100100]; ll a[100100]; cin >> n; for (int i = 0; i < n; ++i) { cin >> t[i] >> a[i]; } for (int i = 1; i < n; ++i) { ll tmp_t = t[i]; ll tmp_a = a[i]; if(t[i-1] > t[i] || a[i-1] > a[i]){ ll tmp_mul = max( (t[i-1] - 1)/ t[i] + 1, (a[i-1] - 1) / a[i] + 1); // if( (tmp_mul * t[i] == t[i-1] && tmp_mul * a[i] > a[i-1] ) || (tmp_mul * a[i] == a[i-1] && tmp_mul * t[i] > t[i-1]) ){ // tmp_mul--; // } // tmp_mul++; t[i] *= tmp_mul a[i] *= tmp_mul // cout << "tmp_mul " << tmp_mul << " "; } // cout << t[i] << " " << a[i] << " i番目 " << i <<endl; } cout << t[n-1] + a[n-1] << endl; }
a.cc: In function 'int main()': a.cc:27:40: error: expected ';' before 'a' 27 | t[i] *= tmp_mul | ^ | ; 28 | a[i] *= tmp_mul | ~
s208952323
p03964
C++
#include <iostream> #include <algorithm> #define ll long long using namespace std; int main(){ int n; ll t[100100]; ll a[100100]; cin >> n; for (int i = 0; i < n; ++i) { cin >> t[i] >> a[i]; } for (int i = 1; i < n; ++i) { ll tmp_t = t[i]; ll tmp_a = a[i]; if(t[i-1] > t[i] || a[i-1] > a[i]){ ll tmp_mul = max( (t[i-1] - 1)/ t[i] + 1, (a[i-1] - 1) / a[i] + 1); // if( (tmp_mul * t[i] == t[i-1] && tmp_mul * a[i] > a[i-1] ) || (tmp_mul * a[i] == a[i-1] && tmp_mul * t[i] > t[i-1]) ){ // tmp_mul--; // } // tmp_mul++; t[i] *= tmp_mul a[i] *= tmp_mul // cout << "tmp_mul " << tmp_mul << " "; } // cout << t[i] << " " << a[i] << " i番目 " << i <<endl; } cout << t[n-1] + a[n-1] << endl; }
a.cc: In function 'int main()': a.cc:27:40: error: expected ';' before 'a' 27 | t[i] *= tmp_mul | ^ | ; 28 | a[i] *= tmp_mul | ~
s191924407
p03964
C++
// Standard I/O #include <iostream> #include <sstream> #include <cstdio> // Standard Library #include <cstdlib> #include <cstring> #include <ctime> #include <cmath> // Template Class #include <complex> #include <string> #include <vector> #include <list> #include <set> #include <map> #include <queue> #include <stack> // Container Control #include <algorithm> using namespace std; #define rep( i, n ) for( int i = 0; i < n; ++i ) #define irep( i, n ) for( int i = n-1; i >= 0; --i ) #define reep( i, s, n ) for ( int i = s; i < n; ++i ) #define ireep( i, n, s ) for ( int i = n-1; i >= s; --i ) #define foreach(itr, x) for( typeof(x.begin()) itr = x.begin(); itr != x.end(); ++itr) #define mp make_pair #define pb push_back #define eb emplace_back #define all( v ) v.begin(), v.end() #define fs first #define sc second #define vc vector // for visualizer.html double SCALE = 1.0; double OFFSET_X = 0.0; double OFFSET_Y = 0.0; #define LINE(x,y,a,b) cerr << "line(" << SCALE*(x) + OFFSET_X << "," \ << SCALE*(y) + OFFSET_Y << "," \ << SCALE*(a) + OFFSET_X << "," \ << SCALE*(b) + OFFSET_Y << ")" << endl; #define CIRCLE(x,y,r) cerr << "circle(" << SCALE*(x) + OFFSET_X << "," \ << SCALE*(y) + OFFSET_Y << "," \ << SCALE*(r) << ")" << endl; typedef long long ll; typedef complex<double> Point; typedef pair<int, int> pii; typedef pair<int, pii> ipii; typedef vector<int> vi; typedef vector<double> vd; typedef vector< vector<int> > vii; typedef vector< vector<double> > vdd; typedef vector<int>::iterator vi_itr; const int IINF = 1 << 28; const double INF = 1e30; const double EPS = 1e-10; const double PI = acos(-1.0); // Direction : L U R D const int dx[] = { -1, 0, 1, 0}; const int dy[] = { 0, -1, 0, 1 }; int main() { int N; cin >> N; ll ans = 1, ans1 = 0, ans2 = 0; rep(i, N){ int t, a; cin >> t >> a; if( i == 0 ){ ans = t+a; ans1 = t; ans2 = a; } else{ ll n = max((ans1+t)/t, ceil((ans2+a)/a)); ans = (t+a)*n; ans1 = t*n; ans2 = a*n; } } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:85:35: error: no matching function for call to 'max(ll, __gnu_cxx::__enable_if<true, double>::__type)' 85 | ll n = max((ans1+t)/t, ceil((ans2+a)/a)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:2: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:85:35: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__enable_if<true, double>::__type' {aka 'double'}) 85 | ll n = max((ans1+t)/t, ceil((ans2+a)/a)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:20: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:85:35: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 85 | ll n = max((ans1+t)/t, ceil((ans2+a)/a)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s425009516
p03964
C++
#include "bits/stdc++.h" using namespace std; typedef long long ll; typedef pair<int,int> pii; #define rep(i,n) for(ll i=0;i<(ll)(n);i++) #define all(a) (a).begin(),(a).end() #define pb push_back #define INF (1e9+1) //#define INF (1LL<<59) #define int ll int main(){ int n; cin>>n; ll l=0,r=0; rep(i,n){ ll a,b; cin>>a>>b; int c = max( 1 , (int)max(ceil((double)l/a),ceil((double)r/b)) ); if(l<=a*c&&r<=b*c) l=a*c, r=b*c; } cout<<l+r<<endl; }
a.cc:11:13: error: '::main' must return 'int' 11 | #define int ll | ^~ a.cc:13:1: note: in expansion of macro 'int' 13 | int main(){ | ^~~ a.cc: In function 'int main()': a.cc:21:28: error: no matching function for call to 'max(int, ll)' 21 | int c = max( 1 , (int)max(ceil((double)l/a),ceil((double)r/b)) ); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:21:28: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'}) 21 | int c = max( 1 , (int)max(ceil((double)l/a),ceil((double)r/b)) ); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:21:28: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 21 | int c = max( 1 , (int)max(ceil((double)l/a),ceil((double)r/b)) ); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s144858718
p03964
C++
#include<algorithm> #include<string> using namespace std; #define loop(i,a,b) for(int i = a; i < b; i++) #define rep(i,a) loop(i,0,a) int main() { int n; int t,k; int tt,kk; int a,b; cin>>n; cin>>a>>b; rep(i,n-1){ cin>>tt>>kk; t=tt; k=kk; while(1){ if(t>=a&&k>=b) break; t+=tt; k+=kk; } a=t; b=k; } cout<<a+b<<endl; }
a.cc: In function 'int main()': a.cc:15:9: error: 'cin' was not declared in this scope 15 | cin>>n; | ^~~ a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 2 | #include<string> +++ |+#include <iostream> 3 | using namespace std; a.cc:30:9: error: 'cout' was not declared in this scope 30 | cout<<a+b<<endl; | ^~~~ a.cc:30:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:30:20: error: 'endl' was not declared in this scope 30 | cout<<a+b<<endl; | ^~~~ a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 2 | #include<string> +++ |+#include <ostream> 3 | using namespace std;
s638045878
p03964
Java
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; import java.util.*; import java.math.*; public class Main { public static void main(String args[] ) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line1 = br.readLine(); line1 = line1.trim(); int N = Integer.parseInt(line1); long PosA = 0; long PosB = 0; long a = 0; long b = 0; long mag = 0; for(int i = 0;i<N;i++){ String lines = br.readLine(); lines = lines.trim(); String[] temp = lines.split(" "); a = Integer.parseInt(temp[0]); b = Integer.parseInt(temp[1]); if(PosA <= a && PosB <= b){ PosA = a; PosB = b; } else { mag = (long)Math.ceil(Math.max((double)PosA/a, (double)PosB/b)); PosA = a * mag; PosB = b * mag; } } System.out.println(PosA+PosB) } }
Main.java:36: error: ';' expected System.out.println(PosA+PosB) ^ 1 error
s604602126
p03964
Java
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; import java.util.*; import java.math.*; public class Main { public static void main(String args[] ) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line1 = br.readLine(); line1 = line1.trim(); int N = Integer.parseInt(line1); long PosA = 0; long PosB = 0; long a = 0; long b = 0; long mag = 0; for(int i = 0;i<N;i++){ String lines = br.readLine(); lines = lines.trim(); String[] temp = lines.stlip(" "); a = Integer.parseInt(temp[0]); b = Integer.parseInt(temp[1]); if(PosA <= a && PosB <= b){ PosA = a; PosB = b; } else { mag = (long)Math.ceil(Math.max((double)PosA/a, (double)PosB/b)); PosA = a * mag; PosB = b * mag; } } } }
Main.java:22: error: cannot find symbol String[] temp = lines.stlip(" "); ^ symbol: method stlip(String) location: variable lines of type String 1 error
s182382240
p03964
Java
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; import java.util.*; import java.math.*; public class Main { public static void main(String args[] ) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line1 = br.readLine(); line1 = line1.trim(); int N = Integer.parseInt(line1); long PosA = 0; long PosB = 0; long a = 0; long b = 0; long mag = 0; for(int i = 0;i<N;i++){ String lines = br.readLine(); lines = lines.trim(); String[] temp = lines.stlip(lines, " "); a = Integer.parseInt(temp[0]); b = Integer.parseInt(temp[1]); if(PosA <= a && PosB <= b){ PosA = a; PosB = b; } else { mag = Math.ceil(Math.max((double)PosA/a, (double)PosB/b)); PosA = a * mag; PosB = b * mag; } } } }
Main.java:22: error: cannot find symbol String[] temp = lines.stlip(lines, " "); ^ symbol: method stlip(String,String) location: variable lines of type String Main.java:30: error: incompatible types: possible lossy conversion from double to long mag = Math.ceil(Math.max((double)PosA/a, (double)PosB/b)); ^ 2 errors
s107558346
p03964
C++
#include<iostream> #include<vector> #include<string> #include<array> #include<algorithm> #include<list> #include<cmath> #include<iomanip> #include<queue> #include<functional> #include<climits> #include<iterator> #include<unordered_set> #include<unordered_map> #include<map> #include<set> #include<typeinfo> #include<chrono> #include<initializer_list> using namespace std; const double pi=4*atan(1.0); constexpr long long mod=static_cast<long long>(1e9+7); int main() { cin >> N; a = 1, b = 1; for (int i = 0; i < N; i++) { cin >> T >> A; n = max((a+T-1)/T,(b+A-1)/A); a = T*n; b = A*n; } cout << a+b << endl; return 0; }
a.cc: In function 'int main()': a.cc:28:24: error: 'N' was not declared in this scope 28 | cin >> N; | ^ a.cc:29:9: error: 'a' was not declared in this scope 29 | a = 1, b = 1; | ^ a.cc:29:16: error: 'b' was not declared in this scope 29 | a = 1, b = 1; | ^ a.cc:31:24: error: 'T' was not declared in this scope 31 | cin >> T >> A; | ^ a.cc:31:29: error: 'A' was not declared in this scope 31 | cin >> T >> A; | ^ a.cc:32:17: error: 'n' was not declared in this scope 32 | n = max((a+T-1)/T,(b+A-1)/A); | ^
s558075274
p03964
C++
#include<iostream> #include<vector> #include<string> #include<array> #include<algorithm> #include<list> #include<cmath> #include<iomanip> #include<queue> #include<functional> #include<climits> #include<iterator> #include<unordered_set> #include<unordered_map> #include<map> #include<set> #include<typeinfo> #include<chrono> #include<initializer_list> using namespace std; const double pi=4*atan(1.0); constexpr long long mod=static_cast<long long>(1e9+7); int main() { int N,A; cin >> N ; int B,C; for(int i=1;i<N+1;i++){ while(0){ } cout<<A<<endl; return 0; }
a.cc: In function 'int main()': a.cc:48:6: error: expected '}' at end of input 48 | } | ^ a.cc:27:16: note: to match this '{' 27 | int main() { | ^
s919317058
p03964
C++
#include<iostream> using namespace std; long a, b, n, N, T, A; long main() { cin >> N; a = 1, b = 1; for (int i = 0; i < N; i++) { cin >> T >> A; n = max((a+T-1)/T,(b+A-1)/A); a = T*n; b = A*n; } cout << a+b << endl; return 0; }
cc1plus: error: '::main' must return 'int'
s119890045
p03964
C++
#include<iostream> #include<map> #include<vector> #include<algorithm> #include<cmath> #include<climits> #include<ctime> #include<cstring> #include<numeric> #include <string> using namespace std; long a, b, n, N, T, A; long main() { cin >> N; a = 1, b = 1; for (int i = 0; i < N; i++) { cin >> T >> A; n = max((a+T-1)/T,(b+A-1)/A); a = T*n; b = A*n; } cout << a+b << endl; return 0; }
cc1plus: error: '::main' must return 'int'
s477740347
p03964
C++
#include<iostream> #include<map> #include<vector> #include<algorithm> #include<cmath> #include<climits> #include<ctime> #include<cstring> #include<numeric> #include <string> using namespace std; int N, T, A; long a, b, n; long main() { cin >> N; a = 1, b = 1; for (int i = 0; i < N; i++) { cin >> T >> A; n = max((a+T-1)/T,(b+A-1)/A); a = T*n; b = A*n; } cout << a+b << endl; return 0; }
cc1plus: error: '::main' must return 'int'
s855378415
p03964
C++
#inclulde <iostream> #include <math.h> int main(){ int reports, votes, votesT(1), votesA(1); scanf("%d", &reports); for(int i = 0; i < reports; i++){ int Ti, Ai; scanf("%d %d", &Ti, &Ai); int zoom_out; if(ceil(static_cast<float>(votesT) / static_cast<float>(Ti)) >= ceil(static_cast<float>(votesA) / static_cast<float>(Ai))) zoom_out = ceil(static_cast<float>(votesT) / static_cast<float>(Ti)); else zoom_out = ceil(static_cast<float>(votesA) / static_cast<float>(Ai)); votesT = Ti * zoom_out; votesA = Ai * zoom_out; printf("%d %d\n", votesT, votesA); } votes = votesT + votesA > pow(10, 18) ? pow(10, 18) : votesT + votesA; printf("%d\n", votes); return 0; }
a.cc:1:2: error: invalid preprocessing directive #inclulde; did you mean #include? 1 | #inclulde <iostream> | ^~~~~~~~ | include a.cc: In function 'int main()': a.cc:6:5: error: 'scanf' was not declared in this scope 6 | scanf("%d", &reports); | ^~~~~ a.cc:19:9: error: 'printf' was not declared in this scope 19 | printf("%d %d\n", votesT, votesA); | ^~~~~~ a.cc:3:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' 2 | #include <math.h> +++ |+#include <cstdio> 3 | a.cc:23:5: error: 'printf' was not declared in this scope 23 | printf("%d\n", votes); | ^~~~~~ a.cc:23:5: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
s374114299
p03964
C++
#include <iostream> #include <limits> using namespace std; int main() { int N; cin >> N; long long a = 0; long long b = 0; for (int i = 0; i < N; ++i) { int T, A; cin >> T >> A; if (a == 0 && b == 0) { a = T; b = A; } else { long long l = 1; long long u = LLONG_MAX - 1; while (l < u) { long long c = (l + u) / 2; if ((T + A) > LLONG_MAX / c) { u = c; } else if (c * T >= a && c * A >= b) { u = c; } else { l = c + 1; } } a = l * T; b = l * A; } } cout << a + b << endl; }
a.cc: In function 'int main()': a.cc:21:39: error: 'LLONG_MAX' was not declared in this scope 21 | long long u = LLONG_MAX - 1; | ^~~~~~~~~ a.cc:3:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 2 | #include <limits> +++ |+#include <climits> 3 |
s509187983
p03964
C++
5 3 10 48 17 31 199 231 23 3 2
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 5 | ^
s214133737
p03964
C++
#include <cstdio> #include <algorithm> using namespace std; int nTimes, votesA, votesB, r1, r2, ans, lol; int main() { scanf("%d", &nTimes); scanf("%d %d", &votesA, &votesB); for (int i = 0; i < nTimes - 1; i++) { // printf("CURRENT VOTES A = %d\n", votesA); // printf("CURRENT VOTES B = %d\n", votesB); scanf("%d %d", &r1, &r2); if (r1 == r2) { if (votesA > votesB) { votesB = votesA; } else { votesA = votesB; } } else if (r1 > r2) { while (lol == 0) { if (votesB % r2 == 0 && votesA <= votesB * r1 / r2) { lol = 1; } else { if (votesB < r2) { votesB = r2; } else if (votesB % r2 != 0) { int test = floor(votesB / r2); votesB = r2 * (test + 1); } else { votesB += r2; } } } lol = 0; votesA = votesB * r1 / r2; } else { while (votesA % r1 != 0) { if (votesA < r1) { votesA = r1; } else if (votesA % r2 != 0) { int test = floor(votesA / r1); votesA = r1 * (test + 1); } else { votesA += r1 } } votesB = votesA * r2 / r1; } } // printf("CURRENT VOTES A = %d\n", votesA); // printf("CURRENT VOTES B = %d\n", votesB); ans = votesB + votesA; printf("%d", ans); }
a.cc: In function 'int main()': a.cc:31:60: error: 'floor' was not declared in this scope 31 | int test = floor(votesB / r2); | ^~~~~ a.cc:45:52: error: 'floor' was not declared in this scope 45 | int test = floor(votesA / r1); | ^~~~~ a.cc:48:53: error: expected ';' before '}' token 48 | votesA += r1 | ^ | ; 49 | } | ~
s156054779
p03964
C++
#include <iostream> #include <vector> #include <string> #include <algorithm> #include <numeric> #include<cmath> using namespace std; int main() { int N; cin >> N; int t, a; cin >> t >> a; long long int nt = t, na = a; for (int i = 1; i < N; i++) { int t, a; cin >> t >> a; //long long int p = max((nt + t - 1)/ t, (na + a - 1)/ a); long long int p = max(ceil(long long double)nt/t), ceil((long long double)na/a)); nt = t * p; na = a * p; } cout << nt+na << endl; return 0; }
a.cc: In function 'int main()': a.cc:17:36: error: expected primary-expression before 'long' 17 | long long int p = max(ceil(long long double)nt/t), ceil((long long double)na/a)); | ^~~~
s673228932
p03964
C++
#include <stdio.h> #include <string> #include <iostream> using namespace std; int main(){ char keyin[20]; int N; int cnt = 0; int l=0, r=0; fgets(keyin, sizeof(keyin), stdin); N = atoi( strtok(keyin, " ") ); for(int i=0; i<N; i++){ fgets(keyin, sizeof(keyin), stdin); int t_l = atoi( strtok(keyin, " ") ); int t_r = atoi( strtok(NULL, " ") ); if(cnt==0){ l = t_l; r = t_r; }else{ int tmp = l/t_l; int i; if(tmp==0){ i = 1; }else{ i = tmp; } int t_l0 = t_l; int t_r0 = t_r; while(true){ t_l = t_l0*i; t_r = t_r0*i; if(t_l >= l && t_r >= r){ l = t_l; r = t_r; break; } i++; } } cnt++; } printf("%d\n", l+r); return 0; }
a.cc: In function 'int main()': a.cc:13:13: error: 'strtok' was not declared in this scope; did you mean 'strtoq'? 13 | N = atoi( strtok(keyin, " ") ); | ^~~~~~ | strtoq
s756981366
p03964
C++
#include <iostream> using namespace std; int main() { int N, T, A; cin >> N; int t = 1; int a = 1; for (int i = 0; i != N; ++i) { cin >> T >> A; if (t / T * A == a) { continue; } if (T >= t && A >= a) { t = T; a = A; continue; } int w; if (T > A) { w = } int x = T; int y = A; while (true) { x += T; y += A; if (x >= t && y >= a) { break; } } t = x; a = y; } cout << t + a << endl; return 0; }
a.cc: In function 'int main()': a.cc:31:9: error: expected primary-expression before '}' token 31 | } | ^
s778824339
p03964
C
#include<stdio.h> #include<math.h> int main(void){ int N,K,i,j,t,a; int T[1000]; int A[1000]; scanf("%d",&N); for(i=0;i<N;i++){ scanf("%d",&T[i]); } for(i=0;i<N;i++){ scanf("%d",&A[i]); } for(i=0;i<N;i++){ if(i==0){ t=T[0]; a=A[0]; } else{ while(a*T[i]/(T[i]+A[i])==t*A[i]/(A[i]+T[i])){ if(T[i]<A[i]){ a++; } else if(T[i]>A[i]){ t++; } else if(T[i]==A[i]){ if(a<t){ a++; } else{ t++; } } } } printf("%d",a+t); return 0; }
main.c: In function 'main': main.c:55:1: error: expected declaration or statement at end of input 55 | } | ^
s330130801
p03964
C
#include <stdio.h> #include <stdlib.h> #include <math.h> int main(){ int i,N; int a,b; int lva, lvb; int temp; int old_a=1, old_b=1; double pa, pb; scanf("%d", &N); for(i=0; i<N; i++){ scanf("%d %d", &a, &b); // temp = 1; // while( old_a > a*temp || old_b > b*temp){ // temp++; // } pa = (double)old_a / a; pa = ceil(pa); pb = (double)old_b / b; pb = ceil(pb); temp = max(pa, pb); old_a = a * temp; old_b = b * temp; } printf("%d\n", old_a+ old_b); return 0; }
main.c: In function 'main': main.c:25:24: error: implicit declaration of function 'max'; did you mean 'fmax'? [-Wimplicit-function-declaration] 25 | temp = max(pa, pb); | ^~~ | fmax
s725998010
p03964
C
#include<stdio.h> #include<math.h> int main(void){ int N,K,i,j,t,a; int T[]; int A[]; scanf("%d",&N); for(i=0,i<N;i++){ scanf("%d",T[i]); } for(i=0,i<N;i++){ scanf("%d",A[i]); } for(i=0;i<N;i++){ if(i==0){ t=T[0]; a=A[0]; } else{ while(a*T[i]/(T[i]+A[i])==t*A[i]/(A[i]+T[i])){ if(T[i]<A[i]){ a++; } else if(T[i]>A[i]){ t++; } else if(T[i]==A[i]){ if(a<t){ a++; } else{ t++; } } } } printf("%d",a+t); return 0; }
main.c: In function 'main': main.c:7:13: error: array size missing in 'T' 7 | int T[]; | ^ main.c:8:13: error: array size missing in 'A' 8 | int A[]; | ^ main.c:12:24: error: expected ';' before ')' token 12 | for(i=0,i<N;i++){ | ^ | ; main.c:16:24: error: expected ';' before ')' token 16 | for(i=0,i<N;i++){ | ^ | ; main.c:55:1: error: expected declaration or statement at end of input 55 | } | ^
s620660866
p03964
C++
#include <iostream> #include <string> #include <algorithm> #include <map> #include <vector> using namespace std; #define debug(x) cout<<#x<<": "<<x<<endl #define rep(i,a,b) for(int i=a;i<b;i++) #define PB push_back #define putn(x,n) cout<< fixed<< setprecision(n)<< x << endl; typedef long long ll; int main(){ cin.tie(0); ios::sync_with_stdio(false); ll st = 0, sa = 0; int n, t, a; cin >> n; cin >> t >> a; sa = a; st = t; rep(i, 0, n-1){ cin >> t >> a; if (sa%a == 0 && st%t == 0 && sa / a == st / t)continue; for (int i = (st%t ? st / t + 1 : st / t);; i++){ st = i*t; if (sa <= a*i){ sa = a*i; break; } } } else{ for (int i = (sa%a?sa / a +1:sa/a);; i++){ sa = i*a; if (st <= t*i){ st = t*i; break; } } } } cout << (sa + st) << endl; return 0; }
a.cc: In function 'int main()': a.cc:35:17: error: 'else' without a previous 'if' 35 | else{ | ^~~~ a.cc: At global scope: a.cc:45:9: error: 'cout' does not name a type 45 | cout << (sa + st) << endl; | ^~~~ a.cc:48:9: error: expected unqualified-id before 'return' 48 | return 0; | ^~~~~~ a.cc:49:1: error: expected declaration before '}' token 49 | } | ^
s205198807
p03964
C++
#include<stdio.h> long long int a[1100],b[1100],t[1100]={1,}; int f(float c){ if((c-(int)c)>0) return ((int)c+1; else return (int)c; } int main(){ int i,n,e; float c,d; long long int result; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%lld %lld",&a[i],&b[i]); if(i!=0){ c = (float)a[i-1]/(float)a[i]; d = (float)b[i-1]/(float)b[i]; c = f(c); d = f(d); e = c>d?c:d; if(e>1){ t[i]=e; }else{ t[i]=1; } a[i]=a[i]*t[i]; b[i]=b[i]*t[i]; } //printf("%d : %d %d\n",i,a[i],b[i]); } printf("%lld",a[i-1]+b[i-1]); }
a.cc: In function 'int f(float)': a.cc:5:33: error: expected ')' before ';' token 5 | return ((int)c+1; | ~ ^ | )
s101359245
p03964
Java
import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long t[] = new int[n]; long a[] = new int[n]; for (int i = 0; i < n; i++) { t[i] = sc.nextInt(); a[i] = sc.nextInt(); } for (int i = 1; i < n; i++) { long tr, ar, r; tr = (t[i] == 0 ? 1 : ((t[i - 1] - 1) / t[i] + 1)); ar = (a[i] == 0 ? 1 : ((a[i - 1] - 1) / a[i] + 1)); r = (tr > ar ? tr : ar); t[i] *= r; a[i] *= r; } System.out.println(t[n - 1] + a[n - 1]); } }
Main.java:7: error: incompatible types: int[] cannot be converted to long[] long t[] = new int[n]; ^ Main.java:8: error: incompatible types: int[] cannot be converted to long[] long a[] = new int[n]; ^ 2 errors
s234358901
p03964
C++
#include<iostream> using namespace std; int main() { __int64 n, i, t, a, x, y,X,Y,g,h; cin >> n; x = 1; y = 1; for (i = 0; i < n; i++) { cin >> t >> a; for (X = 0; g != h; X++) { g = (x + X)*a; for (Y = 0; g != h; Y++) { h = (y + Y)*t; if (Y > 100000000000000000) { break; } } } } cout << x + y; return 0; }
a.cc: In function 'int main()': a.cc:4:9: error: '__int64' was not declared in this scope; did you mean '__int64_t'? 4 | __int64 n, i, t, a, x, y,X,Y,g,h; | ^~~~~~~ | __int64_t a.cc:5:16: error: 'n' was not declared in this scope 5 | cin >> n; | ^ a.cc:6:9: error: 'x' was not declared in this scope 6 | x = 1; | ^ a.cc:7:9: error: 'y' was not declared in this scope 7 | y = 1; | ^ a.cc:8:14: error: 'i' was not declared in this scope 8 | for (i = 0; i < n; i++) { | ^ a.cc:9:24: error: 't' was not declared in this scope; did you mean 'tm'? 9 | cin >> t >> a; | ^ | tm a.cc:9:29: error: 'a' was not declared in this scope 9 | cin >> t >> a; | ^ a.cc:10:22: error: 'X' was not declared in this scope 10 | for (X = 0; g != h; X++) { | ^ a.cc:10:29: error: 'g' was not declared in this scope 10 | for (X = 0; g != h; X++) { | ^ a.cc:10:34: error: 'h' was not declared in this scope 10 | for (X = 0; g != h; X++) { | ^ a.cc:12:30: error: 'Y' was not declared in this scope 12 | for (Y = 0; g != h; Y++) { | ^
s789665030
p03964
C++
#include<stdio.h> long long int a[1100],b[1100],t[1100]={1,}; int f(float c){ if((c-(int)c)>0) return (int)c+1; else (int)c; } int main(){ int i,,n,e; float c,d; long long int result; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d %d",&a[i],&b[i]); if(i!=0){ c = (float)a[i-1]/(float)a[i]; d = (float)b[i-1]/(float)b[i]; c = f(c); d = f(d); e = c>d?c:d; if(e>1){ t[i]=e; }else{ t[i]=1; } a[i]=a[i]*t[i]; b[i]=b[i]*t[i]; } //printf("%d : %d %d\n",i,a[i],b[i]); } printf("%lld",a[i-1]+b[i-1]); }
a.cc: In function 'int main()': a.cc:11:15: error: expected unqualified-id before ',' token 11 | int i,,n,e; | ^ a.cc: In function 'int f(float)': a.cc:8:1: warning: control reaches end of non-void function [-Wreturn-type] 8 | } | ^
s997467752
p03964
Java
import java.util.Scanner; public class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long takahashi = 1, aoki = 1; for(int i=0; i<n; i++){ int t = sc.nextInt(); int a = sc.nextInt(); int tmp1 = takahashi/t, tmp2 = aoki/a; tmp1 += (takahashi%t==0)?0:1; tmp2 += (aoki%a==0)?0:1; long tmp = Math.max(tmp1, tmp2); takahashi = t*tmp; aoki = a*tmp; } System.out.println((takahashi+aoki)); } }
Main.java:12: error: incompatible types: possible lossy conversion from long to int int tmp1 = takahashi/t, tmp2 = aoki/a; ^ Main.java:12: error: incompatible types: possible lossy conversion from long to int int tmp1 = takahashi/t, tmp2 = aoki/a; ^ 2 errors
s069199583
p03964
C
#include <stdio.h> int N, T[1234], A[1234]; int tmp = 1, ans[2] = { 0 }; int main(void) { scanf("%d", &N); for (int i = 0; i < N; ++i) { scanf("%d%d", &T[i], &A[i]); } for (int i = 0; i < N; ++i) { if (i == 0) { ans[0] += T[i]; ans[1] += A[i]; } else { while (true) { if (ans[0] <= T[i] * tmp&&ans[1] <= A[i] * tmp) { ans[0] = T[i] * tmp; ans[1] = A[i] * tmp; tmp = 1; break; } tmp++; } } } printf("%d\n", ans[0] + ans[1]); return 0; }
main.c: In function 'main': main.c:15:32: error: 'true' undeclared (first use in this function) 15 | while (true) { | ^~~~ main.c:2:1: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>' 1 | #include <stdio.h> +++ |+#include <stdbool.h> 2 | main.c:15:32: note: each undeclared identifier is reported only once for each function it appears in 15 | while (true) { | ^~~~
s060809615
p03964
C++
#include<iostream> using namespace std; using ll=long long; ll n,a[2000],b[2000],ans,x,y; int i; int main(){ cin>>n; while(i<n)cin>>a[i]>>b[i],++i; x=y=1;i=0; while(i<n){ ll r=max((x+a[i]-1)/a[i],y+b[i]-1)/b[i])); x=a[i]*r,y=b[i]*r; }ans=x+y; cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:12:40: error: expected ',' or ';' before ')' token 12 | ll r=max((x+a[i]-1)/a[i],y+b[i]-1)/b[i])); | ^
s093690181
p03965
Java
import java.util.Scanner; import java.lang.String; public class TestMain { public static void main (String[] arg) { Scanner sc = new Scanner(System.in); String tcdSequence = sc.next(); sc.close(); int tdcLength = tcdSequence.length(); char[] acdSequence = new char[tdcLength]; for (int i = 0; i < acdSequence.length; i++) { if (i % 2 == 0) { acdSequence[i] = 'g'; } else { acdSequence[i] = 'p'; } } int acdScore = 0; for (int k = 0; k < tcdSequence.length(); k++) { if ((tcdSequence.charAt(k) == 'g') && (acdSequence[k] == 'p')) { acdScore++; } else if ((tcdSequence.charAt(k) == 'p') && (acdSequence[k] == 'g')) { acdScore--; } } System.out.println(acdScore); } }
Main.java:4: error: class TestMain is public, should be declared in a file named TestMain.java public class TestMain { ^ 1 error
s012688517
p03965
Java
import java.util.Scanner; import java.lang.String; public class TestMain { public static void main (String[] arg) { Scanner sc = new Scanner(System.in); rockpaper(sc); sc.close(); } public static void rockpaper(Scanner sc) { String tcdSequence = sc.next(); char[] acdSequence = new char[tcdSequence.length()]; for (int i = 0; i < acdSequence.length; i++) { if (i % 2 == 0) { acdSequence[i] = 'g'; } else { acdSequence[i] = 'p'; } } int acdScore = 0; for (int k = 0; k < tcdSequence.length(); k++) { if ((tcdSequence.charAt(k) == 'g') && (acdSequence[k] == 'p')) { acdScore++; } else if ((tcdSequence.charAt(k) == 'p') && (acdSequence[k] == 'g')) { acdScore--; } } System.out.println(acdScore); } }
Main.java:4: error: class TestMain is public, should be declared in a file named TestMain.java public class TestMain { ^ 1 error
s914154987
p03965
Java
import java.util.Scanner; import java.lang.String; public class TestMain { public static void main (String[] arg) { Scanner sc = new Scanner(System.in); rockpaper(sc); sc.close(); } public static void rockpaper(Scanner sc) { String tcdSequence = sc.next(); char[] acdSequence = new char[tcdSequence.length()]; if (tcdSequence.charAt(0) != 'g') { //WARN } for (int i = 0; i < acdSequence.length; i++) { if (i % 2 == 0) { acdSequence[i] = 'g'; } else { acdSequence[i] = 'p'; } } int acdScore = 0; for (int k = 0; k < tcdSequence.length(); k++) { if ((tcdSequence.charAt(k) == 'g') && (acdSequence[k] == 'p')) { acdScore++; } else if ((tcdSequence.charAt(k) == 'p') && (acdSequence[k] == 'g')) { acdScore--; } } System.out.println(acdScore); } }
Main.java:4: error: class TestMain is public, should be declared in a file named TestMain.java public class TestMain { ^ 1 error