submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s532816503
p03963
C++
#include <iostream> #include <string> #include <algorithm> #define MOD 1000000007; using namespace std; int main() { int N, K; cin >> N >> K; cout << K * pow(K - 1, N - 1); return 0; } int pow(int A, int B) { if (B % 2 == 1) { return pow(A*A, B / 2)* A; } else if (B == 0) { return 1; } else if (B % 2 == 0) { return pow(A*A, B / 2); } }
a.cc: In function 'int main()': a.cc:12:21: error: 'pow' was not declared in this scope 12 | cout << K * pow(K - 1, N - 1); | ^~~ a.cc: In function 'int pow(int, int)': a.cc:31:1: warning: control reaches end of non-void function [-Wreturn-type] 31 | } | ^
s782896368
p03963
C++
#include <algorithm> #include <iostream> ##include <math.h> using namespace std; int main(){ long long int x,y; cin>>x>>y; long long int ans=1; ans=ans*pow(y-1,x-1)*y; cout<<ans<<endl; }
a.cc:3:1: error: stray '##' in program 3 | ##include <math.h> | ^~ a.cc:3:3: error: 'include' does not name a type 3 | ##include <math.h> | ^~~~~~~ a.cc: In function 'int main()': a.cc:7:1: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 7 | cin>>x>>y; | ^~~ | std::cin In file included from a.cc:2: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:9:9: error: 'pow' was not declared in this scope 9 | ans=ans*pow(y-1,x-1)*y; | ^~~ a.cc:10:1: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 10 | cout<<ans<<endl; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:10:12: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 10 | cout<<ans<<endl; | ^~~~ | std::endl In file included from /usr/include/c++/14/iostream:41: /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~
s979067627
p03963
Java
import java.util.Scanner; class Main { int n,k,s; Scanner sc = new Scanner(System.in); n = sc.nextInt(); k = sc.nextInt(); s = k * pow((k-1),(p-1)); System.out.println(s); }
Main.java:5: error: <identifier> expected n = sc.nextInt(); ^ Main.java:6: error: <identifier> expected k = sc.nextInt(); ^ Main.java:7: error: <identifier> expected s = k * pow((k-1),(p-1)); ^ Main.java:8: error: <identifier> expected System.out.println(s); ^ Main.java:8: error: <identifier> expected System.out.println(s); ^ 5 errors
s982143053
p03963
C++
#include <iostream> int main() { int N, K; scanf("%d %d", &N, &K); long long result = 0; result = pow(K - 1, N - 1)*K; printf("%d", result); return 0; }
a.cc: In function 'int main()': a.cc:8:18: error: 'pow' was not declared in this scope 8 | result = pow(K - 1, N - 1)*K; | ^~~
s727092197
p03963
C++
#include"bits/stdc++.h" using namespace std; int main(){ long long ans,n,k; cin>>n>>k; ans=k; for(int i=1;i!=n;++i) ans*=k-1 cout<<ans; }
a.cc: In function 'int main()': a.cc:8:25: error: expected ';' before 'cout' 8 | ans*=k-1 | ^ | ; 9 | cout<<ans; | ~~~~
s916491640
p03963
C++
#include<bits/stdc++.h> using namespace std; using ll = long long; int main() { int N, K; cin >> N >> K; ll p=K ; for (int i = 0;i < N-1;i++) { p = p*(K - 1); } cout << p << endl; return 0;
a.cc: In function 'int main()': a.cc:13:26: error: expected '}' at end of input 13 | return 0; | ^ a.cc:5:12: note: to match this '{' 5 | int main() { | ^
s209598796
p03963
C++
#include <bits/stdc++.h> using namespace std; #define ll long long #define vvi vector< vector<int> > #define vi vector<int> #define All(X) X.begin(),X.end() #define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define REP(i,n) for(int i=0;i<(int)(n);i++) #define pb push_back #define pii pair<int,int> #define mp make_pair #define pi 3.14159265359 #define shosu(X) fixed << setprecision(X) ll gcd(ll a,ll b){return b?gcd(b,a%b):a;} ll lcm(ll a,ll b){return a/gcd(a,b)*b;} int main(){ ll int n,k; cin >> n >> k; ans = k; REP(i,n-1) ans *= (k-1); cout << ans << endl; }
a.cc: In function 'int main()': a.cc:21:1: error: 'ans' was not declared in this scope; did you mean 'abs'? 21 | ans = k; | ^~~ | abs
s037407941
p03963
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int K = sc.nextInt(); int sum =Math.pow((K-1),(N-1))*K; System.out.println(sum); } }
Main.java:7: error: incompatible types: possible lossy conversion from double to int int sum =Math.pow((K-1),(N-1))*K; ^ 1 error
s423625387
p03963
Java
import java.util.Scanner; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); double n = scanner.nextDouble(); double k = scanner.nextDouble(); double cnt = k * Math.pow(k - 1, n-1); System.out.println((int)cnt); } }
Main.java:6: error: cannot find symbol double n = scanner.nextDouble(); ^ symbol: variable scanner location: class Main Main.java:7: error: cannot find symbol double k = scanner.nextDouble(); ^ symbol: variable scanner location: class Main 2 errors
s988518340
p03963
Java
import java.util.Scanner; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); double n = scanner.nextDouble(); double k = scanner.nextDouble(); double cnt = k * Math.pow(k - 1, n-1); System.out.println((int)cnt); } }
Main.java:6: error: cannot find symbol double n = scanner.nextDouble(); ^ symbol: variable scanner location: class Main Main.java:7: error: cannot find symbol double k = scanner.nextDouble(); ^ symbol: variable scanner location: class Main 2 errors
s288762723
p03963
Java
import java.util.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); String c = sc.next(); int N = sc.nextInt(); int K = sc.nextInt(); int cnt = K * (Math.pow(K-1,N-1)); System.out.println(cnt); } }
Main.java:9: error: incompatible types: possible lossy conversion from double to int int cnt = K * (Math.pow(K-1,N-1)); ^ 1 error
s230096297
p03963
C
#include <stdio.h> #include <stdlib.h> int main(void) { int n, k; scanf_s("%d %d", &n, &k); int ans = k; for (int i = 1; i < n; i++) { ans *= (k - 1); } printf("%d\n", ans); return 0; }
main.c: In function 'main': main.c:7:9: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration] 7 | scanf_s("%d %d", &n, &k); | ^~~~~~~ | scanf
s697722992
p03963
C
#include <stdio.h> int main(void) { int n, k; scanf_s("%d %d", &n, &k); int ans = k; for (int i = 1; i < n; i++) { ans *= (k - 1); } printf("%d\n", ans); return 0; }
main.c: In function 'main': main.c:6:9: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration] 6 | scanf_s("%d %d", &n, &k); | ^~~~~~~ | scanf
s778533569
p03963
C
#include <stdio.h> int Power(int i,int j){ int k,l,m; m = 1; k = j-1; for(l=0;l++;l<<k;){ m = m*i; } return m; } int main(){ int N,K; scanf("%d",&N,&K); printf("%d",Power(N,K)); return 0; }
main.c: In function 'Power': main.c:6:18: error: expected ')' before ';' token 6 | for(l=0;l++;l<<k;){ | ~ ^ | )
s509394510
p03963
C++
#include <iostream> #include <cmath> using std; int main() { int a, b; cin >> a >> b; cout << b * pow(b - 1, a - 1) << endl; return 0; }
a.cc:3:7: error: expected nested-name-specifier before 'std' 3 | using std; | ^~~ a.cc: In function 'int main()': a.cc:6:1: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 6 | cin >> a >> b; | ^~~ | std::cin In file included from a.cc:1: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:7:1: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 7 | cout << b * pow(b - 1, a - 1) << endl; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:7:34: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 7 | cout << b * pow(b - 1, a - 1) << endl; | ^~~~ | std::endl In file included from /usr/include/c++/14/iostream:41: /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~
s233411339
p03963
C++
#include <iostream> #include <math> using std; int main() { int a, b; cin >> a >> b; cout << b * pow(b - 1, a - 1) << endl; return 0; }
a.cc:2:10: fatal error: math: No such file or directory 2 | #include <math> | ^~~~~~ compilation terminated.
s028998718
p03963
C++
#include<iostream> using namespace std; int main() { int size, kind; cin >> size >> kind; if (size == 1) { cout << kind << endl; } else { cout << kind*(int)pow(kind - 1, size - 1) << endl; } return 0; }
a.cc: In function 'int main()': a.cc:10:35: error: 'pow' was not declared in this scope 10 | cout << kind*(int)pow(kind - 1, size - 1) << endl; | ^~~
s935723937
p03963
C++
#include <iostream> using namespace std; int main() { int N,K,x; cin << N << K; for(int i=0;i<(N-1);i++) { x*=(K-1); } x*=(K); cout >> x >> endl; }
a.cc: In function 'int main()': a.cc:6:13: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int') 6 | cin << N << K; | ~~~ ^~ ~ | | | | | int | std::istream {aka std::basic_istream<char>} a.cc:6:13: note: candidate: 'operator<<(int, int)' (built-in) 6 | cin << N << K; | ~~~~^~~~ a.cc:6:13: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int' In file included from /usr/include/c++/14/bits/basic_string.h:47, 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/c++/14/string_view:763:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, basic_string_view<_CharT, _Traits>)' 763 | operator<<(basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/string_view:763:5: note: template argument deduction/substitution failed: a.cc:6:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 6 | cin << N << K; | ^ /usr/include/c++/14/bits/basic_string.h:4077:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 4077 | operator<<(basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4077:5: note: template argument deduction/substitution failed: a.cc:6:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 6 | cin << N << K; | ^ In file included from /usr/include/c++/14/bits/memory_resource.h:38, from /usr/include/c++/14/string:68: /usr/include/c++/14/cstddef:125:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator<<(byte, _IntegerType)' 125 | operator<<(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:125:5: note: template argument deduction/substitution failed: a.cc:6:9: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte' 6 | cin << N << K; | ^~~ In file included from /usr/include/c++/14/bits/ios_base.h:46: /usr/include/c++/14/system_error:339:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const error_code&)' 339 | operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e) | ^~~~~~~~ /usr/include/c++/14/system_error:339:5: note: template argument deduction/substitution failed: a.cc:6:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 6 | cin << N << K; | ^ /usr/include/c++/14/ostream:563:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _CharT)' 563 | operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c) | ^~~~~~~~ /usr/include/c++/14/ostream:563:5: note: template argument deduction/substitution failed: a.cc:6:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 6 | cin << N << K; | ^ /usr/include/c++/14/ostream:573:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char)' 573 | operator<<(basic_ostream<_CharT, _Traits>& __out, char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:573:5: note: template argument deduction/substitution failed: a.cc:6:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 6 | cin << N << K; | ^ /usr/include/c++/14/ostream:579:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char)' 579 | operator<<(basic_ostream<char, _Traits>& __out, char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:579:5: note: template argument deduction/substitution failed: a.cc:6:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 6 | cin << N << K; | ^ /usr/include/c++/14/ostream:590:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char)' 590 | operator<<(basic_ostream<char, _Traits>& __out, signed char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:590:5: note: template argument deduction/substitution failed: a.cc:6:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 6 | cin << N << K; | ^ /usr/include/c++/14/ostream:595:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char)' 595 | operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:595:5: note: template argument deduction/substitution failed: a.cc:6:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 6 | cin << N << K; | ^ /usr/include/c++/14/ostream:654:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const _CharT*)' 654 | operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:654:5: note: template argument deduction/substitution failed: a.cc:6:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 6 | cin << N << K; | ^ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:307:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const char*)' 307 | operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s) | ^~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:307:5: note: template argument deduction/substitution failed: a.cc:6:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 6 | cin << N << K; | ^ /usr/include/c++/14/ostream:671:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const char*)' 671 | operator<<(basic_ostream<char, _Traits>& __out, const char* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:671:5: note: template argument deduction/substitution failed: a.cc:6:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 6 | cin << N << K; | ^ /usr/include/c++/14/ostream:684:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const signed char*)' 684 | operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:684:5: note: template argument deduction/substitution failed: a.cc:6:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 6 | cin << N << K; | ^ /usr/include/c++/14/ostream:689:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const unsigned char*)' 689 | operator<<(basic_ostream<char, _Traits>& __out, const unsigned char* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:689:5: note: template argument deduction/substitution failed: a.cc:6:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 6 | cin << N << K; | ^ /usr/include/c++/14/ostream:810:5: note: candidate: 'template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&)' 810 | operator<<(_Ostream&& __os, const _Tp& __x) | ^~~~~~~~ /usr/include/c++/14/ostream:810:5: note: template argument deduction/substitution failed: /usr/include/c++/14/ostream: In substitution of 'template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&) [with _Ostream = std::basic_istream<char>&; _Tp = int]': a.cc:6:9: required from here 6 | cin << N << K; | ^ /usr/include/c++/14/ostream:810:5: error: no type named 'type' in 'struct std::enable_if<false, void>' 810 | operator<<(_Ostream&& __os, const _Tp& __x) | ^~~~~~~~ a.cc:12:14: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int') 12 | cout >> x >> endl; | ~~~~ ^~ ~ | | | | | int | std::ostream {aka std::basic_ostream<char>} a.cc:12:14: note: candidate: 'operator>>(int, int)' (built-in) 12 | cout >> x >> endl; |
s784967661
p03963
C++
#include<iostream> using namespace std; int main(){ double n,k,sum; cin>>n>>k; sum=k*pow(k-1,n-1); cout<<sum<<endl; return 0; }
a.cc: In function 'int main()': a.cc:6:15: error: 'pow' was not declared in this scope 6 | sum=k*pow(k-1,n-1); | ^~~
s041171921
p03963
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() { long long N,K,A; cin >> N >> K ; A=K; for(int i=1;i<N;i++)) A*=(K-1); cout<<A<<endl; return 0; } Submission
a.cc: In function 'int main()': a.cc:37:29: error: expected primary-expression before ')' token 37 | for(int i=1;i<N;i++)) | ^ a.cc: At global scope: a.cc:47:1: error: 'Submission' does not name a type 47 | Submission | ^~~~~~~~~~
s053554388
p03963
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() { long long N,K,A; cin >> N >> K ; A=K; for(int i=1;i<N;i++)) { A*=(K-1); } cout<<A<<endl; return 0; } Submission
a.cc: In function 'int main()': a.cc:37:29: error: expected primary-expression before ')' token 37 | for(int i=1;i<N;i++)) { | ^ a.cc: At global scope: a.cc:47:1: error: 'Submission' does not name a type 47 | Submission | ^~~~~~~~~~
s356694040
p03963
C++
#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; #include <iostream> using namespace std; int main() { long long N,K,A; cin >> N >> K ; A=K; for(int i=1;i<N;i++)) { A*=(K-1); } cout<<A<<endl; return 0; }
a.cc: In function 'int main()': a.cc:32:29: error: expected primary-expression before ')' token 32 | for(int i=1;i<N;i++)) { | ^
s646308505
p03963
C++
#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; #include <iostream> using namespace std; int main() { long long N,K,A; cin >> N >> K ; A=K; for(int i=1;i<N-1;i++)) { A=A*(K-1); } cout<<A<<endl; return 0; }
a.cc: In function 'int main()': a.cc:32:31: error: expected primary-expression before ')' token 32 | for(int i=1;i<N-1;i++)) { | ^
s261675249
p03963
C++
#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; #include <iostream> using namespace std; int main() { long long N,K,A; cin >> N >> K ; A=K; for(int i=1;i<N-1;i++)) { A=A*(K-1); } cout<<A; return 0; }
a.cc: In function 'int main()': a.cc:32:31: error: expected primary-expression before ')' token 32 | for(int i=1;i<N-1;i++)) { | ^
s616821765
p03963
C++
#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; #include <iostream> using namespace std; int main() { int N,K,A; cin >> N >> K ; int A=K; for(int i=1;i++;i<N-1)) { A=A*(K-1); } cout<<A; return 0; }
a.cc: In function 'int main()': a.cc:30:12: error: redeclaration of 'int A' 30 | int A=K; | ^ a.cc:26:17: note: 'int A' previously declared here 26 | int N,K,A; | ^ a.cc:32:31: error: expected primary-expression before ')' token 32 | for(int i=1;i++;i<N-1)) { | ^
s131875455
p03963
C++
#include <iostream> using namespace std; int main() { int N,K,A; cin >> N >> K ; A=K; for(i=1;i++;i<N-1)) { A=A*(K-1); } cout<<A; return 0; }
a.cc: In function 'int main()': a.cc:11:13: error: 'i' was not declared in this scope 11 | for(i=1;i++;i<N-1)) { | ^ a.cc:11:27: error: expected primary-expression before ')' token 11 | for(i=1;i++;i<N-1)) { | ^
s752818001
p03963
C++
#include <iostream> using namespace std; int main() { int N,K,A; cin >> N >> K ; A=K for(i=1;i++;i<N-1)) { A=A*(K-1) } cout<<A; return 0; }
a.cc: In function 'int main()': a.cc:9:11: error: expected ';' before 'for' 9 | A=K | ^ | ; 10 | 11 | for(i=1;i++;i<N-1)) { | ~~~ a.cc:11:17: error: 'i' was not declared in this scope 11 | for(i=1;i++;i<N-1)) { | ^
s491520748
p03963
C++
#include <iostream> using namespace std; int main() { int N,K,A; cin >> N >> K ; for(i=1;i++;i<N-1)) { } else if (a == b) { cout << 2 << endl; } else if (b == c) { cout << 2 << endl; } else if (c == a) { cout << 2 << endl; } else { cout << 3 << endl; } return 0; }
a.cc: In function 'int main()': a.cc:9:13: error: 'i' was not declared in this scope 9 | for(i=1;i++;i<N-1)) { | ^ a.cc:9:27: error: expected primary-expression before ')' token 9 | for(i=1;i++;i<N-1)) { | ^ a.cc:12:9: error: 'else' without a previous 'if' 12 | else if (a == b) { | ^~~~ a.cc:12:18: error: 'a' was not declared in this scope 12 | else if (a == b) { | ^ a.cc:12:23: error: 'b' was not declared in this scope 12 | else if (a == b) { | ^ a.cc:15:23: error: 'c' was not declared in this scope 15 | else if (b == c) { | ^
s727401347
p03963
Java
import java.util.Scanner; public class B { public static void main(String[] args){ Scanner sc = new Scanner(System.in); long a = sc.nextLong(); long b = sc.nextLong(); long tmp = (long) Math.pow((b-1),(a-1)); if (tmp == 0) System.out.println(b); else System.out.println((int)b*tmp); } }
Main.java:3: error: class B is public, should be declared in a file named B.java public class B { ^ 1 error
s551866312
p03963
C
#include<stdio.h> int main(){ int n,k; scanf("%d %d",&n,&k); int answer=k; for(int i=0;i<k;i++){ answer*=(k-1); } printf("%d",&answer) return 0; }
main.c: In function 'main': main.c:9:21: error: expected ';' before 'return' 9 | printf("%d",&answer) | ^ | ; 10 | return 0; | ~~~~~~
s110235551
p03963
C
#include<stdio.h> int main(){ int n,k; scanf("%d %d",&n,&k); int answer=k; for(i=0;i<k,i++){ answer*=(k-1); } return 0; }
main.c: In function 'main': main.c:6:5: error: 'i' undeclared (first use in this function) 6 | for(i=0;i<k,i++){ | ^ main.c:6:5: note: each undeclared identifier is reported only once for each function it appears in main.c:6:16: error: expected ';' before ')' token 6 | for(i=0;i<k,i++){ | ^ | ;
s372464712
p03963
C
#include<stdio.h> #include<math.h> int main(){ double N,K; scanf("%d %d",&N,&K); if(N%2==0){ int a=N/2; double c=pow(K,a)*pow(K-1,a); printf("%f",c); } else{ int a=N/2+1; double c=pow(K,a)*pow(K-1,a-1) printf("%f",c); } return 0; }
main.c: In function 'main': main.c:7:5: error: invalid operands to binary % (have 'double' and 'int') 7 | if(N%2==0){ | ^ main.c:15:1: error: expected ',' or ';' before 'printf' 15 | printf("%f",c); | ^~~~~~
s214981811
p03963
C++
#include <bits/stdc++.h> using namespace std; #define int long long int n, k; int dp[1010][1010]; int poyo(int i=0, int uyu=1001) { int& ret = dp[i][uyu]; if (ret != -1) return ret; if (i == n) return 1; ret = 0; for (int j = 0; j < k; j++){ if (j == uyu) continue; ret += poyo(i + 1, j); } return ret; } int main() { cin >> n >> k; memset(dp, -1, sizeof(dp)); cout << poyo() << endl; }
cc1plus: error: '::main' must return 'int'
s782514763
p03963
C++
#include <bits/stdc++.h> using namespace std; #define int long long int n, k; int dp[1010][1010]; int poyo(int i=0, int uyu=1001) { int& ret = dp[i][uyu]; if (ret != -1) return ret; if (i == n) return 1; ret = 0; for (int j = 0; j < k; j++){ if (j == uyu) continue; ret += poyo(i + 1, j); } return ret; } int main() { cin >> n >> k; memset(dp, -1, sizeof(dp)); cout << poyo() << endl; }
cc1plus: error: '::main' must return 'int'
s713936647
p03963
C++
#include <cstdlib> #include <cmath> #include <climits> #include <cfloat> #include <map> #include <set> #include <iostream> #include <string> #include <vector> #include <algorithm> #include <sstream> #include <complex> #include <stack> #include <queue> #include <cstdio> #include <cstring> #include <iterator> #include <bitset> #include <unordered_set> #include <unordered_map> #include <fstream> #include <iomanip> #include <cassert> //#include <utility> //#include <memory> //#include <functional> //#include <deque> //#include <cctype> //#include <ctime> //#include <numeric> //#include <list> //#include <iomanip> //#if __cplusplus >= 201103L //#include <array> //#include <tuple> //#include <initializer_list> //#include <forward_list> // //#define cauto const auto& //#else //#endif using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef vector<int> vint; typedef vector<vector<int> > vvint; typedef vector<long long> vll, vLL; typedef vector<vector<long long> > vvll, vvLL; #define VV(T) vector<vector< T > > template <class T> void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){ v.assign(a, vector<T>(b, t)); } template <class F, class T> void convert(const F &f, T &t){ stringstream ss; ss << f; ss >> t; } #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define reep(i,a,b) for(int i=(a);i<(b);++i) #define rep(i,n) reep((i),0,(n)) #define ALL(v) (v).begin(),(v).end() #define PB push_back #define F first #define S second #define mkp make_pair #define RALL(v) (v).rbegin(),(v).rend() #define DEBUG #ifdef DEBUG #define dump(x) cout << #x << " = " << (x) << endl; #define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl; #else #define dump(x) #define debug(x) #endif #define MOD 1000000007LL #define EPS 1e-8 #define INF 0x3f3f3f3f #define INFL 0x3f3f3f3f3f3f3f3fLL #define maxs(x,y) x=max(x,y) #define mins(x,y) x=min(x,y) void mainmain(){ ll n,k; cin>>n>>k; ll ans = K; rep(i,n-1){ ans *= K-1; } cout<<ans<<endl; } signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cout<<fixed<<setprecision(20); mainmain(); }
a.cc: In function 'void mainmain()': a.cc:100:18: error: 'K' was not declared in this scope 100 | ll ans = K; | ^
s687553562
p03963
C
#include<stdio.h> #include<math.h> int main(void){ int N,K; scanf("%d%d",&N,&K); printf("%d",K*(int)pow(K-1,N-1)) return 0; }
main.c: In function 'main': main.c:10:41: error: expected ';' before 'return' 10 | printf("%d",K*(int)pow(K-1,N-1)) | ^ | ; 11 | 12 | return 0; | ~~~~~~
s402017310
p03963
C
#include<stdio.h> #includ<math.h> int main(void){ int N,K; scanf("%d%d",&N,&K); printf("%d",K*pow(K-1,N-1)) return 0; }
main.c:2:2: error: invalid preprocessing directive #includ; did you mean #include? 2 | #includ<math.h> | ^~~~~~ | include main.c: In function 'main': main.c:10:23: error: implicit declaration of function 'pow' [-Wimplicit-function-declaration] 10 | printf("%d",K*pow(K-1,N-1)) | ^~~ main.c:2:1: note: include '<math.h>' or provide a declaration of 'pow' 1 | #include<stdio.h> +++ |+#include <math.h> 2 | #includ<math.h> main.c:10:23: warning: incompatible implicit declaration of built-in function 'pow' [-Wbuiltin-declaration-mismatch] 10 | printf("%d",K*pow(K-1,N-1)) | ^~~ main.c:10:23: note: include '<math.h>' or provide a declaration of 'pow' main.c:10:36: error: expected ';' before 'return' 10 | printf("%d",K*pow(K-1,N-1)) | ^ | ; 11 | 12 | return 0; | ~~~~~~
s441668591
p03963
C
#include <stdio.h> int main(){ int n; unsigned long long int k; scanf("%d %llud", &n, &k); unsigned long long int answer = k; for(i = 1; i < n; i++){ answer = answer * (k - 1); } printf("%llud", answer); }
main.c: In function 'main': main.c:8:9: error: 'i' undeclared (first use in this function) 8 | for(i = 1; i < n; i++){ | ^ main.c:8:9: note: each undeclared identifier is reported only once for each function it appears in
s385417573
p03963
Java
import java.util.Scanner; public class Main{ int ruijo(int n, int r){ if(r == 0) return 1; else return n*ruijo(n,r-1); } public static void main(String[] args){ Scanner sc = new Scanner(System.in); int N = sc.nextInt(), K = sc.nextInt(); System.out.println(K*ruijo(N-1,K-1)); } }
Main.java:13: error: non-static method ruijo(int,int) cannot be referenced from a static context System.out.println(K*ruijo(N-1,K-1)); ^ 1 error
s786674598
p03963
C
#include <stdio.h> int main(void) { int n,k,i,j,pos; printf("please give num of balls and num of paints"); scanf("%d %d",&n,%k); i=0; j=0; for(i=0;i<n;i++) { for(j=0;j<k;j++) { if(i!=j) { pos++; } } } return 0; }
main.c: In function 'main': main.c:6:26: error: expected expression before '%' token 6 | scanf("%d %d",&n,%k); | ^
s507334443
p03963
Java
public class Main { public static void main(String[] args) { int N,K; Scanner sc = new Scanner(System.in); N = sc.nextInt(); K = sc.nextInt(); sc.close(); int pattern = K; for(int i=0;i<N-1;i++){ pattern *= (K-1); } System.out.println(pattern); } }
Main.java:6: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:6: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors
s680609097
p03964
C++
#include <algorithm> #include <boost/optional.hpp> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <string> #include <tuple> #include <type_traits> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> #define REP(i, n) for(int i = 0, i##_MACRO = (n); i < i##_MACRO; i++) #define RANGE(i, a, b) for(int i = (a), i##_MACRO = (b); i < i##_MACRO; i++) #define EACH(e, a) for(auto&& e : a) #define ALL(a) std::begin(a), std::end(a) #define RALL(a) std::rbegin(a), std::rend(a) #define FILL(a, n) memset((a), n, sizeof(a)) #define FILLZ(a) FILL(a, 0) #define INT(x) (static_cast<int>(x)) #define PRECISION(x) std::fixed << std::setprecision(x) using namespace std; using ll = long long; using VI = std::vector<int>; using VI2D = std::vector<vector<int>>; using VLL = std::vector<long long>; using VLL2D = std::vector<vector<long long>>; constexpr int INF = 2e9; constexpr double EPS = 1e-10; constexpr double PI = acos(-1.0); constexpr int dx[] = {-1, 0, 1, 0}; constexpr int dy[] = {0, -1, 0, 1}; template <typename T, std::size_t N> struct make_vector_type { using type = typename std::vector<typename make_vector_type<T, (N - 1)>::type>; }; template <typename T> struct make_vector_type<T, 0> { using type = typename std::vector<T>; }; template <typename T, size_t N> auto make_vector_impl(const std::vector<std::size_t>& ls, T init_value) { if constexpr(N == 0) { return std::vector<T>(ls[N], init_value); } else { return typename make_vector_type<T, N>::type( ls[N], make_vector_impl<T, (N - 1)>(ls, init_value)); } } template <typename T, std::size_t N> auto make_vector(const std::size_t (&ls)[N], T init_value) { std::vector<std::size_t> dimensions(N); for(int i = 0; i < N; i++) { dimensions[N - i - 1] = ls[i]; } return make_vector_impl<T, N - 1>(dimensions, init_value); } template <typename T> std::vector<T> make_vector(std::size_t size, T init_value) { return std::vector<T>(size, init_value); } template <typename T> constexpr int sign(T x) { return x < 0 ? -1 : x > 0 ? 1 : 0; } template <> constexpr int sign(double x) { return x < -EPS ? -1 : x > EPS ? 1 : 0; } template <typename T, typename U> constexpr void chmax(T& m, U x) { m = max<T>(m, x); } template <typename T, typename U> constexpr void chmin(T& m, U x) { m = min<T>(m, x); } template <typename T> constexpr T square(T x) { return x * x; } // 最大公約数を返す constexpr long long gcd(long long a, long long b) { if(a < b) { std::swap(a, b); } long long r = a % b; while(r != 0) { a = b; b = r; r = a % b; } return b; } constexpr ll div_ceil(ll a, ll b) { return (a + b - 1) / b; } int main() { int n; cin >> n; VLL t(n), a(n); REP(i, n) { cin >> t[i] >> a[i]; } ll x = 1, y = 1; REP(i, n) { int multiply = max(div_ceil(x / t[i]), div_ceil(y / a[i])); ll new_x, new_y; x = new_x * multiply; y = new_y * multiply; } cout << x + y << endl; return 0; }
a.cc:2:10: fatal error: boost/optional.hpp: No such file or directory 2 | #include <boost/optional.hpp> | ^~~~~~~~~~~~~~~~~~~~ compilation terminated.
s666157188
p03964
C++
// C++ includes used for precompiling -*- C++ -*- // Copyright (C) 2003-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the // terms of the GNU General Public License as published by the // Free Software Foundation; either version 3, or (at your option) // any later version. // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file stdc++.h * This is an implementation file for a precompiled header. */ // 17.4.1.2 Headers // C #ifndef _GLIBCXX_NO_ASSERT #include <cassert> #endif #include <cctype> #include <cerrno> #include <cfloat> #include <ciso646> #include <climits> #include <clocale> #include <cmath> #include <csetjmp> #include <csignal> #include <cstdarg> #include <cstddef> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #if __cplusplus >= 201103L #include <ccomplex> #include <cfenv> #include <cinttypes> #include <cstdbool> #include <cstdint> #include <ctgmath> #include <cwchar> #include <cwctype> #endif // C++ #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <locale> #include <map> #include <memory> #include <new> #include <numeric> #include <ostream> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdexcept> #include <streambuf> #include <string> #include <typeinfo> #include <utility> #include <valarray> #include <vector> #if __cplusplus >= 201103L #include <array> #include <atomic> #include <chrono> #include <condition_variable> #include <forward_list> #include <future> #include <initializer_list> #include <mutex> #include <random> #include <ratio> #include <regex> #include <scoped_allocator> #include <system_error> #include <thread> #include <tuple> #include <typeindex> #include <type_traits> #include <unordered_map> #include <unordered_set> #endif /*全てのライブラリをインクルード*/ #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int main() { ll n; cin>>n; int a[n][2]={}; rep(i,n){ cin>>a[i][0]>>a[i][1]; } ll count_t=a[0][0]; ll count_a=a[0][1]; for(int i=1;i<n;i++){ int true_number true_number=max(a[i][0]/count_t+1,a[i][1]/count_a+1) count_t=a[i][0]*true_number; count_a=a[i][1]*true_number; } cout<<count_t+count_a<<endl; return 0; }
a.cc: In function 'int main()': a.cc:136:9: error: expected initializer before 'true_number' 136 | true_number=max(a[i][0]/count_t+1,a[i][1]/count_a+1) | ^~~~~~~~~~~ a.cc:138:25: error: 'true_number' was not declared in this scope 138 | count_a=a[i][1]*true_number; | ^~~~~~~~~~~
s731252303
p03964
C++
#include<iostream> #include<cmath> using namespace std; int main () { int N; cin >> N; int T[N]; int N[N]; for (int i = 0; i < N; i ++){ cin >> T[i] >> N[i]; } for (int i = 1; i < N; i ++){ while (T[i - 1] > T[i] || N[i - 1] > N[i]){ int countT = T[i - 1] / T[i]; int countN = N[i - 1] / N[i]; int big = max(countT, countN); T[i] *= (big + 1); N[i] *= (big + 1); } } cout << T[N - 1] + N[N - 1] << '\n'; }
a.cc: In function 'int main()': a.cc:9:7: error: conflicting declaration 'int N [N]' 9 | int N[N]; | ^ a.cc:6:7: note: previous declaration as 'int N' 6 | int N; | ^ a.cc:11:21: error: invalid types 'int[int]' for array subscript 11 | cin >> T[i] >> N[i]; | ^ a.cc:14:32: error: invalid types 'int[int]' for array subscript 14 | while (T[i - 1] > T[i] || N[i - 1] > N[i]){ | ^ a.cc:14:43: error: invalid types 'int[int]' for array subscript 14 | while (T[i - 1] > T[i] || N[i - 1] > N[i]){ | ^ a.cc:16:21: error: invalid types 'int[int]' for array subscript 16 | int countN = N[i - 1] / N[i]; | ^ a.cc:16:32: error: invalid types 'int[int]' for array subscript 16 | int countN = N[i - 1] / N[i]; | ^ a.cc:19:8: error: invalid types 'int[int]' for array subscript 19 | N[i] *= (big + 1); | ^ a.cc:22:23: error: invalid types 'int[int]' for array subscript 22 | cout << T[N - 1] + N[N - 1] << '\n'; | ^
s797046988
p03964
C++
#include<iostream> #include<cmath> using namespace std; int main () { int N; cin >> N; int T[N], N[N]; for (int i = 0; i < N; i ++){ cin >> T[i] >> N[i]; } for (int i = 1; i < N; i ++){ while (arrT[i - 1] > arrT[i] || arrN[i - 1] > arrN[i]){ int countT = arrT[i - 1] / arrT[i]; int countN = arrN[i - 1] / arrN[i]; int big = max(countT, countN); arrT[i] *= (big + 1); arrN[i] *= (big + 1); } } cout << arrT[N - 1] + arrN[N - 1] << '\n'; }
a.cc: In function 'int main()': a.cc:8:13: error: conflicting declaration 'int N [N]' 8 | int T[N], N[N]; | ^ a.cc:6:7: note: previous declaration as 'int N' 6 | int N; | ^ a.cc:10:21: error: invalid types 'int[int]' for array subscript 10 | cin >> T[i] >> N[i]; | ^ a.cc:13:12: error: 'arrT' was not declared in this scope 13 | while (arrT[i - 1] > arrT[i] || arrN[i - 1] > arrN[i]){ | ^~~~ a.cc:13:37: error: 'arrN' was not declared in this scope 13 | while (arrT[i - 1] > arrT[i] || arrN[i - 1] > arrN[i]){ | ^~~~ a.cc:21:11: error: 'arrT' was not declared in this scope 21 | cout << arrT[N - 1] + arrN[N - 1] << '\n'; | ^~~~ a.cc:21:25: error: 'arrN' was not declared in this scope 21 | cout << arrT[N - 1] + arrN[N - 1] << '\n'; | ^~~~
s429385952
p03964
C++
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> T(n), A(n); for (int i = 0; i < n; i++) { cin >> T.at(i) >> A.at(i); } int64_t t = 1; int64_t a = 1; int_64 s, x, y; for (int i = 0; i < n; i++) { x = (t+(T.at(i)-1)) / T.at(i); y = (a+(A.at(i)-1)) / A.at(i); s = max(x, y); t = s * T.at(i); a = s * A.at(i); } cout << t + a << endl; }
a.cc: In function 'int main()': a.cc:15:3: error: 'int_64' was not declared in this scope; did you mean 'rintf64'? 15 | int_64 s, x, y; | ^~~~~~ | rintf64 a.cc:17:5: error: 'x' was not declared in this scope 17 | x = (t+(T.at(i)-1)) / T.at(i); | ^ a.cc:18:5: error: 'y' was not declared in this scope 18 | y = (a+(A.at(i)-1)) / A.at(i); | ^ a.cc:19:5: error: 's' was not declared in this scope 19 | s = max(x, y); | ^
s924990061
p03964
C++
#include<cmath> using namespace std; int main(){ int N; cin >> N; int T[N]; int A[N]; for(int i=0; i<N; i++){ cin >> T[i] >> A[i]; } long long currentT = T[0], currentA = A[0]; for(int i=1; i<N; i++){ long long nextT=T[i], nextA=A[i]; if(nextT < currentT || nextA < currentA){ long long scale = max(currentT/nextT, currentA/nextA); nextT = T[i]*scale; nextA = A[i]*scale; if(nextT < currentT || nextA < currentA){ scale++; nextT = T[i]*scale; nextA = A[i]*scale; } } currentT = nextT; currentA = nextA; } cout << (currentT + currentA) << '\n'; }
a.cc: In function 'int main()': a.cc:6:5: error: 'cin' was not declared in this scope 6 | cin >> N; | ^~~ a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 1 | #include<cmath> +++ |+#include <iostream> 2 | using namespace std; a.cc:29:5: error: 'cout' was not declared in this scope 29 | cout << (currentT + currentA) << '\n'; | ^~~~ a.cc:29:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
s344457452
p03964
C++
#include <bits/stdc++.h> #include <string.h> #include <vector> //s#define rep(i, n) for (int i = 0; i < (n); i++) #define MAX 10000 using namespace std; #define ll long long #define pb push_back #define mp make_pair #define all(a) (a).begin(),(a).end() #define rep(i,a,n) for(int i=a; i<n; i++) #define r0 return 0 #define INF (int)1e15 #define MOD 1000000007 int main(){ long long n; cin>>n; pair<long long,long long>ta; for(long long i=0;i<n;i++){ long long T,A; cin>>T>>A; if(i == 0){ ta = make_pair(T,A); continue;} long long n1 = minn(ta.first,T); long long n2 = minn(ta.second,A); int n = max(n1,n2); ta.first = n*t; ta.second = n*A; } cout<<ta.first + ta.second<<endl; return 0; } /* long long f(long long x){ long long cnt=0; while(x){ cnt += 1; x = x/10; } return cnt; } int main(){ long long n,ans=0; cin>>n; for(long long i=1;i<= sqrt(n);i++){ if(n%i == 0){ if(ans == 0) ans = max(f(i),f(n/i)); else ans = min(max(f(i),f(n/i)),ans); } } cout<<ans<<endl; return 0; } */
a.cc: In function 'int main()': a.cc:37:20: error: 'minn' was not declared in this scope 37 | long long n1 = minn(ta.first,T); | ^~~~ a.cc:41:18: error: 't' was not declared in this scope 41 | ta.first = n*t; | ^
s239809796
p03964
C++
#include<bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> T(N); vector<int> A(N); for (int i = 0; i < N; i++) { cin >> T[i] >> A[i]; } int S = T[0] + A[0]; for(int i = 1; i < N; i++){ if(T[i] < T[i-1] || A[i] < A[i-1]){ int p = max((double)T[i-1]/(double)T[i],(double)A[i-1]/(double)A[i]) + 0.9999999999; T[i] = T[i]*p; A[i] = A[i]*p; } S = T[i] + A[i]; } cout << S << endl;
a.cc: In function 'int main()': a.cc:26:21: error: expected '}' at end of input 26 | cout << S << endl; | ^ a.cc:4:12: note: to match this '{' 4 | int main() { | ^
s590502956
p03964
C++
#include <iostream> #include <vector> #include <cmath> using namespace std; int main() { int n; cin >> n; int t[n], a[n]; for (int i = 0; i < n; i++) { cin >> t[i]; cin >> a[i]; } long long A = 1, B = 1; long long total = 0; for (int i = 0; i < n; i++) { long long x = t[i], y = a[i]; long long n = max((A - 1) / x + 1), (B - 1) / y + 1); A = n * x; B = n * y; } total = A + B; cout << total << endl; return 0; }
a.cc: In function 'int main()': a.cc:19:26: error: no matching function for call to 'max(long long int)' 19 | long long n = max((A - 1) / x + 1), (B - 1) / y + 1); | ~~~^~~~~~~~~~~~~~~~~ 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: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
s848578776
p03964
C++
#include <iostream> #include <vector> #include <cmath> using namespace std; int main() { int n; cin >> n; int t[n], a[n]; for (int i = 0; i < n; i++) { cin >> t[i]; cin >> a[i]; } int A = 1, B = 1; int total = 0; for (int i = 0; i < votes.size(); i++) { int x = t[i], y = a[i]; int n = max(ceil(A / x), ceil(B / y)); A = n * x; B = n * y; } total = A + B; cout << total << endl; return 0; }
a.cc: In function 'int main()': a.cc:17:23: error: 'votes' was not declared in this scope 17 | for (int i = 0; i < votes.size(); i++) { | ^~~~~
s471668730
p03964
C++
#include <iostream> #include <vector> #include <cmath> using namespace std; int main() { int n; cin >> n; int t[n], a[n]; for (int i = 0; i < n; i++) { cin >> t[i]; cin >> a[i]; } int A = 1, B = 1; int total = 0; for (int i = 0; i < votes.size(); i++) { int x = t[i], y = a[i]; int n = max(ceil(A / x), ceil(B / y)); A = n * x; B = n * y; } total = a + b; cout << total << endl; return 0; }
a.cc: In function 'int main()': a.cc:17:23: error: 'votes' was not declared in this scope 17 | for (int i = 0; i < votes.size(); i++) { | ^~~~~ a.cc:23:15: error: 'b' was not declared in this scope 23 | total = a + b; | ^
s284386697
p03964
C++
#include <iostream> #include <vector> #include <cmath> using namespace std; int main() { int n; cin >> n; int t, u; vector<pair<int, int>> votes; for (int i = 0; i < n; i++) { cin >> t; cin >> u votes.push_back(make_pair(t, u)); } int a = 1, b = 1; int total = 0; for (int i = 0; i < votes.size() - 1; i++) { int x = votes[i + 1].first, y = votes[i + 1].second; int n = max(ceil(a / x), ceil(a / y)); a = n * x; b = n * y; } total = a + b; cout << total << endl; return 0; }
a.cc: In function 'int main()': a.cc:14:13: error: expected ';' before 'votes' 14 | cin >> u | ^ | ; 15 | votes.push_back(make_pair(t, u)); | ~~~~~
s454612940
p03964
C++
#include <iostream> #include <vector> #include <cmath> using namespace std; int main() { int n; cin >> n; int t; vector<pair<int, int>> votes; for (int i = 0; i < n; i++) { cin >> t; votes.push_back(t); } int a = 1, b = 1; int total = 0; for (int i = 0; i < votes.size() - 1; i++) { int x = votes[i + 1].first, y = votes[i + 1].second; int n = max(ceil(a / x), ceil(a / y)); a = n * x; b = n * y; } total = a + b; cout << total << endl; return 0; }
a.cc: In function 'int main()': a.cc:14:20: error: no matching function for call to 'std::vector<std::pair<int, int> >::push_back(int&)' 14 | votes.push_back(t); | ~~~~~~~~~~~~~~~^~~ In file included from /usr/include/c++/14/vector:66, from a.cc:2: /usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; value_type = std::pair<int, int>]' 1283 | push_back(const value_type& __x) | ^~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1283:35: note: no known conversion for argument 1 from 'int' to 'const std::vector<std::pair<int, int> >::value_type&' {aka 'const std::pair<int, int>&'} 1283 | push_back(const value_type& __x) | ~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; value_type = std::pair<int, int>]' 1300 | push_back(value_type&& __x) | ^~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1300:30: note: no known conversion for argument 1 from 'int' to 'std::vector<std::pair<int, int> >::value_type&&' {aka 'std::pair<int, int>&&'} 1300 | push_back(value_type&& __x) | ~~~~~~~~~~~~~^~~
s287609216
p03964
C++
#include<bits/stdc++.h> using namespace std; #define f(i,a,b) for(i=a;i<b;i++) #define rep(i,n) f(i,0,n) #define fd(i,a,b) for(i=a;i>=b;i--) #define pb push_back #define mp make_pair #define vi vector< int > #define vl vector< ll > #define ss second #define ff first #define ll long long #define ull unsigned long long #define pii pair< int,int > #define pll pair< ll,ll > #define sz(a) a.size() #define inf (1000*1000*1000+5) #define all(a) a.begin(),a.end() #define tri pair<int,pii> #define vii vector<pii> #define vll vector<pll> #define viii vector<tri> #define pi acosl(-1) #define sqr(x) ((x)*(x)) #define mod (1000*1000*1000+7) #define pdd pair<double,double> #define MEMS(x) memset(x,-1,sizeof(x)) #define MEM(x) memset(x,0,sizeof(x)) template <typename T> string NumberToString(T pNumber) { ostringstream oOStrStream; oOStrStream << pNumber; return oOStrStream.str(); } ll StringToNumber(string s) { stringstream geek(s); ll x=0; geek>>x; return x; } ll modPow(ll x,ll n,ll m) { if(n==0) return 1%m; ll u = modPow(x,n/2,m); u=u*u%m; if(n%2==1) u=u*x%m; return u; } ll gcd(ll a,ll b) { if(b==0) return a; return gcd(b,a%b); } ll seive[1000000]; void seiveForm() { ll i,j; seive[0]=seive[1]=1; f(i,2,100000) { if(seive[i]==0) for(j=i*i;j<1000000;j+=i) seive[j]=1; } } bool isPerfectSquare(ll num) { double n = sqrt(num); return n==(ll)n?true:false; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll i,j,l,temp=0,n,t1,t2,N; cin>>n; ll a[n],t[n]; rep(i,n) cin>>a[i]>>t[i]; t1=a[n-1];t2=t[n-1]; rep(i,n) { N = max((t1+a[i]-1)/a[i]),(t2+t[i]-1/t[i])); t1 = N*a[i]; t2 = N*t[i]; } cout<<t1+t2<<endl; return 0; }
a.cc: In function 'int main()': a.cc:89:16: error: no matching function for call to 'max(long long int)' 89 | N = max((t1+a[i]-1)/a[i]),(t2+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: 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:89:16: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 89 | N = max((t1+a[i]-1)/a[i]),(t2+t[i]-1/t[i])); | ~~~^~~~~~~~~~~~~~~~~~ /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
s223329851
p03964
C++
#include <iostream> #include <iomanip> #include <cstdio> #include <queue> #include <cstring> #include <vector> #include <map> #include <algorithm> #include <cctype> #include <cmath> #include <bitset> #include <set> using namespace std; #define REP(i,n) for(int i=0;i<(int)(n);i++) #define RREP(i,n) for(int i=n-1;i>=0;i--) #define FOR(i,k,n) for(int i=(k);i<(int)(n);i++) #define all(i,n) (i),(i+n) int dx4[4]={1,0,-1,0}; int dy4[4]={0,-1,0,1}; int dx8[8]={1,0,-1,1,-1,1,0,-1}; int dy8[8]={1,1,1,0,0,-1,-1,-1}; typedef pair<int, int> P; typedef pair<string, int> SP; typedef long long ll; typedef pair<ll, ll> PLL; const int INF = 1e9; const ll LLINF = 1e18; const int MAX_V = 1e6+1; const ll mod = 1000000007; // -------------------------------------- int n; int main() { cin.tie(0); ios::sync_with_stdio(false); cin >> n; ll x = 1, y = 1; REP(i, n) { int t, a; cin >> t >> a; ll left = 0, right = max(a, b); while(right - left > 1) { ll mid = (right + left) / 2; if(mid * t >= x && mid * a >= y) right = mid; else left = mid; } x = right * t; y = right * a; } cout << (x + y) << endl; }
a.cc: In function 'int main()': a.cc:50:33: error: 'b' was not declared in this scope 50 | ll left = 0, right = max(a, b); | ^
s524769711
p03964
C++
#include <iostream> using namespace std; typedef unsigned int u_long; void fix(u_long & LC, u_long & LA, u_long RT, u_long RA); int main () { u_long N, T, A, CT, CA; cin >> N; cin >> CT >> CA; while (--N > 0) { cin >> T >> A; fix(CT, CA, T, A); } cout << CT + CA << endl; return 0; } void fix(u_long & LT, u_long & LA, u_long RT, u_long RA) { u_long mt = LT/RT, ma = LA/RA; if (LT % RT != 0) mt++; if (LA % RA != 0) ma++; u_long m = mt > ma ? mt : ma; LT = m * RT; LA = m * RA; }
a.cc:5:22: error: conflicting declaration 'typedef unsigned int u_long' 5 | typedef unsigned int u_long; | ^~~~~~ In file included from /usr/include/stdlib.h:514, 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/x86_64-linux-gnu/sys/types.h:36:18: note: previous declaration as 'typedef __u_long u_long' 36 | typedef __u_long u_long; | ^~~~~~
s016442674
p03964
C++
#include <iostream> using namespace std; typedef unsigned int ulong; void fix(ulong & LC, ulong & LA, ulong RT, ulong RA); int main () { ulong N, T, A, CT, CA; cin >> N; cin >> CT >> CA; while (--N > 0) { cin >> T >> A; fix(CT, CA, T, A); } cout << CT + CA << endl; return 0; } void fix(ulong & LT, ulong & LA, ulong RT, ulong RA) { ulong mt = LT/RT, ma = LA/RA; if (LT % RT != 0) mt++; if (LA % RA != 0) ma++; ulong m = mt > ma ? mt : ma; LT = m * RT; LA = m * RA; }
a.cc:5:22: error: conflicting declaration 'typedef unsigned int ulong' 5 | typedef unsigned int ulong; | ^~~~~ In file included from /usr/include/stdlib.h:514, 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/x86_64-linux-gnu/sys/types.h:148:27: note: previous declaration as 'typedef long unsigned int ulong' 148 | typedef unsigned long int ulong; | ^~~~~
s466069284
p03964
C++
101
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 101 | ^~~
s291048469
p03964
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class atcoder_46_C { static class FastReader{ BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } public String next() { while(st==null || !st.hasMoreElements()) { try { st = new StringTokenizer(br.readLine()); } catch(IOException e) { e.printStackTrace(); } } return st.nextToken(); } int nextInt() { return Integer.parseInt(next()); } long nextLong() { return Long.parseLong(next()); } double nextDouble() { return Double.parseDouble(next()); } } public static void main(String[] args) { FastReader ob = new FastReader(); int n = ob.nextInt(); long arr[][] = new long[n][n]; for(int i=0;i<n;i++) { arr[i][0] = ob.nextLong(); arr[i][1]=ob.nextLong(); } for (int i = 1; i < arr.length; i++) { long k1=1,k2=1; if(arr[i-1][0]>arr[i][0]) { k1=(arr[i-1][0]/arr[i][0]); if(arr[i-1][0]%arr[i][0]!=0) { k1++; } } if(arr[i-1][1]>arr[i][1]) { k2=(arr[i-1][1]/arr[i][1]); if(arr[i-1][1]%arr[i][1]!=0) { k2++; } } k1=Math.max(k1, k2); arr[i][0]*=k1; arr[i][1]*=k1; //System.out.println(arr[i][0]+" "+arr[i][1]); } System.out.println(arr[n-1][0]+arr[n-1][1]); } }
Main.java:6: error: class atcoder_46_C is public, should be declared in a file named atcoder_46_C.java public class atcoder_46_C { ^ 1 error
s054402471
p03964
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class atcoder_46_C { static class FastReader{ BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } public String next() { while(st==null || !st.hasMoreElements()) { try { st = new StringTokenizer(br.readLine()); } catch(IOException e) { e.printStackTrace(); } } return st.nextToken(); } int nextInt() { return Integer.parseInt(next()); } long nextLong() { return Long.parseLong(next()); } double nextDouble() { return Double.parseDouble(next()); } } public static void main(String[] args) { FastReader ob = new FastReader(); int n = ob.nextInt(); int arr[][] = new int[n][n]; for(int i=0;i<n;i++) { arr[i][0] = ob.nextInt(); arr[i][1]=ob.nextInt(); } for (int i = 1; i < arr.length; i++) { int k1=1,k2=1; if(arr[i-1][0]>arr[i][0]) { k1=(arr[i-1][0]/arr[i][0]); if(arr[i-1][0]%arr[i][0]!=0) { k1++; } } if(arr[i-1][1]>arr[i][1]) { k2=(arr[i-1][1]/arr[i][1]); if(arr[i-1][1]%arr[i][1]!=0) { k2++; } } k1=Math.max(k1, k2); arr[i][0]*=k1; arr[i][1]*=k1; System.out.println(arr[i][0]+" "+arr[i][1]); } System.out.println(arr[n-1][0]+arr[n-1][1]); } }
Main.java:6: error: class atcoder_46_C is public, should be declared in a file named atcoder_46_C.java public class atcoder_46_C { ^ 1 error
s470009710
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[][] ta = new int[n][2]; int t = 1; int a = 1; for (int[] x : ta) { int power = max(x[0]/t, x[1]/a); t = x[0]*power; a = x[1]*power; } System.out.println(t+a); } }
Main.java:13: error: cannot find symbol int power = max(x[0]/t, x[1]/a); ^ symbol: method max(int,int) location: class Main 1 error
s108632444
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[] ta = new int[n][2]; int t = 0; int a = 0; for (int[] x : ta) { while(x[0] >= t && x[1] >= a){ x[0] *= 2; x[1] *= 2; } t = x[0]; a = x[1]; } System.out.println(t+a); } }
Main.java:8: error: incompatible types: int[][] cannot be converted to int[] int[] ta = new int[n][2]; ^ Main.java:12: error: incompatible types: int cannot be converted to int[] for (int[] x : ta) { ^ 2 errors
s406181482
p03964
C++
#include<iostream> #include<cstdio> #include<algorithm> #include<cmath> #include<cstring> #include<vector> using namespace std; typedef long long llong; int main(){ int n; cin >> n; llong ax, ay; int x, y; cin >> x >> y; ax = x; ay = y; for (int i = 0; i < n - 1; i++){ scanf("%d %d", &x, &y); if (ax < x) ax = x; else if (ax % x != 0) ax += x - (ax % x); if (ax * y / x < ay) ax += (ay - ax / x * y) / y * x; while (ax * y / x < ay) ax += x; ay = ax * y / x; } cout << ax + ay << endl; return 0;
a.cc: In function 'int main()': a.cc:34:14: error: expected '}' at end of input 34 | return 0; | ^ a.cc:9:11: note: to match this '{' 9 | int main(){ | ^
s957278050
p03964
C++
#include<iostream> #include<cstdio> #include<algorithm> #include<cmath> #include<cstring> #include<vector> using namespace std; typedef long long llong; int main(){ int n; cin >> n; llong ax, ay; int x, y; cin >> x >> y; ax = x; ay = y; for (int i = 0; i < n - 1; i++){ scanf("%d %d" &x, &y); while (!(ax % x == 0)){ ax++; } ay - ax / x * y; while(ax * y / x < ay){ ax += x; } ay = ax * y / x; } cout << ax + ay << endl; return 0; }
a.cc: In function 'int main()': a.cc:21:23: error: invalid operands of types 'const char [6]' and 'int' to binary 'operator&' 21 | scanf("%d %d" &x, &y); | ~~~~~~~ ^~ | | | | | int | const char [6]
s426417972
p03964
Java
import java.util.*; import java.io.*; class Main{ public static void main(String[] args){ FastScanner fsc=new FastScanner(); int n=fsc.nextInt(); long[][] ta=new long[n][2]; long t=0, a=0; for(int i=0;i<n;i++){ long ti=fsc.nextLong(); long ai=fsc.nextLong(); ta[i][0]=ti; ta[i][1]=ai; if(i==0){ t=ti; a=ai; } else{ for(int i=1;;i++){ if(ti*i>=t&& ai*i>=a){ t=ti*i; a=ai*i; break; } } } } fsc.close(); System.out.println(t+a); } // ax+by=gcd(a, b) // return [gcd(a, b), x, y] static long[] extGCD(long a, long b) { long[] ret=new long[3]; if (b == 0) { ret[1] = 1; ret[2] = 0; ret[0] = a; return ret; } long[] midRet = extGCD(b, a%b); ret[0] = midRet[0]; ret[2] = midRet[1] - a/b * midRet[2]; ret[1] = midRet[2]; return ret; } static class FastScanner { private final InputStream in = System.in; private final byte[] buffer = new byte[1024]; private int ptr = 0; private int buflen = 0; private boolean hasNextByte(){ if(ptr<buflen) return true; else{ ptr = 0; try{ buflen = in.read(buffer); } catch(IOException e){ e.printStackTrace(); } if(buflen<=0) return false; } return true; } private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;} private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;} public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();} public String next() { if (!hasNext()) throw new NoSuchElementException(); StringBuilder sb = new StringBuilder(); int b = readByte(); while(isPrintableChar(b)) { sb.appendCodePoint(b); b = readByte(); } return sb.toString(); } public long nextLong() { if (!hasNext()) throw new NoSuchElementException(); long n = 0; boolean minus = false; int b = readByte(); if (b == '-') { minus = true; b = readByte(); } if (b < '0' || '9' < b) throw new NumberFormatException(); while(true){ if ('0' <= b && b <= '9') { n *= 10; n += b - '0'; } else if(b == -1 || !isPrintableChar(b)) return minus ? -n : n; else throw new NumberFormatException(); b = readByte(); } } public int nextInt() { long nl = nextLong(); if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException(); return (int) nl; } public double nextDouble() { return Double.parseDouble(next());} public void close(){ try{in.close();} catch(IOException e){e.printStackTrace();} } } }
Main.java:19: error: variable i is already defined in method main(String[]) for(int i=1;;i++){ ^ 1 error
s774196127
p03964
Java
import java.util.*; public class Main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int N = Integer.parseInt(sc.next()); long T[] = new int[N]; long A[] = new int[N]; long xt = 1; long xa = 1; for(int i = 0; i < N; i++) { T[i] = Integer.parseInt(sc.next()); A[i] = Integer.parseInt(sc.next()); } for(int i = 0; i < N; i++) { long kake = (long) Math.max(Math.ceil((xt - 1 + T[i])/T[i]), Math.ceil((xa - 1 + A[i])/A[i])); xt = T[i] * kake; xa = A[i] * kake; } System.out.println(xt + xa); } }
Main.java:6: error: incompatible types: int[] cannot be converted to long[] long T[] = new int[N]; ^ Main.java:7: error: incompatible types: int[] cannot be converted to long[] long A[] = new int[N]; ^ 2 errors
s880214040
p03964
C++
#include <bits/stdc++.h> #ifdef _DEBUG #define debug(x) cerr << "line: " << __LINE__ << ", func: " << __func__ << " -> " << #x << " = " << x << endl #else #define debug(x) #endif #define all(s) begin(s), end(s) #define rall(s) rbegin(s), rend(s) #define rep(i, a, b) for (int i = (a); i < (b); i++) #define rrep(i, a, b) for (int i = ((a)-1); i >= (b); i--) #define pb push_back #define sz(a) int((a).size()) #define put(a) ((cout) << (a) << (endl)) #define putf(a, n) ((cout) << (fixed) << (setprecision(n)) << (a) << (endl)) #define deg2rad(x) (((x)*PI) / (180.0)) #define rad2deg(x) (((x) * (180.0)) / PI) using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; using i_i = pair<int, int>; using ll_ll = pair<ll, ll>; using d_ll = pair<double, ll>; using ll_d = pair<ll, double>; using d_d = pair<double, double>; template <class T> using vec = vector<T>; static constexpr ll LL_INF = 1LL << 60; static constexpr int I_INF = 1 << 28; static constexpr double PI = static_cast<double>(3.14159265358979323846264338327950288); static constexpr double EPS = numeric_limits<double>::epsilon(); static map<type_index, const char* const> scanType = { {typeid(int), "%d"}, {typeid(ll), "%lld"}, {typeid(double), "%lf"}, {typeid(char), "%c"}}; template <class T> static void scan(vector<T>& v); [[maybe_unused]] static void scan(vector<string>& v, bool isWord = true); template <class T> static inline bool chmax(T& a, T b); template <class T> static inline bool chmin(T& a, T b); template <class T> static inline T gcd(T a, T b); template <class T> static inline T lcm(T a, T b); template <class A, size_t N, class T> static void Fill(A (&arr)[N], const T& val); template <class T> T mod(T a, T m); template <class T> T binary_meguru(T ok, T ng, std::function<bool(T)> solve) { while (abs(ok - ng) > 1) { T mid = (ok + ng) / 2; if (solve(mid)) ok = mid; else ng = mid; } return ok; } int main(int argc, char* argv[]) { ll n; cin >> n; vec<ll> t(n), a(n); for (int i = 0; i < n; i++) scanf("%lld %lld", &t[i], &a[i]); pair<__int128_t, __int128_t> votes{t[0], a[0]}; rep(i, 1, n) { pair<__int128_t, __int128_t> ratio{t[i], a[i]}; auto f = [&votes, &ratio](__int128_t num) { return (votes.first <= ratio.first * num) && (votes.second <= ratio.second * num); }; __int128_t multi = binary_meguru<__int128_t>(1'000'000'000'000'000'000LL, 0LL, f); votes.first = ratio.first * multi; votes.second = ratio.second * multi; } put(votes.first + votes.second); return 0; } template <class T> static void scan(vector<T>& v) { auto tFormat = scanType[typeid(T)]; for (T& n : v) { scanf(tFormat, &n); } } static void scan(vector<string>& v, bool isWord) { if (isWord) { for (auto& n : v) { cin >> n; } return; } int i = 0, size = v.size(); string s; getline(cin, s); if (s.size() != 0) { i++; v[0] = s; } for (; i < size; ++i) { getline(cin, v[i]); } } template <class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } template <class T> inline T gcd(T a, T b) { return __gcd(a, b); } template <class T> inline T lcm(T a, T b) { T c = min(a, b), d = max(a, b); return c * (d / gcd(c, d)); } template <class A, size_t N, class T> void Fill(A (&arr)[N], const T& val) { std::fill((T*)arr, (T*)(arr + N), val); } template <class T> T mod(T a, T m) { return (a % m + m) % m; }
a.cc: In function 'int main(int, char**)': a.cc:15:24: error: ambiguous overload for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and '__int128') 15 | #define put(a) ((cout) << (a) << (endl)) | ~~~~~~ ^~ ~~~ | | | std::ostream {aka std::basic_ostream<char>} a.cc:80:3: note: in expansion of macro 'put' 80 | put(votes.first + votes.second); | ^~~ In file included from /usr/include/c++/14/istream:41, from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127, from a.cc:1: /usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 174 | operator<<(long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 178 | operator<<(unsigned long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 182 | operator<<(bool __n) | ^~~~~~~~ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]' 96 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 189 | operator<<(unsigned short __n) | ^~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]' 110 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 200 | operator<<(unsigned int __n) | ^~~~~~~~ /usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 211 | operator<<(long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 215 | operator<<(unsigned long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 231 | operator<<(double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 235 | operator<<(float __f) | ^~~~~~~~ /usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 243 | operator<<(long double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:573:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char) [with _CharT = char; _Traits = char_traits<char>]' 573 | operator<<(basic_ostream<_CharT, _Traits>& __out, char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:579:5: note: candidate: 'std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char) [with _Traits = char_traits<char>]' 579 | operator<<(basic_ostream<char, _Traits>& __out, char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:590:5: note: candidate: 'std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char) [with _Traits = char_traits<char>]' 590 | operator<<(basic_ostream<char, _Traits>& __out, signed char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:595:5: note: candidate: 'std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char) [with _Traits = char_traits<char>]' 595 | operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c) | ^~~~~~~~
s113570183
p03964
C++
#include<bits/stdc++.h> using namespace std; #define fs first #define sc second #define pb push_back #define mp make_pair #define eb emplace_back #define ALL(A) A.begin(),A.end() #define RALL(A) A.rbegin(),A.rend() typedef long long ll; typedef pair<ll,ll> P; const ll mod=1000000007; const ll LINF=1LL<<60; const int INF=1<<30; int main(){ int n; cin >> n; vector<P> v(n); ll T,A; for(int i = 0; i < n; i++) { cin >> T >> A; v[i] = mp(T,A); } // ll a = 1,b = 1; // for(int i = 0; i < n; i++) { // ll x = max((a + v[i].fs + a - 1)/v[i].fs,(b + v[i].sc - 1)/v[i].sc); // a = x * v[i].fs; // b = x * v[i].sc; // } // cout << a + b << endl; for(int i = 1; i < n; i++) { ll lb = 0; ll ub = 1<<18; while(ub - lb > 1){ ll mid = (lb + ub)/2; if ((a[i - 1].fs <= a[i].fs * mid) && (a[i - 1].sc <= a[i].sc * mid)){ ub = mid; } else{ lb = mid; } // cout << a[i].fs << ' ' << a[i].sc << endl; // cout << mid <<endl; } a[i].fs*= ub; a[i].sc *= ub; // cout << a[i].fs << ' ' << a[i].sc << endl; } cout << a[n - 1].fs + a[n - 1].sc << endl; return 0; }
a.cc: In function 'int main()': a.cc:37:30: error: 'a' was not declared in this scope 37 | if ((a[i - 1].fs <= a[i].fs * mid) && (a[i - 1].sc <= a[i].sc * mid)){ | ^ a.cc:47:17: error: 'a' was not declared in this scope 47 | a[i].fs*= ub; | ^ a.cc:51:17: error: 'a' was not declared in this scope 51 | cout << a[n - 1].fs + a[n - 1].sc << endl; | ^
s720051736
p03964
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; long double t[n], a[n]; for ( int i = 0; i < n; i++){ cin >> t[i] >> a[i]; if ( i == 0)continue; if ( t[i] >= t[i-1] && a[i] >= a[i-1])continue; long double mul = max(ceil(t[i-1]/t[i]), ceil(a[i-1]/a[i])); t[i] = t[i] * mul; a[i] = a[i] * mul; } cout << long long(t[n-1] + a[n-1]) << endl; return 0; }
a.cc: In function 'int main()': a.cc:18:11: error: expected primary-expression before 'long' 18 | cout << long long(t[n-1] + a[n-1]) << endl; | ^~~~
s924692496
p03964
C++
//include //------------------------------------------ #include <bits/stdc++.h> using namespace std; //conversion//include //------------------------------------------ #include <bits/stdc++.h> using namespace std; //conversion //------------------------------------------ inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;} template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();} //math //------------------------------------------- template<class T> inline T sqr(T x) {return x*x;} //typedef //------------------------------------------ typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<string> VS; typedef pair<int, int> P; typedef long long ll; //container util //------------------------------------------ #define ALL(a) (a).begin(),(a).end() #define RALL(a) (a).rbegin(), (a).rend() #define PB push_back #define MP make_pair #define SZ(a) int((a).size()) #define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i) #define EXIST(s,e) ((s).find(e)!=(s).end()) #define SORT(c) sort((c).begin(),(c).end()) //repetition //------------------------------------------ #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) //constant //-------------------------------------------- const double EPS = 1e-10; const double PI = acos(-1.0); //clear memory #define CLR(a) memset((a), 0 ,sizeof(a)) //debug #define dump(x) cerr << #x << " = " << (x) << endl; #define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl; // chmax chmin 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; } long long modinv(long long a, long long p){ // a^{-1} = 1/a mod p (拡張Euclidの互除法) long long b = p, u = 1, v = 0; while (b) { long long t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); } u %= p; if (u < 0) u += p; return u; } void extEuclid(long long a, long long b, long long *x, long long *y){ *x = modinv(a, b); *y = (a*(*x)-1) / b; if(*x < 0 || *y < 0){ *x += b; *y += a; } } int main(void){ int N; cin >> N; ll T[N], A[N]; REP(i,N) cin >> T[i] >> A[i]; ll sumT=T[0], sumA=A[0]; FOR(i,1,N){ ll mul = T[i]*sumA - A[i]*sumT; if(mul == 0) continue; ll x,y; if(mul > 0) extEuclid(A[i], T[i], &x, &y); else extEuclid(T[i], A[i], &y, &x); x *= abs(mul); y *= abs(mul); ll left = 0, right = 100000000000000000; ll n = (left+right)/2; REP(j,10000000){ if(x-n*T[i] >= 0 && y-n*A[i] >= 0){ if(x-(n+1)*T[i] < 0 || y-(n+1)*A[i] < 0) break; left = n; } else{ right = n; } n = (left+right)/2; } x -= n*T[i]; y -= n*A[i]; sumT += x; sumA += y; } cout << sumT+sumA << endl; return 0; } //------------------------------------------ inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;} template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();} //math //------------------------------------------- template<class T> inline T sqr(T x) {return x*x;} //typedef //------------------------------------------ typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<string> VS; typedef pair<int, int> P; typedef long long ll; //container util //------------------------------------------ #define ALL(a) (a).begin(),(a).end() #define RALL(a) (a).rbegin(), (a).rend() #define PB push_back #define MP make_pair #define SZ(a) int((a).size()) #define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i) #define EXIST(s,e) ((s).find(e)!=(s).end()) #define SORT(c) sort((c).begin(),(c).end()) //repetition //------------------------------------------ #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) //constant //-------------------------------------------- const double EPS = 1e-10; const double PI = acos(-1.0); //clear memory #define CLR(a) memset((a), 0 ,sizeof(a)) //debug #define dump(x) cerr << #x << " = " << (x) << endl; #define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl; // chmax chmin 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; } long long modinv(long long a, long long p){ // a^{-1} = 1/a mod p (拡張Euclidの互除法) long long b = p, u = 1, v = 0; while (b) { long long t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); } u %= p; if (u < 0) u += p; return u; } void extEuclid(long long a, long long b, long long *x, long long *y){ *x = modinv(a, b); *y = (a*(*x)-1) / b; if(*x < 0 || *y < 0){ *x += b; *y += a; } } int main(void){ int N; cin >> N; ll T[N], A[N]; REP(i,N) cin >> T[i] >> A[i]; ll sumT=T[0], sumA=A[0]; FOR(i,1,N){ ll mul = T[i]*sumA - A[i]*sumT; if(mul == 0) continue; ll x,y; if(mul > 0) extEuclid(A[i], T[i], &x, &y); else extEuclid(T[i], A[i], &y, &x); x *= abs(mul); y *= abs(mul); ll left = 0, right = 1000000000000000; ll n = (left+right)/2; REP(j,10000000){ if(x-n*T[i] >= 0 && y-n*A[i] >= 0){ if(x-(n+1)*T[i] < 0 || y-(n+1)*A[i] < 0) break; left = n; } else{ right = n; } n = (left+right)/2; } x -= n*T[i]; y -= n*A[i]; sumT += x; sumA += y; } cout << sumT+sumA << endl; return 0; }
a.cc:111:12: error: redefinition of 'int toInt(std::string)' 111 | inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;} | ^~~~~ a.cc:11:12: note: 'int toInt(std::string)' previously defined here 11 | inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;} | ^~~~~ a.cc:112:33: error: redefinition of 'template<class T> std::string toString(T)' 112 | template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();} | ^~~~~~~~ a.cc:12:33: note: 'template<class T> std::string toString(T)' previously declared here 12 | template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();} | ^~~~~~~~ a.cc:115:28: error: redefinition of 'template<class T> T sqr(T)' 115 | template<class T> inline T sqr(T x) {return x*x;} | ^~~ a.cc:15:28: note: 'template<class T> T sqr(T)' previously declared here 15 | template<class T> inline T sqr(T x) {return x*x;} | ^~~ a.cc:139:14: error: redefinition of 'const double EPS' 139 | const double EPS = 1e-10; | ^~~ a.cc:39:14: note: 'const double EPS' previously defined here 39 | const double EPS = 1e-10; | ^~~ a.cc:140:14: error: redefinition of 'const double PI' 140 | const double PI = acos(-1.0); | ^~ a.cc:40:14: note: 'const double PI' previously defined here 40 | const double PI = acos(-1.0); | ^~ a.cc:147:31: error: redefinition of 'template<class T> bool chmax(T&, T)' 147 | template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } | ^~~~~ a.cc:47:31: note: 'template<class T> bool chmax(T&, T)' previously declared here 47 | template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } | ^~~~~ a.cc:148:31: error: redefinition of 'template<class T> bool chmin(T&, T)' 148 | template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } | ^~~~~ a.cc:48:31: note: 'template<class T> bool chmin(T&, T)' previously declared here 48 | template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } | ^~~~~ a.cc:150:11: error: redefinition of 'long long int modinv(long long int, long long int)' 150 | long long modinv(long long a, long long p){ | ^~~~~~ a.cc:50:11: note: 'long long int modinv(long long int, long long int)' previously defined here 50 | long long modinv(long long a, long long p){ | ^~~~~~ a.cc:163:6: error: redefinition of 'void extEuclid(long long int, long long int, long long int*, long long int*)' 163 | void extEuclid(long long a, long long b, long long *x, long long *y){ | ^~~~~~~~~ a.cc:63:6: note: 'void extEuclid(long long int, long long int, long long int*, long long int*)' previously defined here 63 | void extEuclid(long long a, long long b, long long *x, long long *y){ | ^~~~~~~~~ a.cc:172:5: error: redefinition of 'int main()' 172 | int main(void){ | ^~~~ a.cc:72:5: note: 'int main()' previously defined here 72 | int main(void){ | ^~~~
s254314028
p03964
C++
#include<bits/stdc++.h> using namespace std; using ll=long long; int main(){ int i,j,cnt; int n; ll t=2,a=2; cin>>n; ll T[n],A[n]; for(i=0;i<n;i++)cin>>T[i]>>A[i]; for(i=0;i<n;i++){ j=max((t+T[i]-1)/T[i],(a+A[i]-1)/A[i]); while(t>T[i]*j || a>A[i]*j)j++; t=j*T[i]; a=j*A[i]; } } cout<<t+a; }
a.cc:19:3: error: 'cout' does not name a type 19 | cout<<t+a; | ^~~~ a.cc:20:1: error: expected declaration before '}' token 20 | } | ^
s879302382
p03964
C++
#include<bits/stdc++.h> using namespace std; #define int long long #define double long double #define fo(a,b) for(int a=0;a<b;a++) #define Sort(a) sort(a.begin(),a.end()) #define rev(a) reverse(a.begin(),a.end()) #define fi first #define se second #define co(a) cout<<a<<endl #define sz size() #define bgn begin() #define en end() #define pb(a) push_back(a) #define pp() pop_back() #define V vector #define P pair #define V2(a,b,c) V<V<int>> a(b,V<int>(c)) #define V2a(a,b,c,d) V<V<int>> a(b,V<int>(c,d)) #define incin(a) int a; cin>>a #define yuko(a) setprecision(a) #define uni(a) a.erase(unique(a.begin(),a.end()),a.end()) #define pri priority_queue #define Pri priority_queue<int,vector<int>,greater<int>> #define ff fi.fi #define fs fi.se #define sf se.fi #define ss se.se #define all(a) (a).begin(),(a).end() #define Pi P<int,int> #define elif else if //#define min min<int> //#define max max<int> int low(V<int> a,int b){ decltype(a)::iterator c=lower_bound(a.begin(),a.end(),b); int d=c-a.bgn; return d; } int upp(V<int> a,int b){ decltype(a)::iterator c=upper_bound(a.begin(),a.end(),b); int d=c-a.bgn; return d; } template<class T> void cou(vector<vector<T>> a){ int b=a.size(); int c=a[0].size(); fo(i,b){ fo(j,c){ cout<<a[i][j]; if(j==c-1) cout<<endl; else cout<<' '; } } } /*template<> void cou(vector<vector<char>> a){ int b=a.size(); int c=a[0].size(); fo(i,b){ fo(j,c){ cout<<a[i][j]; if(j==c-1) cout<<endl; else cout<<' '; } } }*/ int wari(int a,int b) { if(a%b==0) return a/b; else return a/b+1; } int keta(int a){ double b=a; b=log10(b); int c=b; return c+1; } int souwa(int a){ return a*(a+1)/2; } /*int lcm(int a,int b){ int d=a,e=b,f; if(a<b) swap(a,b); int c,m=1; while(m){ c=a%b; if(c==0){ f=b; m--; } else{ a=b; b=c; } } return d*e/f; } */ int gcm(int a,int b){ if(a%b==0) return b; return gcm(b,a%b); } bool prime(int a){ if(a<2) return false; else if(a==2) return true; else if(a%2==0) return false; double b=sqrt(a); for(int i=3;i<=b;i+=2){ if(a%i==0){ return false; } } return true; } struct Union{ vector<int> par; Union(int a){ par= vector<int>(a,-1); } int find(int a){ if(par[a]<0) return a; else return par[a]=find(par[a]); } bool same(int a,int b){ return find(a)==find(b); } int Size(int a){ return -par[find(a)]; } void unite(int a,int b){ a=find(a); b=find(b); if(a==b) return; if(Size(b)>Size(a)) swap<int>(a,b); par[a]+=par[b]; par[b]=a; } }; int ketas(int a){ string b=to_string(a); int c=0; fo(i,keta(a)){ c+=b[i]-'0'; } return c; } /*int gcm(int a,int b){ if(b==0) return a; return gcm(b,a%b); }*/ int lcm(int a,int b){ return a/gcm(a,b)*b; } /*struct aa{ vector<int> gt; aa(int n){ gt= vector<int>(n, 1); } void c(V<int> d,int b){ if(d[b]==0){ gt[d[b]-1]++; gt[gt.sz-1]++; } else{ gt[d[b]-1]++; c(d,d[d[b]]-1); } } void cok(int a){ cout<<gt[a-1]<<endl; fo(i,a-1) cout<<gt[i]<<endl; } }; */ /*struct dfs(){ }*/ bool fe(int a,int b){ a%=10; b%=10; if(a==0) a=10; if(b==0) b=10; if(a>b) return true; else return false; } int INF=1000000007; struct edge{int s,t,d; }; V<int> mojisyu(string a){ V<int> b(26,0); fo(i,a.sz){ b[a[i]-'a']++; } return b; } int wa2(int a){ if(a%2==1) return a/2; return a/2-1; } /*signed main(){ int a,b,c; cin>>a>>b>>c; V<V<edge>> d(a); fo(i,b){ edge e; cin>>e.s>>e.t>>e.d; d[e.s].pb(e); } V<int> e(a,INF); e[c]=0; priority_queue<P<int,int>,V<P<int,int>>,greater<P<int,int>>> f; f.push({0,c}); int h=INF; while(!f.empty()){ P<int,int> g; g=f.top(); f.pop(); int v = g.second, i = g.first; for(edge l : d[v]){ if(e[l.t] > i + l.d){ e[l.t] = i + l.d; f.push({i+l.d , l.t}); } } } fo(i,a){ if(e[i]==INF) cout<<"INF"<<endl; else cout<<e[i]<<endl; } } ?*/ int nCr(int n,int r){ double a=1; r=min(r,n-r); for(int i=n;i>n-r;i--){ a*=i; a/=n-i+1; } return a; } int a,b,e=0; V<V<char>> c(55,V<char>(55)); V<V<int>> d(55,V<int>(55,0)); void sea(int x,int y){ if(x<0||a<=x||y<0||b<=y||c[x][y]=='#') return; if(d[x][y]) return; d[x][y]++; sea(x+1,y); sea(x-1,y); sea(x,y+1); sea(x,y-1); } signed main(){ int a; cin>>a; V<P<int,int>> b(a); fo(i,a) cin>>b[i].fi>>b[i].se; int c=b[0].fi,d=b[0].se,e,f; for(int i=1;i<a;i++){ e=b[i].fi,f=b[i].se if(c%e==0&&c/e*f==d) continue; if(c>=d){ if(e>=f){
a.cc: In function 'int main()': a.cc:288:5: error: expected ';' before 'if' 288 | if(c%e==0&&c/e*f==d) | ^~ a.cc:291:16: error: expected '}' at end of input 291 | if(e>=f){ | ~^ a.cc:291:16: error: expected '}' at end of input a.cc:290:13: note: to match this '{' 290 | if(c>=d){ | ^ a.cc:291:16: error: expected '}' at end of input 291 | if(e>=f){ | ^ a.cc:286:23: note: to match this '{' 286 | for(int i=1;i<a;i++){ | ^ a.cc:291:16: error: expected '}' at end of input 291 | if(e>=f){ | ^ a.cc:279:14: note: to match this '{' 279 | signed main(){ | ^
s846899865
p03964
C++
#include <bits/stdc++.h> #define REP(i, n) for(int i = 0; i < n; i++) using namespace std; typedef long long ll; int main() { int N; cin >> N; ll t, a, A = 1, T = 1; REP(i, N) { cint >> t >> a; ll n = max((T + t - 1) / t, (A + a - 1) / a); T = n * t; A = n * a; } cout << T + A << endl; }
a.cc: In function 'int main()': a.cc:10:9: error: 'cint' was not declared in this scope; did you mean 'uint'? 10 | cint >> t >> a; | ^~~~ | uint
s280376748
p03964
C++
#include <bits/stdc++.h> #define REP(i, n) for(int i = 0; i < n; i++) using namespace std; typedef long long ll; int main() { int N; cin >> N; ll t, a, A = 1, T = 1; REP(i, N) { cint >> t >> a; ll n = max((T + t - 1) / t, (A + a - 1) / a); T = n * t[i]; A = n * a[i]; } cout << T + A << endl; }
a.cc: In function 'int main()': a.cc:10:9: error: 'cint' was not declared in this scope; did you mean 'uint'? 10 | cint >> t >> a; | ^~~~ | uint a.cc:12:18: error: invalid types 'll {aka long long int}[int]' for array subscript 12 | T = n * t[i]; | ^ a.cc:13:18: error: invalid types 'll {aka long long int}[int]' for array subscript 13 | A = n * a[i]; | ^
s651673982
p03964
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> t(N), a(N); REP(i, N) { cin >> t[i] >> a[i]; } int A, T = 1; for(int i = 0; i < N; i++) { ll x = (T + t[i] - 1) / t[i]; ll y = (A + a[i] - 1) / a[i]; ll n = max(x, y); T = n * t[i]; A = n * a[i]; } cout << T + A << endl; }
a.cc: In function 'int main()': a.cc:7:9: error: 'i' was not declared in this scope 7 | REP(i, N) { cin >> t[i] >> a[i]; } | ^ a.cc:7:5: error: 'REP' was not declared in this scope 7 | REP(i, N) { cin >> t[i] >> a[i]; } | ^~~ a.cc:10:9: error: 'll' was not declared in this scope 10 | ll x = (T + t[i] - 1) / t[i]; | ^~ a.cc:11:11: error: expected ';' before 'y' 11 | ll y = (A + a[i] - 1) / a[i]; | ^~ | ; a.cc:12:11: error: expected ';' before 'n' 12 | ll n = max(x, y); | ^~ | ; a.cc:13:13: error: 'n' was not declared in this scope 13 | T = n * t[i]; | ^
s950860848
p03964
C++
#include <bits/stdc++.h> #define REP(i, n) for(ll i = 0; i < (ll)n; i++) #define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++) #define ALL(obj) (obj).begin(), (obj).end() #define INF (1ll << 60) #define sz(x) int(x.size()) using namespace std; typedef long long ll; using vl = vector<ll>; using vvl = vector<vl>; typedef double db; typedef string str; typedef pair<ll, ll> p; constexpr int MOD = 1000000007; using ll = long long; template <class T> inline bool chmin(T &a, T b) { if(a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if(a < b) { a = b; return true; } return false; } void print(const std::vector<int> &v) { std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; }); std::cout << std::endl; } long long gcd(long long a, long long b) { for(;;) { if(a == 0) return b; b %= a; if(b == 0) return a; a %= b; } } long long lcm(long long a, long long b) { long long temp = gcd(a, b); return temp ? (a / temp * b) : 0; } // シミュレーション // https://ykmaku.hatenablog.com/entry/2018/06/28/155635 int main() { int N; cin >> N; vector<int> T(N), A(N); vector<int> S(N); REP(i, N) { cin >> T[i] >> A[i]; S[i] = T[i] + A[i]; } ll A = 1; ll T = 1; for(int i = 0; i < N; i++) { ll x = (T + t[i] - 1) / t[i]; ll y = (A + a[i] - 1) / a[i]; ll n = max(x, y); T = n * t[i]; A = n * a[i]; } cout << T + A << endl; }
a.cc: In function 'int main()': a.cc:62:8: error: conflicting declaration 'll A' 62 | ll A = 1; | ^ a.cc:56:23: note: previous declaration as 'std::vector<int> A' 56 | vector<int> T(N), A(N); | ^ a.cc:63:8: error: conflicting declaration 'll T' 63 | ll T = 1; | ^ a.cc:56:17: note: previous declaration as 'std::vector<int> T' 56 | vector<int> T(N), A(N); | ^ a.cc:65:21: error: 't' was not declared in this scope 65 | ll x = (T + t[i] - 1) / t[i]; | ^ a.cc:66:21: error: 'a' was not declared in this scope 66 | ll y = (A + a[i] - 1) / a[i]; | ^ a.cc:71:15: error: no match for 'operator+' (operand types are 'std::vector<int>' and 'std::vector<int>') 71 | cout << T + A << endl; | ~ ^ ~ | | | | | vector<[...]> | vector<[...]> In file included from /usr/include/c++/14/bits/stl_algobase.h:67, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_iterator.h:627:5: note: candidate: 'template<class _Iterator> constexpr std::reverse_iterator<_Iterator> std::operator+(typename reverse_iterator<_Iterator>::difference_type, const reverse_iterator<_Iterator>&)' 627 | operator+(typename reverse_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:627:5: note: template argument deduction/substitution failed: a.cc:71:17: note: 'std::vector<int>' is not derived from 'const std::reverse_iterator<_Iterator>' 71 | cout << T + A << endl; | ^ /usr/include/c++/14/bits/stl_iterator.h:1798:5: note: candidate: 'template<class _Iterator> constexpr std::move_iterator<_IteratorL> std::operator+(typename move_iterator<_IteratorL>::difference_type, const move_iterator<_IteratorL>&)' 1798 | operator+(typename move_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1798:5: note: template argument deduction/substitution failed: a.cc:71:17: note: 'std::vector<int>' is not derived from 'const std::move_iterator<_IteratorL>' 71 | cout << T + A << endl; | ^ In file included from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/basic_string.h:3598:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3598 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3598:5: note: template argument deduction/substitution failed: a.cc:71:17: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 71 | cout << T + A << endl; | ^ /usr/include/c++/14/bits/basic_string.h:3616:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3616 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3616:5: note: template argument deduction/substitution failed: a.cc:71:17: note: mismatched types 'const _CharT*' and 'std::vector<int>' 71 | cout << T + A << endl; | ^ /usr/include/c++/14/bits/basic_string.h:3635:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3635 | operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3635:5: note: template argument deduction/substitution failed: a.cc:71:17: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 71 | cout << T + A << endl; | ^ /usr/include/c++/14/bits/basic_string.h:3652:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3652 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3652:5: note: template argument deduction/substitution failed: a.cc:71:17: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 71 | cout << T + A << endl; | ^ /usr/include/c++/14/bits/basic_string.h:3670:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT)' 3670 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3670:5: note: template argument deduction/substitution failed: a.cc:71:17: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 71 | cout << T + A << endl; | ^ /usr/include/c++/14/bits/basic_string.h:3682:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3682 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3682:5: note: template argument deduction/substitution failed: a.cc:71:17: note: 'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 71 | cout << T + A << endl; | ^ /usr/include/c++/14/bits/basic_string.h:3689:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3689 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3689:5: note: template argument deduction/substitution failed: a.cc:71:17: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 71 | cout << T + A << endl; | ^ /usr/include/c++/14/bits/basic_string.h:3696:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3696 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3696:5: note: template argument deduction/substitution failed: a.cc:71:17: note: 'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 71 | cout << T + A << endl; | ^ /usr/include/c++/14/bits/basic_string.h:3719:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3719 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3719:5: note: template argument deduction/substitution failed: a.cc:71:17: note: mismatched types 'const _CharT*' and 'std::vector<int>' 71 | cout << T + A << endl; | ^ /usr/include/c++/14/bits/basic_string.h:3726:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3726 | operator+(_CharT __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3726:5: note: template argument deduction/substitution failed: a.cc:71:17: note: 'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 71 | cout << T + A << endl; | ^ /usr/include/c++/14/bits/basic_string.h:3733:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const _CharT*)' 3733 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3733:5: note: template argument deduction/substitution failed: a.cc:71:17: note: 'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 71 | cout << T + A << endl; | ^ /usr/include/c++/14/bits/basic_string.h:3740:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, _CharT)' 3740 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3740:5: note: template argument deduction/substitution failed: a.cc:71:17: note: 'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 71 | cout << T + A <<
s747943115
p03964
C++
#include <iostream> #include <vector> using namespace std; int lcm(int a, int t){ int A = a, T = t; int gcd = 0; //euclid; if(a < t){ int tmp = t; t = a; a = tmp; } int d = 0; int r = 0; while(r != 0){ d = t / a; r = t % a; t = r; a = d; } gcd = a; return (A * T) / gcd; } int main(){ int N; cin >> N; vector<int> A(N), T(N), L(N); for(int i = 0; i < N; i++) cin >> A[i] >> T[i]; for(int i = 0; i < N; i++) L[i] = lcm(A[i], T[i]); //A'[i] T'[i] = 最小公倍数のlcm[i]の倍数で、A[i-1], T[i-1] 以上で最小なA'[i] T'[i] for(int i = 1; i < N; i++){ int preA = A[i-1], preT = T[i-1]; for(int i = 1; i < 100; i++){ int nowA = lcm[i] * i / T[i], nowT = lcm[i] * i / A[i]; if(nowA < preA || nowT < preT) continue; else{ A[i] = nowA, T[i] = nowT; break; } } } int ans = A[N-1] + T[N-1]; cout << ans; }
a.cc: In function 'int main()': a.cc:37:23: warning: pointer to a function used in arithmetic [-Wpointer-arith] 37 | int nowA = lcm[i] * i / T[i], nowT = lcm[i] * i / A[i]; | ^ a.cc:37:25: error: invalid operands of types 'int(int, int)' and 'int' to binary 'operator*' 37 | int nowA = lcm[i] * i / T[i], nowT = lcm[i] * i / A[i]; | ~~~~~~ ^ ~ | | | | | int | int(int, int) a.cc:38:25: error: 'nowT' was not declared in this scope; did you mean 'nowA'? 38 | if(nowA < preA || nowT < preT) continue; | ^~~~ | nowA
s502303020
p03964
C++
#include <iostream> #include <vector> using namespace std; int lcm(int a, int t){ int A = a, T = t; int gcd = 0; //euclid; if(a < t){ int tmp = t; t = a; a = tmp; } int d = 0; int r = 0; while(r != 0){ d = t / a; r = t % a; t = r; a = d; } gcd = a; return (A * T) / gcd; } int main(){ int N; cin >> N vector<int> A(N), T(N), L(N); for(int i = 0; i < N; i++) cin >> A[i] >> T[i]; for(int i = 0; i < N; i++) L[i] = lcm(A[i], T[i]); //A'[i] T'[i] = 最小公倍数のlcm[i]の倍数で、A[i-1], T[i-1] 以上で最小なA'[i] T'[i] for(int i = 1; i < N; i++){ int preA = A[i-1], preT = T[i-1]; for(int i = 1; i < 100; i++){ int nowA = lcm[i] * i / T[i], nowT = lcm[i] * i / A[i]; if(nowA < preA || nowT < preT) continue; else{ A[i] = nowA, T[i] = nowT; break; } } } int ans = A[N-1] + T[N-1]; cout << ans; }
a.cc: In function 'int main()': a.cc:29:11: error: expected ';' before 'vector' 29 | cin >> N | ^ | ; 30 | vector<int> A(N), T(N), L(N); | ~~~~~~ a.cc:31:37: error: 'A' was not declared in this scope 31 | for(int i = 0; i < N; i++) cin >> A[i] >> T[i]; | ^ a.cc:31:45: error: 'T' was not declared in this scope 31 | for(int i = 0; i < N; i++) cin >> A[i] >> T[i]; | ^ a.cc:32:30: error: 'L' was not declared in this scope 32 | for(int i = 0; i < N; i++) L[i] = lcm(A[i], T[i]); | ^ a.cc:32:41: error: 'A' was not declared in this scope 32 | for(int i = 0; i < N; i++) L[i] = lcm(A[i], T[i]); | ^ a.cc:32:47: error: 'T' was not declared in this scope 32 | for(int i = 0; i < N; i++) L[i] = lcm(A[i], T[i]); | ^ a.cc:35:16: error: 'A' was not declared in this scope 35 | int preA = A[i-1], preT = T[i-1]; | ^ a.cc:37:23: warning: pointer to a function used in arithmetic [-Wpointer-arith] 37 | int nowA = lcm[i] * i / T[i], nowT = lcm[i] * i / A[i]; | ^ a.cc:37:25: error: invalid operands of types 'int(int, int)' and 'int' to binary 'operator*' 37 | int nowA = lcm[i] * i / T[i], nowT = lcm[i] * i / A[i]; | ~~~~~~ ^ ~ | | | | | int | int(int, int) a.cc:37:31: error: 'T' was not declared in this scope 37 | int nowA = lcm[i] * i / T[i], nowT = lcm[i] * i / A[i]; | ^ a.cc:38:25: error: 'nowT' was not declared in this scope; did you mean 'nowA'? 38 | if(nowA < preA || nowT < preT) continue; | ^~~~ | nowA a.cc:38:32: error: 'preT' was not declared in this scope; did you mean 'preA'? 38 | if(nowA < preA || nowT < preT) continue; | ^~~~ | preA a.cc:45:13: error: 'A' was not declared in this scope 45 | int ans = A[N-1] + T[N-1]; | ^ a.cc:45:22: error: 'T' was not declared in this scope 45 | int ans = A[N-1] + T[N-1]; | ^
s387485199
p03964
C++
#include <iostream> #include <vector> using namespace std; int lcm(int a, t){ int A = a, T = t; int gcd = 0; //euclid; if(a < t){ int tmp = t; t = a; a = tmp; } int d = 0; int r = 0; while(r != 0){ d = t / a; r = t % a; t = r; a = d; } gcd = a; return (A * T) / gcd; } int main(){ int N; cin >> N vector<int> A(N), T(N), L(N); for(int i = 0; i < N; i++) cin >> A[i] >> T[i]; for(int i = 0; i < N; i++) L[i] = lcm(A[i], T[i]); //A'[i] T'[i] = 最小公倍数のlcm[i]の倍数で、A[i-1], T[i-1] 以上で最小なA'[i] T'[i] for(int i = 1; i < N; i++){ int preA = A[i-1], preT = T[i-1]; for(int i = 1; i < 100; i++){ int nowA = lcm[i] * i / T[i], nowT = lcm[i] * i / A[i]; if(nowA < preA || nowT < preT) continue; else{ A[i] = nowA, T[i] = nowT; break; } } } int ans = A[N-1] + T[N-1]; cout << ans; }
a.cc:6:16: error: 't' has not been declared 6 | int lcm(int a, t){ | ^ a.cc: In function 'int lcm(int, int)': a.cc:7:18: error: 't' was not declared in this scope 7 | int A = a, T = t; | ^ a.cc: In function 'int main()': a.cc:29:11: error: expected ';' before 'vector' 29 | cin >> N | ^ | ; 30 | vector<int> A(N), T(N), L(N); | ~~~~~~ a.cc:31:37: error: 'A' was not declared in this scope 31 | for(int i = 0; i < N; i++) cin >> A[i] >> T[i]; | ^ a.cc:31:45: error: 'T' was not declared in this scope 31 | for(int i = 0; i < N; i++) cin >> A[i] >> T[i]; | ^ a.cc:32:30: error: 'L' was not declared in this scope 32 | for(int i = 0; i < N; i++) L[i] = lcm(A[i], T[i]); | ^ a.cc:32:41: error: 'A' was not declared in this scope 32 | for(int i = 0; i < N; i++) L[i] = lcm(A[i], T[i]); | ^ a.cc:32:47: error: 'T' was not declared in this scope 32 | for(int i = 0; i < N; i++) L[i] = lcm(A[i], T[i]); | ^ a.cc:35:16: error: 'A' was not declared in this scope 35 | int preA = A[i-1], preT = T[i-1]; | ^ a.cc:37:23: warning: pointer to a function used in arithmetic [-Wpointer-arith] 37 | int nowA = lcm[i] * i / T[i], nowT = lcm[i] * i / A[i]; | ^ a.cc:37:25: error: invalid operands of types 'int(int, int)' and 'int' to binary 'operator*' 37 | int nowA = lcm[i] * i / T[i], nowT = lcm[i] * i / A[i]; | ~~~~~~ ^ ~ | | | | | int | int(int, int) a.cc:37:31: error: 'T' was not declared in this scope 37 | int nowA = lcm[i] * i / T[i], nowT = lcm[i] * i / A[i]; | ^ a.cc:38:25: error: 'nowT' was not declared in this scope; did you mean 'nowA'? 38 | if(nowA < preA || nowT < preT) continue; | ^~~~ | nowA a.cc:38:32: error: 'preT' was not declared in this scope; did you mean 'preA'? 38 | if(nowA < preA || nowT < preT) continue; | ^~~~ | preA a.cc:45:13: error: 'A' was not declared in this scope 45 | int ans = A[N-1] + T[N-1]; | ^ a.cc:45:22: error: 'T' was not declared in this scope 45 | int ans = A[N-1] + T[N-1]; | ^
s968505617
p03964
C++
#include <isotream> #include <vector> using namespace std; int lcm(int a, t){ int A = a, T = t; int gcd = 0; //euclid; if(a < t){ int tmp = t; t = a; a = tmp; } int d = 0; int r = 0; while(r != 0){ d = t / a; r = t % a; t = r; a = d; } gcd = a; return (A * T) / gcd; } int main(){ int N; cin >> N vector<int> A(N), T(N), L(N); for(int i = 0; i < N; i++) cin >> A[i] >> T[i]; for(int i = 0; i < N; i++) L[i] = lcm(A[i], T[i]); //A'[i] T'[i] = 最小公倍数のlcm[i]の倍数で、A[i-1], T[i-1] 以上で最小なA'[i] T'[i] for(int i = 1; i < N; i++){ int preA = A[i-1], preT = T[i-1]; for(int i = 1; i < 100; i++){ int nowA = lcm[i] * i / T[i], nowT = lcm[i] * i / A[i]; if(nowA < preA || nowT < preT) continue; else{ A[i] = nowA, T[i] = nowT; break; } } } int ans = A[N-1] + T[N-1]; cout << ans; }
a.cc:1:10: fatal error: isotream: No such file or directory 1 | #include <isotream> | ^~~~~~~~~~ compilation terminated.
s810598657
p03964
C++
3 #include <iostream> #include <cstring> #include <map> #include <iomanip> #include <algorithm> #include <cmath> #include <set> #include <vector> #include <queue> #include <list> #include <numeric> #include <stdio.h> #include <string> #include <cstdlib> #include <math.h> #include <stack> #include <climits> #include <bitset> #include <utility> using namespace std; typedef long long ll; template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } // const ll INF = 1LL <<60; const int INF = 10000; //最小公倍数 ll gcd(ll x, ll y) { ll tmp = 0; if (x < y){ tmp=x; x=y; y=tmp; } while (y > 0) { ll r = x % y; x = y; y = r; } return x; } //最大公倍数 ll lcm(ll x,ll y){ return x/gcd(x,y)*y; } //階乗 ll kaijo(ll k){ ll sum = 1; for (ll i = 1; i <= k; ++i) { sum *= i; sum%=1000000000+7; } return sum; } //for(int i = ; i < ; i++){} ll lmax(ll s,ll t){ if(s>t){ return s; } else{ return t; } } ll lmin(ll s,ll t){ if(s<t){ return s; } else{ return t; } } // ここから開始 int main(){ int n; cin>>n; int t[n],a[n]; for(int i = 0; i < n; i++){ cin>>t[i]>>a[i]; } ll tt = t[0]; ll aa = a[0]; for(int i = 1; i < n; i++){ if(tt<=t[i]&&aa<=a[i]) { tt = t[i]; aa = a[i]; // cout<<"IF"; } else{ ll mod = lmax((tt-1)/t[i]+1,(aa-1)/a[i]+1); ll tmptt=t[i],tmpaa = a[i]; tt = t[i]*mod; aa = a[i]*mod; // cout<<"ELSE"; } // cout<<tt<<" "<<aa<<endl; } cout<<tt+aa<<endl; return 0; }
a.cc:1:3: error: stray '#' in program 1 | 3 #include <iostream> | ^ a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 3 #include <iostream> | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/bits/stl_tree.h:63, from /usr/include/c++/14/map:62, from a.cc:3: /usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity 164 | __is_null_pointer(std::nullptr_t) | ^ /usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)' 159 | __is_null_pointer(_Type) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std' 164 | __is_null_pointer(std::nullptr_t) | ^~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std' 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ In file included from /usr/include/string.h:33, from /usr/include/c++/14/cstring:43, from a.cc:2: /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared 2086 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope 2087 | struct remove_extent<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid 2087 | struct remove_extent<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared 2099 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope 2100 | struct remove_all_extents<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid 2100 | struct remove_all_extents<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared 2171 | template<std::size_t _Len> | ^~~ /usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope 2176 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^~~~ /usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^ /usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope 2202 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope 2203 | struct __attribute__((__aligned__((_Align)))) { } __align; | ^~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:65: /usr/include/c++/14/bits/stl_iterator_base_types.h:125:67: error: 'ptrdiff_t' does not name a type 125 | template<typename _Category, typename _Tp, typename _Distance = ptrdiff_t, | ^~~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_types.h:1:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' +++ |+#include <cstddef> 1 | // Types used in iterator implementation -*- C++ -*- /usr/include/c++/14/bits/stl_iterator_base_types.h:214:15: error: 'ptrdiff_t' does not name a type 214 | typedef ptrdiff_t difference_type; | ^~~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_types.h:214:15: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/bits/stl_iterator_base_types.h:225:15: error: 'ptrdiff_t' does not name a type 225 | typedef ptrdiff_t difference_type; | ^~~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_types.h:225:15: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' In file included from /usr/include/c++/14/bits/stl_algobase.h:66: /usr/include/c++/14/bits/stl_iterator_base_funcs.h:112:5: error: 'ptrdiff_t' does not name a type 112 | ptrdiff_t | ^~~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:66:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 65 | #include <debug/assertions.h> +++ |+#include <cstddef> 66 | #include <bits/stl_iterator_base_types.h> /usr/include/c++/14/bits/stl_iterator_base_funcs.h:118:5: error: 'ptrdiff_t' does not name a type 118 | ptrdiff_t | ^~~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:118:5: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' In file included from /usr/include/c++/14/bits/stl_iterator.h:67,
s964741776
p03964
C++
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int kuriage(long long int x, long long int y) { return (x + (y - 1)) / y; } int main() { int n; cin >> n; long long int a, b; cin >> a >> b; rep (i, n - 1) { long long int c, d; cin >> c >> d; if (a <= c && b <= d) { a = c; b = d; } else { long long int kake = max (kuriage(a,c), kuriage(b,d)) a = c * kake; b = d * kake; } } cout << a + b << endl; }
a.cc: In function 'int main()': a.cc:22:13: error: expected ',' or ';' before 'a' 22 | a = c * kake; b = d * kake; | ^
s068894814
p03964
C++
#include <bits/stdc++.h> using namespace std; // def #define debug(x) cout << #x << ": " << x << endl #define out(x) cout << x << endl #define repeat(i, a, b) for (int i = (a); i < (b); i++) #define revrepeat(i, a, b) for (int i = (b)-1; i >= (a); i--) #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define revrep(i, n) for (int i = (n)-1; i >= 0; i--) typedef long long ll; typedef pair<int, int> P; const int M = 1e9 + 7; const int INF = 1e9; const int MAX_V = 1000 + 5; const int MAX_N = 1e5 + 5; int main() { ll n; cin >> n; vector<P> p; rep(i, n) { ll a, b; cin >> a >> b; p.push_back(P(a, b)); } ll ans; x, y; x = p[0].first; y = p[0].second; repeat(i, 1, n) { ll f = p[i].first; ll s = p[i].second; if (x > f || y > s) { ll a = (x + f - 1) / f; ll b = (y + s - 1) / s; ll mul = max(a, b); x = f * mul; y = s * mul; } else { x = f; y = s; } } ans = x + y; cout << ans << endl; }
a.cc: In function 'int main()': a.cc:28:5: error: 'x' was not declared in this scope 28 | x, y; | ^ a.cc:28:8: error: 'y' was not declared in this scope 28 | x, y; | ^
s153641478
p03964
C++
#include <bits/stdc++.h> #define REP(i, n) for(int i = 0; i < n; ++i) #define REPP(i, n) for(int i = 1; i <= n; ++i) #define REPR(i, n) for(int i = n-1; i >= 0; --i) #define FOR(i, m, n) for(int i = m; i < n; ++i) #define ALL(v) v.begin(), v.end() using namespace std; typedef long long ll; const ll MOD = 1000000007; template<typename T1,typename T2> inline void chmin(T1 &a,T2 b) {if(a>b) a=b;} template<typename T1,typename T2> inline void chmax(T1 &a,T2 b) {if(a<b) a=b;} int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; vector<int> t(n),a(n); REP(i,n) cin >> t[i] >> a[i]; ll x = 1, y = 1, n= 1;; REPP(i,n-1) { n = max((t[i-1]*n + t[i]-1)/t[i], (a[i-1]*n + a[i]-1)/a[i]); x = t[i]*n, y = a[i]*n; } ll ans = x+y; cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:20:22: error: conflicting declaration 'll n' 20 | ll x = 1, y = 1, n= 1;; | ^ a.cc:17:9: note: previous declaration as 'int n' 17 | int n; cin >> n; | ^
s992330708
p03964
C++
#include<algorithm> #include<climits> #include<cmath> #include<cstdio> #include<cstdlib> #include<ctime> #include<string> #include<cstring> #include<vector> #include<stack> #include<queue> #include<set> #include<bitset> using namespace std; typedef long long ll; typedef unsigned long long ull; template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } #define mod 1000000007LL #define eps 0.0001 #define pi acos(-1) #define INF 10000000000000000 #define rep(i, n) for(int i = 0;i < n;++i) #define rep1(i, n) for(int i = 1;i < n;++i) #define pri(x) cout << (x) << "\n" #define pri2(x, y) cout << (x) << " " << (y) << "\n" #define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n" #define chmin int main(){ ios::sync_with_stdio(false); cin.tie(0); // --------------------- // コーディング開始 // --------------------- ll n; cin >> n; ll t[n],a[n]; rep(i,n){ cin >> t[i] >> a[i]; } ll T = 1; ll A = 1; rep(i,n){ ll T2 = T/t[i]; ll A2 = A/a[i]; if(T%t[i]!=0) T2++; if(A%a[i]!=0) A2++; ll N = max(T2,A2); T = N*t[i]; A = N*a[i]; } pri(T+A); return 0; }
a.cc: In function 'int main()': a.cc:39:10: error: incomplete type 'std::ios' {aka 'std::basic_ios<char>'} used in nested name specifier 39 | ios::sync_with_stdio(false); | ^~~~~~~~~~~~~~~ a.cc:40:5: error: 'cin' was not declared in this scope 40 | cin.tie(0); | ^~~ a.cc:15:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 14 | #include<bitset> +++ |+#include <iostream> 15 | a.cc:31:16: error: 'cout' was not declared in this scope 31 | #define pri(x) cout << (x) << "\n" | ^~~~ a.cc:61:5: note: in expansion of macro 'pri' 61 | pri(T+A); | ^~~ a.cc:31:16: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 31 | #define pri(x) cout << (x) << "\n" | ^~~~ a.cc:61:5: note: in expansion of macro 'pri' 61 | pri(T+A); | ^~~
s011974550
p03964
C++
#include<iostream> #include<algorithm> #include<climits> #include<cmath> #include<cstdio> #include<cstdlib> #include<ctime> #include<string> #include<cstring> #include<vector> #include<stack> #include<queue> #include<set> #include<bitset> using namespace std; typedef long long ll; typedef unsigned long long ull; template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } #define mod 1000000007LL #define eps 0.0001 #define pi acos(-1) #define INF 10000000000000000 #define rep(i, n) for(int i = 0;i < n;++i) #define rep1(i, n) for(int i = 1;i < n;++i) #define pri(x) cout << (x) << "\n" #define pri2(x, y) cout << (x) << " " << (y) << "\n" #define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n" #define chmin int main(){ ios::sync_with_stdio(false); cin.tie(0); // --------------------- // コーディング開始 // --------------------- ll n; cin >> n; ll t[n],a[n]; rep(i,n){ cin >> t[i] >> a[i]; } ll T = 1; lnt A = 1; rep(i,n){ ll T2 = T/t[i]; ll A2 = A/a[i]; if(T%t[i]!=0) T2++; if(A%a[i]!=0) A2++; ll N = max(T2,A2); T = N*t[i]; A = N*a[i]; } pri(T+A); return 0; }
a.cc: In function 'int main()': a.cc:51:5: error: 'lnt' was not declared in this scope; did you mean 'int'? 51 | lnt A = 1; | ^~~ | int a.cc:54:17: error: 'A' was not declared in this scope 54 | ll A2 = A/a[i]; | ^ a.cc:61:11: error: 'A' was not declared in this scope 61 | pri(T+A); | ^ a.cc:31:25: note: in definition of macro 'pri' 31 | #define pri(x) cout << (x) << "\n" | ^
s678139121
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 xRatio[]=new int[n]; int yRatio[]=new int[n]; int x[]=new int[n]; int y[]=new int[n]; for(int i=0;i<n;i++){ xRatio[i]=sc.nextInt(); yRatio[i]=sc.nextInt(); } sc.close(); x[0]=xRatio[0]; y[0]=yRatio[0]; for(int i=1;i<n;i++){ double ratio1=Math.ceil((double)x[i-1]/xRatio[i]); double ratio2=Math.ceil((double)y[i-1]/yRatio[i]); double ratio=Math.max(ratio1,ratio2); x[i]=(int)xRatio[i]*(int)ratio; y[i]=(int)yRatio[i]*(int)ratio; } System.out.println(x[i]+y[i]); } }
Main.java:24: error: cannot find symbol System.out.println(x[i]+y[i]); ^ symbol: variable i location: class Main Main.java:24: error: cannot find symbol System.out.println(x[i]+y[i]); ^ symbol: variable i location: class Main 2 errors
s604071460
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 xRatio[]=new int[n]; int yRatio[]=new int[n]; int x[]=new int[n]; int y[]=new int[n]; for(int i=0;i<n;i++){ xRatio[i]=sc.nextInt(); yRatio[i]=sc.nextInt(); } sc.close(); x[0]=xRatio[0]; y[0]=yRatio[0]; for(int i=1;i<n;i++){ double ratio1=Math.ceil((double)x[i-1]/xRatio[i]); double ratio2=Math.ceil((double)y[i-1]/yRatio[i]); double ratio=Math.max(ratio1,ratio2); x[i]=(int)xRatio[i]*(int)ratio; y[i]=(int)yRatio[i]*(int)ratio; } System.out.println(x[i]+y[i]); } }
Main.java:24: error: cannot find symbol System.out.println(x[i]+y[i]); ^ symbol: variable i location: class Main Main.java:24: error: cannot find symbol System.out.println(x[i]+y[i]); ^ symbol: variable i location: class Main 2 errors
s017788226
p03964
C++
int main() { int n; cin >> n; int a[n], b[n]; for (int i = 0; i < n; i++) cin >> a[i] >> b[i]; ll l = a[0], r = b[0]; for (int i = 1; i < n; i++) { ll x = a[i], y = b[i]; ll a1 = l / x + (l % x == 0 ? 0 : 1); ll a2 = r / y + (r % y == 0 ? 0 : 1); ll k = max(a1, a2); l = x * k; r = y * k; } cout << l + r; } main()
a.cc: In function 'int main()': a.cc:3:5: error: 'cin' was not declared in this scope 3 | cin >> n; | ^~~ a.cc:7:5: error: 'll' was not declared in this scope 7 | ll l = a[0], r = b[0]; | ^~ a.cc:9:11: error: expected ';' before 'x' 9 | ll x = a[i], y = b[i]; | ^~ | ; a.cc:10:11: error: expected ';' before 'a1' 10 | ll a1 = l / x + (l % x == 0 ? 0 : 1); | ^~~ | ; a.cc:11:11: error: expected ';' before 'a2' 11 | ll a2 = r / y + (r % y == 0 ? 0 : 1); | ^~~ | ; a.cc:12:11: error: expected ';' before 'k' 12 | ll k = max(a1, a2); | ^~ | ; a.cc:13:9: error: 'l' was not declared in this scope 13 | l = x * k; | ^ a.cc:13:13: error: 'x' was not declared in this scope 13 | l = x * k; | ^ a.cc:13:17: error: 'k' was not declared in this scope 13 | l = x * k; | ^ a.cc:14:9: error: 'r' was not declared in this scope 14 | r = y * k; | ^ a.cc:14:13: error: 'y' was not declared in this scope 14 | r = y * k; | ^ a.cc:16:5: error: 'cout' was not declared in this scope 16 | cout << l + r; | ^~~~ a.cc:16:13: error: 'l' was not declared in this scope 16 | cout << l + r; | ^ a.cc:16:17: error: 'r' was not declared in this scope 16 | cout << l + r; | ^ a.cc: At global scope: a.cc:19:7: error: expected constructor, destructor, or type conversion at end of input 19 | main() | ^
s026356821
p03964
C++
#include<iostresm> #include<cmath> using namespace std; int main{ int N,T[],A[],i,t=1,a=1,addt=0,adda=0; cin>>N; T = new int[N]; A = new int[N]; for(i=0;i<N;i++){ cin>>T[i]>>A[i]; } t=T[0]; a=A[0]; for(i=1;i<N;i++,addt=0,adda=0){ while(fmod(((a+adda),A[i]))==0){ adda++; } addt=T[i]*(a+adda)/A[i]-t; a+=adda; t+=addt; } cout << a+t<<endl; return 0; }
a.cc:1:9: fatal error: iostresm: No such file or directory 1 | #include<iostresm> | ^~~~~~~~~~ compilation terminated.
s318894996
p03964
C++
#include<cstdio> int main(){ int n; scanf("%d", &n); int t[n], a[n]; for(int i=0; i<n; i++){ scanf("%d %d", &t[i], &a[i]); } long long T, A, n; for(int i = 0; i < n; i++){ if(i == 0){ n = 1; } else{ long long x = T / t[i]; long long y = A / a[i]; if(x != 0) x++; if(y != 0) y++; n = max(x,y); } T = t[i] * n; A = a[i] * n; } printf("%d", T+A); return 0; }
a.cc: In function 'int main()': a.cc:11:19: error: conflicting declaration 'long long int n' 11 | long long T, A, n; | ^ a.cc:3:7: note: previous declaration as 'int n' 3 | int n; | ^ a.cc:22:11: error: 'max' was not declared in this scope 22 | n = max(x,y); | ^~~
s164498723
p03964
Java
import java.util.*; public class Main { public static void main(String[] args) throws Exception { // Your code here! Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long a = sc.nextLong(); long b = sc.nextLong(); while (n-- > 1) { long newA = sc.nextLong(); long newB = sc.nextLong(); long x = (long)Math.ceil(Math.max((double)a / newA), Math.max((double)b / newB)); a = newA * x; b = newB * x; } System.out.println(a+b); } }
Main.java:14: error: no suitable method found for max(double) long x = (long)Math.ceil(Math.max((double)a / newA), Math.max((double)b / newB)); ^ method Math.max(int,int) is not applicable (actual and formal argument lists differ in length) method Math.max(long,long) is not applicable (actual and formal argument lists differ in length) method Math.max(float,float) is not applicable (actual and formal argument lists differ in length) method Math.max(double,double) is not applicable (actual and formal argument lists differ in length) Main.java:14: error: no suitable method found for max(double) long x = (long)Math.ceil(Math.max((double)a / newA), Math.max((double)b / newB)); ^ method Math.max(int,int) is not applicable (actual and formal argument lists differ in length) method Math.max(long,long) is not applicable (actual and formal argument lists differ in length) method Math.max(float,float) is not applicable (actual and formal argument lists differ in length) method Math.max(double,double) is not applicable (actual and formal argument lists differ in length) 2 errors
s079952785
p03964
Java
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.math.BigDecimal; import java.math.RoundingMode; import java.util.Arrays; import java.util.HashMap; import java.util.Map; import java.util.NoSuchElementException; import java.util.stream.IntStream; import java.util.stream.Stream; public class Main { public static void main(String[] args) throws IOException { new Main().solve(); } private void solve() throws IOException { try { // solveA(); // solveB(); solveC(); // solveD(); // solveE(); // solveF(); } finally { if (in != null) { in.close(); } if (out != null) { out.flush(); out.close(); } } } private void solveA() { Map<Integer, Integer> wk = IntStream.range(0, 3).collect(() -> new HashMap<Integer, Integer>(), (t, i) -> { t.merge(nextInt(), 1, (oldV, newV) -> oldV + newV); }, (t, u) -> { t.putAll(u); }); out.println(wk.size()); } /* * 10個 8色 * 8 7(8-1:隣の色を抜く) 7(8-1:隣の色を抜く) 7(8-1:隣の色を抜く) 7(8-1:隣の色を抜く) 7(8-1:隣の色を抜く) ・・・・ */ private void solveB() { long numN = nextLong(); long numK = nextLong(); long res = (long) numK * (long) Math.pow(numK - 1, numN - 1); out.println(res); } private void solveC() { int numN = nextInt(); long[][] wk = IntStream.range(0, numN).collect(() -> new long[numN][2], (t, i) -> { t[i][0] = nextLong(); t[i][1] = nextLong(); }, (t, u) -> { Stream.concat(Arrays.stream(t), Arrays.stream(u)); }); long[][] memo = new long[numN][2]; memo[0][0] = wk[0][0]; memo[0][1] = wk[0][1]; chkC(wk, memo, 1); out.println(memo[numN - 1][0] + memo[numN - 1][1]); } private void chkC(long[][] wk, long[][] memo, int currentI) { if (currentI >= wk.length) { return; } long x = wk[currentI][0]; long y = wk[currentI][1]; long a = memo[currentI - 1][0]; long b = memo[currentI - 1][1]; long p13 = new BigDecimal(a).divide(new BigDecimal(x),RoundingMode.UP).longValue(); long p24 = new BigDecimal(b).divide(new BigDecimal(y),RoundingMode.UP).longValue(); long base = Math.max(p13 > 0 ? p13 : 1, p24 > 0 ? p24 : 1); memo[currentI][0] = base * x; memo[currentI][1] = base * y; chkC(wk, memo, currentI + 1); } private long maxKoubai(long v1, long v2) { return (v1 * v2) / minKouyaku(v1, v2); } private long minKouyaku(long v1, long v2) { long w1 = Math.min(v1, v2); long w2 = Math.max(v1, v2); long amari = w2 % w1; while (w1 != 0) { if (amari == 0) { break; } w2 = w1; w1 = amari; amari = w2 % w1; } return w1 } private void solveD() { int numN = nextInt(); out.println(""); } private void solveE() { int numN = nextInt(); out.println(""); } private void solveF() { int numN = nextInt(); out.println(""); } private final PrintWriter out = new PrintWriter(System.out); private final InputStream in = System.in; private final byte[] buffer = new byte[1024]; private int ptr = 0; private int buflen = 0; private boolean hasNextByte() { if (ptr < buflen) { return true; } else { ptr = 0; try { buflen = in.read(buffer); } catch (IOException e) { e.printStackTrace(); } if (buflen <= 0) { return false; } } return true; } private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1; } private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126; } private void skipUnprintable() { while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; } public boolean hasNext() { skipUnprintable(); return hasNextByte(); } public int nextInt() { return Integer.parseInt(next()); } public String next() { if (!hasNext()) throw new NoSuchElementException(); StringBuilder sb = new StringBuilder(); int b = readByte(); while (isPrintableChar(b)) { sb.appendCodePoint(b); b = readByte(); } return sb.toString(); } public long nextLong() { if (!hasNext()) throw new NoSuchElementException(); long n = 0; boolean minus = false; int b = readByte(); if (b == '-') { minus = true; b = readByte(); } if (b < '0' || '9' < b) { throw new NumberFormatException(); } while (true) { if ('0' <= b && b <= '9') { n *= 10; n += b - '0'; } else if (b == -1 || !isPrintableChar(b)) { return minus ? -n : n; } else { throw new NumberFormatException(); } b = readByte(); } } }
Main.java:125: error: ';' expected return w1 ^ 1 error
s488386856
p03964
C++
#include <iostream> #include <vector> #include <unordered_set> #include <string> #include <algorithm> #include <math.h> #include <util.h> using namespace std; int main() { int n; cin >> n; vector<int> tvotes(n); vector<int> avotes(n); for(int i = 0; i < n; i++) { int t, a; cin >> t >> a; tvotes[i] = t; avotes[i] = a; } pair<int, int> current = make_pair(tvotes[0], avotes[0]); if(n == 1) { cout << current.first + current.second << endl; return 0; } for(int i = 1; i < n; i++) { if(tvotes[i] < avotes[i]) { while((current.first * avotes[i]) % tvotes[i] != 0 || ((current.first * avotes[i]) / tvotes[i]) < current.second) { current.first++; } current.second = (current.first * avotes[i]) / tvotes[i]; } else if(tvotes[i] == avotes[i]){ if(current.first == current.second) continue; if(current.first > current.second) { current.second = current.first; } else { current.first = current.second; } } else { while((current.second * tvotes[i]) % avotes[i] != 0 || ((current.second * tvotes[i]) / avotes[i]) < current.first) { current.second++; } current.first = (current.second * tvotes[i]) / avotes[i]; } } cout << current.first + current.second << endl; }
a.cc:7:10: fatal error: util.h: No such file or directory 7 | #include <util.h> | ^~~~~~~~ compilation terminated.
s546751178
p03964
C++
#include <bits/stdc++.h> #define REP(i, n) for(int i = 0;i < n;i++) #define REPR(i, n) for(int i = n;i >= 0;i--) #define FOR(i, m, n) for(int i = m;i < n;i++) #define FORR(i, m, n) for(int i = m;i >= n;i--) #define SORT(v, n) sort(v, v+n); #define VSORT(v) sort(v.begin(), v.end()); #define llong long long #define pb(a) push_back(a) #define INF 999999999 using namespace std; typedef pair<int, int> P; typedef pair<llong, llong> LP; typedef pair<int, P> PP; typedef pair<llong, LP> LPP; int dy[]={0, 0, 1, -1, 0}; int dx[]={1, -1, 0, 0, 0}; int main(){ int n; cin >> n; ll t=0, a=0; cin >> t >> a; ll tmp_t, tmp_a, rate_t, rate_a, rate; REP(i, n-1){ cin >> tmp_t >> tmp_a; rate_t = t%tmp_t==0 ? (int)(t/tmp_t) : (int)(t/tmp_t) + 1; rate_a = a%tmp_a==0 ? (int)(a/tmp_a) : (int)(a/tmp_a) + 1; rate = max(rate_t, rate_a); t = rate * tmp_t; a = rate * tmp_a; } else { t = tmp_t; a = tmp_a; } } cout << t+a << '\n'; return 0; }
a.cc: In function 'int main()': a.cc:23:9: error: 'll' was not declared in this scope 23 | ll t=0, a=0; | ^~ a.cc:24:16: error: 't' was not declared in this scope 24 | cin >> t >> a; | ^ a.cc:24:21: error: 'a' was not declared in this scope 24 | cin >> t >> a; | ^ a.cc:25:11: error: expected ';' before 'tmp_t' 25 | ll tmp_t, tmp_a, rate_t, rate_a, rate; | ^~~~~~ | ; a.cc:27:24: error: 'tmp_t' was not declared in this scope; did you mean 'time_t'? 27 | cin >> tmp_t >> tmp_a; | ^~~~~ | time_t a.cc:27:33: error: 'tmp_a' was not declared in this scope; did you mean 'tmpnam'? 27 | cin >> tmp_t >> tmp_a; | ^~~~~ | tmpnam a.cc:28:25: error: 'rate_t' was not declared in this scope 28 | rate_t = t%tmp_t==0 ? (int)(t/tmp_t) : (int)(t/tmp_t) + 1; | ^~~~~~ a.cc:29:25: error: 'rate_a' was not declared in this scope 29 | rate_a = a%tmp_a==0 ? (int)(a/tmp_a) : (int)(a/tmp_a) + 1; | ^~~~~~ a.cc:30:25: error: 'rate' was not declared in this scope 30 | rate = max(rate_t, rate_a); | ^~~~ a.cc:33:19: error: 'else' without a previous 'if' 33 | } else { | ^~~~ a.cc:34:29: error: 'tmp_t' was not declared in this scope; did you mean 'time_t'? 34 | t = tmp_t; | ^~~~~ | time_t a.cc:35:29: error: 'tmp_a' was not declared in this scope; did you mean 'tmpnam'? 35 | a = tmp_a; | ^~~~~ | tmpnam a.cc: At global scope: a.cc:38:9: error: 'cout' does not name a type 38 | cout << t+a << '\n'; | ^~~~ a.cc:40:9: error: expected unqualified-id before 'return' 40 | return 0; | ^~~~~~ a.cc:41:1: error: expected declaration before '}' token 41 | } | ^
s661688326
p03964
C++
#include<bits/stdc++.h> using namespace std; using ll = long long; int main(void){ int N; cin>>N; ll aok,tkhs; cin>>aok>>tkhs; if (N==1) { cout<<aok+tkhs<<endl; return 0; } for (int i=1;i<N;i++){ int a,t; cin>>a>>t; ll n=1; /* while(a*n<aok || t*n<tkhs) { n++; } */ n = max((ll)(ceil((double)aok/a)),(ll)(ceil((double)tkhs/t))); aok=a*n; tkhs=t*n; //cout<<aok<<" "<<tkhs<<" "<<a<<" "<<t<<endl; } cout<<aok+tkhs<<endl; return 0;
a.cc: In function 'int main()': a.cc:30:14: error: expected '}' at end of input 30 | return 0; | ^ a.cc:5:15: note: to match this '{' 5 | int main(void){ | ^
s536551720
p03964
C++
#include <bits/stdc++.h> using namespace std; long int main() { int N; cin >> N; vector<long int> T(N),A(N),B(N); for (int i=0;i<N;i++) { cin >> T.at(i) >> A.at(i); } for (int i=0;i<N-1;i++) { B.at(i+1) = max( (T.at(i)-1) / T.at(i+1) , (A.at(i)-1) / A.at(i+1)) + 1; T.at(i+1) = T.at(i+1) * B.at(i+1); A.at(i+1) = A.at(i+1) * B.at(i+1); } cout << T.at(N-1) + A.at(N-1) << endl; }
a.cc:4:6: error: '::main' must return 'int' 4 | long int main() { | ^~~
s348955999
p03964
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> T(N),A(N),B(N); for (int i=0;i<N;i++) { cin >> T.at(i) >> A.at(i); } for (int i=0;i<N-1;i++) { B.at(i+1) = max( (T.at(i)-1) / T.at(i+1) , (A.at(i)-1) / A.at(i+1) ) + 1; T.at(i+1) = T.at(i+1) * B.at(i+1); A.at(i+1) = A.at(i+1) * B.at(i+1); } int answer; answer = T.at(N-1) + A.at(N-1) cout << answer << endl; //for(int i=0;i<N;i++) { //cout << T.at(i) << ' ' << A.at(i) << endl; //} }
a.cc: In function 'int main()': a.cc:17:33: error: expected ';' before 'cout' 17 | answer = T.at(N-1) + A.at(N-1) | ^ | ; 18 | cout << answer << endl; | ~~~~
s379743416
p03964
C++
#include<bits/stdc++.h> using namespace std; using ll = long long; #define MM = 1000000000; #define mod = MM + 7; #define INF (ll)1e18 #define pi acos(-1.0) #define MAX 100005 #define NIL -1 int dx[4] = {0, 1, 0, -1}; int dy[4] = {1, 0, -1, 0}; int main(){ ll n; cin >> n; ll t[n],a[n]; for(ll i = 0; i < n; i++){ cin >> t[i] >> a[i]; } ll x = t[0], y = a[0]; mx = 0; for(ll i = 1; i < n; i++){ ll n = max(x/t[i],y/a[i]); x = n*t[i]; y = n*a[i]; } cout << x+y << endl; }
a.cc: In function 'int main()': a.cc:20:5: error: 'mx' was not declared in this scope; did you mean 'x'? 20 | mx = 0; | ^~ | x