submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s790357674
p03965
C++
// 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 <unordered_map> #include <valarray> #include <vector> // // Iteration // #define REP(i, a, b) for (int i = a; i < (int)(b); i++) #define rep(i, n) REP(i, 0, n) #define each(x,v) for(auto&&x:v) // as if v.each // // Debug // #define dump(c) cerr << "> " << #c << " = " << (c) << endl; // // Vector // #define sort(v) sort(v.begin(), v.end()) // unique should be used with sort #define unique(v) unique(v.begin(), v.end()) - v.begin() #define lower_bound(v,x) lower_bound(v.begin(),v.end(), x); #define upper_bound(v,x) upper_bound(v.begin(),v.end(), x); // // Namespace // using namespace std; // // Type // typedef long long ll; typedef unsigned long long ull; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<vll> vvll; typedef vector<vi> vvi; typedef vector<double> vd; typedef vector<vd> vvd; typedef vector<string> vs; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int INF = 1 << 10; const int M = 100100; const double EPS = 1e-10; static const double pi=3.1415926535897932; string str; ll n; ll a[M][M]; ll x,y; ll dp(ll i, ll j){ if(i==n){ return 0; } if(a[i][j]!=INF){ return a[i][j]; } if(j==0){ a[i][j] = dp(i+1,1) + ((str[i]=='g') ? 0 : -1); // gを出す return a[i][j]; }else{ x = dp(i+1,j+1) + ((str[i]=='g') ? 0 : -1); // gを出す y = dp(i+1,j-1) + ((str[i]=='g') ? 1 : 0); // pを出す a[i][j] = max(x,y); return a[i][j]; } } int main() { cin >> str; n = str.size(); rep(i,n){ rep(j,n){ a[i][j] = INF; } } cout << dp(0,0) <<endl; return 0; }
/tmp/ccDeEBv6.o: in function `dp(long long, long long)': a.cc:(.text+0x16f): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccDeEBv6.o a.cc:(.text+0x1c0): relocation truncated to fit: R_X86_64_PC32 against symbol `y' defined in .bss section in /tmp/ccDeEBv6.o a.cc:(.text+0x1c7): relocation truncated to fit: R_X86_64_PC32 against symbol `y' defined in .bss section in /tmp/ccDeEBv6.o a.cc:(.text+0x1d1): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccDeEBv6.o collect2: error: ld returned 1 exit status
s491479117
p03965
C++
// 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 <unordered_map> #include <valarray> #include <vector> // // Iteration // #define REP(i, a, b) for (int i = a; i < (int)(b); i++) #define rep(i, n) REP(i, 0, n) #define each(x,v) for(auto&&x:v) // as if v.each // // Debug // #define dump(c) cerr << "> " << #c << " = " << (c) << endl; // // Vector // #define sort(v) sort(v.begin(), v.end()) // unique should be used with sort #define unique(v) unique(v.begin(), v.end()) - v.begin() #define lower_bound(v,x) lower_bound(v.begin(),v.end(), x); #define upper_bound(v,x) upper_bound(v.begin(),v.end(), x); // // Namespace // using namespace std; // // Type // typedef long long ll; typedef unsigned long long ull; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<vll> vvll; typedef vector<vi> vvi; typedef vector<double> vd; typedef vector<vd> vvd; typedef vector<string> vs; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int INF = 1 << 10; const int M = 100100; const double EPS = 1e-10; static const double pi=3.1415926535897932; string str; ll n; ll a[M][M]; ll x,y; ll dp(ll i, ll j){ if(i==n){ return 0; } if(a[i][j]!=INF){ return a[i][j]; } if(j==0){ a[i][j] = dp(i+1,1) + ((str[i]=='g') ? 0 : -1); // gを出す cout << str[i] << " i=" << i << " j=" << j << " a[i][j]=" << a[i][j] << endl; return a[i][j]; }else{ x = dp(i+1,j+1) + ((str[i]=='g') ? 0 : -1); // gを出す y = dp(i+1,j-1) + ((str[i]=='g') ? 1 : 0); // pを出す a[i][j] = max(x,y); cout << str[i] << " i=" << i << " j=" << j << " a[i][j]=" << a[i][j] << endl; return a[i][j]; } } int main() { cin >> str; n = str.size(); rep(i,n){ rep(j,n){ a[i][j] = INF; } } cout << "initialisation done" << str.size() << endl; cout << dp(0,0) <<endl; return 0; }
/tmp/ccZGelT2.o: in function `dp(long long, long long)': a.cc:(.text+0x244): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccZGelT2.o a.cc:(.text+0x295): relocation truncated to fit: R_X86_64_PC32 against symbol `y' defined in .bss section in /tmp/ccZGelT2.o a.cc:(.text+0x29c): relocation truncated to fit: R_X86_64_PC32 against symbol `y' defined in .bss section in /tmp/ccZGelT2.o a.cc:(.text+0x2a6): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccZGelT2.o collect2: error: ld returned 1 exit status
s776169144
p03965
C++
#include <algorithm>//min/max/sort(rand-access it)/merge #include <array> #include <bitset> #include <climits>//INT_MAX/INT_MIN/ULLONG_MAX #include <cmath>//fmin/fmax/fabs/sin(h)/cos(h)/tan(h)/exp/log/pow/sqrt/cbrt/ceil/floor/round/trunc #include <cstdlib>//abs/atof/atoi/atol/atoll/strtod/strtof/..., srand/rand, calloc/malloc, exit, qsort #include <iomanip>//setfill/setw #include <iostream>//cin/cout/wcin/wcout/left/right/internal/dec/hex/oct/fixed/scientific #include <iterator> #include <limits> #include <list> #include <queue> #include <string>//stoi/stol/stoul/stoll/stoull/stof/stod/stold/to_string/getline #include <tuple> #include <utility>//pair #include <valarray> #include <vector> #define PRIME_SHORT 10007 #define PRIME 1000000007 using namespace std; typedef unsigned int ui; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> pii; typedef pair<ll, int> plli; typedef pair<ull, int> puli; typedef pair<double, int> pdi; typedef pair<ll, ll> pllll; typedef pair<ull, ull> pulul; typedef pair<double, double> pdd; typedef tuple<int, int, int> ti3; typedef tuple<int, int, int, int> ti4; static const bool debug = false; static const int inf = numeric_limits<int>::max(); void rar(int n, int* a); void rar2(int n, int m, int** a); int ipow(int base, int exp); int left(int current, bool swap); int right(int current, bool swap); int griddist(int x, int y, int s, int t); int griddist(pii one, pii two); double sqeucldist(double x, double y, double s, double t); double sqeucldist(pii one, pii two); ull modadd(ull a, ull b, int mod); ull modmult(ull a, ull b, int mod); int main(void) { cin >> s; int n = s.size(); int score = n%2 ? (n - 1)/2 : n/2; int detractions = 0; for (int i = 0; i < n; ++i) if (s[i] == 'p') ++detractions; cout << score - detractions << endl; return 0; } void rar(int n, int* a) { for (int i = 0; i < n; ++i) { cin >> a[i]; } return; } void rar2(int n, int m, int** a) { for (int i = 0; i < n; ++i) { a[i] = new int[m]; for (int j = 0; j < m; ++j) { cin >> a[i][j]; } } return; } int ipow(int base, int exp) { int result = 1; while (exp) { if (exp & 1) result *= base; exp >>= 1; base *= base; } return result; } int left(int current, bool swap = false) { if(swap){ return right(current, false); } else { return 2*current + 1; } } int right(int current, bool swap = false) { if(swap){ return left(current, false); } else { return 2*(current+1); } } int griddist(int x, int y, int s, int t) { return abs(x-s) + abs(y-t); } int griddist(pii one, pii two) { return abs(one.first - two.first) + abs(one.second - two.second); } double sqeucldist(double x, double y, double s, double t) { double a = x-s; double b = y-t; return a*a+b*b; } double sqeucldist(pii one, pii two) { double a = one.first - two.first; double b = one.second - two.second; return a*a+b*b; } ull modadd(ull a, ull b, int mod) { return (a%mod + b%mod)%mod; } ull modmult(ull a, ull b, int mod) { return ((a%mod)*(b%mod))%mod; }
a.cc: In function 'int main()': a.cc:55:12: error: 's' was not declared in this scope 55 | cin >> s; | ^
s495919971
p03965
C++
#include <iostream> #include <string> using namespace std; int main(void){ string source; cin >> source; int score = 0; for(int i = 0; i < source.size(); i++){ if(i < source.size / 2){ if(source[i] == 'p')score--; else score++; }else{ if(source[i] == 'g')score++; } } cout << score << endl; return 0; }
a.cc: In function 'int main()': a.cc:10:19: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?) 10 | if(i < source.size / 2){ | ~~~~~~~^~~~ | ()
s225994884
p03965
C
#include <stdio.h> int main() { char s[1e6]; int g = 0, p = 0; scanf("%s", s); while (*(++s)) { if (*s == 'g') { g++; } else { p++; } } printf("%d\n", g - p >> 1); return 0; }
main.c: In function 'main': main.c:3:10: error: size of array 's' has non-integer type 3 | char s[1e6]; | ^ main.c:6:14: error: lvalue required as increment operand 6 | while (*(++s)) { | ^~
s857960751
p03965
C
#include <stdio.h> int main() { char c; int g = 0, p = 0; while (c = getc(STDIN)) { if (c == 'g') { g++; } else { p++; } } printf("%d\n", g - p >> 1); return 0; }
main.c: In function 'main': main.c:5:21: error: 'STDIN' undeclared (first use in this function) 5 | while (c = getc(STDIN)) { | ^~~~~ main.c:5:21: note: each undeclared identifier is reported only once for each function it appears in
s173641854
p03965
C
#include <stdio.h> int main() { char c; int g = 0, p = 0; while (c = getc()) { if (c == 'g') { g++; } else { p++; } } printf("%d\n", g - p >> 1); return 0; }
main.c: In function 'main': main.c:5:16: error: too few arguments to function 'getc' 5 | while (c = getc()) { | ^~~~ In file included from main.c:1: /usr/include/stdio.h:576:12: note: declared here 576 | extern int getc (FILE *__stream) __nonnull ((1)); | ^~~~
s259927735
p03965
C
#include <stdio.h> int main() { char c; while (c = getc()) { if (c == 'g') { g++; } else { p++; } } printf("%d\n", g - p >> 1); return 0; }
main.c: In function 'main': main.c:4:16: error: too few arguments to function 'getc' 4 | while (c = getc()) { | ^~~~ In file included from main.c:1: /usr/include/stdio.h:576:12: note: declared here 576 | extern int getc (FILE *__stream) __nonnull ((1)); | ^~~~ main.c:6:13: error: 'g' undeclared (first use in this function) 6 | g++; | ^ main.c:6:13: note: each undeclared identifier is reported only once for each function it appears in main.c:8:13: error: 'p' undeclared (first use in this function) 8 | p++; | ^
s385680098
p03965
C
#include <stdio.h> int main(void) { int i,gc,pc,score; char[100000] code; scanf("%s",&code); for(i=0;code[i]!='\0';i++) { if(code[i] == 'g') { pc++; score++; } else if(code[i] == 'p') { gc++; score++; } if(gc>pc) { score--; } else if(pc>gc) { score--; } } printf("%d",score); return 0; }
main.c: In function 'main': main.c:6:13: error: expected identifier or '(' before '[' token 6 | char[100000] code; | ^ main.c:8:21: error: 'code' undeclared (first use in this function) 8 | scanf("%s",&code); | ^~~~ main.c:8:21: note: each undeclared identifier is reported only once for each function it appears in
s233368417
p03965
C
#include<stdio.h> int main(){ char s[100001]; scanf("%s",s); int g=0; int p=0; int score=0; int i=0; while(s[i]!='\0'){ if(s[i]=='g'){ if(p<g){ p++; score++; } else{ g++; } } else{ if(p<g){ p++; } else{ g++; score--; } } i++; } printf("%d\n",score); return 0;
main.c: In function 'main': main.c:35:5: error: expected declaration or statement at end of input 35 | return 0; | ^~~~~~
s964287299
p03966
Java
import java.util.Scanner; public class Main { static Scanner scanner; public static void main(String[] args) { scanner = new Scanner(System.in); int N=gi(); long[] T=new long[N]; long[] A=new long[N]; for (int i=0; i<N; i++) { T[i]=gl(); A[i]=gl(); } long ht=1; long ha=1; for (int i=0; i<N; i++) { long hi=(long)Math.max(Math.ceil((double)ht/(double)T[i]), Math.ceil((double)ha/(double)A[i])); ht=hi*T[i]; ha=hi*A[i]; } System.out.println((long(ht+ha)); // if(ans==0) { // // System.out.println("Yes"); // } else { // System.out.println("No"); // // } } // 文字列として入力を取得 public static String gs() { return scanner.next(); } // intとして入力を取得 public static int gi() { return Integer.parseInt(scanner.next()); } // longとして入力を取得 public static long gl() { return Long.parseLong(scanner.next()); } // doubleとして入力を取得 public static double gd() { return Double.parseDouble(scanner.next()); } }
Main.java:27: error: '.class' expected System.out.println((long(ht+ha)); ^ Main.java:27: error: not a statement System.out.println((long(ht+ha)); ^ Main.java:27: error: ';' expected System.out.println((long(ht+ha)); ^ 3 errors
s325969655
p03966
C++
#include <bits/stdc++.h> using namespace std; long long n,t[1005],a[1005]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin>>n; for(long long i=0;i<n;i++) cin>>t[i]>>a[i]; for(long long i=1;i<n;i++) { long long d=max(t[i-1]/t[i],a[i-1])/a[i]); if(d*a[i]<a[i-1]||d*t[i]<t[i-1]) d++; a[i]*=d; t[i]*=d; } cout<<t[n-1]+a[n-1]<<endl; return 0; }
a.cc: In function 'int main()': a.cc:16:49: error: expected ',' or ';' before ')' token 16 | long long d=max(t[i-1]/t[i],a[i-1])/a[i]); | ^
s167945519
p03966
C++
#include <bits/stdc++.h> using namespace std; long long n,t[1005],a[1005]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin>>n; for(long long i=0;i<n;i++) cin>>t[i]>>a[i]; for(long long i=1;i<n;i++) { long long d=max(t[i-1])/t[i],a[i-1])/a[i]); if(d*a[i]<a[i-1]||d*t[i]<t[i-1]) d++; a[i]*=d; t[i]*=d; } cout<<t[n-1]+a[n-1]<<endl; return 0; }
a.cc: In function 'int main()': a.cc:16:24: error: no matching function for call to 'max(long long int&)' 16 | long long d=max(t[i-1])/t[i],a[i-1])/a[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:16:24: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 16 | long long d=max(t[i-1])/t[i],a[i-1])/a[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
s387275769
p03966
C++
#include <bits/stdc++.h> using namespace std; long long n,t[1005],a[1005]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin>>n; for(long long i=0;i<n;i++) cin>>t[i]>>a[i]; for(long long i=1;i<n;i++) { long long d=max((t[i-1])/t[i],a[i-1])/a[i]); if(d*a[i]<a[i-1]||d*t[i]<t[i-1]) d++; a[i]*=d; t[i]*=d; } cout<<t[n-1]+a[n-1]<<endl; return 0; }
a.cc: In function 'int main()': a.cc:16:51: error: expected ',' or ';' before ')' token 16 | long long d=max((t[i-1])/t[i],a[i-1])/a[i]); | ^
s878380552
p03966
C++
#include <iostream> #include <algorithm> using namespace std; int main() { long long N, T, A; cin >> N >> T >> A; for (int i = 1; i < N; i++) { long double t, a; cin >> t >> a; if (T * a > A * t) { T = t * ceil((long double)T / t); A = a * ceil((long double)T / t); } else { T = t * ceil((long double)A / a); A = a * ceil((long double)A / a); } } cout << T + A << endl; }
a.cc: In function 'int main()': a.cc:12:33: error: 'ceil' was not declared in this scope 12 | T = t * ceil((long double)T / t); | ^~~~ a.cc:16:33: error: 'ceil' was not declared in this scope 16 | T = t * ceil((long double)A / a); | ^~~~
s715895056
p03966
C++
#include<bits/stdc++.h> using namespace std; deque < int > a; deque < int > b; int ans=1; int gcd(int a2,int b2) { while(a2%b2!=0) { a2=b2; b2=a2%b2; } return a2; } int main() { int n; cin>>n; int a2,b2; for(int i=0;i<n;i++) { cin>>a2>>b2; a.push_back(a2); b.push_back(b2); } ans+=(a[0]+b[0]); for(int i=1;i<a.size();i++) { int a2=a[i-1]+(a[i-1]%a[i]); int b2=b[i-1]+(b[i-1]%b[i]); int y=gcd(a[i],b[i]); if(a[i]<b[i]) { int b3=b2; b3=a2*b[i]/a[i]; if(b3<b2) { int u=(b2-b3+2)/ } } ans+=(j+j2); a[i]=j; b[i]=j2; } cout<<ans; return 0; }
a.cc: In function 'int main()': a.cc:39:25: error: expected primary-expression before '}' token 39 | } | ^ a.cc:41:23: error: 'j' was not declared in this scope 41 | ans+=(j+j2); | ^ a.cc:41:25: error: 'j2' was not declared in this scope; did you mean 'b2'? 41 | ans+=(j+j2); | ^~ | b2
s840414112
p03966
C++
#include <bits/stdc++.h> using namespace std; #define fi first #define endl "\n" #define se second #define ls( s) (s&(-s)) #define ll long long #define inf 0x3f3f3f3f const ll N = 500030; #define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end))) const ll mod = 1e9+7; int main() { ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0); ll x=1,y=1; ll n; cin>>n; while(n--) { ll a,b; cin>>a>>b; if(a!=b) ll aa=(x+a-1)/a; ll bb=(y+b-1)/b; ll z=max(bb,aa); // cout<<y<<endl; y=z*b; x=z*a; //cout<<x<<" "<<y<<endl; } cout<<x+y<<endl; }
a.cc: In function 'int main()': a.cc:33:37: error: 'aa' was not declared in this scope; did you mean 'a'? 33 | ll z=max(bb,aa); | ^~ | a
s056388004
p03966
C++
#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> #include <queue> #include <stack> #include <map> #include <set> #include <vector> #include <iomanip> using namespace std; typedef long long ll; ll CEIL(ll x, ll y) { ll ans=x/y; if (x % y == 0)return ans; else return ans + 1; } int main() { int at, aa; int n; int x, y; scanf_s("%d", &n); scanf_s("%d%d", &at, &aa); for (int i = 2; i <= n; i++) { scanf_s("%d%d", &x, &y); ll t = max(CEIL(at, x), CEIL(aa, y)); at = t * x; aa = t * y; } printf("%lld", at + aa); }
a.cc: In function 'int main()': a.cc:24:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 24 | scanf_s("%d", &n); | ^~~~~~~ | scanf
s517820454
p03966
C++
#include <iostream> #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> //#include <boost/multiprecision/cpp_int.hpp> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep_r(i, n) for (int i = n - 1; i >= 0; i--) #define rep1(i, n) for (int i = 1; i <= (int)(n); i++) #define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define all(x) (x).begin(), (x).end() #define SZ(x) ((ll)(x).size()) #define bit(n) (1LL << (n)) #define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()); #define INF bit(60) #define pb push_back #define mod 1000000007 namespace mp = boost::multiprecision; using namespace std; using uif = uint_fast64_t; //using ll = mp::int256_t; using ll = long long int; int main(void) { ll n; cin >> n; vector<long long int> T(n); vector<long long int> A(n); rep(i, n) cin >> T[i] >> A[i]; ll t = T[0]; ll a = A[0]; for (ll i = 1; i < n; i++) { ll l = 1; ll r = LLONG_MAX / 1001; while (r - l > 1) { ll piv = l + (r - l) / 2; if (piv * T[i] >= t && piv * A[i] >= a) { r = piv; } else { l = piv; } } ll k; if (l == r) k = l; else { if (l * T[i] >= t && l * A[i] >= a) k = l; else k = r; } t = k * T[i]; a = k * A[i]; } cout << t + a << endl; return 0; }
a.cc:22:16: error: 'boost' has not been declared 22 | namespace mp = boost::multiprecision; | ^~~~~ a.cc:22:23: error: 'multiprecision' is not a namespace-name 22 | namespace mp = boost::multiprecision; | ^~~~~~~~~~~~~~
s511631275
p03966
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #define Abs(x)((x) < 0 ? (x) * -1 : (x)) #define rep(x, y) for ((x) = 0; (x) < (y); (x)++) #define repin(x, y) for ((x) = 0; (x) <= (y); (x)++) #define nep(x, y) for ((x) = (y) - 1; 0 <= (x); (x)--) #define nepi(x, y, z) for ((x) = (y) - 1; (z) <= (x); (x)--) #define repi(x, y, z) for ((x) = (z); (x) < (y); (x)++) #define repiin(x, y, z) for ((x) = (z); (x) <= (y); (x)++) #define reps(x, y, z) for ((x) = 0; (x) < (y); (x) += (z)) #define repis(x, y, z, s) for ((x) = (z); (x) < (y); (x) += (s)) #define repiins(x, y, z, s) for ((x) = (z); (x) <= (y); (x) += (s)) #define repit(x) for (__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++) #define repit2(x) for (__typeof((x).begin()) it2 = (x).begin(); it2 != (x).end(); it2++) #define nepit(x) for (__typeof((x).rbegin()) it = (x).rbegin(); it != (x).rend(); it++) #define All(x) (x).begin(),(x).end() #define Mem0(x) memset(x, 0, sizeof(x)) #define Mem1(x) memset(x, -1, sizeof(x)) // can be applied to string type #define Unique(v) v.resize(unique(All(v)) - v.begin()) #define peq(p0, p1)(p0.first == p1.first && p0.second == p1.second) #define End '\n' #define Out(x) cout<<(x)<<End #define YES cout<<"YES"<<End #define NO cout<<"NO"<<End #define Yes cout<<"Yes"<<End #define No cout<<"No"<<End template<typename T> void Outln(const string &sep, const T &val) { cout << val << End; } template<typename T, typename... Args> void Outln(const string &sep, const T &val, Args... args) { cout << val << sep; Outln(sep, std::forward<Args>(args)...); } template<typename T> void Outln(const char &ch, const T &val) { cout << val << End; } template<typename T, typename... Args> void Outln(const char &ch, const T &val, Args... args) { cout << val << ch; Outln(ch, std::forward<Args>(args)...); } // container output function template<typename T> inline void OutN(T x) { size_t i, len = x.size() - 1; for (i = 0; i < len; i++) cout << x[i] << " "; cout << x[len] << '\n'; } // array output function template<typename T> inline void OutaN(T x[], const size_t &n) { size_t i, len = n - 1; for (i = 0; i < len; i++) cout << x[i] << " "; cout << x[len] << '\n'; } // iterator output function template<typename T> inline void Outit(T x) { auto end = x.end(); end--; for (auto it = x.begin(); it != end; it++) cout << *it << " "; cout << *end << '\n'; } template<typename T> void Debug(const T &val) { cerr << val << End; } template<typename T, typename... Args> void Debug(const T &val, Args... args) { cerr << val << ' '; Debug(std::forward<Args>(args)...); } template<typename T> inline bool Max(T &x, const T &y) { return x < y ? x = y, 1 : 0; } template<typename T> inline bool Min(T &x, const T &y) { return x > y ? x = y, 1 : 0; } template<typename T> using V = vector<T>; template<typename T> using VV = V<V<T> >; // can be applied to string type #define Sort(v) sort(All(v)) #define SortR(v) sort(All(v), std::greater<__typeof(v[0])>()) // array sorters #define Sart(a) sort(a, a + sizeof(a) / sizeof(__typeof(a[0]))); #define SartR(a) sort(a, a + sizeof(a) / sizeof(__typeof(a[0])), std::greater<__typeof(a[0])>()) #define pf push_front #define pb push_back #define pof pop_front #define pob pop_back #define mp make_pair #define mt make_tuple #define a first #define b second #define lb std::lower_bound #define ub std::upper_bound #define lbi(v, x) lb(All(v), (x))-v.begin() #define ubi(v, x) ub(All(v), (x))-v.begin() inline bool isSame(const string &a, const string &b) { return a.compare(b) == 0; } inline bool isLess(const string &a, const string &b) { return a.compare(b) < 0; } inline bool isGreater(const string &a, const string &b) { return a.compare(b) > 0; } inline string Str(const char &ch, const int &n) { return string(n, ch); } inline string Str(const int &n, const char &ch) { return string(n, ch); } vector<string> getStrLine() { vector<string> v; string str; getline(cin, str); istringstream iss(str); for (string word; iss >> word;) v.push_back(word); return v; } static const ll MOD = 1e9 + 7; static const double PI = 3.141592653589793; inline double rad2deg(const double &rad) { return rad * (180.0 / PI); } inline double deg2rad(const double &deg) { return deg * (PI / 180.0); } /*** ATCODER, CODECHEF and TOPCODER ***/ // -2147483648 <= INT <= 2147483647 // -9223372036854775808 <= LONG <= 9223372036854775807 // -9223372036854775808 <= LLONG <= 9223372036854775807 /*** END ***/ /*** CODEFORCES ***/ // -2147483648 <= INT <= 2147483647 // -2147483648 <= LONG <= 2147483647 // -9223372036854775808 <= LLONG <= 9223372036854775807 /*** END ***/ // [C-f5] 'reload // [C-f6] 'getready // [C-f7] 'copy // [C-f8] 'compile // [C-f9] 'make #define LOCAL 0 int main() { #if LOCAL freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout); freopen("debug.txt", "w", stderr); #endif cin.tie(0); ios::sync_with_stdio(false); //std::cout.precision(18); int n; cin >> n; ll t, a; ll x, y; ll w, z; cin >> x >> y; int i, j; repi(i, n, 1) { cin >> t >> a; if (t == 1 && t == a) { x = max(x, y); y = x; } else { w = t; z = a; j = max(1, max(x / t, y / a)); while (w < x || z < y) { w = t * j; z = a * j; j++; } x = w; y = z; } } Out(x + y); return 0; }
a.cc: In function 'int main()': a.cc:193:32: error: no matching function for call to 'max(int, const long long int&)' 193 | j = max(1, max(x / t, y / a)); | ~~~^~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:193:32: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 193 | j = max(1, max(x / t, y / a)); | ~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:193:32: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 193 | j = max(1, max(x / t, y / a)); | ~~~^~~~~~~~~~~~~~~~~~~~~~
s986405549
p03966
C++
#include <bits/stdc++.h> using namespace std; long long curA, curT, A, T; int n; int main() { scanf("%d", &n); scanf("%lld%lld", &curT, &curA); for(int i = 1; i < n; i++) { scanf("%lld%lld", &T, &A); if(T <#include <bits/stdc++.h> using namespace std; long long curA, curT, A, T; int n; int main() { scanf("%d", &n); scanf("%lld%lld", &curT, &curA); for(int i = 1; i < n; i++) { scanf("%lld%lld", &T, &A); if(T < curT || A < curA) { long long r = max((curT - 1) / T, (curA - 1) / A) + 1; curT = T * r; curA = A * r; } else { curT = T; curA = A; } //printf("--->%lld %lld\n", curT, curA); } printf("%lld\n", curT + curA); return 0; } curT || A < curA) { long long r = max((curT - 1) / T, (curA - 1) / A) + 1; curT = T * r; curA = A * r; } else { curT = T; curA = A; } //printf("--->%lld %lld\n", curT, curA); } printf("%lld\n", curT + curA); return 0; }
a.cc:12:15: error: stray '#' in program 12 | if(T <#include <bits/stdc++.h> | ^ a.cc: In function 'int main()': a.cc:12:16: error: 'include' was not declared in this scope 12 | if(T <#include <bits/stdc++.h> | ^~~~~~~ a.cc:12:25: error: 'bits' was not declared in this scope 12 | if(T <#include <bits/stdc++.h> | ^~~~ a.cc:12:30: error: 'stdc' was not declared in this scope; did you mean 'std'? 12 | if(T <#include <bits/stdc++.h> | ^~~~ | std a.cc:13:1: error: expected primary-expression before 'using' 13 | using namespace std; | ^~~~~ a.cc:15:15: error: expected initializer before ',' token 15 | long long curA, curT, A, T; | ^ a.cc:15:15: error: expected ')' before ',' token 15 | long long curA, curT, A, T; | ^ | ) a.cc:12:11: note: to match this '(' 12 | if(T <#include <bits/stdc++.h> | ^ a.cc:18:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 18 | int main() { | ^~ a.cc:18:9: note: remove parentheses to default-initialize a variable 18 | int main() { | ^~ | -- a.cc:18:9: note: or replace parentheses with braces to value-initialize a variable a.cc:18:12: error: a function-definition is not allowed here before '{' token 18 | int main() { | ^ a.cc:37:18: error: expected ';' before ')' token 37 | curT || A < curA) { | ^ | ; a.cc:43:11: error: 'else' without a previous 'if' 43 | } else { | ^~~~
s331113121
p03966
C++
#include <bits/stdc++.h> using namespace std; int main() { __int128_t n; cin>>n; vector<__int128_t> t(n); vector<__int128_t> a(n); for(int i=0;i<n;i++){ cin>>t.at(i); cin>>a.at(i); } __int128_t T=t.at(0),A=a.at(0); for(int i=0;i<n;i++){ if(T*a.at(i)<A*t.at(i)){ if(A%a.at(i)==0){ T=t.at(i)*(A/a.at(i)); continue; } else{ A+=(a.at(i)-(A%a.at(i))); T=t.at(i)*(A/a.at(i)); continue; } } if(T*a.at(i)>A*t.at(i)){ if(T%t.at(i)==0){ A=a.at(i)*(T/t.at(i)); continue; } else{ T+=(t.at(i)-(T%t.at(i))); A=a.at(i)*(T/t.at(i)); continue; } } } cout<<A+T<<endl; }
a.cc: In function 'int main()': a.cc:6:6: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and '__int128') 6 | cin>>n; | ~~~^~~ | | | | | __int128 | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127, from a.cc:1: /usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed: a.cc:6:8: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type '__int128' 6 | cin>>n; | ^ /usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed: a.cc:6:8: error: cannot bind non-const lvalue reference of type 'short int&' to a value of type '__int128' 6 | cin>>n; | ^ /usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed: a.cc:6:8: error: cannot bind non-const lvalue reference of type 'short unsigned int&' to a value of type '__int128' 6 | cin>>n; | ^ /usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed: a.cc:6:8: error: cannot bind non-const lvalue reference of type 'int&' to a value of type '__int128' 6 | cin>>n; | ^ /usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed: a.cc:6:8: error: cannot bind non-const lvalue reference of type 'unsigned int&' to a value of type '__int128' 6 | cin>>n; | ^ /usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed: a.cc:6:8: error: cannot bind non-const lvalue reference of type 'long int&' to a value of type '__int128' 6 | cin>>n; | ^ /usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed: a.cc:6:8: error: cannot bind non-const lvalue reference of type 'long unsigned int&' to a value of type '__int128' 6 | cin>>n; | ^ /usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed: a.cc:6:8: error: cannot bind non-const lvalue reference of type 'long long int&' to a value of type '__int128' 6 | cin>>n; | ^ /usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed: a.cc:6:8: error: cannot bind non-const lvalue reference of type 'long long unsigned int&' to a value of type '__int128' 6 | cin>>n; | ^ /usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 219 | operator>>(float& __f) | ^~~~~~~~ /usr/include/c++/14/istream:219:7: note: conversion of argument 1 would be ill-formed: a.cc:6:8: error: cannot bind non-const lvalue reference of type 'float&' to a value of type '__int128' 6 | cin>>n; | ^ /usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 223 | operator>>(double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:223:7: note: conversion of argument 1 would be ill-formed: a.cc:6:8: error: cannot bind non-const lvalue reference of type 'double&' to a value of type '__int128' 6 | cin>>n; | ^ /usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 227 | operator>>(long double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:227:7: note: conversion of argument 1 would be ill-formed: a.cc:6:8: error: cannot bind non-const lvalue reference of type 'long double&' to a value of type '__int128' 6 | cin>>n; | ^ /usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed: a.cc:6:8: error: invalid conversion from '__int128' to 'void*' [-fpermissive] 6 | cin>>n; | ^ | | | __int128 a.cc:6:8: error: cannot bind rvalue '(void*)((long int)n)' to 'void*&' /usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:122:7: note: conversion of argument 1 would be ill-formed: a.cc:6:8: error: invalid conversion from '__int128' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} [-fpermissive] 6 | cin>>n; | ^ | | | __int128 /usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]' (near match) 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:126:7: note: conversion of argument 1 would be ill-formed: a.cc:6:8: error: invalid conversion from '__int128' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} [-fpermissive] 6 | cin>>n; | ^ | | | __int128 /usr/include/c++/14/istream:133:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 133 | operator>>(ios_base& (*__pf)(ios_base&)) | ^~~~~~~~ /usr/include/c++/14/istream:133:7: note: conversion of argument 1 would be ill-formed: a.cc:6:8: error: invalid conversion from '__int128' to 'std::ios_base& (*)(std::ios_base&)' [-fpermissive] 6 | cin>>n; | ^ | | | __int128 /usr/include/
s679125258
p03966
C++
#include <bits/stdc++.h> using namespace std; #include <boost/multiprecision/cpp_int.hpp> namespace mp = boost::multiprecision; int main() { mp::cpp_int n; cin>>n; vector<mp::cpp_int> t(n); vector<mp::cpp_int> a(n); for(int i=0;i<n;i++){ cin>>t.at(i); cin>>a.at(i); } mp::cpp_int T=t.at(0),A=a.at(0); for(int i=0;i<n;i++){ if(T*a.at(i)<A*t.at(i)){ if(A%a.at(i)==0){ T=t.at(i)*(A/a.at(i)); continue; } else{ A+=(a.at(i)-(A%a.at(i))); T=t.at(i)*(A/a.at(i)); continue; } } if(T*a.at(i)>A*t.at(i)){ if(T%t.at(i)==0){ A=a.at(i)*(T/t.at(i)); continue; } else{ T+=(t.at(i)-(T%t.at(i))); A=a.at(i)*(T/t.at(i)); continue; } } } cout<<A+T<<endl; }
a.cc:3:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory 3 | #include <boost/multiprecision/cpp_int.hpp> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated.
s118018880
p03966
C++
#include <bits/stdc++.h> using namespace std; #include <boost/multiprecision/cpp_int.hpp> namespace mp = boost::multiprecision; int main() { mp:cpp_int n; cin>>n; vector<mp::cpp_int> t(n); vector<mp::cpp_int> a(n); for(int i=0;i<n;i++){ cin>>t.at(i); cin>>a.at(i); } mp:cpp_int T=t.at(0),A=a.at(0); for(int i=0;i<n;i++){ if(T*a.at(i)<A*t.at(i)){ if(A%a.at(i)==0){ T=t.at(i)*(A/a.at(i)); continue; } else{ A+=(a.at(i)-(A%a.at(i))); T=t.at(i)*(A/a.at(i)); continue; } } if(T*a.at(i)>A*t.at(i)){ if(T%t.at(i)==0){ A=a.at(i)*(T/t.at(i)); continue; } else{ T+=(t.at(i)-(T%t.at(i))); A=a.at(i)*(T/t.at(i)); continue; } } } cout<<A+T<<endl; }
a.cc:3:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory 3 | #include <boost/multiprecision/cpp_int.hpp> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated.
s379692667
p03966
C++
#include <bits/stdc++.h> using namespace std; #include <boost/multiprecision/cpp_int.hpp> namespace mp = boost::multiprecision;int maiint main() { mp:cpp_int n; cin>>n; vector<mp::cpp_int> t(n); vector<mp::cpp_int> a(n); for(int i=0;i<n;i++){ cin>>t.at(i); cin>>a.at(i); } mp:cpp_int T=t.at(0),A=a.at(0); for(int i=0;i<n;i++){ if(T*a.at(i)<A*t.at(i)){ if(A%a.at(i)==0){ T=t.at(i)*(A/a.at(i)); continue; } else{ A+=(a.at(i)-(A%a.at(i))); T=t.at(i)*(A/a.at(i)); continue; } } if(T*a.at(i)>A*t.at(i)){ if(T%t.at(i)==0){ A=a.at(i)*(T/t.at(i)); continue; } else{ T+=(t.at(i)-(T%t.at(i))); A=a.at(i)*(T/t.at(i)); continue; } } } cout<<A+T<<endl; }
a.cc:3:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory 3 | #include <boost/multiprecision/cpp_int.hpp> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated.
s160458356
p03966
C
#include <stdio.h> int main(){ int n,ans=1,p; scanf("%d",&n); int t[n+1],a[n+1]; for(int i=1;i<=n;i++) scanf("%d %d",&t[i],&a[i]); for(int i=1;i<=n;i++){ p=0; for(j=1;j>=0;j++){ p+=t[i]+a[i]; if(p>=ans) break; } } printf("%d",ans); return 0; }
main.c: In function 'main': main.c:12:9: error: 'j' undeclared (first use in this function) 12 | for(j=1;j>=0;j++){ | ^ main.c:12:9: note: each undeclared identifier is reported only once for each function it appears in
s908972189
p03966
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int N = sc.nextInt(); long[] T = new long[N]; long[] A = new long[N]; for( int i=0; i<N; i++ ){ T[i] = sc.nextLong(); A[i] = sc.nextLong(); } for( int i=1; i<N; i++ ){ if( T[i]<T[i-1] || A[i]<A[i-1] ){ long a = Math.max(T[i-1]/T[i],A[i-1]/A[i]); for( long j=a; j<(a+2; j++ ){ T[i] *= j; A[i] *= j; if( T[i]>=T[i-1] && A[i]>=A[i-1] ){ break; } T[i] = T[i]/j; A[i] = A[i]/j; } } } System.out.println(T[N-1]+A[N-1]); } }
Main.java:16: error: ')' expected for( long j=a; j<(a+2; j++ ){ ^ 1 error
s266831868
p03966
Java
import java.util.*; public class Main{ public static void main(String args[]){ Scanner sc = new Scanner(System.in); int N = sc.nextInt(); long[][] T = new long[3][N]; for(int i = 0; i < N; i++){ T[0][i] = sc.nextLong(); T[1][i] = sc.nextLong(); } sc.close(); long numT = T[0][0]; long numA = T[1][0]; for(int i = 1; i < N; i++){ long t, a; if(numT%T[0][i] == 0) t = numT%T[0][i]; else t = numT%T[0][i]+1; if(numT%T[0][i] == 0) a = numA%T[1][i]; else a = numA%T[1][i]+1; min = Math.max(t, a); numT = min*T[0][i]; numA = min*T[1][i]; } System.out.println(numT+numA); } }
Main.java:29: error: cannot find symbol min = Math.max(t, a); ^ symbol: variable min location: class Main Main.java:30: error: cannot find symbol numT = min*T[0][i]; ^ symbol: variable min location: class Main Main.java:31: error: cannot find symbol numA = min*T[1][i]; ^ symbol: variable min location: class Main 3 errors
s369097091
p03966
C++
#include<bits/stdc++.h> using namespace std; #define all(a) (a).begin(),(a).end() typedef long long ll; const ll mod=1000000007; #define repi(i,a,b) for(int i=int(a);i<int(b);++i) int main() { int n; cin >> n; double a=1.0d; double t=1.0d; repi(i,0,n){ double ttmp, atmp; cin >> ttmp >> atmp; double x = max(ceil(t/ttmp),seil(a/atmp)); t = ttmp*x; a = atmp*x; } cout << t+a << endl; return 0; }
a.cc: In function 'int main()': a.cc:15:45: error: 'seil' was not declared in this scope; did you mean 'ceil'? 15 | double x = max(ceil(t/ttmp),seil(a/atmp)); | ^~~~ | ceil
s087408506
p03966
C++
5 3 10 48 17 31 199 231 23 3 2
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 5 | ^
s535211967
p03966
C++
#include<bits/stdc++.h> #define mins(a,b) a=min(a,b) #define maxs(a,b) a=max(a,b) template < typename T > std::string to_string( const T& n ) { std::ostringstream stm ; stm << n ; return stm.str() ; } using namespace std; const long long INF=9000000000000000; int main(){ long long n,a=0,b=0; cin>>n; long long num[n*2]; for(int i=0;i<n*2;i++){ cin>>num[i]; } for(int i=0;i<n;i++){ if(num[i*2]>=a and num[i*2+1]>=b){ a=num[i*2];b=num[i*2+1]; } else{ for(int i=2;i<=max(a/num[i*2],b/num[i*2+1];i++){ a=(a/(i-1))*i; b=(b/(i-1))*i; if(num[i*2]>=a and num[i*2+1]>=b) break; } } } cout<<a+b<<endl; }
a.cc: In function 'int main()': a.cc:25:49: error: expected ')' before ';' token 25 | for(int i=2;i<=max(a/num[i*2],b/num[i*2+1];i++){ | ~ ^ | )
s478410202
p03966
C++
#include<bits/stdc++.h> #define mins(a,b) a=min(a,b) #define maxs(a,b) a=max(a,b) template < typename T > std::string to_string( const T& n ) { std::ostringstream stm ; stm << n ; return stm.str() ; } using namespace std; const long long INF=9000000000000000; int main(){ long long n,a=0,b=0; cin>>n; long long num[n*2]; for(int i=0;i<n*2;i++){ cin>>num[i]; } for(int i=0;i<n;i++){ if(num[i*2]>=a and num[i*2+1]>=b){ a=num[i*2];b=num[i*2+1]; } else{ for(int i=1;i<=max(a/num[i*2],b/num } } cout<<a+b<<endl; }
a.cc: In function 'int main()': a.cc:25:38: error: invalid operands of types 'long long int' and 'long long int [(n * 2)]' to binary 'operator/' 25 | for(int i=1;i<=max(a/num[i*2],b/num | ~^~~~ | | | | | long long int [(n * 2)] | long long int a.cc:25:42: error: expected ';' before '}' token 25 | for(int i=1;i<=max(a/num[i*2],b/num | ^ | ; 26 | } | ~ a.cc:26:5: error: expected primary-expression before '}' token 26 | } | ^ a.cc:25:42: error: expected ')' before '}' token 25 | for(int i=1;i<=max(a/num[i*2],b/num | ~ ^ | ) 26 | } | ~ a.cc:26:5: error: expected primary-expression before '}' token 26 | } | ^
s238238716
p03966
C++
#include <bits/stdc++.h> using namespace std; const long long mod = pow(10, 9) + 7; const long long INF = 1LL << 60; template <class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;} template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;} int divCeil(int A, int B) {return (A + (B - 1)) / B;} 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); long long t = T.at(0), a = A.at(0); for (int i = 1; i < N; i++) { long long p = 1; if (T.at(i) < t) chmax(p, divCeil(t, T.at(i))); if (A.at(i) < a) chmax(p, divCeil(a, A.at(i))); t = T.at(i) * p; a = A.at(i) * p; } long long ans = t + a; cout << ans << endl; }
a.cc: In function 'int main()': a.cc:20:27: error: no matching function for call to 'chmax(long long int&, int)' 20 | if (T.at(i) < t) chmax(p, divCeil(t, T.at(i))); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ a.cc:6:25: note: candidate: 'template<class T> bool chmax(T&, T)' 6 | template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;} | ^~~~~ a.cc:6:25: note: template argument deduction/substitution failed: a.cc:20:27: note: deduced conflicting types for parameter 'T' ('long long int' and 'int') 20 | if (T.at(i) < t) chmax(p, divCeil(t, T.at(i))); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ a.cc:21:27: error: no matching function for call to 'chmax(long long int&, int)' 21 | if (A.at(i) < a) chmax(p, divCeil(a, A.at(i))); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ a.cc:6:25: note: candidate: 'template<class T> bool chmax(T&, T)' 6 | template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;} | ^~~~~ a.cc:6:25: note: template argument deduction/substitution failed: a.cc:21:27: note: deduced conflicting types for parameter 'T' ('long long int' and 'int') 21 | if (A.at(i) < a) chmax(p, divCeil(a, A.at(i))); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
s953327894
p03966
C++
#include <bits/stdc++.h> using namespace std; using int64 = long long; #define int int64 #define debug(x) cerr<<#x<<" "<<x<<endl; signed main() { int n;cin>>n; int s,t; cin>>s>>t; for(int i=0;i<n-1;++i){ int tmp = max((s+p-1)/p, (t+q-1)/q); s=tmp*p; t=tmp*q; } cout<<s+t<<endl; return 0; }
a.cc: In function 'int main()': a.cc:12:22: error: 'p' was not declared in this scope 12 | int tmp = max((s+p-1)/p, (t+q-1)/q); | ^ a.cc:12:33: error: 'q' was not declared in this scope 12 | int tmp = max((s+p-1)/p, (t+q-1)/q); | ^
s710477504
p03966
C++
#include <bits/stdc++.h> // statics using namespace std; using int64 = long long; using PAIR = pair<int64, int64>; constexpr int INF = 1 << 30; constexpr int64 LINF = 1LL << 60; constexpr int MOD = 1e9 + 7; constexpr int MAX_N = 3e5 + 1; // init/input #define int int64 #define INIT ios::sync_with_stdio(false);cin.tie(0); #define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__); template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;} template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);} #define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i; // out #define OUT(dist) cout<<(dist); #define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist); #define SP cout<<" "; #define BR cout<<endl; #define zero(n) cout<<setfill('0')<<right<<setw(n) #define debug(x) cerr<<#x<<":"<< (x);BR; // utility #define ALL(a) (a).begin(), (a).end() #define RALL(a) (a).rbegin(), (a).rend() #define EACH(i, a) for(auto &&i:(a)) #define FOR(i, a, b) for(int i=(a);i<(b);++i) #define RFOR(i, a, b) for(int i=(b)-1;i>=(a);--i) #define REP(i, n) for(int i=0;i<(n);++i) #define RREP(i, n) for(int i=(n)-1;i>=0;--i) template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } int gcd(int a,int b){return b?gcd(b,a%b):a;} signed main() { INIT; VAR(int,n); int s,t; bool isFirst=true; REP(i,n){ VAR(int,p,q); if(isFirst){ s=p;t=q; isFirst=false; continue; } int ss=s,st=t,ts=s,tt=t; // s int tmp=ss; if(ss%p!=0){ tmp = (ss/p+1)*p; } int sss = tmp; while(ss>tmp) tmp += sss; ss=tmp; st=(tmp/p)*q; // t tmp=tt; if(tt%q!=0){ tmp = (tt/q+1)*q; } sss = tmp; while(tt>tmp) tmp += sss; tt=tmp; ts=(tmp/q)*p; int ttmp = INF; if(ss>s&&st>t) { ttmp = min(ttmp, ss+st); s = ss; t = st; } if(ts>s&&tt>t) { if(ttmp>ts+tt) s = ts,t=tt; } } OUT(ans)BR; return 0; }
a.cc: In function 'int main()': a.cc:83:7: error: 'ans' was not declared in this scope; did you mean 'abs'? 83 | OUT(ans)BR; | ^~~ a.cc:20:26: note: in definition of macro 'OUT' 20 | #define OUT(dist) cout<<(dist); | ^~~~
s941583283
p03966
C++
#include <bits/stdc++.h> // statics using namespace std; using int64 = long long; using PAIR = pair<int64, int64>; constexpr int INF = 1 << 30; constexpr int64 LINF = 1LL << 60; constexpr int MOD = 1e9 + 7; constexpr int MAX_N = 3e5 + 1; // init/input #define int int64 #define INIT ios::sync_with_stdio(false);cin.tie(0); #define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__); template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;} template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);} #define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i; // out #define OUT(dist) cout<<(dist); #define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist); #define SP cout<<" "; #define BR cout<<endl; #define zero(n) cout<<setfill('0')<<right<<setw(n) #define debug(x) cerr<<#x<<":"<< (x);BR; // utility #define ALL(a) (a).begin(), (a).end() #define RALL(a) (a).rbegin(), (a).rend() #define EACH(i, a) for(auto &&i:(a)) #define FOR(i, a, b) for(int i=(a);i<(b);++i) #define RFOR(i, a, b) for(int i=(b)-1;i>=(a);--i) #define REP(i, n) for(int i=0;i<(n);++i) #define RREP(i, n) for(int i=(n)-1;i>=0;--i) template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } int gcd(int a,int b){return b?gcd(b,a%b):a;} signed main() { INIT; VAR(int,n); int s,t; bool isFirst=true; REP(i,n){ VAR(int,p,q); if(isFirst){ s=p;t=q; isFirst=false; continue; } int ss=s,st=t,ts=s,tt=t; // s int tmp=ss; if(ss%p!=0){ tmp = (ss/p+1)*p; } int sss = tmp; while(ss>tmp) tmp += sss; ss=tmp; st=(tmp/p)*q; // t tmp=tt; if(tt%q!=0){ tmp = (tt/q+1)*q; } int sss = tmp; while(tt>tmp) tmp += sss; tt=tmp; ts=(tmp/q)*p; int ttmp = INF; if(ss>s&&st>t) { ttmp = min(ttmp, ss+st); s = ss; t = st; } if(ts>s&&tt>t) { if(ttmp>ts+tt) s = ts,t=tt; } } OUT(ans)BR; return 0; }
a.cc: In function 'int main()': a.cc:68:9: error: redeclaration of 'int64 sss' 68 | int sss = tmp; | ^~~ a.cc:58:9: note: 'int64 sss' previously declared here 58 | int sss = tmp; | ^~~ a.cc:83:7: error: 'ans' was not declared in this scope; did you mean 'abs'? 83 | OUT(ans)BR; | ^~~ a.cc:20:26: note: in definition of macro 'OUT' 20 | #define OUT(dist) cout<<(dist); | ^~~~
s024971000
p03966
C++
#include <iostream> #include <string> #include <vector> #include <utility> #include <functional> #include <numeric> #include <list> #include <set> #include <map> #include <algorithm> #include <cmath> #include <limits> #include <iomanip> #include <bitset> #include <queue> using namespace std; typedef long long ll; template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } #define REP(i, n) for(int i = 0;i < n;i++) const long long INF = 1LL << 60; int MOD = 1000000007; int main(){ std::ios_base::sync_with_stdio(false); int n; cin>>n; int aa=1,bb=1; REP(i,n){ int a,b; cin>>a>>b; k1=aa/a; k2=bb/b; if(aa%a!=0) k1++; if(bb%b!=0) k2++; aa=max(k1,k2)*a; bb=max(k1,k2)*b; } cout << aa+bb <<endl; return 0; }
a.cc: In function 'int main()': a.cc:34:7: error: 'k1' was not declared in this scope; did you mean 'y1'? 34 | k1=aa/a; | ^~ | y1 a.cc:35:7: error: 'k2' was not declared in this scope 35 | k2=bb/b; | ^~
s198044452
p03966
C++
import java.util.Scanner; public class Main { public static void main(String[] args) { try (Scanner sc = new Scanner(System.in);) { new Main().solve(sc); } } void solve(Scanner sc) { int n = sc.nextInt(); double numOfT = 1; double numOfA = 1; for (int i = 0; i < n; i++) { long t = sc.nextLong(); long a = sc.nextLong(); double x = Math.max(Math.ceil((double)numOfT / t), Math.ceil((double)numOfA / a)); numOfT = t * x; numOfA = a * x; } System.out.println((long)(numOfT + numOfA)); } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.Scanner; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: expected unqualified-id before 'public' 3 | public class Main { | ^~~~~~
s972097370
p03966
C++
#include <iostream> #include <string> #include <vector> #include <cstdlib> #include <cstdio> #include <cmath> #include <algorithm> #include <map> #include <stack> #include <queue> #include <set> #include <cstring> using namespace std; // ascending order #define vsort(v) sort(v.begin(), v.end()) // descending order #define vsort_r(v) sort(v.begin(), v.end(), greater<int>()) #define vunique(v) unique(v.begin(), v.end()) #define mp make_pair #define ts(x) to_string(x) #define rep(i, a, b) for(int i = (int)a; i < (int)b; i++) #define repm(i, a, b) for(int i = (int)a; i > (int)b; i--) #define bit(a) bitset<8>(a) #define des_priority_queue priority_queue<int, vector<int>, greater<int> > #define all(v) (v).begin(), (v).end() typedef long long ll; typedef pair<int, int> P; const ll INF = 1e18; int main(){ cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; int T[N], A[N]; rep(i, 0, N) cin >> T[i] >> A[i]; int rsl = T[0] + A[0]; int x = T[0], y = A[0]; rep(i, 1, N) { if(T[i] >= x and A[i] >= y) { x = T[i]; y = A[i]; } else if(T[i] >= x and A[i] < y) { int j = 0; while(true) { if((y + j) % A[i] == 0) { y += j; x = T[i] * (y / A[i]); break; } j++; } } else if(A[i] >= y and T[i] < x) { int j = 0; while(true) { if((x + j) % T[i] == 0) { x += j; y = A[i] * (x / T[i]); break; } j++; } } else { int rsl1 = 0, x1 = 0, x2 = 0, y1 = 0, y2 = 0; if(x >= y) { if(x % T[i] == 0) { y = A[i] * (x / T[i]); } else { int j = 0; while(true) { if((x + j) % T[i] == 0) { x += j; y = A[i] * (x / T[i]); break; } j++; } } rsl1 = x + y; x1 = x; y1 = y; } else { if(y % A[i] == 0) { x = T[i] * (A[i] / y); } else { int j = 0; while(true) { if((y + j) % A[i] == 0) { y += j; x = T[i] * (x / A[i]); break; } j++; } } rsl2 = x + y; x2 = x; y1 = y; } if(rsl1 < rsl2) { rsl = rsl1; x = x1; y = y1; } else { rsl = rsl2; x = x2; y = y2; } } } rsl = x + y; cout << rsl << endl; }
a.cc: In function 'int main()': a.cc:99:33: error: 'rsl2' was not declared in this scope; did you mean 'rsl1'? 99 | rsl2 = x + y; | ^~~~ | rsl1 a.cc:102:35: error: 'rsl2' was not declared in this scope; did you mean 'rsl1'? 102 | if(rsl1 < rsl2) { | ^~~~ | rsl1
s284156512
p03966
C++
#include <bits/stdc++.h> using namespace std; typedef __int128 int64; long long n, A[1005], B[1005]; int64 extended_euclid(int64 a, int64 b, int64 &x, int64 &y) { int64 xx = y = 0; int64 yy = x = 1; while (b) { int64 q = a / b; int64 t = b; b = a%b; a = t; t = xx; xx = x - q*xx; x = t; t = yy; yy = y - q*yy; y = t; } return a; } int64 abs(int64 x) { return x < 0 ? -x : x; } int64 down(int64 a, int64 b) { int64 ans = a / b; if(abs(a) % abs(b)) ans--; return ans; } int64 up(int64 a, int64 b) { int64 ans = a / b; if(abs(a) % abs(b)) ans++; return ans; } int main() { scanf("%lld", &n); for(int64 i = 1; i <= n; i++) { scanf("%lld%lld", &A[i], &B[i]); } long long ans = A[1] + B[1]; for(int64 i = 1; i < n; i++) { int64 a = A[i], b = B[i]; int64 c = A[i + 1], d = B[i + 1]; int64 x, y; int64 g = extended_euclid(d, c, x, y); int64 v = (c * b - d * a) / g; x = x * v; y = -y * v; int64 k_neg = max(up(x * g, c), up(y * g, d)) + 1; x = x - k_neg * c / g; y = y - k_neg * d / g; int64 k = min(down(x * g, c), down(y * g, d)); x = x - k * c / g; y = y - k * d / g; A[i + 1] = a + x; B[i + 1] = b + y; ans += x; ans += y; } printf("%lld\n", ans); return 0; }
a.cc: In function 'int64 down(int64, int64)': a.cc:26:15: error: call of overloaded 'abs(int64&)' is ambiguous 26 | if(abs(a) % abs(b)) | ~~~^~~ In file included from /usr/include/c++/14/cstdlib:79, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42, from a.cc:1: /usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)' 980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; | ^~~ a.cc:19:7: note: candidate: 'int64 abs(int64)' 19 | int64 abs(int64 x) { | ^~~ In file included from /usr/include/c++/14/cstdlib:81: /usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)' 137 | abs(__float128 __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)' 85 | abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; } | ^~~ /usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)' 79 | abs(long double __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)' 75 | abs(float __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)' 71 | abs(double __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)' 61 | abs(long long __x) { return __builtin_llabs (__x); } | ^~~ /usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)' 56 | abs(long __i) { return __builtin_labs(__i); } | ^~~ a.cc:26:24: error: call of overloaded 'abs(int64&)' is ambiguous 26 | if(abs(a) % abs(b)) | ~~~^~~ /usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)' 980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; | ^~~ a.cc:19:7: note: candidate: 'int64 abs(int64)' 19 | int64 abs(int64 x) { | ^~~ /usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)' 137 | abs(__float128 __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)' 85 | abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; } | ^~~ /usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)' 79 | abs(long double __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)' 75 | abs(float __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)' 71 | abs(double __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)' 61 | abs(long long __x) { return __builtin_llabs (__x); } | ^~~ /usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)' 56 | abs(long __i) { return __builtin_labs(__i); } | ^~~ a.cc: In function 'int64 up(int64, int64)': a.cc:35:15: error: call of overloaded 'abs(int64&)' is ambiguous 35 | if(abs(a) % abs(b)) | ~~~^~~ /usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)' 980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; | ^~~ a.cc:19:7: note: candidate: 'int64 abs(int64)' 19 | int64 abs(int64 x) { | ^~~ /usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)' 137 | abs(__float128 __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)' 85 | abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; } | ^~~ /usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)' 79 | abs(long double __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)' 75 | abs(float __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)' 71 | abs(double __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)' 61 | abs(long long __x) { return __builtin_llabs (__x); } | ^~~ /usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)' 56 | abs(long __i) { return __builtin_labs(__i); } | ^~~ a.cc:35:24: error: call of overloaded 'abs(int64&)' is ambiguous 35 | if(abs(a) % abs(b)) | ~~~^~~ /usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)' 980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; | ^~~ a.cc:19:7: note: candidate: 'int64 abs(int64)' 19 | int64 abs(int64 x) { | ^~~ /usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)' 137 | abs(__float128 __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)' 85 | abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; } | ^~~ /usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)' 79 | abs(long double __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)' 75 | abs(float __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)' 71 | abs(double __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)' 61 | abs(long long __x) { return __builtin_llabs (__x); } | ^~~ /usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)' 56 | abs(long __i) { return __builtin_labs(__i); } | ^~~
s429119676
p03966
C++
#include<bits\stdc++.h> using namespace std; #define ll long long #define lf double #define N 4 #define err {puts("-1");exit(0);}; int color[408][4]; ll has(int a[]) { ll res=0; for(int i=N-1;i>=0;i--) res=res*1000+a[i]; return res; } vector<ll> _rotate(int c[]) { vector<ll> res; // for(int i=0;i<N;i++) cout<<c[i]<<" "; for(int i=0;i<N;i++) { int a[4]; for(int j=0;j<N;j++) a[j]=c[(i+j)%N]; res.push_back(has(a)); }return res; } int same(ll x,ll y) { int a[N],c[N];int sum=0; for(int i=0;i<N;i++) a[i]=x%1000,x/=1000; for(int i=0;i<N;i++) { for(int j=0;j<N;j++) c[j]=a[(i+j)%N]; sum+= has(c)==y; }return sum; } map<ll,ll >m; void ins(int x) { vector<ll> v=_rotate(color[x]); for(int i=0;i<v.size();i++) m[v[i]]++; } ll ans; ll operate(int c1[],int c2[]) { // for(int i=0;i<N;i++) cout<<c1[i]<<" ";cout<<"\n"; // for(int i=0;i<N;i++) cout<<c2[i]<<" ";cout<<"\n";system("pause"); ll p=has(c1); int a[4];ll ck[4]; for(int i=0;i<N;i++) { a[0]=c1[i],a[1]=c1[(i+1)%N],a[2]=c2[(i+1)%N],a[3]=c2[i]; ck[i]=has(a); } ll cnt=1; for(int i=0;i<4;i++) { ll over=same(p,ck[i]); for(int j=0;j<i;j++) over+=same(ck[j],ck[i]); if(m[ck[i]]<=0) return 0; cnt*=m[ck[i]]-over; } return cnt; } int bel[]={0,3,2,1}; int main() { int n;cin>>n; for(int i=1;i<=n;i++) for(int j=0;j<N;j++) cin>>color[i][j]; for(int i=n;i>=1;i--) { for(int j=i+1;j<=n;j++) { int a[N],b[N];for(int k=0;k<N;k++) b[k]=color[i][k]; for(int k=0;k<N;k++) { for(int l=0;l<N;l++) a[l]=color[j][bel[(l+k)%N]]; ans+=operate(a,b); } }ins(i); } cout<<ans; return 0; } /* 3 2 6 3 4 1 1 2 2 1 1 3 3 2 1 9 1 1 3 2 */ /* 5 1 2 3 4 5 6 1 1 4 2 2 3 6 1 1 4 2 1 1 5 2 2 5 10 1 1 5 2 */
a.cc:1:9: fatal error: bits\stdc++.h: No such file or directory 1 | #include<bits\stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s308960611
p03966
C++
#include <bits/stdc++.h> using namespace std; long long n,a,b,x=1,y=1; int main() { cin>>n; while(n--) { cin>>a>>b; int mid=max(x/a,y/b); while(a*mid<x || b*mid<y) mid++; x=a*sum,y=b*sum; } cout<<x+y; return 0; }
a.cc: In function 'int main()': a.cc:14:15: error: 'sum' was not declared in this scope 14 | x=a*sum,y=b*sum; | ^~~
s694618803
p03966
C++
#include <bits/stdc++.h> using namespace std; int main(int argc, char const *argv[]) { long long n, smax = 1, t, a; cin >> n; for (int i = 0; i < n; i++) { cin >> t >> a; smax = max(smax, t + a); } long long tasum = t + a, tacount = 0; while (tasum < smax) { tacount++; if (tasum * tacouunt > smax) break; } cout << (t + a) * tacount; return 0; }
a.cc: In function 'int main(int, const char**)': a.cc:19:21: error: 'tacouunt' was not declared in this scope; did you mean 'tacount'? 19 | if (tasum * tacouunt > smax) | ^~~~~~~~ | tacount
s678573827
p03966
C++
#include <bits/stdc++.h> using namespace std; int main(int argc, char const *argv[]) { long long n, smax = 1; double t, a; cin >> n; for (int i = 0; i < n; i++) { cin >> t >> a; smax = max(smax, t + a); } long long tasum = t + a, tacount = 0; while (tasum < smax) { tacount++; if (tasum * tacouunt > smax) break; } cout<<(t+a)*tacount; return 0; }
a.cc: In function 'int main(int, const char**)': a.cc:12:19: error: no matching function for call to 'max(long long int&, double)' 12 | smax = max(smax, t + a); | ~~~^~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:12:19: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'double') 12 | smax = max(smax, t + a); | ~~~^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:12:19: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 12 | smax = max(smax, t + a); | ~~~^~~~~~~~~~~~~ a.cc:19:21: error: 'tacouunt' was not declared in this scope; did you mean 'tacount'? 19 | if (tasum * tacouunt > smax) | ^~~~~~~~ | tacount
s942070309
p03966
C++
#include <algorithm> #include <cmath> #include <iostream> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int N; cin >> N; int int x, y; size_t a, b; cin >> a >> b; for (int i = 1; i < N; ++i) { cin >> x >> y; size_t n = max(ceil(a * 1.0 / x), ceil(b * 1.0 / y)); a = n * x; b = n * y; } cout << a + b << endl; return 0; }
a.cc: In function 'int main()': a.cc:14:3: error: two or more data types in declaration of 'x' 14 | int int x, y; | ^~~ a.cc:14:3: error: two or more data types in declaration of 'y' a.cc:18:12: error: 'x' was not declared in this scope 18 | cin >> x >> y; | ^ a.cc:18:17: error: 'y' was not declared in this scope 18 | cin >> x >> y; | ^
s999889322
p03966
C++
#include <iostream> #include <algorithm> using namespace std; int main(){ int n,i; long long x=0,y=0; cin >> n; for(i=0;i<n;i++){ long long int p,q; cin >> p >> q; if(p>=x %% q>=y){ x=p; y=q; }else if(p>q){ long long m=y/q; if(y%q!=0)m++; x=p*m; y=q*m; }else if(p<q){ long long m=x/p; if(x%p!=0)m++; x=p*m; y=q*m; }else if(p==q){ x=y=min(x,y); } } cout << x+y << endl; return 0; }
a.cc: In function 'int main()': a.cc:12:14: error: expected primary-expression before '%' token 12 | if(p>=x %% q>=y){ | ^
s169764003
p03966
C++
#include <iostream> #include <vector> using namespace std; int main(){ int N; cin >> N; unsigned long long t,a; t = 1ll; a = 1ll; unsigned long long A,T; for(int i=0;i<N;i++){ cin >> T >> A; long long i = (t+T-1)/T; long long j = (a+A-1)/A; long long k = max(i,j); t = T*k; a = A*k; } cout << a + t << endl; return 0; }
a.cc: In function 'int main()': a.cc:14:19: error: redeclaration of 'long long int i' 14 | long long i = (t+T-1)/T; | ^ a.cc:12:13: note: 'int i' previously declared here 12 | for(int i=0;i<N;i++){ | ^
s344289241
p03966
C
#define _CRT_SECURE_NO_WARNINGS #include <math.h> #include <stdio.h> #include <stdlib.h> int n; int t[10000]; int a[10000]; int t1,a1; int main() { scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%d %d", &t[i], &a[i]); } int temp; for (int i = 1; i < n; i++) { temp = max((a[i - 1] + a[i] - 1) / a[i], (t[i - 1] + t[i] - 1)/ t[i]); a[i] = temp * a[i]; t[i] = temp * t[i]; } printf("%d\n", a[n - 1] + t[n - 1]); return 0; }
main.c: In function 'main': main.c:21:24: error: implicit declaration of function 'max'; did you mean 'fmax'? [-Wimplicit-function-declaration] 21 | temp = max((a[i - 1] + a[i] - 1) / a[i], (t[i - 1] + t[i] - 1)/ t[i]); | ^~~ | fmax
s283274411
p03966
C
#define _CRT_SECURE_NO_WARNINGS #include <math.h> #include <stdio.h> #include <stdlib.h> int n; int t[1000]; int a[1000]; int t1,a1; int main() { scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%d %d", &t[i], &a[i]); } int temp; for (int i = 1; i < n; i++) { temp = max((a[i - 1] + a[i] - 1) / a[i], (t[i - 1] + t[i] - 1)/ t[i]); a[i] = temp * a[i]; t[i] = temp * t[i]; } printf("%d\n", a[n - 1] + t[n - 1]); return 0; }
main.c: In function 'main': main.c:21:24: error: implicit declaration of function 'max'; did you mean 'fmax'? [-Wimplicit-function-declaration] 21 | temp = max((a[i - 1] + a[i] - 1) / a[i], (t[i - 1] + t[i] - 1)/ t[i]); | ^~~ | fmax
s152647448
p03966
C
#include <math.h> #include <stdio.h> #include <stdlib.h> /* int n, k; int a[15]; int main() { scanf("%d %d", &n, &k); for (int i = 0; i < n; i++) { scanf("%d", &a[i]); } int ans; int color = 0; for (int i = 1; i < n; i++) { if (a[i - 1] < a[i]) { color++; } } while (color < k) { color = 0; for (int i = 1; i < n; i++) { if (a[i - 1] < a[i]) { color++; } } } } */ int n; int t[1000]; int a[1000]; int t1,a1; int main() { scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%d %d", &t[i], &a[i]); } int temp; for (int i = 1; i < n; i++) { temp = max((a[i - 1] + a[i] - 1) / a[i], (t[i - 1] + t[i] - 1)/ t[i]); a[i] = temp * a[i]; t[i] = temp * t[i]; } printf("%d\n", a[n - 1] + t[n - 1]); return 0; }
main.c: In function 'main': main.c:46:24: error: implicit declaration of function 'max'; did you mean 'fmax'? [-Wimplicit-function-declaration] 46 | temp = max((a[i - 1] + a[i] - 1) / a[i], (t[i - 1] + t[i] - 1)/ t[i]); | ^~~ | fmax
s367633036
p03966
C++
#include <math.h> #include <stdio.h> #include <stdlib.h> /* int n, k; int a[15]; int main() { scanf("%d %d", &n, &k); for (int i = 0; i < n; i++) { scanf("%d", &a[i]); } int ans; int color = 0; for (int i = 1; i < n; i++) { if (a[i - 1] < a[i]) { color++; } } while (color < k) { color = 0; for (int i = 1; i < n; i++) { if (a[i - 1] < a[i]) { color++; } } } } */ int n; int t[1000]; int a[1000]; int t1,a1; int main() { scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%d %d", &t[i], &a[i]); } int temp; for (int i = 1; i < n; i++) { temp = max((a[i - 1] + a[i] - 1) / a[i], (t[i - 1] + t[i] - 1)/ t[i]); a[i] = temp * a[i]; t[i] = temp * t[i]; } printf("%d\n", a[n - 1] + t[n - 1]); return 0; }
a.cc: In function 'int main()': a.cc:46:24: error: 'max' was not declared in this scope; did you mean 'std::max'? 46 | temp = max((a[i - 1] + a[i] - 1) / a[i], (t[i - 1] + t[i] - 1)/ t[i]); | ^~~ | std::max In file included from /usr/include/c++/14/bits/specfun.h:43, from /usr/include/c++/14/cmath:3906, from /usr/include/c++/14/math.h:36, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:303:5: note: 'std::max' declared here 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~
s804535325
p03966
C++
#include "bits/stdc++.h" using namespace std; int main(){ int n; cin>>n; int x; long long int A=0; long long int B=0; for(int i=0;i<n;i++){ long long int t,a; cin>>t>>a; x=max(1,max(A/t,B/a)); while(A>t*x||B>a*x)x++; A=x*t; B=x*a; } cout<<A+B<<endl; return 0; }
a.cc: In function 'int main()': a.cc:15:22: error: no matching function for call to 'max(int, const long long int&)' 15 | x=max(1,max(A/t,B/a)); | ~~~^~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:15:22: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 15 | x=max(1,max(A/t,B/a)); | ~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:15:22: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 15 | x=max(1,max(A/t,B/a)); | ~~~^~~~~~~~~~~~~~~~
s149092539
p03966
C++
#include<iostream> #include<algorithm> #include<cstdio> #include<cmath> #include<math.h> #include<string> #include<string.h> #include<stack> #include<queue> #include<vector> #include<utility> #include<set> #include<map> #include<stdlib.h> #include<iomanip> using namespace std; #define ll long long #define ld long double #define EPS 0.0000000001 #define INF 1e9 #define MOD 1000000007 #define rep(i,n) for(i=0;i<n;i++) #define loop(i,a,n) for(i=a;i<n;i++) #define all(in) in.begin(),in.end() #define shosu(x) fixed<<setprecision(x) typedef vector<int> vi; typedef pair<int,int> pii; int main(void) { int i,j; int n; cin>>n; ll x=0,y=0; rep(i,n){ ll t,a; cin>>t>>a; ll i=max(1, max(x/t,y/a)); while(x>t*i||y>a*i)i++; x=t*i; y=a*i; } cout<<x+y<<endl; }
a.cc: In function 'int main()': a.cc:40:13: error: no matching function for call to 'max(int, const long long int&)' 40 | ll i=max(1, max(x/t,y/a)); | ~~~^~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:40:13: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 40 | ll i=max(1, max(x/t,y/a)); | ~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:2: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:40:13: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 40 | ll i=max(1, max(x/t,y/a)); | ~~~^~~~~~~~~~~~~~~~~
s781486806
p03966
C++
#include<iostream> #include<algorithm> #include<cstdio> #include<cmath> #include<math.h> #include<string> #include<string.h> #include<stack> #include<queue> #include<vector> #include<utility> #include<set> #include<map> #include<stdlib.h> #include<iomanip> using namespace std; #define ll long long #define ld long double #define EPS 0.0000000001 #define INF 1e9 #define MOD 1000000007 #define rep(i,n) for(i=0;i<n;i++) #define loop(i,a,n) for(i=a;i<n;i++) #define all(in) in.begin(),in.end() #define shosu(x) fixed<<setprecision(x) typedef vector<int> vi; typedef pair<int,int> pii; int main(void) { int i,j; int n; cin>>n; ll x=0,y=0; rep(i,n){ ll t,a; cin>>t>>a; int i=max(1, max(x/t,y/a)); while(x>t*i||y>a*i)i++; x=t*i; y=a*i; } cout<<x+y<<endl; }
a.cc: In function 'int main()': a.cc:40:14: error: no matching function for call to 'max(int, const long long int&)' 40 | int i=max(1, max(x/t,y/a)); | ~~~^~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:40:14: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 40 | int i=max(1, max(x/t,y/a)); | ~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:2: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:40:14: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 40 | int i=max(1, max(x/t,y/a)); | ~~~^~~~~~~~~~~~~~~~~
s858691577
p03966
C++
##include<bits/stdc++.h> #define F first #define S second #define pb push_back #define ll long long #define int long long using namespace std ; const int MAXN = 101 * 1001 ; int32_t main() { ios::sync_with_stdio(0) ; cin.tie(0) ; int n , a , b , x , y ; cin >> n >> a >> b ; for(int i = 1 ; i < n ; i ++ ) { cin >> x >> y ; int q = (a+x-1) / x ; int w = (b+y-1) / y ; q = max(q,w) ; a = q * x ; b = q * y ; } cout<<a+b<<'\n'; } ~
a.cc:1:1: error: stray '##' in program 1 | ##include<bits/stdc++.h> | ^~ a.cc:1:3: error: 'include' does not name a type 1 | ##include<bits/stdc++.h> | ^~~~~~~ a.cc:13:1: error: 'int32_t' does not name a type 13 | int32_t main() | ^~~~~~~ a.cc:1:1: note: 'int32_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' +++ |+#include <cstdint> 1 | ##include<bits/stdc++.h> a.cc:32:2: error: expected class-name at end of input 32 | ~ | ^
s467397644
p03966
C++
#include<iostream> using namespace std; int euclid(int a, int b){ int tmp; if(a< b){ tmp= a; a= b; b= tmp; } if(a%b ==0) return b; tmp= a% b; a= b; b= tmp; return euclid(a,b); } int main(){ int n; long long int *t, *a; cin>> n; t= new int[n]; a= new int[n]; for(int i=0; i<n; i++) cin>> t[i]>> a[i]; if(n==1){ cout<< t[0]+a[0]<<endl; } else{ for(int i=0; i<n-1; i++){ if(t[i+1]< t[i] || a[i+1]< a[i]){ int tQuot= min(t[i]%t[i+1], 1); int aQuot= min(a[i]%a[i+1], 1); int tMulti= t[i]/t[i+1] + tQuot; int aMulti= a[i]/a[i+1] + aQuot; int multi= max(tMulti, aMulti); if(t[i+1]< t[i] && a[i+1]< a[i]){ if(aMulti* t[i+1]> t[i] && aMulti* a[i+1]> a[i] && tMulti* t[i+1]> t[i] && tMulti* a[i+1]> a[i] ){ multi= min(tMulti, aMulti); } } t[i+1]*= multi; a[i+1]*= multi; } } cout<< t[n-1]+a[n-1]<< endl; } return 0; }
a.cc: In function 'int main()': a.cc:26:12: error: cannot convert 'int*' to 'long long int*' in assignment 26 | t= new int[n]; | ^~~~~~~~~~ | | | int* a.cc:27:12: error: cannot convert 'int*' to 'long long int*' in assignment 27 | a= new int[n]; | ^~~~~~~~~~ | | | int* a.cc:37:47: error: no matching function for call to 'min(long long int, int)' 37 | int tQuot= min(t[i]%t[i+1], 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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:37:47: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 37 | int tQuot= min(t[i]%t[i+1], 1); | ~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided a.cc:38:47: error: no matching function for call to 'min(long long int, int)' 38 | int aQuot= min(a[i]%a[i+1], 1); | ~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:38:47: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 38 | int aQuot= min(a[i]%a[i+1], 1); | ~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided
s466345210
p03966
C++
#include<iostream> #include<vector> #include<string> #include<algorithm> #include<map> #include<set> #include<utility> #include<cmath> #include<cstring> #include<queue> #include<stack> #include<cstdio> #include<sstream> #include<iomanip> #define loop(i,a,b) for(int i=a;i<b;i++) #define rep(i,a) loop(i,0,a) #define pb push_back #define mp make_pair #define all(in) in.begin(),in.end() #define shosu(x) fixed<<setprecision(x) using namespace std; //kaewasuretyuui typedef long long ll; typedef pair<int,int> pii; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<pii> vp; typedef vector<vp> vvp; typedef pair<int,pii> pip; typedef vector<pip>vip; const double PI=acos(-1); const double EPS=1e-8; const int inf=2e9; int main(){ int n; cin>>n; ll a,b; cin>>a>>b; rep(i,n-1){ ll s,t; cin>>s>>t; if(a<=s&&b<=t){ a=s;b=t; }else if((double)a/s<(double)b/t){ // ll q=ceil((double)b/t); ll q=(b-1)/t+1; a=s*q;b=t*q; }else{ // ll q=ceil((double)a/s); ll=q=(a-1)/s+1; a=s*q;b=t*q; } } cout<<a+b<<endl; }
a.cc: In function 'int main()': a.cc:50:27: error: expected unqualified-id before '=' token 50 | ll=q=(a-1)/s+1; | ^ a.cc:51:29: error: 'q' was not declared in this scope 51 | a=s*q;b=t*q; | ^
s581379578
p03966
C++
# include <stdio.h> # include <string.h> # define MAX(a,b) (a)>(b)?(a):(b) typedef __int64 LL; int main () { int i, n, a, b; LL x=1, y=1, d; scanf("%d",&n); for (i=1; i<=n; ++i) { scanf("%d%d",&a,&b); d=MAX((x+a-1)/a,(y+b-1)/b); x=a*d; y=b*d; } printf("%I64d\n",x+y); return 0; }
a.cc:4:9: error: '__int64' does not name a type; did you mean '__int64_t'? 4 | typedef __int64 LL; | ^~~~~~~ | __int64_t a.cc: In function 'int main()': a.cc:9:9: error: 'LL' was not declared in this scope 9 | LL x=1, y=1, d; | ^~ a.cc:13:17: error: 'd' was not declared in this scope 13 | d=MAX((x+a-1)/a,(y+b-1)/b); | ^ a.cc:13:24: error: 'x' was not declared in this scope 13 | d=MAX((x+a-1)/a,(y+b-1)/b); | ^ a.cc:3:20: note: in definition of macro 'MAX' 3 | # define MAX(a,b) (a)>(b)?(a):(b) | ^ a.cc:13:34: error: 'y' was not declared in this scope 13 | d=MAX((x+a-1)/a,(y+b-1)/b); | ^ a.cc:3:24: note: in definition of macro 'MAX' 3 | # define MAX(a,b) (a)>(b)?(a):(b) | ^ a.cc:16:26: error: 'x' was not declared in this scope 16 | printf("%I64d\n",x+y); | ^ a.cc:16:28: error: 'y' was not declared in this scope 16 | printf("%I64d\n",x+y); | ^
s913010025
p03966
C++
# include <stdio.h> # include <string.h> # define MAX(a,b) (a)>(b)?(a):(b) typedef __int64 LL; int main () { int i, n, a, b; LL x=1, y=1, d; scanf("%d",&n); for (i=1; i<=n; ++i) { scanf("%d%d",&a,&b); d=MAX((x+a-1)/a,(y+b-1)/b); x=a*d; y=b*d; } printf("%I64d\n",x+y); return 0; }
a.cc:4:9: error: '__int64' does not name a type; did you mean '__int64_t'? 4 | typedef __int64 LL; | ^~~~~~~ | __int64_t a.cc: In function 'int main()': a.cc:9:9: error: 'LL' was not declared in this scope 9 | LL x=1, y=1, d; | ^~ a.cc:13:17: error: 'd' was not declared in this scope 13 | d=MAX((x+a-1)/a,(y+b-1)/b); | ^ a.cc:13:24: error: 'x' was not declared in this scope 13 | d=MAX((x+a-1)/a,(y+b-1)/b); | ^ a.cc:3:20: note: in definition of macro 'MAX' 3 | # define MAX(a,b) (a)>(b)?(a):(b) | ^ a.cc:13:34: error: 'y' was not declared in this scope 13 | d=MAX((x+a-1)/a,(y+b-1)/b); | ^ a.cc:3:24: note: in definition of macro 'MAX' 3 | # define MAX(a,b) (a)>(b)?(a):(b) | ^ a.cc:16:26: error: 'x' was not declared in this scope 16 | printf("%I64d\n",x+y); | ^ a.cc:16:28: error: 'y' was not declared in this scope 16 | printf("%I64d\n",x+y); | ^
s315134235
p03966
C++
#include<iostream> #include<fstream> #include<algorithm> #include<vector> #include<queue> #include<map> #include<set> #include<string> #include<cmath> using namespace std; #define REP(i,m,n) for(int i=(m); i<(int)(n); i++) #define RREP(i,m,n) for(int i=(int)(n-1); i>=m; i--) #define rep(i,n) REP(i,0,n) #define rrep(i,n) RREP(i,0,n) #define fi first #define se second #define _DEBUG #ifdef _DEBUG ifstream ifs("input.txt"); #define input ifs #else #define input cin #endif #define DEBUG(x) cout<<#x<<": "<<x<<endl using ll = long long; using pii = pair<int, int>; using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); int n; ll a = 1, t = 1; input >> n; rep(i, n){ ll x, y; input >> x >> y; ll k = max((a + x - 1) / x, (t + y - 1) / y); a = k * x; t = k * y; } cout << ct + ca << endl; return 0; }
a.cc: In function 'int main()': a.cc:49:13: error: 'ct' was not declared in this scope; did you mean 't'? 49 | cout << ct + ca << endl; | ^~ | t a.cc:49:18: error: 'ca' was not declared in this scope; did you mean 'a'? 49 | cout << ct + ca << endl; | ^~ | a
s935142711
p03966
C++
#include <iostream> using namespace std; int main(void){ // Here your code ! ilong long int n,a[2000],b[2000],da[2000],db[2000]; scanf("%d",&n); for(int i=0;i<n;i++)scanf("%lld%lld",&a[i],&b[i]); da[0]=a[0]; db[0]=b[0]; for(int i=1;i<n;i++){ while(da[i-1]>da[i]||db[i-1]>db[i]){da[i]+=a[i];db[i]+=b[i];} } printf("%lld\n",da[n-1]+db[n-1]); }
a.cc: In function 'int main()': a.cc:5:5: error: 'ilong' was not declared in this scope; did you mean 'ulong'? 5 | ilong long int n,a[2000],b[2000],da[2000],db[2000]; | ^~~~~ | ulong a.cc:6:17: error: 'n' was not declared in this scope 6 | scanf("%d",&n); | ^ a.cc:7:43: error: 'a' was not declared in this scope 7 | for(int i=0;i<n;i++)scanf("%lld%lld",&a[i],&b[i]); | ^ a.cc:7:49: error: 'b' was not declared in this scope 7 | for(int i=0;i<n;i++)scanf("%lld%lld",&a[i],&b[i]); | ^ a.cc:8:5: error: 'da' was not declared in this scope 8 | da[0]=a[0]; | ^~ a.cc:8:11: error: 'a' was not declared in this scope 8 | da[0]=a[0]; | ^ a.cc:9:5: error: 'db' was not declared in this scope 9 | db[0]=b[0]; | ^~ a.cc:9:11: error: 'b' was not declared in this scope 9 | db[0]=b[0]; | ^
s516249261
p03966
C++
#include <iostream> #include <algorithm> #include <vector> #include <deque> #include <queue> #include <list> #include <stack> #include <string> #include <functional> #include <numeric> #include <cmath> #include <iomanip> #include <map> #include <set> #include <cstdlib> #include <Windows.h> #define INT_MAX 2147483647 #define INT_MIN -2147483648 #define INF 100000000 #define _INF -100000000 #define INFLL (long long)1e14 #define _INFLL (long long)-1e14 #define Loop(i, n) for(int i = 0; i < (int)n; i++) #define Loop1(i, n) for(int i = 1; i <= (int)n; i++) #define Loopr(i, n) for(int i = (int)n - 1; i >= 0; i--) #define Loopr1(i, n) for(int i = (int)n; i >= 1; i--) using namespace std; typedef long long int ll; typedef vector<int> vi; typedef vector<vector<int>> vvi; typedef vector<ll> vll; typedef vector<vector<ll>> vvll; typedef pair<int, int> P; int main() { int n; cin >> n; ll x = 1, y = 1; Loop(i, n) { ll t, a; cin >> t >> a; if (t >= x&&a >= y) { x = t; y = a; } else { ll p, q; if (x%t == 0) p = x / t; else p = x / t + 1; if (y%a == 0) q = y / a; else q = y / a + 1; if (p >= q) { x = t*(int)p; y = a*(int)p; } else { x = t*(int)q; y = a*(int)q; } } } cout << x + y << endl; }
a.cc:16:10: fatal error: Windows.h: No such file or directory 16 | #include <Windows.h> | ^~~~~~~~~~~ compilation terminated.
s113112542
p03966
C++
#include <iostream> #include <vector> using namespace std; typedef vector<int> V; typedef unsigned long long ull; typedef pair<ull, ull> P; ull minMultipleAbove(int x, int a){ return a == 1 ? x : x + a - x % a; } double div(double x, double y){ return x / y; } P look(P votes, int t, int a){ double r1 = div(t, a); double r2 = div(votes.first, votes.second); if(r1 > r2){ int va = minMultipleAbove(votes.second, a); return P(va * t / a, va); }else if(r1 < r2){ int vt = minMultipleAbove(votes.first, t); return P(vt, vt * a / t); }else{ return votes; } } ull solve(const V& t, const V& a){ int n = t.size(); P votes = P(1, 1); for(int i = 0; i < n; i++){ votes = look(votes, t[i], a[i]); // cout << votes.first << " " << votes.second << endl; } return votes.first + votes.second; } int main(int argc, char* argv[]){ int n; cin >> n; V t(n), a(n); for(int i = 0; i < n; i++){ cin >> t[i] >> a[i]; } cout << solve(t, a) << endl; return 0; } /* t : a = x + n : y + m a(x + n) = t(y + m) ax + an = ty + tm an - tm = ty - ax */
a.cc: In function 'P look(P, int, int)': a.cc:18:20: error: cannot convert 'div_t' to 'double' in initialization 18 | double r1 = div(t, a); | ~~~^~~~~~ | | | div_t a.cc:19:20: error: call of overloaded 'div(long long unsigned int&, long long unsigned int&)' is ambiguous 19 | double r2 = div(votes.first, votes.second); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/cstdlib:79, from /usr/include/c++/14/ext/string_conversions.h:43, from /usr/include/c++/14/bits/basic_string.h:4154, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/stdlib.h:992:14: note: candidate: 'div_t div(int, int)' 992 | extern div_t div (int __numer, int __denom) | ^~~ a.cc:13:8: note: candidate: 'double div(double, double)' 13 | double div(double x, double y){ | ^~~ /usr/include/c++/14/cstdlib:219:3: note: candidate: 'lldiv_t __gnu_cxx::div(long long int, long long int)' 219 | div(long long __n, long long __d) | ^~~ /usr/include/c++/14/cstdlib:181:3: note: candidate: 'ldiv_t std::div(long int, long int)' 181 | div(long __i, long __j) _GLIBCXX_NOTHROW { return ldiv(__i, __j); } | ^~~
s726832603
p03966
C++
//AtCoDeer and election_returns_prompt_report #include <iostream> #include <cmath> int main(){ int n; long long int t, a; std::cin >> n; long long int tt, aa; std::cin >> tt >> aa; for(int i=1;i<n;i++){ cin >> t >> a; long long int n1, n2; n1 = n2 = 0; n1 = tt/t; if(tt%t != 0){ n1++; } n2 = aa/a; if(aa%a != 0){ n2++ } tt = max(n1, n2)*t; aa = max(n1, n2)*a; } std::cout << tt+aa << std::endl; return 0; }
a.cc: In function 'int main()': a.cc:13:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 13 | cin >> t >> a; | ^~~ | std::cin In file included from a.cc:3: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:22:11: error: expected ';' before '}' token 22 | n2++ | ^ | ; 23 | } | ~ a.cc:24:10: error: 'max' was not declared in this scope; did you mean 'std::max'? 24 | tt = max(n1, n2)*t; | ^~~ | std::max 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: /usr/include/c++/14/bits/stl_algobase.h:303:5: note: 'std::max' declared here 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~
s890628373
p03966
C++
//AtCoDeer and election_returns_prompt_report #include <iostream> #include <cmath> int main(){ int n; long long int t, a; std::cin >> n; long long int tt, aa; std::cin >> tt >> aa; for(int i=1;i<n;i++){ cin >> t >> a; long long int n1, n2; n1 = n2 = 0; n1 = tt/t; if(tt%t != 0){ n1++; } n2 = aa/a; if(aa%a != 0){ n2++ } tt = max(n1, n2)*t; aa = max(n1, n2)*a; } std::cout << tt+aa << std::endl; return 0; }
a.cc: In function 'int main()': a.cc:13:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 13 | cin >> t >> a; | ^~~ | std::cin In file included from a.cc:3: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:22:11: error: expected ';' before '}' token 22 | n2++ | ^ | ; 23 | } | ~ a.cc:24:10: error: 'max' was not declared in this scope; did you mean 'std::max'? 24 | tt = max(n1, n2)*t; | ^~~ | std::max 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: /usr/include/c++/14/bits/stl_algobase.h:303:5: note: 'std::max' declared here 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~
s201732326
p03966
C++
m = (s+e-1)/2; if( (a[i]*m < a[i-1] or b[i]*m < b[i-1]) ) s = m+1; else e = m; } a[i] *= e, b[i] *= e; } if( n == 1 and a[0] + b[0] == 2 ) cout<<0<<endl; else cout<<a[n-1]+b[n-1]<<endl; return 0; }
a.cc:2:13: error: 'm' does not name a type 2 | m = (s+e-1)/2; | ^ a.cc:3:13: error: expected unqualified-id before 'if' 3 | if( (a[i]*m < a[i-1] or b[i]*m < b[i-1]) ) | ^~ a.cc:5:13: error: expected unqualified-id before 'else' 5 | else | ^~~~ a.cc:7:9: error: expected declaration before '}' token 7 | } | ^ a.cc:8:9: error: 'a' does not name a type 8 | a[i] *= e, b[i] *= e; | ^ a.cc:9:5: error: expected declaration before '}' token 9 | } | ^ a.cc:10:5: error: expected unqualified-id before 'if' 10 | if( n == 1 and a[0] + b[0] == 2 ) cout<<0<<endl; | ^~ a.cc:11:5: error: expected unqualified-id before 'else' 11 | else cout<<a[n-1]+b[n-1]<<endl; | ^~~~ a.cc:12:5: error: expected unqualified-id before 'return' 12 | return 0; | ^~~~~~ a.cc:13:1: error: expected declaration before '}' token 13 | } | ^
s966448509
p03966
Java
/* Filename: ARC062C.java * Author: Mushiyo */ import java.util.Scanner; public class ARC062C { public static void main(String[] args) { Scanner input = new Scanner(System.in); while (input.hasNext()) { int N = input.nextInt(); long T = input.nextLong(), A = input.nextLong(); for(int i = 2; i <= N; ++i){ int Ti = input.nextInt(); int Ai = input.nextInt(); long mul = Math.max(T / Ti, A / Ai); long newT = Ti * mul; long newA = Ai * mul; if(newT < T || newA < A){ newT += Ti; newA += Ai; } T = newT; A = newA; } System.out.println(T + A); } } }
Main.java:7: error: class ARC062C is public, should be declared in a file named ARC062C.java public class ARC062C { ^ 1 error
s560657889
p03966
Java
N = int(input()) T,A = [0 for i in range(N)],[0 for i in range(N)] for i in range(N): T[i],A[i] = map(int,input().split()) a = 1 b = 1 for i in range(N): low = 0 high = 10**18 while high - low > 1: x = (high + low) // 2 if a <= T[i] * x and b <= A[i] * x: high = x else: low = x a = high * T[i] b = high * A[i] print(a + b)
Main.java:1: error: class, interface, enum, or record expected N = int(input()) ^ 1 error
s113166123
p03966
C++
#include<iostream> #include<string> #include<cstring> using namespace std; int main() { int num1=0,num2=0,num3=0,num4=0,num5=0,num6=0,test1,test2; cin>>num1; for(int i=0;i<num1;i++){ cin>>test1>>test2; if(i==0){ num2=test1; num3=test2; } } for(int w=0;w<num1;w++){ for(int q=1;q<1000000;q++){ num4=num2*q; num5=num3*q; if(num4>=test1[w]&&num5>=test2[w]){ num2=num4; num3=num5; } } } num6=num2+num3; cout<<num6; cout<<"\n"; return 0; }
a.cc: In function 'int main()': a.cc:21:39: error: invalid types 'int[int]' for array subscript 21 | if(num4>=test1[w]&&num5>=test2[w]){ | ^ a.cc:21:55: error: invalid types 'int[int]' for array subscript 21 | if(num4>=test1[w]&&num5>=test2[w]){ | ^
s770118765
p03966
C++
#include<iostream> #include<string> #include<cstring> using namespace std; int main() { int num1=0,num2=0,num3=0,num4=0,num5=0,test1=0,test2=0; cin>>num1; for(int i=0;i<num1;i++){ cin>>test1[i]>>test2[i]; } num2=test1[0]; num3=test2[0]; if(w=0;w<num1;w++){ if(q=1;q<1000000;q++){ num4=num2*q; num5=num3*q; if(num4>test1[w]&&num5>test2[w]){ } } } return 0; }
a.cc: In function 'int main()': a.cc:11:27: error: invalid types 'int[int]' for array subscript 11 | cin>>test1[i]>>test2[i]; | ^ a.cc:11:37: error: invalid types 'int[int]' for array subscript 11 | cin>>test1[i]>>test2[i]; | ^ a.cc:13:19: error: invalid types 'int[int]' for array subscript 13 | num2=test1[0]; | ^ a.cc:14:19: error: invalid types 'int[int]' for array subscript 14 | num3=test2[0]; | ^ a.cc:15:12: error: 'w' was not declared in this scope 15 | if(w=0;w<num1;w++){ | ^ a.cc:15:22: error: expected ')' before ';' token 15 | if(w=0;w<num1;w++){ | ~ ^ | ) a.cc:15:23: error: 'w' was not declared in this scope 15 | if(w=0;w<num1;w++){ | ^
s448743527
p03966
C++
#define REP(i,n) for (lli i=0;i<(n);i++) #define rep(i,n) for (lli i=0;i<(n);i++) #define INF LLONG_MAX/3 #define PB push_back #define pb push_back #define all(a) (a).begin(),(a),end() #define pll pair<lli,lli> lli binary_search(lli a,lli b){ lli l=1,u=INF; while(u-l>1){ lli mid =(l+u)/2; if(mid*b>=a){ u = mid; }else{ l = mid; } } return u*b; } int main(){ lli N,t=1,a=1,d; lli T[1000],A[1000]; cin>>N; rep(i,N){ cin>>T[i]>>A[i]; if(a<=A[i]){ a=A[i]; }else{ a = binary_search(a,A[i]); } d = (a/A[i])*T[i]; if(d<t){ if(t<=T[i]){ t=T[i]; }else{ t = binary_search(t,T[i]); } a = (t/T[i])*A[i]; }else{ t=d; } } cout<<a+t<<endl; return 0; }
a.cc:10:1: error: 'lli' does not name a type 10 | lli binary_search(lli a,lli b){ | ^~~ a.cc: In function 'int main()': a.cc:26:3: error: 'lli' was not declared in this scope 26 | lli N,t=1,a=1,d; | ^~~ a.cc:27:6: error: expected ';' before 'T' 27 | lli T[1000],A[1000]; | ^~ | ; a.cc:28:3: error: 'cin' was not declared in this scope 28 | cin>>N; | ^~~ a.cc:28:8: error: 'N' was not declared in this scope 28 | cin>>N; | ^ a.cc:29:7: error: expected ';' before 'i' 29 | rep(i,N){ | ^ a.cc:2:27: note: in definition of macro 'rep' 2 | #define rep(i,n) for (lli i=0;i<(n);i++) | ^ a.cc:29:7: error: 'i' was not declared in this scope 29 | rep(i,N){ | ^ a.cc:2:31: note: in definition of macro 'rep' 2 | #define rep(i,n) for (lli i=0;i<(n);i++) | ^ a.cc:30:10: error: 'T' was not declared in this scope 30 | cin>>T[i]>>A[i]; | ^ a.cc:30:16: error: 'A' was not declared in this scope 30 | cin>>T[i]>>A[i]; | ^ a.cc:31:8: error: 'a' was not declared in this scope 31 | if(a<=A[i]){ | ^ a.cc:34:11: error: 'binary_search' was not declared in this scope 34 | a = binary_search(a,A[i]); | ^~~~~~~~~~~~~ a.cc:36:5: error: 'd' was not declared in this scope 36 | d = (a/A[i])*T[i]; | ^ a.cc:36:10: error: 'a' was not declared in this scope 36 | d = (a/A[i])*T[i]; | ^ a.cc:37:10: error: 't' was not declared in this scope 37 | if(d<t){ | ^ a.cc:41:13: error: 'binary_search' was not declared in this scope 41 | t = binary_search(t,T[i]); | ^~~~~~~~~~~~~ a.cc:50:3: error: 'cout' was not declared in this scope 50 | cout<<a+t<<endl; | ^~~~ a.cc:50:9: error: 'a' was not declared in this scope 50 | cout<<a+t<<endl; | ^ a.cc:50:11: error: 't' was not declared in this scope 50 | cout<<a+t<<endl; | ^ a.cc:50:14: error: 'endl' was not declared in this scope 50 | cout<<a+t<<endl; | ^~~~
s996704658
p03966
C
#include<stdio.h> int main() { int N; int T,A; int i; int k; unsigned int realT = 1,realA = 1; scanf("%d", &N); for ( i = 0; i < N; i++ ) { scanf("%d %d", &T, &A); k = 1; if ( T == A ) { if ( realA < realT ) realA = realT; else realT = realA; } else { while ( T*k < realT || A*k < realA ) { k++; } realT = T*k; realA = A*k; } } printf("%d\n", (realA+realT)); return 0; } p
main.c:28:1: error: expected '=', ',', ';', 'asm' or '__attribute__' at end of input 28 | p | ^
s896145733
p03966
C++
#include <cstdio> #include <iostream> #include <cstring> #include <algorithm> #include <sstream> #include <vector> #include <map> #include <set> #include <deque> #include <list> #include <stack> #include <queue> #include <complex> #include <ctime> #include<cstdlib> #define _USE_MATH_DEFINES #include <math.h> #include<cmath> #include <cstdarg> #include <iomanip> #include<unordered_map> #include<unordered_set> //#include <arra.y> //#define NDEBUG #include <assert.h> using namespace std; #define dprint(Exp,...) if(Exp){fprintf(stderr, __VA_ARGS__);} #define printe(...) fprintf(stderr, __VA_ARGS__); #define PrtExp(_Exp) cerr<< #_Exp <<" = "<< (_Exp) #define PrtExpN(_Exp) cerr<< #_Exp <<" = "<< (_Exp) <<"\n" #define SINT(n) scanf("%d",&n); #define SINT2(n,m) scanf("%d %d",&n,&m); #define SINT3(n,m,o) scanf("%d %d %d",&n,&m,&o); #define SINT4(n,m,o,p) scanf("%d %d %d %d",&n,&m,&o,&p); #define SINT5(n,m,o,p,q) scanf("%d %d %d %d %d",&n,&m,&o,&p,&q); //#define SLL(n) scanf("%I64d",&n); #define SLL(n) scanf("%lld",&n); #define SLL2(n,m) scanf("%lld %lld",&n,&m); #define SLL3(n,m,o) scanf("%lld %lld %lld",&n,&m,&o); #define SST(s) scanf("%s",s); #define SCH(c) scanf("%c",&c); #define GC() getchar(); #define PINT(n) printf("%d",(int)(n)); #define PINT2(n,m) printf("%d %d",(int)(n),(int)(m)); #define PINT3(n,m,l) printf("%d %d %d",(int)(n),(int)(m),(int)(l)); //#define PLL(n) printf("%I64d",(long long)(n)); #define PLL(n) printf("%lld",(long long)(n)); #define PST(s) printf("%s",(s)); #define PCH(s) printf("%c",(s)); #define PINTN(n) printf("%d\n",(int)(n)); #define PINT2N(n,m) printf("%d %d\n",(int)(n),(int)(m)); #define PINT3N(n,m,l) printf("%d %d %d\n",(int)(n),(int)(m),(int)(l)); //#define PLLN(n) printf("%I64d\n",(long long)(n)); #define PLLN(n) printf("%lld\n",(long long)(n)); #define PSTN(s) printf("%s\n",(s)); #define PCHN(s) printf("%c\n",(s)); #define PSP() printf(" "); #define PN() printf("\n"); #define PC(c) putchar(c); #define CSP (' ') #define SN ("\n") #define rep(i,a) for(i=0;i<a;i++) #define reP(i,a) for(i=0;i<=a;i++) #define Rep(i,a) for(i=a-1;i>=0;i--) #define ReP(i,a) for(i=a;i>=0;i--) #define rEp(i,a) for(int i=0;i<a;i++) #define rEP(i,a) for(int i=0;i<=a;i++) #define REp(i,a) for(int i=a-1;i>=0;i--) #define REP(i,a) for(int i=a;i>=0;i--) #define repft(i,a,b) for(i=a;i<b;i++) #define repfT(i,a,b) for(i=a;i<=b;i++) #define Repft(i,a,b) for(i=a-1;i>=b;i--) #define RepfT(i,a,b) for(i=a;i>=b;i--) #define foreach(a,it) for(auto it = a.begin(); it != a.end(); ++it) #define FILL(a,v) fill(begin(a),end(a), v) #define FILL0(a) memset(a,0,sizeof(a)) #define FILL1(a) memset(a,-1,sizeof(a)) typedef long long ll; typedef unsigned long ul; typedef pair<int, int> Pi; typedef pair<ll, ll> Pl; const int INF = 0x1f1f1f1f;//522,133,279 const ll INFLL = 0x1f1f1f1f1f1f1f1fLL;//2,242,545,357,980,376,863 template <class A, class B> inline ostream& operator<<(ostream& st, const pair<A, B>& P) { return st << "(" << P.first << "," << P.second << ")"; }; template <class A, class B> inline pair<A, B> operator+(const pair<A, B>& P, const pair<A, B>& Q) { return pair<A, B>(P.first + Q.first, P.second + Q.second); }; template <class A, class B> inline pair<A, B> operator-(const pair<A, B>& P, const pair<A, B>& Q) { return pair<A, B>(P.first - Q.first, P.second - Q.second); }; ll bitcount(ll bits) { bits = (bits & 0x5555555555555555) + (bits >> 1 & 0x5555555555555555); bits = (bits & 0x3333333333333333) + (bits >> 2 & 0x3333333333333333); bits = (bits & 0x0f0f0f0f0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f0f0f0f0f); bits = (bits & 0x00ff00ff00ff00ff) + (bits >> 8 & 0x00ff00ff00ff00ff); bits = (bits & 0x0000ffff0000ffff) + (bits >> 16 & 0x0000ffff0000ffff); return (bits & 0x00000000ffffffff) + (bits >> 32 & 0x00000000ffffffff); } //#include <quadmath.h> /* 必ず include する. */ #ifdef __FreeBSD__ #include <floatingpoint.h> /* 必ず include する. */ #endif typedef long double long_double_t; int main() { int n; ll T=1, A=1; fpsetprec(FP_PE); cin >> n; while (n--) { ll t, a; SLL2(t, a); long_double_t td = (double)T/t; long_double_t ad = (double)A/a; ll N = ceil(max(td, ad)); T = t*N; A = a*N; //cout << T <<" " <<A << endl; } cout << T + A << endl; return 0; }
a.cc: In function 'int main()': a.cc:126:19: error: 'FP_PE' was not declared in this scope; did you mean 'FP_ZERO'? 126 | fpsetprec(FP_PE); | ^~~~~ | FP_ZERO a.cc:126:9: error: 'fpsetprec' was not declared in this scope 126 | fpsetprec(FP_PE); | ^~~~~~~~~
s407607427
p03966
C++
#include <cstdio> #include <iostream> #include <cstring> #include <algorithm> #include <sstream> #include <vector> #include <map> #include <set> #include <deque> #include <list> #include <stack> #include <queue> #include <complex> #include <ctime> #include<cstdlib> #define _USE_MATH_DEFINES #include <math.h> #include<cmath> #include <cstdarg> #include <iomanip> #include<unordered_map> #include<unordered_set> //#include <arra.y> //#define NDEBUG #include <assert.h> using namespace std; #define dprint(Exp,...) if(Exp){fprintf(stderr, __VA_ARGS__);} #define printe(...) fprintf(stderr, __VA_ARGS__); #define PrtExp(_Exp) cerr<< #_Exp <<" = "<< (_Exp) #define PrtExpN(_Exp) cerr<< #_Exp <<" = "<< (_Exp) <<"\n" #define SINT(n) scanf("%d",&n); #define SINT2(n,m) scanf("%d %d",&n,&m); #define SINT3(n,m,o) scanf("%d %d %d",&n,&m,&o); #define SINT4(n,m,o,p) scanf("%d %d %d %d",&n,&m,&o,&p); #define SINT5(n,m,o,p,q) scanf("%d %d %d %d %d",&n,&m,&o,&p,&q); //#define SLL(n) scanf("%I64d",&n); #define SLL(n) scanf("%lld",&n); #define SLL2(n,m) scanf("%lld %lld",&n,&m); #define SLL3(n,m,o) scanf("%lld %lld %lld",&n,&m,&o); #define SST(s) scanf("%s",s); #define SCH(c) scanf("%c",&c); #define GC() getchar(); #define PINT(n) printf("%d",(int)(n)); #define PINT2(n,m) printf("%d %d",(int)(n),(int)(m)); #define PINT3(n,m,l) printf("%d %d %d",(int)(n),(int)(m),(int)(l)); //#define PLL(n) printf("%I64d",(long long)(n)); #define PLL(n) printf("%lld",(long long)(n)); #define PST(s) printf("%s",(s)); #define PCH(s) printf("%c",(s)); #define PINTN(n) printf("%d\n",(int)(n)); #define PINT2N(n,m) printf("%d %d\n",(int)(n),(int)(m)); #define PINT3N(n,m,l) printf("%d %d %d\n",(int)(n),(int)(m),(int)(l)); //#define PLLN(n) printf("%I64d\n",(long long)(n)); #define PLLN(n) printf("%lld\n",(long long)(n)); #define PSTN(s) printf("%s\n",(s)); #define PCHN(s) printf("%c\n",(s)); #define PSP() printf(" "); #define PN() printf("\n"); #define PC(c) putchar(c); #define CSP (' ') #define SN ("\n") #define rep(i,a) for(i=0;i<a;i++) #define reP(i,a) for(i=0;i<=a;i++) #define Rep(i,a) for(i=a-1;i>=0;i--) #define ReP(i,a) for(i=a;i>=0;i--) #define rEp(i,a) for(int i=0;i<a;i++) #define rEP(i,a) for(int i=0;i<=a;i++) #define REp(i,a) for(int i=a-1;i>=0;i--) #define REP(i,a) for(int i=a;i>=0;i--) #define repft(i,a,b) for(i=a;i<b;i++) #define repfT(i,a,b) for(i=a;i<=b;i++) #define Repft(i,a,b) for(i=a-1;i>=b;i--) #define RepfT(i,a,b) for(i=a;i>=b;i--) #define foreach(a,it) for(auto it = a.begin(); it != a.end(); ++it) #define FILL(a,v) fill(begin(a),end(a), v) #define FILL0(a) memset(a,0,sizeof(a)) #define FILL1(a) memset(a,-1,sizeof(a)) typedef long long ll; typedef unsigned long ul; typedef pair<int, int> Pi; typedef pair<ll, ll> Pl; const int INF = 0x1f1f1f1f;//522,133,279 const ll INFLL = 0x1f1f1f1f1f1f1f1fLL;//2,242,545,357,980,376,863 template <class A, class B> inline ostream& operator<<(ostream& st, const pair<A, B>& P) { return st << "(" << P.first << "," << P.second << ")"; }; template <class A, class B> inline pair<A, B> operator+(const pair<A, B>& P, const pair<A, B>& Q) { return pair<A, B>(P.first + Q.first, P.second + Q.second); }; template <class A, class B> inline pair<A, B> operator-(const pair<A, B>& P, const pair<A, B>& Q) { return pair<A, B>(P.first - Q.first, P.second - Q.second); }; ll bitcount(ll bits) { bits = (bits & 0x5555555555555555) + (bits >> 1 & 0x5555555555555555); bits = (bits & 0x3333333333333333) + (bits >> 2 & 0x3333333333333333); bits = (bits & 0x0f0f0f0f0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f0f0f0f0f); bits = (bits & 0x00ff00ff00ff00ff) + (bits >> 8 & 0x00ff00ff00ff00ff); bits = (bits & 0x0000ffff0000ffff) + (bits >> 16 & 0x0000ffff0000ffff); return (bits & 0x00000000ffffffff) + (bits >> 32 & 0x00000000ffffffff); } //#include <quadmath.h> /* 必ず include する. */ typedef __float128 long_double_t; int main() { int n; ll T=1, A=1; cin >> n; while (n--) { ll t, a; SLL2(t, a); long_double_t td = (double)T/t; long_double_t ad = (double)A/a; ll N = ceil(max(td, ad)); T = t*N; A = a*N; //cout << T <<" " <<A << endl; } cout << T + A << endl; return 0; }
a.cc: In function 'int main()': a.cc:131:28: error: call of overloaded 'ceil(const __float128&)' is ambiguous 131 | ll N = ceil(max(td, ad)); | ~~~~^~~~~~~~~~~~~ In file included from /usr/include/features.h:523, from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683, from /usr/include/c++/14/cstdio:41, from a.cc:1: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:192:1: note: candidate: 'double ceil(double)' 192 | __MATHCALLX (ceil,, (_Mdouble_ __x), (__const__)); | ^~~~~~~~~~~ In file included from /usr/include/c++/14/complex:44, from a.cc:13: /usr/include/c++/14/cmath:166:3: note: candidate: 'constexpr long double std::ceil(long double)' 166 | ceil(long double __x) | ^~~~ /usr/include/c++/14/cmath:162:3: note: candidate: 'constexpr float std::ceil(float)' 162 | ceil(float __x) | ^~~~
s772606477
p03966
C++
#include <cstdio> #include <iostream> #include <cstring> #include <algorithm> #include <sstream> #include <vector> #include <map> #include <set> #include <deque> #include <list> #include <stack> #include <queue> #include <complex> #include <ctime> #include<cstdlib> #define _USE_MATH_DEFINES #include <math.h> #include<cmath> #include <cstdarg> #include <iomanip> #include<unordered_map> #include<unordered_set> //#include <arra.y> //#define NDEBUG #include <assert.h> using namespace std; #define dprint(Exp,...) if(Exp){fprintf(stderr, __VA_ARGS__);} #define printe(...) fprintf(stderr, __VA_ARGS__); #define PrtExp(_Exp) cerr<< #_Exp <<" = "<< (_Exp) #define PrtExpN(_Exp) cerr<< #_Exp <<" = "<< (_Exp) <<"\n" #define SINT(n) scanf("%d",&n); #define SINT2(n,m) scanf("%d %d",&n,&m); #define SINT3(n,m,o) scanf("%d %d %d",&n,&m,&o); #define SINT4(n,m,o,p) scanf("%d %d %d %d",&n,&m,&o,&p); #define SINT5(n,m,o,p,q) scanf("%d %d %d %d %d",&n,&m,&o,&p,&q); //#define SLL(n) scanf("%I64d",&n); #define SLL(n) scanf("%lld",&n); #define SLL2(n,m) scanf("%lld %lld",&n,&m); #define SLL3(n,m,o) scanf("%lld %lld %lld",&n,&m,&o); #define SST(s) scanf("%s",s); #define SCH(c) scanf("%c",&c); #define GC() getchar(); #define PINT(n) printf("%d",(int)(n)); #define PINT2(n,m) printf("%d %d",(int)(n),(int)(m)); #define PINT3(n,m,l) printf("%d %d %d",(int)(n),(int)(m),(int)(l)); //#define PLL(n) printf("%I64d",(long long)(n)); #define PLL(n) printf("%lld",(long long)(n)); #define PST(s) printf("%s",(s)); #define PCH(s) printf("%c",(s)); #define PINTN(n) printf("%d\n",(int)(n)); #define PINT2N(n,m) printf("%d %d\n",(int)(n),(int)(m)); #define PINT3N(n,m,l) printf("%d %d %d\n",(int)(n),(int)(m),(int)(l)); //#define PLLN(n) printf("%I64d\n",(long long)(n)); #define PLLN(n) printf("%lld\n",(long long)(n)); #define PSTN(s) printf("%s\n",(s)); #define PCHN(s) printf("%c\n",(s)); #define PSP() printf(" "); #define PN() printf("\n"); #define PC(c) putchar(c); #define CSP (' ') #define SN ("\n") #define rep(i,a) for(i=0;i<a;i++) #define reP(i,a) for(i=0;i<=a;i++) #define Rep(i,a) for(i=a-1;i>=0;i--) #define ReP(i,a) for(i=a;i>=0;i--) #define rEp(i,a) for(int i=0;i<a;i++) #define rEP(i,a) for(int i=0;i<=a;i++) #define REp(i,a) for(int i=a-1;i>=0;i--) #define REP(i,a) for(int i=a;i>=0;i--) #define repft(i,a,b) for(i=a;i<b;i++) #define repfT(i,a,b) for(i=a;i<=b;i++) #define Repft(i,a,b) for(i=a-1;i>=b;i--) #define RepfT(i,a,b) for(i=a;i>=b;i--) #define foreach(a,it) for(auto it = a.begin(); it != a.end(); ++it) #define FILL(a,v) fill(begin(a),end(a), v) #define FILL0(a) memset(a,0,sizeof(a)) #define FILL1(a) memset(a,-1,sizeof(a)) typedef long long ll; typedef unsigned long ul; typedef pair<int, int> Pi; typedef pair<ll, ll> Pl; const int INF = 0x1f1f1f1f;//522,133,279 const ll INFLL = 0x1f1f1f1f1f1f1f1fLL;//2,242,545,357,980,376,863 template <class A, class B> inline ostream& operator<<(ostream& st, const pair<A, B>& P) { return st << "(" << P.first << "," << P.second << ")"; }; template <class A, class B> inline pair<A, B> operator+(const pair<A, B>& P, const pair<A, B>& Q) { return pair<A, B>(P.first + Q.first, P.second + Q.second); }; template <class A, class B> inline pair<A, B> operator-(const pair<A, B>& P, const pair<A, B>& Q) { return pair<A, B>(P.first - Q.first, P.second - Q.second); }; ll bitcount(ll bits) { bits = (bits & 0x5555555555555555) + (bits >> 1 & 0x5555555555555555); bits = (bits & 0x3333333333333333) + (bits >> 2 & 0x3333333333333333); bits = (bits & 0x0f0f0f0f0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f0f0f0f0f); bits = (bits & 0x00ff00ff00ff00ff) + (bits >> 8 & 0x00ff00ff00ff00ff); bits = (bits & 0x0000ffff0000ffff) + (bits >> 16 & 0x0000ffff0000ffff); return (bits & 0x00000000ffffffff) + (bits >> 32 & 0x00000000ffffffff); } #include <quadmath.h> /* 必ず include する. */ typedef __float128 long_double_t; int main() { int n; ll T=1, A=1; cin >> n; while (n--) { ll t, a; SLL2(t, a); long_double_t td = (double)T/t; long_double_t ad = (double)A/a; ll N = ceil(max(td, ad)); T = t*N; A = a*N; //cout << T <<" " <<A << endl; } cout << T + A << endl; return 0; }
a.cc: In function 'int main()': a.cc:131:28: error: call of overloaded 'ceil(const __float128&)' is ambiguous 131 | ll N = ceil(max(td, ad)); | ~~~~^~~~~~~~~~~~~ In file included from /usr/include/features.h:523, from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683, from /usr/include/c++/14/cstdio:41, from a.cc:1: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:192:1: note: candidate: 'double ceil(double)' 192 | __MATHCALLX (ceil,, (_Mdouble_ __x), (__const__)); | ^~~~~~~~~~~ In file included from /usr/include/c++/14/complex:44, from a.cc:13: /usr/include/c++/14/cmath:166:3: note: candidate: 'constexpr long double std::ceil(long double)' 166 | ceil(long double __x) | ^~~~ /usr/include/c++/14/cmath:162:3: note: candidate: 'constexpr float std::ceil(float)' 162 | ceil(float __x) | ^~~~
s270059659
p03966
C++
#include <iostream> #include <cstdio> #include <algorithm> #define rep(i,a,b) for(int i = a; i <= b; i++) using namespace std; const int N = 100010; char s[N]; int main() { scanf("%s",s + 1); int n = strlen(s + 1), s0 = 0; rep(i,1,n) if (s[i] == 'p') s0--; cout <<s0 + n / 2<<endl; }
a.cc: In function 'int main()': a.cc:9:36: error: 'strlen' was not declared in this scope 9 | scanf("%s",s + 1); int n = strlen(s + 1), s0 = 0; | ^~~~~~ a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include <algorithm> +++ |+#include <cstring> 4 | #define rep(i,a,b) for(int i = a; i <= b; i++) a.cc:10:37: error: 's0' was not declared in this scope; did you mean 's'? 10 | rep(i,1,n) if (s[i] == 'p') s0--; | ^~ | s a.cc:11:16: error: 's0' was not declared in this scope; did you mean 's'? 11 | cout <<s0 + n / 2<<endl; | ^~ | s
s563674814
p03966
C++
import java.io.IOException; import java.io.InputStream; import java.util.NoSuchElementException; public class Main { private void solve(FastScanner sc) { int n = sc.nextInt(); long tx = 1, ax = 1; for (int i = 0; i < n; i++) { int t = sc.nextInt(); int a = sc.nextInt(); long y = Math.max(-Math.floorDiv(-tx,t), -Math.floorDiv(-ax,a)); tx = t*y; ax = a*y; } System.out.println(tx+ax); } /* * template */ public static void main(String[] args) { FastScanner sc = new FastScanner(); new Main().solve(sc); } 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; } boolean hasNext() { while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte(); } 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(); } 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(); } } int nextInt() { long nl = nextLong(); if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException(); return (int) nl; } double nextDouble() { return Double.parseDouble(next()); } } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.io.IOException; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:2:1: error: 'import' does not name a type 2 | import java.io.InputStream; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: 'import' does not name a type 3 | import java.util.NoSuchElementException; | ^~~~~~ a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:5:1: error: expected unqualified-id before 'public' 5 | public class Main { | ^~~~~~
s303400468
p03966
C++
#include<bits/stdc++.h> using namespace std; typedef unsigned int uint; typedef long long int ll; typedef unsigned long long int ull; #define debugv(v) printf("L%d %s => ",__LINE__,#v);for(auto e:v){cout<<e<<" ";}cout<<endl; #define debugm(m) printf("L%d %s is..\n",__LINE__,#m);for(auto v:m){for(auto e:v){cout<<e<<" ";}cout<<endl;} #define debuga(m,w) printf("L%d %s is => ",__LINE__,#m);for(int x=0;x<(w);x++){cout<<(m)[x]<<" ";}cout<<endl; #define debugaa(m,w,h) printf("L%d %s is..\n",__LINE__,#m);for(int y=0;y<(h);y++){for(int x=0;x<(w);x++){cout<<(m)[x][y]<<" ";}cout<<endl;} #define ALL(v) (v).begin(),(v).end() #define BIGINT 0x7FFFFFFF #define E107 1000000007 void printbit(int u){if(u==0)cout<<0;else{int s=0,k=0;for(;0<u;u>>=1,k++)s=(s<<1)|(u&1);for(;0<k--;s>>=1)cout<<(s&1);}} #define TIME chrono::system_clock::now() #define MILLISEC(t) (chrono::duration_cast<chrono::milliseconds>(t).count()) template<typename T1,typename T2> ostream& operator <<(ostream &o,const pair<T1,T2> p){o<<"("<<p.first<<":"<<p.second<<")";return o;} ll gcd(ll m,ll n){ if ((0==m) || (0==n)) return 0; while(m!=n){ if (m>n) m=m-n; else n=n-m; } return m; } ll lcm(ll m,ll n){ return ((m/gcd(m,n))*n); } int main(){ int i,j,k,l; ll it,ia; cin >> n; ll tak=0,aok=0; cin>>tak>>aok; for (i=1;i<n;i++){ cin>>it>>ia; for (j=1;;j++){ if (tak<=it*j && aok<=ia*j) break; } tak = it*j; aok = ia*j; } cout << (tak+aok) << endl; return 0; }
a.cc: In function 'int main()': a.cc:43:12: error: 'n' was not declared in this scope 43 | cin >> n; | ^
s551746838
p03966
C++
#include <bits/stdc++.h> using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x<(to);x++) #define FORR(x,arr) for(auto& x:arr) #define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++) #define ALL(a) (a.begin()),(a.end()) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) //------------------------------------------------------- string S; void solve() { int i,j,k,l,r,x,y; string s; cin>>S; int ret=0; FORR(c,S) { if(L) L--, ret++; else L++; if(c=='p') ret--; } cout<<ret<<endl; } int main(int argc,char** argv){ string s;int i; if(argc==1) ios::sync_with_stdio(false), cin.tie(0); FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin); solve(); return 0; }
a.cc: In function 'void solve()': a.cc:24:20: error: 'L' was not declared in this scope 24 | if(L) L--, ret++; | ^
s713707405
p03966
C++
5 3 10 48 17 31 199 231 23 3 2
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 5 | ^
s914076187
p03967
C++
ggppgggpggggppgggpgg#include <iostream> #include <iomanip> #include <algorithm> #include <bitset> #include <set> #include <unordered_set> #include <map> #include <unordered_map> #include <cmath> #include <time.h> #include <random> #include <string> #include <cassert> #include <vector> #include <ostream> #include <istream> #include <stack> #include <deque> #include <queue> #include <functional> #include <chrono> #include <stack> using namespace std; #define int long long #define pb push_back #define all(a) (a).begin(), (a).end() #define pii pair<int, int> #define ld long double ostream& operator<< (ostream &out, const vector<int> &b) { for (auto k : b) out << k << " "; return out; } istream& operator>> (istream& in, pii& b) { in >> b.first >> b.second; return in; } ostream& operator<< (ostream& out, const pii& b) { out << "{" << b.first << ", " << b.second << "}"; return out; } template <typename T1, typename T2> inline bool chkmin(T1 &x, const T2 &y) {if (x > y) {x = y; return 1;} return 0;} template <typename T1, typename T2> inline bool chkmax(T1 &x, const T2 &y) {if (x < y) {x = y; return 1;} return 0;} #ifdef LOCAL #define dbg(x) cout << #x << " : " << (x) << "\n"; const int INF = 1e18; // const int mod = 2600000069; // const int p = 10; #else #define dbg(x) 57 const int INF = 1e18; // const int mod = 2600000069; // const int p = 179; #endif const ld PI = acos(-1); #define time clock() / (double) CLOCKS_PER_SEC // #pragma GCC optimize("Ofast,no-stack-protector") // #pragma GCC target("sse,sse2,sse3,sse3,sse4") // #pragma GCC optimize("unroll-loops") // #pragma GCC optimize("fast-math") // #pragma GCC target("avx2") // #pragma GCC optimize("section-anchors") // #pragma GCC optimize("profile-values,profile-reorder-functions,tracer") // #pragma GCC optimize("vpt") // #pragma GCC optimize("rename-registers") // #pragma GCC optimize("move-loop-invariants") // #pragma GCC optimize("unswitch-loops") // #pragma GCC optimize("function-sections") // #pragma GCC optimize("data-sections") mt19937 gen(chrono::high_resolution_clock::now().time_since_epoch().count()); signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); string s; cin >> s; int n = s.size(); int ans = 0, b = 0; for (int i = 0; i < n; i++) { if (s[i] == 'p') { b--; if (b == -1) { ans--; b += 2; } } else { if (b > 0) { b--; ans++; } else { b++; } } } cout << ans; } /* */
a.cc:1:21: error: stray '#' in program 1 | ggppgggpggggppgggpgg#include <iostream> | ^ a.cc:1:1: error: 'ggppgggpggggppgggpgg' does not name a type 1 | ggppgggpggggppgggpgg#include <iostream> | ^~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/iosfwd:42, from /usr/include/c++/14/iomanip:41, from a.cc:2: /usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type 68 | typedef ptrdiff_t streamsize; // Signed integral type | ^~~~~~~~~ /usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 40 | #include <cwchar> // For mbstate_t +++ |+#include <cstddef> 41 | In file included from /usr/include/c++/14/bits/char_traits.h:50, from /usr/include/c++/14/string:42, 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/iomanip:42: /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std' 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ In file included from /usr/include/wchar.h:35, from /usr/include/c++/14/cwchar:44, from /usr/include/c++/14/bits/postypes.h:40: /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared 2086 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope 2087 | struct remove_extent<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid 2087 | struct remove_extent<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared 2099 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope 2100 | struct remove_all_extents<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid 2100 | struct remove_all_extents<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared 2171 | template<std::size_t _Len> | ^~~ /usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope 2176 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^~~~ /usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^ /usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope 2202 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope 2203 | struct __attribute__((__aligned__((_Align)))) { } __align; | ^~~~~~ /usr/include/c++/14/bits/char_traits.h:144:61: error: 'std::size_t' has not been declared 144 | compare(const char_type* __s1, const char_type* __s2, std::size_t __n); | ^~~ /usr/include/c++/14/bits/char_traits.h:146:40: error: 'size_t' in namespace 'std' does not name a type 146 | static _GLIBCXX14_CONSTEXPR std::size_t | ^~~~~~ /usr/include/c++/14/bits/char_traits.h:150:34: error: 'std::size_t' has not been declared 150 | find(const char_type* __s, std::size_t __n, const char_type& __a); | ^~~ /usr/include/c++/14/bits/char_traits.h:153:52: error: 'std::size_t' has not been declared 153 | move(char_type* __s1, const char_type* __s2, std::size_t __n); | ^~~ /usr/include/c++/14/bits/char_traits.h:156:52: error: 'std::size_t' has not been declared 156 | copy(char_type* __s1, const char_type* __s2, std::size_t __n); | ^~~ /usr/include/c++/14/bits/char_traits.h:159:30: error: 'std::size_t' has not been declared 159 | assign(char_type* __s, std::size_t __n, char_type __a); | ^~~ /usr/include/c++/14/bits/char_traits.h:187:59: error: 'std::size_t' has not been declared 187 | compare(const char_type* __s1, const char_type* __s2, std::size_t __n) | ^~~ /usr/include/c++/14/bits/char_traits.h: In static member function 'static constexpr int __gnu_cxx::char_traits<_CharT>::compare(const char_type*, const char_type*, int)': /usr/include/c++/14/bits/char_traits.h:189:17: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 189 | for (std::size_t __i = 0; __i < __n; ++__i) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/bits/char_traits.h:189:33: error: '__i' was not declared in this scope
s291736029
p03967
C++
def main(): s = str(input()) num_g = 0 num_p = 0 ans = 0 for i in range(len(s)): if s[i] == 'g': num_g += 1 if s[i] == 'p': if num_p < num_g: num_p += 1 else: ans -= 1 num_g += 1 s[i] = 'g' for i in range(len(s)-1, -1, -1): if s[i] == 'g': if num_g-1 >= num_p+1: num_g -= 1 num_p += 1 ans += 1 else: num_g -= 1 if s[i] == 'p': num_p -= 1 print(ans) if __name__ == "__main__": main()
a.cc:1:1: error: 'def' does not name a type 1 | def main(): | ^~~
s331282957
p03967
C++
#include <bits/stdc++.h> using namespace std; typedef long long int ll; #define FOR(i,l,r) for(i=l;i<r;i++) #define REP(i,n) FOR(i,0,n) #define ALL(x) x.begin(),x.end() #define P pair<ll,ll> #define F first #define S second signed main(){ ll i,G=0,P=0,ans;string S;cin>>S; REP(i,S.size()){ if(S[i]=='p')P++; else G++; } cout<<(G-P)/2<<endl; return 0; }
a.cc: In function 'int main()': a.cc:11:13: error: invalid declarator before '=' token 11 | ll i,G=0,P=0,ans;string S;cin>>S; | ^ a.cc:13:19: error: expected unqualified-id before '++' token 13 | if(S[i]=='p')P++; | ^~ a.cc:16:13: error: expected primary-expression before ')' token 16 | cout<<(G-P)/2<<endl; | ^
s391978084
p03967
C++
#include <bits/stdc++.h> using namespace std; //long long using ll = long long; // pair<int, int> using PII = pair<int, int>; //最大値、mod const int MOD = 1000000007; const int mod = 1000000007; const int INF = 1000000001; const long long LINF = 1e18; const int MAX = 510000; //出力系 #define print(x) cout << x << endl #define prints(x) cout << fixed << setprecision(10) << x << endl #define printc(x) cout << setw(2) << setfill('0') << x << endl; #define yes cout << "Yes" << endl #define YES cout << "YES" << endl #define no cout << "No" << endl #define NO cout << "NO" << endl // begin() end() #define all(x) (x).begin(),(x).end() //for #define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i) //最大公約数 unsigned gcd(unsigned a, unsigned b) { if(a < b) return gcd(b, a); unsigned r; while ((r=a%b)) { a = b; b = r; } return b; } // 最小公倍数 unsigned lcm(unsigned a, unsigned b){ return a / gcd(a, b) * b; } // a = max(a, b), a = min(a, b) 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; } // 階乗(MODをとる) ll pow_mod(ll num, ll pow, ll mod) { ll prod = 1; num %= mod; while (pow > 0) { if (pow & 1) prod = prod * num % mod; num = num * num % mod; pow >>= 1; } return prod; } // 二項係数(MODとる、1 ≦ k ≦ n ≦ 10^7 程度) // COMinit() // COM(x, y) // とコンビで使う // テーブルを作る前処理 long long fac[MAX], finv[MAX], inv[MAX]; void COMinit() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (int i = 2; i < MAX; i++){ fac[i] = fac[i - 1] * i % MOD; inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD; finv[i] = finv[i - 1] * inv[i] % MOD; } } // 二項係数計算 long long COM(int n, int k){ if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD; } int dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0}; struct UnionFind { vector<int> par; vector<int> rank; vector<ll> Size; UnionFind(int n = 1) { init(n); } void init(int n = 1) { par.resize(n + 1); rank.resize(n + 1); Size.resize(n + 1); for (int i = 0; i <= n; ++i) par[i] = i, rank[i] = 0, Size[i] = 1; } int root(int x) { if (par[x] == x) { return x; } else { int r = root(par[x]); return par[x] = r; } } bool issame(int x, int y) { return root(x) == root(y); } bool merge(int x, int y) { x = root(x); y = root(y); if (x == y) return false; if (rank[x] < rank[y]) swap(x, y); if (rank[x] == rank[y]) ++rank[x]; par[y] = x; Size[x] += Size[y]; return true; } ll size(int x){ return Size[root(x)]; } }; #define rrep(i,a,b) for(int i=(a);i>(b);i--) #define rep(i,a,b) for(int i=(a);i<(b);i++) struct Mint { int val; Mint inv() const{ int tmp,a=val,b=mod,x=1,y=0; while(b)tmp=a/b,a-=tmp*b,swap(a,b),x-=tmp*y,swap(x,y); return Mint(x); } public: Mint():val(0){} Mint(ll x){if((val=x%mod)<0)val+=mod;} Mint pow(ll t){Mint res=1,b=*this; while(t){if(t&1)res*=b;b*=b;t>>=1;}return res;} Mint& operator+=(const Mint& x){if((val+=x.val)>=mod)val-=mod;return *this;} Mint& operator-=(const Mint& x){if((val+=mod-x.val)>=mod)val-=mod; return *this;} Mint& operator*=(const Mint& x){val=(ll)val*x.val%mod; return *this;} Mint& operator/=(const Mint& x){return *this*=x.inv();} bool operator==(const Mint& x) const{return val==x.val;} bool operator!=(const Mint& x) const{return val!=x.val;} bool operator<(const Mint& x) const{return val<x.val;} bool operator<=(const Mint& x) const{return val<=x.val;} bool operator>(const Mint& x) const{return val>x.val;} bool operator>=(const Mint& x) const{return val>=x.val;} Mint operator+(const Mint& x) const{return Mint(*this)+=x;} Mint operator-(const Mint& x) const{return Mint(*this)-=x;} Mint operator*(const Mint& x) const{return Mint(*this)*=x;} Mint operator/(const Mint& x) const{return Mint(*this)/=x;} }; struct factorial { vector<Mint> Fact, Finv; public: factorial(int maxx){ Fact.resize(maxx+1),Finv.resize(maxx+1); Fact[0]=Mint(1); rep(i,0,maxx)Fact[i+1]=Fact[i]*(i+1); Finv[maxx]=Mint(1)/Fact[maxx]; rrep(i,maxx,0)Finv[i-1]=Finv[i]*i; } Mint fact(int n,bool inv=0){if(inv)return Finv[n];else return Fact[n];} Mint nPr(int n,int r){if(n<0||n<r||r<0)return Mint(0);else return Fact[n]*Finv[n-r];} Mint nCr(int n,int r){if(n<0||n<r||r<0)return Mint(0);else return Fact[n]*Finv[r]*Finv[n-r];} }; ll modfact(ll n) { if (n <= 1) return 1; return (n * modfact(n - 1)) % MOD; } bool wat[3005], sug[3005]; int main(){ cin >> s int ans = s.size() / 2; REP(i, s.size()) if(s[i] == 'p') ans--; cout << ans; return 0; }
a.cc: In function 'int main()': a.cc:188:12: error: 's' was not declared in this scope 188 | cin >> s | ^ a.cc:190:38: error: 'ans' was not declared in this scope; did you mean 'abs'? 190 | REP(i, s.size()) if(s[i] == 'p') ans--; | ^~~ | abs a.cc:191:13: error: 'ans' was not declared in this scope; did you mean 'abs'? 191 | cout << ans; | ^~~ | abs
s738213199
p03967
C++
//INCLUDE //------------------------------------------ #include <bits/stdc++.h> //DEFINE //------------------------------------------ #define ll long long #define ld long double #define ALLv(a) (a).begin(),(a).end() #define ALL(a,n) (a),(a)+n #define vi vector<long long> #define vd vector<long double> #define vs vector<string> //CONST //------------------------------------------ #define INF 1010000000000000017LL #define MOD 1000000007LL #define EPS 1e-12 #define PI 3.14159265358979323846 //REPEAT //------------------------------------------ #define FOR(i,m,n) for(ll (i)=(m); (i)<(n); (i)++) #define REP(i,n) for(ll (i)=0; (i)<(n); (i)++) #define REPS(i,x) for(ll (i)=1; (i)<=(x); (i)++) #define RREP(i,x) for(ll (i)=(x)-1; (i)>=0; (i)--) #define RREPS(i,x) for(ll (i)=(x); (i)> 0; (i)--) #define WREP(i,in,j,jn) REP(i,in)REP(j,jn) //----------------------------------------- #define dcml(n) fixed<<setprecision(n) using namespace std; int main(void){ string cin>>s; ll N=s.size(); ll cntp=0;REP(i,N)if(s[i]=='p')cntp++; cout<<N/2-cntp<<"\n"; }
a.cc: In function 'int main()': a.cc:31:15: error: expected initializer before '>>' token 31 | string cin>>s; | ^~ a.cc:32:10: error: 's' was not declared in this scope 32 | ll N=s.size(); | ^
s156746730
p03967
C++
//INCLUDE //------------------------------------------ #include <bits/stdc++.h> //DEFINE //------------------------------------------ #define ll long long #define ld long double #define ALLv(a) (a).begin(),(a).end() #define ALL(a,n) (a),(a)+n #define vi vector<long long> #define vd vector<long double> #define vs vector<string> //CONST //------------------------------------------ #define INF 1010000000000000017LL #define MOD 1000000007LL #define EPS 1e-12 #define PI 3.14159265358979323846 //REPEAT //------------------------------------------ #define FOR(i,m,n) for(ll (i)=(m); (i)<(n); (i)++) #define REP(i,n) for(ll (i)=0; (i)<(n); (i)++) #define REPS(i,x) for(ll (i)=1; (i)<=(x); (i)++) #define RREP(i,x) for(ll (i)=(x)-1; (i)>=0; (i)--) #define RREPS(i,x) for(ll (i)=(x); (i)> 0; (i)--) #define WREP(i,in,j,jn) REP(i,in)REP(j,jn) //----------------------------------------- #define dcml(n) fixed<<setprecision(n) using namespace std; int main(void){ string string>>s; ll N=s.size(); ll cntp=0;REP(i,N)if(s[i]=='p')cntp++; cout<<N/2-cntp<<"\n"; }
a.cc: In function 'int main()': a.cc:31:18: error: expected initializer before '>>' token 31 | string string>>s; | ^~ a.cc:32:10: error: 's' was not declared in this scope 32 | ll N=s.size(); | ^
s056838507
p03967
C++
#include <bits/stdc++.h> using namespace std; int main(){ string s; cin>>s; ll ans=s.size()/2; for(int i=0;i<s.size();i++)if(s[i]=='p')ans--; cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:6:3: error: 'll' was not declared in this scope 6 | ll ans=s.size()/2; | ^~ a.cc:7:43: error: 'ans' was not declared in this scope; did you mean 'abs'? 7 | for(int i=0;i<s.size();i++)if(s[i]=='p')ans--; | ^~~ | abs a.cc:8:9: error: 'ans' was not declared in this scope; did you mean 'abs'? 8 | cout<<ans<<endl; | ^~~ | abs
s893414346
p03967
C++
#include<iostream> using namespace std; char s[100001] = { '\0' }; int main(void) { int sum = 0; int sumg=0, sump=0; cin >> s; for (int i = 0; i <strlen(s); i++) { if (s[i] == 'g') { if (sump <sumg) { sump++; sum++; } else if (sump >= sumg) { sumg++; } } else if (s[i] == 'p') { if (sump < sumg) { sump++; } else if (sump >= sumg) { sumg++; sum--; } } } cout << sum; }
a.cc: In function 'int main()': a.cc:9:28: error: 'strlen' was not declared in this scope 9 | for (int i = 0; i <strlen(s); i++) | ^~~~~~ a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include<iostream> +++ |+#include <cstring> 2 | using namespace std;
s534669119
p03967
C++
#include<bits/stdc++.h> using namespace std; int main(){ string s;cin>>s; int ans=0; for(int i=0;i<s.size();i++){ if(i%2)if(s[i]=='g')k++; else if(s[i]=='p')k--; } cout<<k<<endl; }
a.cc: In function 'int main()': a.cc:7:21: error: 'k' was not declared in this scope 7 | if(i%2)if(s[i]=='g')k++; | ^ a.cc:8:23: error: 'k' was not declared in this scope 8 | else if(s[i]=='p')k--; | ^ a.cc:10:9: error: 'k' was not declared in this scope 10 | cout<<k<<endl; | ^
s133288819
p03967
C++
#include <bits/stdc++.h> #define _GLIBCXX_DEBUG using namespace std; using ll=long long; using vec=vector<ll>; using Graph = vector<vector<ll>>; #define loop(i,n) for(ll i=0;i<n;i++) #define Loop(i, m, n) for(ll i = m;i < n;i++) #define pool(i,n) for(ll i=n;i>=0;i--) #define Pool(i, m, n) for(ll i=n;i>=m;i--) #define MAX 999999999ll #define MIN -999999999ll #define setbit bitset<8> #define flagcount __builtin_popcount #define flag(x) (1<<x) #define flagadd(bit,x) bit|=flag(x) #define flagpop(bit,x) bit&=~flag(x) #define flagon(bit,i) bit&flag(i) #define flagoff(bit,i) !(bit & (1<<i)) #define all(v) v.begin(),v.end() #define low2way(v,x) lower_bound(all(v),x) #define high2way(v,x) upper_bound(all(v),x) #define count2way(v,x) high2way(v,x)-low2way(v,x) #define lower(v,x) low2way(v,x)-v.begin() //1番左が0、もし見つから無いならnを出力 #define higher(v,x) high2way(v,x)-v.begin()-1 //1番左が0、もし見つからないならn-1を出力(注意) #define putout(x) cout<<x<<endl #define gcd(x,y) __gcd(x,y) #define Gput(a,b) G[a].push_back(b) const int dx[4] = {1, 0, -1, 0}; const int dy[4] = {0, 1, 0, -1}; ll lcm(ll x,ll y){ ll z=gcd(x,y); return x*(y/z); } ll ctoi(char c){ if(c>='0'&&c<='9'){ return c-'0'; } return 0; } vector<bool> seen; void dfs(const Graph &G,ll v){ seen[v]=true; for(auto nextv:G[v]){ if(seen[nextv])continue; dfs(G,nextv); } } ll fact(ll n){ ll sum=0; Loop(i,1,n+1){ sum+=i; } return sum; } int main() { cout << fixed << setprecision(16); string s; cin>>s; ll n=s.size(); ll gcount=0; ll pcount=0; ll ans=-1; loop(i,n){ if(s[i]=='g'&&pcount>0){ gcount++; ans-=pcount-1; pcount=0; } if(s[i]=='p'&&gcount>0){ pcount++; ans+=gcount-1; gcount=0; } if(s[i]=='g'&&pcount==0){ gcount++; } if(s[i]=='p'&&gcount==0){ pcount++; } } if(pcount>0)ans+=pcount-1; if(gcount>0)ans+=gcount-1; putout(max(ans,0)); }
a.cc: In function 'int main()': a.cc:86:13: error: no matching function for call to 'max(ll&, int)' 86 | putout(max(ans,0)); | ~~~^~~~~~~ a.cc:26:25: note: in definition of macro 'putout' 26 | #define putout(x) cout<<x<<endl | ^ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:86:13: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 86 | putout(max(ans,0)); | ~~~^~~~~~~ a.cc:26:25: note: in definition of macro 'putout' 26 | #define putout(x) cout<<x<<endl | ^ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:86:13: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 86 | putout(max(ans,0)); | ~~~^~~~~~~ a.cc:26:25: note: in definition of macro 'putout' 26 | #define putout(x) cout<<x<<endl | ^
s459594613
p03967
C++
#include <bits/stdc++.h> #define _GLIBCXX_DEBUG using namespace std; using ll=long long; using vec=vector<ll>; using Graph = vector<vector<ll>>; #define loop(i,n) for(ll i=0;i<n;i++) #define Loop(i, m, n) for(ll i = m;i < n;i++) #define pool(i,n) for(ll i=n;i>=0;i--) #define Pool(i, m, n) for(ll i=n;i>=m;i--) #define MAX 999999999ll #define MIN -999999999ll #define setbit bitset<8> #define flagcount __builtin_popcount #define flag(x) (1<<x) #define flagadd(bit,x) bit|=flag(x) #define flagpop(bit,x) bit&=~flag(x) #define flagon(bit,i) bit&flag(i) #define flagoff(bit,i) !(bit & (1<<i)) #define all(v) v.begin(),v.end() #define low2way(v,x) lower_bound(all(v),x) #define high2way(v,x) upper_bound(all(v),x) #define count2way(v,x) high2way(v,x)-low2way(v,x) #define lower(v,x) low2way(v,x)-v.begin() //1番左が0、もし見つから無いならnを出力 #define higher(v,x) high2way(v,x)-v.begin()-1 //1番左が0、もし見つからないならn-1を出力(注意) #define putout(x) cout<<x<<endl #define gcd(x,y) __gcd(x,y) #define Gput(a,b) G[a].push_back(b) const int dx[4] = {1, 0, -1, 0}; const int dy[4] = {0, 1, 0, -1}; ll lcm(ll x,ll y){ ll z=gcd(x,y); return x*(y/z); } ll ctoi(char c){ if(c>='0'&&c<='9'){ return c-'0'; } return 0; } vector<bool> seen; void dfs(const Graph &G,ll v){ seen[v]=true; for(auto nextv:G[v]){ if(seen[nextv])continue; dfs(G,nextv); } } ll fact(ll n){ ll sum=0; Loop(i,1,n+1){ sum+=i; } return sum; } int main() { cout << fixed << setprecision(16); string s; cin>>s; ll n=s.size(); ll gcount=0; ll pcount=0; ll ans=0; loop(i,n){ if(s[i]=='g'&&pcount>0){ gcount++; ans+=pcount-1; } if(s[i]=='p'&&gcount>0){ pcount++; ans+=gcount-1; } loop(i,n){ if(s[i]=='g'&&pcount==0){ gcount++; } if(s[i]=='p'&&gcount==0){ pcount++; } } if(pcount>0)ans+=pcount-1; if(gcount>0)ans+=gcount-1; putout(ans); }
a.cc: In function 'int main()': a.cc:86:2: error: expected '}' at end of input 86 | } | ^ a.cc:57:12: note: to match this '{' 57 | int main() { | ^
s269566153
p03967
C++
#include <bits/stdc++.h> #define _GLIBCXX_DEBUG using namespace std; using ll=long long; using vec=vector<ll>; using Graph = vector<vector<ll>>; #define loop(i,n) for(ll i=0;i<n;i++) #define Loop(i, m, n) for(ll i = m;i < n;i++) #define pool(i,n) for(ll i=n;i>=0;i--) #define Pool(i, m, n) for(ll i=n;i>=m;i--) #define MAX 999999999ll #define MIN -999999999ll #define setbit bitset<8> #define flagcount __builtin_popcount #define flag(x) (1<<x) #define flagadd(bit,x) bit|=flag(x) #define flagpop(bit,x) bit&=~flag(x) #define flagon(bit,i) bit&flag(i) #define flagoff(bit,i) !(bit & (1<<i)) #define all(v) v.begin(),v.end() #define low2way(v,x) lower_bound(all(v),x) #define high2way(v,x) upper_bound(all(v),x) #define count2way(v,x) high2way(v,x)-low2way(v,x) #define lower(v,x) low2way(v,x)-v.begin() //1番左が0、もし見つから無いならnを出力 #define higher(v,x) high2way(v,x)-v.begin()-1 //1番左が0、もし見つからないならn-1を出力(注意) #define putout(x) cout<<x<<endl #define gcd(x,y) __gcd(x,y) #define Gput(a,b) G[a].push_back(b) const int dx[4] = {1, 0, -1, 0}; const int dy[4] = {0, 1, 0, -1}; ll lcm(ll x,ll y){ ll z=gcd(x,y); return x*(y/z); } ll ctoi(char c){ if(c>='0'&&c<='9'){ return c-'0'; } return 0; } vector<bool> seen; void dfs(const Graph &G,ll v){ seen[v]=true; for(auto nextv:G[v]){ if(seen[nextv])continue; dfs(G,nextv); } } ll fact(ll n){ ll sum=0; Loop(i,1,n+1){ sum+=i; } return sum; } int main() { cout << fixed << setprecision(16); string s; cin>>s; ll n=s.size(); ll gcount=0; ll ans=0; loop(i,n){ if(s[i]=='g'&&pcount>0){ gcount++; ans+=pcount-1; } if(s[i]=='p'&&gcount>0){ pcount++; ans+=gcount-1; } loop(i,n){ if(s[i]=='g'&&pcount==0){ gcount++; } if(s[i]=='p'&&gcount==0){ pcount++; } } if(pcount>0)ans+=pcount-1; if(gcount>0)ans+=gcount-1; putout(ans); }
a.cc: In function 'int main()': a.cc:65:15: error: 'pcount' was not declared in this scope; did you mean 'gcount'? 65 | if(s[i]=='g'&&pcount>0){ | ^~~~~~ | gcount a.cc:70:1: error: 'pcount' was not declared in this scope; did you mean 'gcount'? 70 | pcount++; | ^~~~~~ | gcount a.cc:74:15: error: 'pcount' was not declared in this scope; did you mean 'gcount'? 74 | if(s[i]=='g'&&pcount==0){ | ^~~~~~ | gcount a.cc:78:1: error: 'pcount' was not declared in this scope; did you mean 'gcount'? 78 | pcount++; | ^~~~~~ | gcount a.cc:81:4: error: 'pcount' was not declared in this scope; did you mean 'gcount'? 81 | if(pcount>0)ans+=pcount-1; | ^~~~~~ | gcount a.cc:84:2: error: expected '}' at end of input 84 | } | ^ a.cc:57:12: note: to match this '{' 57 | int main() { | ^
s105454842
p03967
C++
s = input() score = 0 g = 0 for i in s: if g == 0: g += 1 if i == "p": score -= 1 elif g == 1: g -= 1 if i == 'g': score += 1 print(score)
a.cc:1:1: error: 's' does not name a type 1 | s = input() | ^
s674142658
p03967
C++
#include <iostream> #include <vector> #include <algorithm> #include <set> #include <map> #include <utility> #include <tuple> #include <string> #include <cctype> #include <cstdio> #include <math.h> using i8 = int8_t; using u8 = uint8_t; using i16 = int16_t; using u16 = uint16_t; using i32 = int32_t; using u32 = uint32_t; using i64 = int64_t; using u64 = uint64_t; using f32 = float; using f64 = double; constexpr i64 INF = 1'010'000'000'000'000'017LL; constexpr i64 MOD = 1'000'000'007LL; constexpr f64 EPS = 1e-12; constexpr f64 PI = 3.14159265358979323846; const int AMAX = 100000; using namespace std; #define rep(i, n) for (i64 i = 0; i < (int)(n); i++) #define FOR(i, m, n) for (i64 i = m; i < n; i++) #define SORT(x) sort(x.begin(), x.end()) #define REVE(x) reverse(x.begin(), x.end()) #define all(x) (x).begin(), (x).end() #define fst first #define mp make_pair #define pb push_back #define eb emplace_back #define pob pop_back #define sw swap #define UP(x) transform(x.begin(), x.end(), x.begin(), ::toupper); #define down(x) transform(x.begin(), x.end(), x.begin(), ::tolower); using LL = long long; using ULL = unsigned long long; 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; } int main(void) { string a; cin >> a; int ans; rep(i, a.size()-1){    if(a[i]=="p")ans++ } cout << a.size / 2 - ans; return 0; }
a.cc:69:1: error: extended character   is not valid in an identifier 69 |    if(a[i]=="p")ans++ | ^ a.cc:69:1: error: extended character   is not valid in an identifier a.cc:13:12: error: 'uint8_t' does not name a type 13 | using u8 = uint8_t; | ^~~~~~~ a.cc:12:1: note: 'uint8_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' 11 | #include <math.h> +++ |+#include <cstdint> 12 | using i8 = int8_t; a.cc:15:13: error: 'uint16_t' does not name a type 15 | using u16 = uint16_t; | ^~~~~~~~ a.cc:15:13: note: 'uint16_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' a.cc:17:13: error: 'uint32_t' does not name a type 17 | using u32 = uint32_t; | ^~~~~~~~ a.cc:17:13: note: 'uint32_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' a.cc:19:13: error: 'uint64_t' does not name a type 19 | using u64 = uint64_t; | ^~~~~~~~ a.cc:19:13: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' a.cc: In function 'int main()': a.cc:69:1: error: '\U00003000\U00003000' was not declared in this scope 69 |    if(a[i]=="p")ans++ | ^~~~ a.cc:71:15: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?) 71 | cout << a.size / 2 - ans; | ~~^~~~ | ()
s711518422
p03967
C++
x#include <iostream> #include <string> #include <vector> #include <algorithm> #include <cmath> #include <stdio.h> #include <queue> #include <climits> #include <map> #include <set> const int mod = 1e9 + 7; const int inf = 1 << 20; const long long INF = 1LL << 60; using namespace std; typedef long long ll; typedef pair<int, int> P; using namespace std; int main() { string s; cin >> s; int a = s.size(); int num = a / 2; int p = 0; for(int i = 0; i < a; i++){ if(s[i] == 'p'){ p++; } } cout << num - p << endl; }
a.cc:1:2: error: stray '#' in program 1 | x#include <iostream> | ^ a.cc:1:1: error: 'x' does not name a type 1 | x#include <iostream> | ^ In file included from /usr/include/c++/14/bits/char_traits.h:42, from /usr/include/c++/14/string:42, from a.cc:2: /usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type 68 | typedef ptrdiff_t streamsize; // Signed integral type | ^~~~~~~~~ /usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 40 | #include <cwchar> // For mbstate_t +++ |+#include <cstddef> 41 | In file included from /usr/include/c++/14/bits/char_traits.h:50: /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std' 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ In file included from /usr/include/wchar.h:35, from /usr/include/c++/14/cwchar:44, from /usr/include/c++/14/bits/postypes.h:40: /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared 2086 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope 2087 | struct remove_extent<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid 2087 | struct remove_extent<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared 2099 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope 2100 | struct remove_all_extents<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid 2100 | struct remove_all_extents<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared 2171 | template<std::size_t _Len> | ^~~ /usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope 2176 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^~~~ /usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^ /usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope 2202 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope 2203 | struct __attribute__((__aligned__((_Align)))) { } __align; | ^~~~~~ /usr/include/c++/14/bits/char_traits.h:144:61: error: 'std::size_t' has not been declared 144 | compare(const char_type* __s1, const char_type* __s2, std::size_t __n); | ^~~ /usr/include/c++/14/bits/char_traits.h:146:40: error: 'size_t' in namespace 'std' does not name a type 146 | static _GLIBCXX14_CONSTEXPR std::size_t | ^~~~~~ /usr/include/c++/14/bits/char_traits.h:150:34: error: 'std::size_t' has not been declared 150 | find(const char_type* __s, std::size_t __n, const char_type& __a); | ^~~ /usr/include/c++/14/bits/char_traits.h:153:52: error: 'std::size_t' has not been declared 153 | move(char_type* __s1, const char_type* __s2, std::size_t __n); | ^~~ /usr/include/c++/14/bits/char_traits.h:156:52: error: 'std::size_t' has not been declared 156 | copy(char_type* __s1, const char_type* __s2, std::size_t __n); | ^~~ /usr/include/c++/14/bits/char_traits.h:159:30: error: 'std::size_t' has not been declared 159 | assign(char_type* __s, std::size_t __n, char_type __a); | ^~~ /usr/include/c++/14/bits/char_traits.h:187:59: error: 'std::size_t' has not been declared 187 | compare(const char_type* __s1, const char_type* __s2, std::size_t __n) | ^~~ /usr/include/c++/14/bits/char_traits.h: In static member function 'static constexpr int __gnu_cxx::char_traits<_CharT>::compare(const char_type*, const char_type*, int)': /usr/include/c++/14/bits/char_traits.h:189:17: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 189 | for (std::size_t __i = 0; __i < __n; ++__i) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/bits/char_traits.h:189:33: error: '__i' was not declared in this scope; did you mean '__n'? 189 | for (std::size_t __i = 0; __i < __n; ++__i) | ^~~ | __n /usr/include/c++/14/bits/char_traits.h: At global scope: /usr/include/c++/14/bits/char_traits.h:198:31: error: 'size_t' in namespace 'std' does not name a
s060455872
p03967
C++
#include <bits/stdc++.h> using namespace std; int main(){ string s; cin >> s; int ans = n/2; for (int i = 0; i < s.size(); i++){ if (s[i] == 'p') ans--; } printf("%d",ans); }
a.cc: In function 'int main()': a.cc:6:15: error: 'n' was not declared in this scope 6 | int ans = n/2; | ^
s625643978
p03967
Java
import java.util.Scanner; import jdk.management.cmm.SystemResourcePressureMXBean; public class Main { public static void main(String[] args) { Scanner input=new Scanner( System.in); String string=input.next(); int len=string.length(); int ans=0; for(int i=0;i<len;i++) { if(i%2==0) { if(string.charAt(i)=='p') ans--; } else { if(string.charAt(i)=='g') ans++; } } System.out.println(ans); } }
Main.java:3: error: package jdk.management.cmm does not exist import jdk.management.cmm.SystemResourcePressureMXBean; ^ 1 error
s623105061
p03967
C++
s = gets.chomp.split('') sum = 0 s.each_index do |i| case s[i] when 'g' sum += i.even? ? 0 : 1 when 'p' sum += i.even? ? (-1) : 0 end end puts sum
a.cc:1:22: error: empty character constant 1 | s = gets.chomp.split('') | ^~ a.cc:1:1: error: 's' does not name a type 1 | s = gets.chomp.split('') | ^
s769105954
p03967
C++
v
a.cc:1:1: error: 'v' does not name a type 1 | v | ^
s489116203
p03967
C++
#include <bits/stdc++.h> #ifdef _WIN32 #include "debug.hpp" #endif using namespace std; #define rep(i, N) for(int i = 0; i < (N); i++) #define reps(i, N) for(int i = 1; i <= (N); i++) #define repr(i, N) for(int i = (N) - 1; i >= 0; i--) #define pub push_back template<typename T> void chmax(T &a, T b){ a = max(a, b); }; template<typename T> void chmin(T &a, T b){ a = min(a, b); }; typedef long long ll; typedef pair<int, int> P; const int INF = 100000000; const ll LINF = 10000000000000000; const int MOD = 1000000007; const int dx[9] = { 0, 1, 0, -1, 1, 1, -1, -1, 0}; const int dy[9] = { 1, 0, -1, 0, 1, -1, -1, 1, 0}; //--------------------------------------// string S; void solve(){ int ans = 0; rep(i, N){ if(i % 2 == 0 and S[i] == 'p') ans--; else if(i % 2 == 1 and S[i] == 'g') ans++; } cout << ans << endl; } int main(){ cin.tie(0); ios::sync_with_stdio(false); cin >> S; solve(); return 0; }
a.cc: In function 'void solve()': a.cc:29:16: error: 'N' was not declared in this scope 29 | rep(i, N){ | ^ a.cc:7:40: note: in definition of macro 'rep' 7 | #define rep(i, N) for(int i = 0; i < (N); i++) | ^