submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s695332308
p03864
C++
// https://atcoder.jp/contests/arc064/tasks/arc064_a #include <bits/stdc++.h> using namespace std; #define watch(x) cerr << (#x) << " is " << (x) << endl; #define endl '\n' #define int long long signed main() { ios::sync_with_stdio(0); cin.sync_with_stdio(0); cin.tie(0); int N, x; cin >> N >> x; vector<int> a(N+5); for(int i = 1; i <= N; i++) { cin >> a[i]; } int ans = 0; for(int i = 1; i <= N; i++) { ans += max(0, (a[i]+a[i-1])-x); a[i] -= max(0, (a[i]+a[i-1])-x); assert(a[i] >= 0); } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:23:23: error: no matching function for call to 'max(int, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)' 23 | ans += max(0, (a[i]+a[i-1])-x); | ~~~^~~~~~~~~~~~~~~~~~~~ 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:3: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:23:23: note: deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}) 23 | ans += max(0, (a[i]+a[i-1])-x); | ~~~^~~~~~~~~~~~~~~~~~~~ /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:23:23: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 23 | ans += max(0, (a[i]+a[i-1])-x); | ~~~^~~~~~~~~~~~~~~~~~~~ a.cc:24:24: error: no matching function for call to 'max(int, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)' 24 | a[i] -= max(0, (a[i]+a[i-1])-x); | ~~~^~~~~~~~~~~~~~~~~~~~ /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:24:24: note: deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}) 24 | a[i] -= max(0, (a[i]+a[i-1])-x); | ~~~^~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:24:24: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 24 | a[i] -= max(0, (a[i]+a[i-1])-x); | ~~~^~~~~~~~~~~~~~~~~~~~
s222695562
p03864
C++
#include <bits/stdc++.h> #define rep(i,n) for(int i=0;i<n;i++) #define all(x) (x).begin(),(x).end() #define cyes cout<<"YES"<<endl #define cno cout<<"NO"<<endl #define sp <<" "<< #define cst(x) cout<<fixed<<setprecision(x) #define pi 3.14159265359 #define mod 1000000007 #define int long long using namespace std; using ll = long long; using ld = long double; using Graph = vector<vector<int>>; using que_a = priority_queue<int, vector<int>, greater<int> >; using que_d = priority_queue<int>; using pint = pair<int,int>; int main(){ int n; cin >> n; int x; cin >> x; vector<int> a(n); rep(i,n) cin >> a.at(i); ll cnt = 0; if(a.at(0) > x){ a.at(0) = x; cnt += a.at(0) - x; } for(int i = 1; i < n; i++){ int sum = a.at(i-1) + a.at(i); if(sum > x){ a.at(i) -= sum - x; cnt += sum - x; } } cout << cnt << endl; return 0; }
cc1plus: error: '::main' must return 'int'
s381298640
p03864
C++
#include<bits/stdc++.h> using namespace std; int main () { int N; long long x; cin >> N >> x; vector<long long>A(N); for (int i = 0; i < N; i ++) cin >> A[i]; long long ans = 0; for (int i = 1; i < N; i ++) { long long kj = A[i - 1] + A[i] - x; if (kj <= 0) continue; ans += kj; A[i] = max(0, A[i] - x); } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:14:15: error: no matching function for call to 'max(int, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)' 14 | A[i] = max(0, A[i] - x); | ~~~^~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:14:15: note: deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}) 14 | A[i] = max(0, A[i] - x); | ~~~^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:14:15: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 14 | A[i] = max(0, A[i] - x); | ~~~^~~~~~~~~~~~~
s394090948
p03864
C++
#include <bits/stdc++.h> using namespace std; #define int long long int N,X; int A[100001]; int32_t main(){ cin>>N>>X; int ans = 0; for (int i=0;i<N;i++) cin>>A[i]; for (int i=1;i<N;i++){ if (A[i] + A[i-1] > X){ ans += A[i] - max(0,X-A[i-1]); A[i] = max(0,X-A[i-1]); } if (A[i-1] > X){ ans += A[i-1] - X; A[i-1] = X; } } //for (int i=0;i<N;i++) cout<<A[i]<<' '; cout<<ans; }
a.cc: In function 'int32_t main()': a.cc:13:34: error: no matching function for call to 'max(int, long long int)' 13 | ans += A[i] - max(0,X-A[i-1]); | ~~~^~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:13:34: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 13 | ans += A[i] - max(0,X-A[i-1]); | ~~~^~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:13:34: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 13 | ans += A[i] - max(0,X-A[i-1]); | ~~~^~~~~~~~~~~~ a.cc:14:35: error: no matching function for call to 'max(int, long long int)' 14 | A[i] = max(0,X-A[i-1]); | ~~~^~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:14:35: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 14 | A[i] = max(0,X-A[i-1]); | ~~~^~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:14:35: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 14 | A[i] = max(0,X-A[i-1]); | ~~~^~~~~~~~~~~~
s937916885
p03864
C++
#include <bits/stdc++.h> using namespace std; #define int ll int N,X; int A[100001]; int32_t main(){ cin>>N>>X; int ans = 0; for (int i=0;i<N;i++) cin>>A[i]; for (int i=1;i<N;i++){ if (A[i] + A[i-1] > X){ ans += A[i] - max(0,X-A[i-1]); A[i] = max(0,X-A[i-1]); } if (A[i-1] > X){ ans += A[i-1] - X; A[i-1] = X; } } //for (int i=0;i<N;i++) cout<<A[i]<<' '; cout<<ans; }
a.cc:3:13: error: 'll' does not name a type 3 | #define int ll | ^~ a.cc:4:1: note: in expansion of macro 'int' 4 | int N,X; | ^~~ a.cc:3:13: error: 'll' does not name a type 3 | #define int ll | ^~ a.cc:5:1: note: in expansion of macro 'int' 5 | int A[100001]; | ^~~ a.cc: In function 'int32_t main()': a.cc:7:14: error: 'N' was not declared in this scope 7 | cin>>N>>X; | ^ a.cc:7:17: error: 'X' was not declared in this scope 7 | cin>>N>>X; | ^ a.cc:3:13: error: 'll' was not declared in this scope 3 | #define int ll | ^~ a.cc:8:5: note: in expansion of macro 'int' 8 | int ans = 0; | ^~~ a.cc:9:18: error: expected ';' before 'i' 9 | for (int i=0;i<N;i++) cin>>A[i]; | ^ a.cc:9:22: error: 'i' was not declared in this scope 9 | for (int i=0;i<N;i++) cin>>A[i]; | ^ a.cc:9:36: error: 'A' was not declared in this scope 9 | for (int i=0;i<N;i++) cin>>A[i]; | ^ a.cc:11:14: error: expected ';' before 'i' 11 | for (int i=1;i<N;i++){ | ^ a.cc:11:18: error: 'i' was not declared in this scope 11 | for (int i=1;i<N;i++){ | ^ a.cc:12:21: error: 'A' was not declared in this scope 12 | if (A[i] + A[i-1] > X){ | ^ a.cc:13:17: error: 'ans' was not declared in this scope; did you mean 'abs'? 13 | ans += A[i] - max(0,X-A[i-1]); | ^~~ | abs a.cc:16:13: error: 'A' was not declared in this scope 16 | if (A[i-1] > X){ | ^ a.cc:17:17: error: 'ans' was not declared in this scope; did you mean 'abs'? 17 | ans += A[i-1] - X; | ^~~ | abs a.cc:23:11: error: 'ans' was not declared in this scope; did you mean 'abs'? 23 | cout<<ans; | ^~~ | abs
s445741362
p03864
C++
#include <bits/stdc++.h> using namespace std; int N,X; int A[100001] int main(){ cin>>N>>X; int ans = 0; for (int i=0;i<N;i++) cin>>A[i]; for (int i=1;i<N;i++){ if (A[i] + A[i-1] > X){ ans += A[i-1] - max(0,X - A[i]); A[i-1] = max(0,X - A[i]); } if (A[i-1] > X){ ans += A[i-1] - X; A[i-1] = X; } } cout<<ans; }
a.cc:5:1: error: expected initializer before 'int' 5 | int main(){ | ^~~
s526619154
p03864
C++
#include <bits/stdc++.h> using namespace std; int main() { long long int a,b,c[100010]d=0; cin >> a >> b; long long int ans =0; for(int i=0;i<a;i++) cin >> c[i]; for(int i=0;i<a-1;i++){ if(b < c[i]+c[i+1]){ ans += (c[i+1]+c[i])-b; c[i+1] = max(d,b-c[i]); } } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:6:36: error: expected initializer before 'd' 6 | long long int a,b,c[100010]d=0; | ^ a.cc:12:12: error: 'c' was not declared in this scope 12 | cin >> c[i]; | ^ a.cc:19:12: error: 'c' was not declared in this scope 19 | if(b < c[i]+c[i+1]){ | ^ a.cc:22:20: error: 'd' was not declared in this scope 22 | c[i+1] = max(d,b-c[i]); | ^
s179698150
p03864
C++
#include <bits/stdc++.h> using namespace std; int main() { long long int a,b,c[100010]; cin >> a >> b; long long int ans =0; for(int i=0;i<a;i++) cin >> c[i]; for(int i=0;i<a-1;i++){ if(b < c[i]+c[i+1]){ ans += (c[i+1]+c[i])-b; c[i+1] = max(0,b-c[i]); } } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:22:19: error: no matching function for call to 'max(int, long long int)' 22 | c[i+1] = max(0,b-c[i]); | ~~~^~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:22:19: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 22 | c[i+1] = max(0,b-c[i]); | ~~~^~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:22:19: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 22 | c[i+1] = max(0,b-c[i]); | ~~~^~~~~~~~~~
s988204210
p03864
C++
#include <bits/stdc++.h> #define r(i,n) for(long long i = 0; i<n; i++) typedef long long ll; using namespace std; int main() { ll n,x,count=0; cin >> n >> x; vector<ll> v(n,0); r(i,n)cin >> v[i]; r(i,n-1){ if(v[i]+v[i+1]>x){ count+=v[i]+v[i+1]-x; v[i+1]=max(0,x-v[i]); } } cout<<count<<endl; }
a.cc: In function 'int main()': a.cc:14:17: error: no matching function for call to 'max(int, ll)' 14 | v[i+1]=max(0,x-v[i]); | ~~~^~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:14:17: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'}) 14 | v[i+1]=max(0,x-v[i]); | ~~~^~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:14:17: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 14 | v[i+1]=max(0,x-v[i]); | ~~~^~~~~~~~~~
s909246792
p03864
C++
6 1 1 6 1 2 0 4#include <bits/stdc++.h> using namespace std; #define ll long long #define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++) #define rep(i,n) REP(i,0,n) #define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++) #define repl(i,n) REP(i,0,n) const int inf = 1e9+7; const ll longinf = 1LL<<60; const ll mod = 1e9+7; int main() { int N; ll x; cin >> N >> x; vector<ll> A(N); rep(i, N) cin >> A[i]; vector<ll> B(N-1); rep(i, N-1) B[i] = max(0LL, A[i+1] + A[i] - x); ll cnt = 0; rep(i, N) { int b = max(0LL, min(B[i], A[i+1])); if(i == 0) { A[i] -= B[i] - b; cnt += B[i] - b; } A[i+1] -= b; B[i+1] -= b; cnt += b; } cout << cnt << endl; return 0; }
a.cc:2:12: error: stray '#' in program 2 | 1 6 1 2 0 4#include <bits/stdc++.h> | ^ a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 6 1 | ^ a.cc: In function 'int main()': a.cc:16:3: error: 'cin' was not declared in this scope 16 | cin >> N >> x; | ^~~ a.cc:17:3: error: 'vector' was not declared in this scope 17 | vector<ll> A(N); | ^~~~~~ a.cc:4:12: error: expected primary-expression before 'long' 4 | #define ll long long | ^~~~ a.cc:17:10: note: in expansion of macro 'll' 17 | vector<ll> A(N); | ^~ a.cc:18:20: error: 'A' was not declared in this scope 18 | rep(i, N) cin >> A[i]; | ^ a.cc:4:12: error: expected primary-expression before 'long' 4 | #define ll long long | ^~~~ a.cc:19:10: note: in expansion of macro 'll' 19 | vector<ll> B(N-1); | ^~ a.cc:21:5: error: 'B' was not declared in this scope 21 | B[i] = max(0LL, A[i+1] + A[i] - x); | ^ a.cc:21:21: error: 'A' was not declared in this scope 21 | B[i] = max(0LL, A[i+1] + A[i] - x); | ^ a.cc:21:12: error: 'max' was not declared in this scope 21 | B[i] = max(0LL, A[i+1] + A[i] - x); | ^~~ a.cc:24:26: error: 'B' was not declared in this scope 24 | int b = max(0LL, min(B[i], A[i+1])); | ^ a.cc:24:32: error: 'A' was not declared in this scope 24 | int b = max(0LL, min(B[i], A[i+1])); | ^ a.cc:24:22: error: 'min' was not declared in this scope; did you mean 'main'? 24 | int b = max(0LL, min(B[i], A[i+1])); | ^~~ | main a.cc:24:13: error: 'max' was not declared in this scope 24 | int b = max(0LL, min(B[i], A[i+1])); | ^~~ a.cc:33:3: error: 'cout' was not declared in this scope 33 | cout << cnt << endl; | ^~~~ a.cc:33:18: error: 'endl' was not declared in this scope 33 | cout << cnt << endl; | ^~~~
s536757930
p03864
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int MAXN = 100 * 1000 + 123; int n, x, a[MAXN], ans; int main() { cin >> n >> x; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 1; i < n; i++) while (a[i] + a[i - 1] > x) { if (a[i]) { ans += min(a[i], a[i] + a[i - 1] - x); a[i] -= min(a[i], a[i] + a[i - 1] - x); } else { ans += min(a[i - 1], a[i] + a[i - 1] - x); a[i - 1] -= min(a[i - 1], a[i] + a[i - 1] - x) } } cout << ans; return 0; }
a.cc: In function 'int main()': a.cc:31:79: error: expected ';' before '}' token 31 | a[i - 1] -= min(a[i - 1], a[i] + a[i - 1] - x) | ^ | ; 32 | } | ~
s543397954
p03864
C++
#include <bits/stdc++.h> #define int long long using namespace std; main(){ int n,x; scanf("%lld%lld",&n,&x); int a[n]; for (int i = 0; i < n; i++){ scanf("%lld",&a[i]); } int s[n+1]; s[0] = a[0], s[n] = a[n-1]; for (int i = 1; i < n; i++) s[i] = a[i]+a[i-1]; int ans = 0; for (int i = 0; i <= n; i++){ int k = max(0,s[i]-x); ans += k; s[i+1] -= k; } printf("%lld",ans); }
a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 4 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:15:20: error: no matching function for call to 'max(int, long long int)' 15 | int k = max(0,s[i]-x); | ~~~^~~~~~~~~~ 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:20: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 15 | int k = max(0,s[i]-x); | ~~~^~~~~~~~~~ /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:20: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 15 | int k = max(0,s[i]-x); | ~~~^~~~~~~~~~
s972621204
p03864
C++
#include<bits/stdc++.h> using namespace std; using ll = long long; int main(){ int n; ll x,ans=0; vector<ll> a(n); for(int i=0;i<n;i++)cin>>a[i]; for(int i=0;i<n-1;i++){ if(a[i]+a[i+1]<=x)continue; ll b = a[i]+a[i+1]; ans+=b-x; a[i+1]=max(x-a[i],0); if(a[i]>x){ ans+=a[i]-x; } } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:15:15: error: no matching function for call to 'max(ll, int)' 15 | a[i+1]=max(x-a[i],0); | ~~~^~~~~~~~~~ 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:15: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 15 | a[i+1]=max(x-a[i],0); | ~~~^~~~~~~~~~ /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:15: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 15 | a[i+1]=max(x-a[i],0); | ~~~^~~~~~~~~~
s364116676
p03864
C++
#include<bits/stdc++.h> using namespace std; #define int long long #define fo(a,b) for(int a=0;a<b;a++) #define Sort(a) sort(a.begin(),a.end()) #define rev(a) reverse(a.begin(),a.end()) int wari(int a,int b) { if(a%b==0) return a/b; else return a/b+1; } int keta(int a){ double b=a; b=log10(b); int c=b; return c+1; } int souwa(int a){ return a*(a+1)/2; } int lcm(int a,int b){ int d=a,e=b,f; if(a<b) swap(a,b); int c,m=1; while(m){ c=a%b; if(c==0){ f=b; m--; } else{ a=b; b=c; } } return d*e/f; } int gcm(int a,int b){ int d=a,e=b,f; if(a<b) swap(a,b); int c,m=1; while(m){ c=a%b; if(c==0){ f=b; m--; } else{ a=b; b=c; } } return f; } signed main(){ int a,b,d=0; cin>>a>>b; vector<int> c(a); fo(i,a) cin>>c[i]; fo(i,a-1){ if(c[i]+c[i+1]>b){ if(c[i+1]>c[i]+c[i+1]-b){ d+=b-c[i]; c[i+1]=b-c[i]; } else{ d+=c[i]+c[i+1]-b c[i]=b; c[i+1]=0; } } } cout<<d<<endl; } }
a.cc: In function 'int main()': a.cc:71:25: error: expected ';' before 'c' 71 | d+=c[i]+c[i+1]-b | ^ | ; 72 | c[i]=b; | ~ a.cc: At global scope: a.cc:80:1: error: expected declaration before '}' token 80 | } | ^
s767926563
p03864
C++
#include <iostream> #include <vector> #include<list> #include <algorithm> #include <string> #include <math.h> #include<map> #include <utility> #include <cstring> #include <iomanip> #include<queue> using namespace std; #define REP(i,k,n) for(int i=k;i<n;i++) #define INF 1000000000 typedef long long ll; #define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0])) #define MOD 1000000007 template<typename T> int vector_finder(std::vector<T> vec, T number) { auto itr = std::find(vec.begin(), vec.end(), number); size_t index = std::distance( vec.begin(), itr ); if (index != vec.size()) { // 発見できたとき return 1; } else { // 発見できなかったとき return 0; } } template<typename T> T gcd(T a,T b){ if(b>0){ return gcd(b, a % b); }else{ return a; } } template<typename T> T lcm(T a,T b){ T g = gcd(a, b); return a /g* b ; } void clear( std::queue<pair<int,int> > &q ) { std::queue<pair<int,int> > empty; std::swap( q, empty ); } bool IsPrime(int num) { if (num < 2) return false; else if (num == 2) return true; else if (num % 2 == 0) return false; // 偶数はあらかじめ除く double sqrtNum = sqrt(num); for (int i = 3; i <= sqrtNum; i += 2) { if (num % i == 0) { // 素数ではない return false; } } // 素数である return true; } template<typename T> int GetDigit(T num){ int digit=0; while(num!=0){ num /= 10; digit++; } return digit; } template<typename T> std::vector<T> enum_div(T n)//nの約数を列挙 { std::vector<T> ret; for(T i=1 ; i*i<=n ; ++i) { if(n%i == 0) { ret.push_back(i); if(i!=1 && i*i!=n) { ret.push_back(n/i); } } } return ret; } class DisjointSet{ public: vector<int> rank, p; DisjointSet(){ } DisjointSet(int size){ rank.resize(size, 0); p.resize(size, 0); for (int i = 0; i < size;i++){ makeSet(i); } } void makeSet(int x){ p[x] = x; rank[x] = 0; } bool same(int x,int y){ return findSet(x) == findSet(y); } void unite(int x,int y){ link(findSet(x), findSet(y)); } void link(int x,int y){ if(rank[x]>rank[y]){ p[y] = x; }else{ p[x] = y; if(rank[x]==rank[y]){ rank[y]++; } } } int findSet(int x){ if(x!=p[x]){ p[x] = findSet(p[x]); } return p[x]; } }; int main() { int N; cin >> N; ll x; ll a[N]; cin >> x; REP(i,0,N){ cin >> a[i]; } ll ans = 0; REP(i,0,N-1){ if(a[i]+a[i+1]>x){ ans += (a[i] + a[i + 1])-x; if(a[i+1]>=(a[i]+a[i+1])-x){ a[i + 1] -= (a[i] + a[i + 1])-x; } else { a[i + 1] = 0; } } } cout << ans << endl; }#include <iostream> #include <vector> #include<list> #include <algorithm> #include <string> #include <math.h> #include<map> #include <utility> #include <cstring> #include <iomanip> #include<queue> using namespace std; #define REP(i,k,n) for(int i=k;i<n;i++) #define INF 1000000000 typedef long long ll; #define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0])) #define MOD 1000000007 template<typename T> int vector_finder(std::vector<T> vec, T number) { auto itr = std::find(vec.begin(), vec.end(), number); size_t index = std::distance( vec.begin(), itr ); if (index != vec.size()) { // 発見できたとき return 1; } else { // 発見できなかったとき return 0; } } template<typename T> T gcd(T a,T b){ if(b>0){ return gcd(b, a % b); }else{ return a; } } template<typename T> T lcm(T a,T b){ T g = gcd(a, b); return a /g* b ; } void clear( std::queue<pair<int,int> > &q ) { std::queue<pair<int,int> > empty; std::swap( q, empty ); } bool IsPrime(int num) { if (num < 2) return false; else if (num == 2) return true; else if (num % 2 == 0) return false; // 偶数はあらかじめ除く double sqrtNum = sqrt(num); for (int i = 3; i <= sqrtNum; i += 2) { if (num % i == 0) { // 素数ではない return false; } } // 素数である return true; } template<typename T> int GetDigit(T num){ int digit=0; while(num!=0){ num /= 10; digit++; } return digit; } template<typename T> std::vector<T> enum_div(T n)//nの約数を列挙 { std::vector<T> ret; for(T i=1 ; i*i<=n ; ++i) { if(n%i == 0) { ret.push_back(i); if(i!=1 && i*i!=n) { ret.push_back(n/i); } } } return ret; } class DisjointSet{ public: vector<int> rank, p; DisjointSet(){ } DisjointSet(int size){ rank.resize(size, 0); p.resize(size, 0); for (int i = 0; i < size;i++){ makeSet(i); } } void makeSet(int x){ p[x] = x; rank[x] = 0; } bool same(int x,int y){ return findSet(x) == findSet(y); } void unite(int x,int y){ link(findSet(x), findSet(y)); } void link(int x,int y){ if(rank[x]>rank[y]){ p[y] = x; }else{ p[x] = y; if(rank[x]==rank[y]){ rank[y]++; } } } int findSet(int x){ if(x!=p[x]){ p[x] = findSet(p[x]); } return p[x]; } }; int main() { int N; cin >> N; ll x; ll a[N]; cin >> x; REP(i,0,N){ cin >> a[i]; } ll ans = 0; REP(i,0,N-1){ if(a[i]+a[i+1]>x){ ans += (a[i] + a[i + 1])-x; if(a[i+1]>=(a[i]+a[i+1])-x){ a[i + 1] -= (a[i] + a[i + 1])-x; } else { a[i + 1] = 0; } } } cout << ans << endl; }
a.cc:174:2: error: stray '#' in program 174 | }#include <iostream> | ^ a.cc:174:3: error: 'include' does not name a type 174 | }#include <iostream> | ^~~~~~~ a.cc:194:5: error: redefinition of 'template<class T> int vector_finder(std::vector<_Tp>, T)' 194 | int vector_finder(std::vector<T> vec, T number) { | ^~~~~~~~~~~~~ a.cc:21:5: note: 'template<class T> int vector_finder(std::vector<_Tp>, T)' previously declared here 21 | int vector_finder(std::vector<T> vec, T number) { | ^~~~~~~~~~~~~ a.cc:206:3: error: redefinition of 'template<class T> T gcd(T, T)' 206 | T gcd(T a,T b){ | ^~~ a.cc:33:3: note: 'template<class T> T gcd(T, T)' previously declared here 33 | T gcd(T a,T b){ | ^~~ a.cc:215:3: error: redefinition of 'template<class T> T lcm(T, T)' 215 | T lcm(T a,T b){ | ^~~ a.cc:42:3: note: 'template<class T> T lcm(T, T)' previously declared here 42 | T lcm(T a,T b){ | ^~~ a.cc:220:6: error: redefinition of 'void clear(std::queue<std::pair<int, int> >&)' 220 | void clear( std::queue<pair<int,int> > &q ) | ^~~~~ a.cc:47:6: note: 'void clear(std::queue<std::pair<int, int> >&)' previously defined here 47 | void clear( std::queue<pair<int,int> > &q ) | ^~~~~ a.cc:225:6: error: redefinition of 'bool IsPrime(int)' 225 | bool IsPrime(int num) | ^~~~~~~ a.cc:52:6: note: 'bool IsPrime(int)' previously defined here 52 | bool IsPrime(int num) | ^~~~~~~ a.cc:245:6: error: redefinition of 'template<class T> int GetDigit(T)' 245 | int GetDigit(T num){ | ^~~~~~~~ a.cc:72:6: note: 'template<class T> int GetDigit(T)' previously declared here 72 | int GetDigit(T num){ | ^~~~~~~~ a.cc:255:16: error: redefinition of 'template<class T> std::vector<_Tp> enum_div(T)' 255 | std::vector<T> enum_div(T n)//nの約数を列挙 | ^~~~~~~~ a.cc:82:16: note: 'template<class T> std::vector<_Tp> enum_div(T)' previously declared here 82 | std::vector<T> enum_div(T n)//nの約数を列挙 | ^~~~~~~~ a.cc:273:7: error: redefinition of 'class DisjointSet' 273 | class DisjointSet{ | ^~~~~~~~~~~ a.cc:100:7: note: previous definition of 'class DisjointSet' 100 | class DisjointSet{ | ^~~~~~~~~~~ a.cc:317:5: error: redefinition of 'int main()' 317 | int main() | ^~~~ a.cc:144:5: note: 'int main()' previously defined here 144 | int main() | ^~~~
s479214693
p03864
C++
#include <bits/stdc++.h> #define REP(i,n) for(int i=0;i<n;i++) #define REPP(i,n) for(int i=1;i<=n;i++) const double PI = acos(-1); const double EPS = 1e-15; long long INF=(long long)1E17; #define i_7 (long long)(1E9+7) long mod(long a){ long long c=a%i_7; if(c>=0)return c; return c+i_7; } using namespace std; bool prime(int n){ if(n==1){ return false; }else if(n==2){ return true; }else{ for(int i=2;i<=sqrt(n);i++){ if(n%i==0){ return false; } } return true; } } long long gcd(long long a, long long b){ if(a<b){ swap(a,b); } if(a%b==0){ return b; }else{ return gcd(b,a%b); } } long long lcm(long long x, long long y){ return (x/gcd(x,y))*y; } class UnionFind { public: //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。 vector<int> Parent; //クラスを作るときは、Parentの値を全て-1にする。 //以下のようにすると全てバラバラの頂点として解釈できる。 UnionFind(int N) { Parent = vector<int>(N, -1); } //Aがどのグループに属しているか調べる int root(int A) { if (Parent[A] < 0) return A; return Parent[A] = root(Parent[A]); } //自分のいるグループの頂点数を調べる int size(int A) { return -Parent[root(A)];//先祖をrootで取っておきたい。 } //AとBをくっ付ける bool connect(int A, int B) { //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける A = root(A); B = root(B); if (A == B) { //すでにくっついてるからくっ付けない return false; } //大きい方(A)に小さいほう(B)をくっ付けたい //大小が逆だったらAとBをひっくり返す。 if (size(A) < size(B)) swap(A, B); //Aのサイズを更新する Parent[A] += Parent[B]; //Bの親をAに変更する Parent[B] = A; return true; } }; int main(){ int n; long long x; cin>>n>>x; long long a[n]; REP(i,n){ cin>>a[i]; } long long ans=0; REP(i,n){ if(i==0){ ans += max(a[i]-x,0); }else{ ans += max(a[i-1]+a[i]-x,0); } } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:100:17: error: no matching function for call to 'max(long long int, int)' 100 | ans += max(a[i]-x,0); | ~~~^~~~~~~~~~ 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:100:17: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 100 | ans += max(a[i]-x,0); | ~~~^~~~~~~~~~ /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:100:17: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 100 | ans += max(a[i]-x,0); | ~~~^~~~~~~~~~ a.cc:102:17: error: no matching function for call to 'max(long long int, int)' 102 | ans += max(a[i-1]+a[i]-x,0); | ~~~^~~~~~~~~~~~~~~~~ /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:102:17: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 102 | ans += max(a[i-1]+a[i]-x,0); | ~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:102:17: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 102 | ans += max(a[i-1]+a[i]-x,0); | ~~~^~~~~~~~~~~~~~~~~
s381781931
p03864
C
#include "pch.h" #include <stdio.h> #include <math.h> #include <string.h> #include <stdlib.h> #define ll long long #define fr(i,l,r) for(i=(l);i<(r);i++) #define min(p,q) ((p)<(q)?(p):(q)) #define max(p,q) ((p)>(q)?(p):(q)) #define INF 1000000000000//10^12 int main(void) { //変数の宣言 ll int n,x; ll int a[100010]; //よく使う変数 int i,j,k,l; int flag=0; ll int ans=0; int count=0; int temp,temp1,temp2; int max,min; int len; int sum=0; //データの読み込み scanf("%lld %lld",&n,&x); // scanf_s("%lld %lld",&n,&x); fr(i,0,n){ scanf("%lld",&a[i]); // scanf_s("%lld",&a[i]); } // printf("nは%dです\n", n); // printf("データの読み込み終了\n"); //実際の処理 fr(i,0,n){ if(i==0){ if(a[0]>x){ ans=ans+a[0]-x; a[0]=x; } }else{ if(a[i]+a[i-1]>x){ ans=ans+a[i]+a[i-1]-x; a[i]=x-a[i-1]; } } } // printf("計算部分終了\n"); //出力 printf("%lld",ans); // printf("結果の出力終了\n"); return 0; }
main.c:3:10: fatal error: pch.h: No such file or directory 3 | #include "pch.h" | ^~~~~~~ compilation terminated.
s719805386
p03864
C
#include "pch.h" #include <stdio.h> #include <math.h> #include <string.h> #include <stdlib.h> #define ll long long #define fr(i,l,r) for(i=(l);i<(r);i++) #define min(p,q) ((p)<(q)?(p):(q)) #define max(p,q) ((p)>(q)?(p):(q)) #define INF 1000000000000//10^12 int main(void) { //変数の宣言 ll int n,x; ll int a[100010]; //よく使う変数 int i,j,k,l; int flag=0; ll int ans=0; int count=0; int temp,temp1,temp2; int max,min; int len; int sum=0; //データの読み込み // scanf("%lld %lld",&n,&x); scanf_s("%lld %lld",&n,&x); fr(i,0,n){ // scanf("%lld",&a[i]); scanf_s("%lld",&a[i]); } // printf("nは%dです\n", n); // printf("データの読み込み終了\n"); //実際の処理 fr(i,0,n){ if(i==0){ if(a[0]>x){ ans=ans+a[0]-x; a[0]=x; } }else{ if(a[i]+a[i-1]>x){ ans=ans+a[i]+a[i-1]-x; a[i]=x-a[i-1]; } } } // printf("計算部分終了\n"); //出力 printf("%lld",ans); // printf("結果の出力終了\n"); return 0; }
main.c:3:10: fatal error: pch.h: No such file or directory 3 | #include "pch.h" | ^~~~~~~ compilation terminated.
s733248891
p03864
C++
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int N, x; cin >> N >> x; vector<int> a(N); for (int i = 0; i < N; i++) cin >> a[i]; long long ans = 0, his = 0; for (int i = 0; i < N; i++) { his = min(x - his, a[i]); ans += a[i] - his; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:12:18: error: no matching function for call to 'min(long long int, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)' 12 | his = min(x - his, a[i]); | ~~~^~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, 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:12:18: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}) 12 | his = min(x - his, a[i]); | ~~~^~~~~~~~~~~~~~~ /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 In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:12:18: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 12 | his = min(x - his, a[i]); | ~~~^~~~~~~~~~~~~~~
s377682275
p03864
C++
#include "bits/stdc++.h" using namespace std; #define fst first #define scd second #define int long long int a[100000]; signed main() { int n, x, total = 0; scanf("%d%d", &n, &x); for(int i = 0; i < n; scanf("%d", &a[i++])){} for(int i = 1; i < n; ++i) { if(a[i - 1] + a[i] > x) { total += max(0, a[i - 1] + a[i] - x); a[i] -= max(0, a[i - 1] + a[i] - x); } if(a[i - 1] + a[i] > x) { total += max(0, a[i - 1] + a[i] - x); a[i - 1] -= max(0, a[i - 1] + a[i] - x); } } printf("%lld\n", total); }
a.cc: In function 'int main()': a.cc:16:37: error: no matching function for call to 'max(int, long long int)' 16 | total += max(0, a[i - 1] + a[i] - x); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~ 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:16:37: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 16 | total += max(0, a[i - 1] + a[i] - x); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~ /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:16:37: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 16 | total += max(0, a[i - 1] + a[i] - x); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~ a.cc:17:36: error: no matching function for call to 'max(int, long long int)' 17 | a[i] -= max(0, a[i - 1] + a[i] - x); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~ /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:17:36: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 17 | a[i] -= max(0, a[i - 1] + a[i] - x); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:17:36: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 17 | a[i] -= max(0, a[i - 1] + a[i] - x); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~ a.cc:21:37: error: no matching function for call to 'max(int, long long int)' 21 | total += max(0, a[i - 1] + a[i] - x); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:21:37: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 21 | total += max(0, a[i - 1] + a[i] - x); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:21:37: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 21 | total += max(0, a[i - 1] + a[i] - x); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~ a.cc:22:40: error: no matching function for call to 'max(int, long long int)' 22 | a[i - 1] -= max(0, a[i - 1] + a[i] - x); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~ /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:22:40: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 22 | a[i - 1] -= max(0, a[i - 1] + a[i] - x); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:22:40: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 22 | a[i - 1] -= max(0, a[i - 1] + a[i] - x); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~
s201131522
p03864
C++
#pragma region _head #include<iostream> #include<string> #include<vector> #include<algorithm> #include<cmath> #include<map> #include<set> #include<iomanip> #include<queue> #include<stack> #include<numeric> #include<utility> #include<regex> #pragma region _define #define f(i,a,b) for(int i=a;i<b;i++) #define f_vI(v,n) f(i,0,n)cin>>v[i] #define f_v2I(v1,v2,n) f(i,0,n)cin>>v1[i]>>v2[i] #define f_v3I(v1,v2,v3,n) f(i,0,n)cin>>v1[i]>>v2[i]>>v3[i] #define f_vO(v,n) f(i,0,n)cout<<v[i]<<endl #define all(a) a.begin(),a.end() #define size(s) s.size() #define check() cout<<"! ! !" #define endl "\n" #define _y() cout<<"Yes"<<endl #define _Y() cout<<"YES"<<endl #define _n() cout<<"No"<<endl #define _N() cout<<"NO"<<endl #pragma endregion #pragma region _using using namespace std; using LL = long long; using st = string; using vi = vector<LL>; using vvi = vector<vi>; using vvvi = vector<vvi>; using vc = vector<char>; using vs = vector<st>; using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>; using si = stack<LL>; using ss = stack<st>; using pi = pair<LL, LL>; using v_pi = vector<pi>; #pragma endregion #pragma region _graph #define node 50 //グラフの最大位数 適宜変更 //bool graph[node][node]; bool visited[node] = { false }; #define link(a,b,m) f(i,0,m){cin>>a[i]>>b[i]; a[i]--; b[i]--; graph[a[i]][b[i]]=graph[b[i]][a[i]]=true;} #pragma endregion LL gcd(LL a, LL b) { LL r; while ((r = a % b) != 0) { a = b; b = r; } return b; } LL lcm(LL a, LL b) { return (a / gcd(a, b) * b); } #pragma endregion /*****************************************************************************/ int main(void) { cin.tie(0); ios::sync_with_stdio(false); LL n, x; cin >> n >> x; vi a(n); f_vI(a, n); __int128 ans = 0; f(i, 0, n - 1) { if (a[i] + a[i + 1] > x) { ans += a[i + 1] - (x - a[i]); a[i + 1] = x - a[i]; } } cout << ans; return 0; }
a.cc: In function 'int main()': a.cc:93:14: error: ambiguous overload for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and '__int128') 93 | cout << ans; | ~~~~ ^~ ~~~ | | | | | __int128 | std::ostream {aka std::basic_ostream<char>} In file included from /usr/include/c++/14/iostream:41, from a.cc:3: /usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 174 | operator<<(long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 178 | operator<<(unsigned long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 182 | operator<<(bool __n) | ^~~~~~~~ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]' 96 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 189 | operator<<(unsigned short __n) | ^~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]' 110 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 200 | operator<<(unsigned int __n) | ^~~~~~~~ /usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 211 | operator<<(long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 215 | operator<<(unsigned long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 231 | operator<<(double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 235 | operator<<(float __f) | ^~~~~~~~ /usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 243 | operator<<(long double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:573:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char) [with _CharT = char; _Traits = char_traits<char>]' 573 | operator<<(basic_ostream<_CharT, _Traits>& __out, char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:579:5: note: candidate: 'std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char) [with _Traits = char_traits<char>]' 579 | operator<<(basic_ostream<char, _Traits>& __out, char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:590:5: note: candidate: 'std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char) [with _Traits = char_traits<char>]' 590 | operator<<(basic_ostream<char, _Traits>& __out, signed char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:595:5: note: candidate: 'std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char) [with _Traits = char_traits<char>]' 595 | operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c) | ^~~~~~~~
s214192750
p03864
C++
// ConsoleApplication9.cpp : アプリケーションのエントリ ポイントを定義します。 // #include<iostream> #include<string> #include<algorithm> #include<vector> #include<queue> #include<map> #include<math.h> #include<iomanip> #include<set> #include<numeric> #include<cstring> #include<cstdio> #include<functional> #define REP(i, n) for(int i = 0;i < n;i++) #define REPR(i, n) for(int i = n;i >= 0;i--) #define FOR(i, m, n) for(int i = m;i < n;i++) #define FORR(i, m, n) for(int i = m;i >= n;i--) #define SORT(v, n) sort(v, v+n); #define VSORT(v) sort(v.begin(), v.end()); #define REVERSE(v,n) reverse(v,v+n); #define VREVERSE(v) reverse(v.begin(), v.end()); #define ll long long #define pb(a) push_back(a) #define INF 9999999999 #define m0(x) memset(x,0,sizeof(x)) #define fill(x,y) memset(x,y,sizeof(x)) #define p(x) cout<<x<<endl; #define pe(x) cout<<x<<" "; #define lb(v,n) lower_bound(v.begin(), v.end(), n); #define int long long using namespace std; int dy[4] = { 0,0,1,-1 }; int dx[4] = { 1,-1,0,0 }; int dxx[8] = { 0,0,1,1,1,-1,-1,-1 }; int dyy[8] = { 1,-1,0,1,-1,0,1,-1 }; ll gcd(ll x, ll y) { ll m = max(x, y), n = min(x, y); if (m%n == 0)return n; else return gcd(m%n, n); } ll lcm(ll x, ll y) { return x / gcd(x, y)*y; } ll myPow(ll x, ll n, ll m) { if (n == 0) return 1; if (n % 2 == 0) return myPow(x * x % m, n / 2, m); else return x * myPow(x, n - 1, m) % m; } ll pow2(ll a, ll n) {//aのn乗を計算します。 ll x = 1; while (n > 0) {//全てのbitが捨てられるまで。 if (n & 1) {//1番右のbitが1のとき。 x = x * a; } a = a * a; n >>= 1;//bit全体を右に1つシフトして一番右を捨てる。 } return x; } long long nCr(int n, int r) { if (r > n / 2) r = n - r; // because C(n, r) == C(n, n - r) long long ans = 1; int i; for (i = 1; i <= r; i++) { ans *= n - r + i; ans /= i; } return ans; } const int MAX = 510000; const int MOD = 1000000007; 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; } bool arr[100000100]; vector<ll>sosuu; void Eratosthenes() { ll N = 10000010; int c = 0; for (int i = 0; i < N; i++) { arr[i] = 1; } for (ll i = 2; i < sqrt(N); i++) { if (arr[i]) { for (ll j = 0; i * (j + 2) < N; j++) { arr[i *(j + 2)] = 0; } } } for (int ll i = 2; i < N; i++) { if (arr[i]) { sosuu.pb(i); //cout << sosuu[c] << " "; c++; } } //cout << endl; //cout << c << endl; } ll stoL(string s) { ll n = s.length(); ll ans = 0; for (int i = 0; i < n; i++) { ans += pow2(10, n - i-1)*(ll)(s[i]-'0'); } return ans; } int a[100010], sum[100010]; signed main() { int N, x; cin >> N >> x; REP(i, N) { cin >> a[i]; } sum[0] = a[0]; sum[N] = a[N - 1]; FOR(i,1, N ) { sum[i] = a[i-1] + a[i]; } //REP(i, N + 1)pe(sum[i]); ll ans = 0; FOR(i, 1, N) { if (sum[i] > x) { if (sum[i - 1] > sum[i + 1]) { ans += sum[i] - x; sum[i - 1] -= (sum[i] - x); sum[i] -= (sum[i] - x); } else { ans += sum[i] - x; sum[i + 1] -= (sum[i] - x); sum[i] -= (sum[i] - x); } } } p(ans); }
a.cc: In function 'void Eratosthenes()': a.cc:27:12: error: 'long long long' is too long for GCC 27 | #define ll long long | ^~~~ a.cc:132:18: note: in expansion of macro 'll' 132 | for (int ll i = 2; i < N; i++) { | ^~ a.cc:27:17: error: 'long long long' is too long for GCC 27 | #define ll long long | ^~~~ a.cc:132:18: note: in expansion of macro 'll' 132 | for (int ll i = 2; i < N; i++) { | ^~
s799095704
p03864
C++
// #include <bits/stdc++.h> #include <map> #include <set> #include <ctime> #include <cstring> #include <queue> #include <iostream> #include <algorithm> using namespace std; #define mod 1000000009 #define INF 1000000000 #define ll long long #define dbl double #define ull unsigned ll #define vi vector<int> #define vll vector<ll> #define vvi vector<vi> #define vvvll vector<vector<vector<ll>>> #define REP(i, n) for (int i = 0; i < (int)n; ++i) #define all(x) begin(x), end(x) #define contains(a, x) (a.find(x) != end(a)) #define F(i,a,b) for(int i = (int)(a); i < (int)(b); ++i) #define RF(i,a,b)for(int i = (int)(a); i >= (int)(b); --i) #define fast() {ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);} #define log(x) cout << (x) << endl; int main() { fast(); int n, x; cin >> n >> x; vi a(n); REP (i,n) cin>>a[i]; a[i] = min(a[i], x); ll c = max(a[i]-x, 0); for (int i=0; i<n-1; i+=1) { if (a[i]+a[i+1] > x) { c += (a[i] + a[i+1]) - x; a[i+1] = x - a[i]; } } log(c); return 0; }
a.cc: In function 'int main()': a.cc:38:11: error: 'i' was not declared in this scope 38 | a[i] = min(a[i], x); | ^
s060250743
p03864
C++
// #include <bits/stdc++.h> #include <map> #include <set> #include <ctime> #include <cstring> #include <queue> #include <iostream> #include <algorithm> using namespace std; #define mod 1000000009 #define INF 1000000000 #define ll long long #define dbl double #define ull unsigned ll #define vi vector<int> #define vll vector<ll> #define vvi vector<vi> #define vvvll vector<vector<vector<ll>>> #define REP(i, n) for (int i = 0; i < (int)n; ++i) #define all(x) begin(x), end(x) #define contains(a, x) (a.find(x) != end(a)) #define F(i,a,b) for(int i = (int)(a); i < (int)(b); ++i) #define RF(i,a,b)for(int i = (int)(a); i >= (int)(b); --i) #define fast() {ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);} #define log(x) cout << (x) << endl; int main() { fast(); int n, x; cin >> n >> x; vi a(n); REP (i,n) cin>>a[i]; a[i] = min(a[i], x); int c = max(a[i]-x, 0); for (int i=0; i<n-1; i+=1) { if (a[i]+a[i+1] > x) { c += (a[i] + a[i+1]) - x; a[i+1] = x - a[i]; } } log(c); return 0; }
a.cc: In function 'int main()': a.cc:38:11: error: 'i' was not declared in this scope 38 | a[i] = min(a[i], x); | ^
s440790580
p03864
C++
#include <iostream> #include <algorithm> typedef long long ll; using namespace std; int main() { ll n, x, cnt = 0, prev = 0, now; cin >> n >> x; for (ll i = 0; i < n; ++i) { cin >> now; cnt += max(prev + now - x, 0); prev = now - max(prev + now - x, 0); } cout << cnt << endl; return 0; }
a.cc: In function 'int main()': a.cc:13:19: error: no matching function for call to 'max(ll, int)' 13 | cnt += max(prev + now - x, 0); | ~~~^~~~~~~~~~~~~~~~~~~ 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:13:19: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 13 | cnt += max(prev + now - x, 0); | ~~~^~~~~~~~~~~~~~~~~~~ /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:13:19: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 13 | cnt += max(prev + now - x, 0); | ~~~^~~~~~~~~~~~~~~~~~~ a.cc:14:25: error: no matching function for call to 'max(ll, int)' 14 | prev = now - max(prev + now - x, 0); | ~~~^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:14:25: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 14 | prev = now - max(prev + now - x, 0); | ~~~^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:14:25: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 14 | prev = now - max(prev + now - x, 0); | ~~~^~~~~~~~~~~~~~~~~~~
s724444677
p03864
C++
include<stdio.h> int main(void){ long N,x; long a[100000]; long i; long eat; long sum,o; scanf("%d %d",&N,&x); for(i=0;i<N;i++){ scanf("%d",&a[i]); } for(i=0;i<N-1;i++){ sum=a[i]+a[i+1]; o=sum-x; if(o>0){ eat+=o; if(a[i+1]>o){ a[i+1]-=o; } else{ a[i+1]=0; } } } printf("%d\n",eat); return 0; }
a.cc:1:1: error: 'include' does not name a type 1 | include<stdio.h> | ^~~~~~~
s178649637
p03864
C++
#include <iostream> #include <cmath> #include <string> #include <vector> #include <algorithm> using namespace std; typedef long long ll; int main() { ll n,x,ans=0; cin >> n >> x; ll a[n+2]; for(ll i=1;i<=n;i++) cin >> a[i]; a[0]=0; a[n+1]=0; for(ll i=0;i<=n;i++){ ll cur=max(0,a[i+1]+a[i]-x); ans += cur; a[i+1] -= cur; } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:17:19: error: no matching function for call to 'max(int, ll)' 17 | ll cur=max(0,a[i+1]+a[i]-x); | ~~~^~~~~~~~~~~~~~~~~ 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:17:19: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'}) 17 | ll cur=max(0,a[i+1]+a[i]-x); | ~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:5: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:17:19: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 17 | ll cur=max(0,a[i+1]+a[i]-x); | ~~~^~~~~~~~~~~~~~~~~
s423048046
p03864
C++
#include<stdio.h> #include<iostream> using namespace std; int N,x; int main(){ cin >> N >> x; long long int pre = 0; long long int ans = 0; cin >> pre; for(int i=1; i<N; i++){ long long int eat=0; long long int y; cin >> y; if ( pre + y > x ) { eat = pre + y - x; ans += eat; } pre = max( y - eat,0); } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:20:18: error: no matching function for call to 'max(long long int, int)' 20 | pre = max( y - eat,0); | ~~~^~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:2: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:20:18: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 20 | pre = max( y - eat,0); | ~~~^~~~~~~~~~~~ /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
s595363655
p03864
C++
#include <iostream> #include <algorithm> #include <vector> #include <map> #include <string> #include <cmath> #include <iomanip> #include <numeric> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define REP(i, n) FOR(i, 0, n) #define SORT(c) sort((c).begin(), (c).end()) #define INF (ll)1e18 #define MOD (ll)1e9 + 7 typedef long long ll; typedef pair<int, int> P; typedef vector<int> V; typedef map<int, int> M; int main() { ll n, x, a1, a2; ll ans; cin >> n >> x; ans = 0; cin >> a1; FOR(i, 1, n) { cin >> a2; if (a1 + a2 > x) { ans += (a1 + a2 - x); a2 -= max(0, (a1 + a2 - x)); } a1 = a2; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:39:22: error: no matching function for call to 'max(int, ll)' 39 | a2 -= max(0, (a1 + a2 - x)); | ~~~^~~~~~~~~~~~~~~~~~ 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:39:22: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'}) 39 | a2 -= max(0, (a1 + a2 - x)); | ~~~^~~~~~~~~~~~~~~~~~ /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:39:22: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 39 | a2 -= max(0, (a1 + a2 - x)); | ~~~^~~~~~~~~~~~~~~~~~
s245875128
p03864
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n; long long x; cin>>n>>x; long long a[n],sum=0; for(int i=0;i<n;i++){ cin>>a[i]; } long long qb=a[n-1]+a[n-2]-x; if(qb>0){ sum+=qb; if(qb<=a[n-2]){ a[n-2]-=qb; }else{ qb-=a[n-2]; a[n-2]=0; a[n-1]-=qb; } } for(int i=1;i<n-1;i++){ long long nor=(a[i]+a[i-1])-x; if(nor>0){ sum+=nor; if(nor<=a[i]){ a[i]-=nor; }else{ nor-=a[i]; a[i]=0; a[i-1]-=nor; } } } cout<<sum<<endl; return(0); } #include<bits/stdc++.h> using namespace std; int main(){ int n; long long x; cin>>n>>x; long long a[n],sum=0; for(int i=0;i<n;i++){ cin>>a[i]; } long long qb=a[n-1]+a[n-2]-x; if(qb>0){ sum+=qb; if(qb<=a[n-2]){ a[n-2]-=qb; }else{ qb-=a[n-2]; a[n-2]=0; a[n-1]-=qb; } } for(int i=1;i<n-1;i++){ long long nor=(a[i]+a[i-1])-x; if(nor>0){ sum+=nor; if(nor<=a[i]){ a[i]-=nor; }else{ nor-=a[i]; a[i]=0; a[i-1]-=nor; } } } cout<<sum<<endl; return(0); }
a.cc:41:5: error: redefinition of 'int main()' 41 | int main(){ | ^~~~ a.cc:3:5: note: 'int main()' previously defined here 3 | int main(){ | ^~~~
s888010616
p03864
C++
#include<cstdio> #include<queue> #include<utility> #include<cstring> #include<stack> #include<algorithm> #include<cmath> #include<iostream> #include<map> #define MAX_N 100001 #define INF_INT 2147483647 #define INF_LL 9223372036854775807 #define REP(i,n) for(int i=0;i<(int)(n);i++) using namespace std; typedef long long int ll; typedef pair<ll,ll> P; void init(int n); int find(int n); void unite(int x,int y); bool same(int x, int y); ll bpow(ll,ll,ll); typedef vector<int> vec; typedef vector<vec> mat; mat mul(mat &A,mat &B); mat pow(mat A,ll n); int dx[4] = {1,0,0,-1}; int dy[4] = {0,1,-1,0}; bool cmp_P(const P &a,const P &b){ return a.second < b.second; } int main() { ll N,a[100001],cnt=0,tmp=0,t,x,b[100001]; cin >> N >> x; REP(i,N)cin >> a[i]; REP(i,N-1){ if(a[i] + a[i+1] > x){ t = a[i+1]; a[i+1] = max(x-a[i],0); tmp += t - a[i+1]; } } if((a[0] + a[1]) > x){ t = a[0]; a[0] = max(x-a[1],0); tmp += t - a[0]; } cout << tmp << endl; return 0; } int par[MAX_N]; int ranks[MAX_N]; //n要素で初期化 void init(int n){ REP(i,n){ par[i] = i; ranks[i] = 0; } } //木の根を求める int find(int x){ if(par[x] == x){ return x; }else{ return par[x] = find(par[x]); } } void unite(int x,int y){ x = find(x); y = find(y); if(x == y) return ; if(ranks[x] < ranks[y]){ par[x] = y; }else{ par[y] = x; if(ranks[x] == ranks[y]) ranks[x]++; } } bool same(int x, int y){ return find(x) == find(y); } ll bpow(ll a, ll n,ll mod){ int i = 0; ll res=1; while(n){ if(n & 1) res = (res*a) % mod; a = (a*a) % mod; n >>= 1; } return res; } const int MOD = 1000000007; mat mul(mat &A, mat &B){ mat C(A.size(),vec(B[0].size())); REP(i,A.size())REP(k,B.size())REP(j,B[0].size()){ C[i][j] = (C[i][j] + A[i][k] * B[k][j]) % MOD; } return C; } mat pow(mat A,ll n) { mat B(A.size(),vec(A.size())); REP(i,A.size()){ B[i][i] = 1; } while(n > 0){ if ( n & 1) B = mul(B,A); A = mul(A,A); n >>= 1; } return B; }
a.cc: In function 'int main()': a.cc:41:19: error: no matching function for call to 'max(ll, int)' 41 | a[i+1] = max(x-a[i],0); | ~~~^~~~~~~~~~ In file included from /usr/include/c++/14/deque:62, from /usr/include/c++/14/queue:62, from a.cc:2: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:41:19: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 41 | a[i+1] = max(x-a[i],0); | ~~~^~~~~~~~~~ /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:6: /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:41:19: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 41 | a[i+1] = max(x-a[i],0); | ~~~^~~~~~~~~~ a.cc:47:15: error: no matching function for call to 'max(ll, int)' 47 | a[0] = max(x-a[1],0); | ~~~^~~~~~~~~~ /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:47:15: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 47 | a[0] = max(x-a[1],0); | ~~~^~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:47:15: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 47 | a[0] = max(x-a[1],0); | ~~~^~~~~~~~~~
s542444688
p03864
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<ll> vl; typedef pair<int,int> P; typedef pair<ll,ll> PL; #define INF 1<<30 #define LINF 1ll<<60ll #define MOD 1000000007 #define pb(a) push_back(a) #define _overload3(_1,_2,_3,name,...) name #define _rep(i,n) _repi(i,0,n) #define _repi(i,a,b) for(int i=a, i##_len=(b); i<i##_len; ++i) #define REP(...) _overload3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__) #define REPR(i, n) for(int i = n;i >= 0;--i) #define REPARR(i, v) for(int i = 0;i < sz(v);++i) #define all(vec) (vec.begin()),(vec.end()) #define sz(x) ((int)(x).size()) #define bit(n) (1ll<<(n)) template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;} template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;} #define YES(n) cout<<((n)?"YES":"NO")<<endl #define Yes(n) cout<<((n)?"Yes":"No")<<endl #define yes(n) cout<<((n)?"yes":"no")<<endl #define poss(n) cout<<((n)?"possible":"impossible")<<endl #define Poss(n) cout<<((n)?"Possible":"Impossible")<<endl int main(){ int n,x; cin>>n>>x; vi a(n); REP(i,n){ cin>>a[i]; } if (a[0] > x) { ans += a[0] - x; a[0] = x; } ll ans=0; REP(i,n-1){ if(a[i]+a[i+1]>x){ ans+=(a[i]+a[i+1]-x); a[i+1]=x-a[i]; } } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:48:8: error: 'ans' was not declared in this scope; did you mean 'abs'? 48 | ans += a[0] - x; | ^~~ | abs
s466445984
p03864
C++
#include "bits/stdc++.h" using namespace std; using ll = long long; int main () { cin.tie(0); cin.sync_with_stdio(0); int n, m; cin >> n >> m; vector<int> a(n); for(int& x : ) cin >> x; ll ans = 0; for(int i = 1; i < n; ++i) { if(a[i-1] + a[i] >= m) { int take = a[i-1] + a[i] - m; int take_i = min(take, a[i]); take -= take_i; int take_i_1 = min(take, a[i-1]); take -= take_i_1; a[i] -= take_i; a[i-1] -= take_i_1; ans += take_i + take_i_1; } } cout << ans << flush; }
a.cc: In function 'int main()': a.cc:12:22: error: expected primary-expression before ')' token 12 | for(int& x : ) cin >> x; | ^
s769431867
p03864
C++
#include "bits/stdc++.h" using namespace std; using ll = long long; int main () { cin.tie(0); cin.sync_with_stdio(0); int n, m; cin >> n >> m; vector<int> a(n); for(int& x : ) cin >> x; ll ans = 0; for(int i = 1; i < n; ++i) { if(a[i-1] + a[i] >= m) { int take = a[i-1] + a[i] - m; int take_i = min(take, a[i]) take -= take_i; int take_i_1 = min(take, a[i-1]) take -= take_i_1; a[i] -= take_i; a[i-1] -= take_i_1; ans += take_i + take_i_1; } } cout << ans << flush; }
a.cc: In function 'int main()': a.cc:12:22: error: expected primary-expression before ')' token 12 | for(int& x : ) cin >> x; | ^ a.cc:18:25: error: expected ',' or ';' before 'take' 18 | take -= take_i; | ^~~~ a.cc:20:25: error: expected ',' or ';' before 'take' 20 | take -= take_i_1; | ^~~~
s525094331
p03864
C++
#include <algorithm> #include <cassert> // #include <chrono> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <map> #include <memory> #include <queue> // #include <random> #include <set> #include <stack> #include <string> #include <utility> #include <vector> /* unsigned seed1 = std::chrono::system_clock::now().time_since_epoch().count(); mt19937 g1.seed(seed1); */ using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> pii; typedef pair<pii, pii> ppiipii; typedef pair<int, ppiipii> pippiipii; typedef pair<int, pii> pipii; typedef pair<pii, int> ppiii; typedef pair<int, ppiii> pippiii; typedef pair<int, ll> pill; typedef pair<int, double> pid; // note to self, the below two triggers someone typedef pair<ll, ll> pll; typedef pair<ll, int> plli; typedef long double ld; int l[1000000]; int main() { int n, t; scanf("%d %d", &n, &t); ll ret = 0; for(int i = 0; i < n; i++) scanf("%d", &l[i]); for(int i = 1; i < n; i++) { if(l[i-1] + l[i] > x) { ret += l[i-1] + l[i] - x; l[i] = x - l[i-1]; } } printf("%lld\n", ret); }
a.cc: In function 'int main()': a.cc:50:24: error: 'x' was not declared in this scope 50 | if(l[i-1] + l[i] > x) { | ^
s135044257
p03864
C++
#include <bits/stdc++.h> #define int long long using namespace std; signed main() { int N,X; cin>>N>>X; int ans=0; std::vector<int> v(N); for(int i=0;i<N;i++)cin>>v[i]; for(int i=1;i<N;i++){ if(v[i-1]+v[i]>X){ ans+=v[i-1]+v[i]-X; v[i]=max(0,X-v[i-1]); } } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:14:33: error: no matching function for call to 'max(int, long long int)' 14 | v[i]=max(0,X-v[i-1]); | ~~~^~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:14:33: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 14 | v[i]=max(0,X-v[i-1]); | ~~~^~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:14:33: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 14 | v[i]=max(0,X-v[i-1]); | ~~~^~~~~~~~~~~~
s046782339
p03864
C++
#include<bits/stdc++.h> using namespace std; #define ll long long #define llu unsigned long long #define ld double #define llu unsigned long long #define rep(i,x,y) for(ll i=(ll)(x);i<(ll)(y);++i) #define For(i,x,y) for(ll i=(ll)(x);i<=(ll)(y);++i) #define FOr(i,x,y) for(ll i=(ll)(x);i>=(ll)(y);--i) #define pi acos(-1) #define mk make_pair #define pa pair<ll,ll> #define lf else if #define IL inline #define max(x,y) ((x)<(y)?(y):(x)) #define min(x,y) ((x)<(y)?(x):(y)) #define sqr(x) ((x)*(x)) #define Mul(x,y) ((x)=1LL*(x)*(y)%mod) #define Add(x,y) ((x)=((x)+(y))%mod) #define E(x) return writeln(x),0 #define LL (long long) #define p(x) printf("~%lld~\n",LL(x)) #define pp(x,y) printf("~~%lld %lld~~\n",LL(x),LL(y)) #define ppp(x,y,z) printf("~~~%lld %lld %lld~~~\n",LL(x),LL(y),LL(z)) #define pppp(a,b,c,d) printf("~~~%lld %lld %lld %lld\n",LL(a),LL(b),LL(c),LL(d)) #define f_in(x) freopen(x".in","r",stdin) #define f_out(x) freopen(x".out","w",stdout) #define open(x) f_in(x),f_out(x) #define fi first #define se second #define GuYue puts("\nGuYueNa________________________________________________________________________________") #define y1 fafa____ typedef complex<double> E; namespace SHENZHEBEI{ #ifdef LOCAL struct _{_(){freopen("cf.in","r",stdin);}}_; #endif #define NEG 1 static const int GYN=2333333; char SZB[GYN],*S=SZB,*T=SZB; inline char gc(){ if (S==T){ T=(S=SZB)+fread(SZB,1,GYN,stdin); if (S==T) return '\n'; } return *S++; } #if NEG inline ll read(){ ll x=0,g=1; char ch=gc(); for (;!isdigit(ch);ch=gc()) if (ch=='-') g=-1; for (;isdigit(ch);ch=gc()) x=x*10-48+ch; return x*g; } inline void write(ll x){ if (x<0) putchar('-'),x=-x; if (x>=10) write(x/10); putchar(x%10+'0'); } #else inline ll read(){ ll x=0; char ch=gc(); for (;!isdigit(ch);ch=gc()); for (;isdigit(ch);ch=gc()) x=x*10-48+ch; return x; } inline void write(ll x){ if (x>=10) write(x/10); putchar(x%10+'0'); } #endif inline char readchar(){ char ch=gc(); for(;isspace(ch);ch=gc()); return ch; } inline ll readstr(char *s){ char ch=gc(); int cur=0; for(;isspace(ch);ch=gc()); for(;!isspace(ch);ch=gc()) s[cur++]=ch; s[cur]='\0'; return cur; } void Print(long long *a,int s,int t){For(i,s,t)printf("%lld ",a[i]);puts("");} void Print(int *a,int s,int t){For(i,s,t)printf("%d ",a[i]);puts("");} void Print(char *a,int s,int t){For(i,s,t)putchar(a[i]);puts("");} void writeln(ll x){write(x);putchar('\n');} }using namespace SHENZHEBEI; const ll N=100010; int main(){ n=read(),k=read(); }
a.cc: In function 'int main()': a.cc:58:9: error: 'n' was not declared in this scope 58 | n=read(),k=read(); | ^ a.cc:58:18: error: 'k' was not declared in this scope 58 | n=read(),k=read(); | ^
s680645527
p03864
C++
#include <bits/stdc++.h> using namespace std; const int maxn=1e3+10; const double inf=1.0*(2e9+7); const long long double dll; struct node{ int x,y,r; }cir[maxn]; dll calc(node a,node b){ return max(0.0,sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y))-a.r-b.r); } dll mat[maxn][maxn]; dll dis[maxn]; int sx,sy,ex,ey,n; bool vis[maxn]; void Dijkstra(){ int a=0; int p; dll mi; memset(vis,0,sizeof(vis)); for(int i = 0; i <= n; i++) dis[i] = mat[a][i]; dis[a] = 0; vis[a] = 1; for(int i = 0; i <= n; i++){ mi = inf; for(int j = 0; j <= n; j++){ if(dis[j]<mi && !vis[j]){ p = j; mi = dis[j]; } } if(mi==inf) break; vis[p] = 1; for(int j=0; j <= n; j++){ if(dis[p]+mat[p][j] < dis[j] && !vis[j]) dis[j]=dis[p]+mat[p][j]; } } } int main(){ scanf("%d%d%d%d",&sx,&sy,&ex,&ey); cir[0].x=sx,cir[0].y=sy,cir[0].r=0; scanf("%d",&n); for (int i=1;i<=n;i++){ scanf("%d%d%d",&cir[i].x,&cir[i].y,&cir[i].r); } n++; cir[n].x=ex,cir[n].y=ey,cir[n].r=0; for (int i=0;i<=n;i++){ for (int j=0;j<=n;j++) mat[i][j]=inf; } for (int i=0;i<=n;i++){ for (int j=0;j<=n;j++){ mat[i][j]=calc(cir[i],cir[j]); } } Dijkstra(); // for (int i=0;i<=n;i++){ // printf("%d %lf\n",i,dis[i]); // } printf("%.9f\n",dis[n]); return 0; }
a.cc:5:12: error: 'long long' specified with 'double' 5 | const long long double dll; | ^~~~ a.cc:5:24: error: uninitialized 'const dll' [-fpermissive] 5 | const long long double dll; | ^~~ a.cc:9:1: error: 'dll' does not name a type 9 | dll calc(node a,node b){ | ^~~ a.cc:12:1: error: 'dll' does not name a type 12 | dll mat[maxn][maxn]; | ^~~ a.cc:13:1: error: 'dll' does not name a type 13 | dll dis[maxn]; | ^~~ a.cc: In function 'void Dijkstra()': a.cc:19:7: error: expected ';' before 'mi' 19 | dll mi; | ^~~ | ; a.cc:22:9: error: 'dis' was not declared in this scope; did you mean 'vis'? 22 | dis[i] = mat[a][i]; | ^~~ | vis a.cc:22:18: error: 'mat' was not declared in this scope 22 | dis[i] = mat[a][i]; | ^~~ a.cc:23:5: error: 'dis' was not declared in this scope; did you mean 'vis'? 23 | dis[a] = 0; | ^~~ | vis a.cc:26:9: error: 'mi' was not declared in this scope; did you mean 'i'? 26 | mi = inf; | ^~ | i a.cc:37:23: error: 'mat' was not declared in this scope 37 | if(dis[p]+mat[p][j] < dis[j] && !vis[j]) | ^~~ a.cc: In function 'int main()': a.cc:53:13: error: 'mat' was not declared in this scope 53 | mat[i][j]=inf; | ^~~ a.cc:57:13: error: 'mat' was not declared in this scope 57 | mat[i][j]=calc(cir[i],cir[j]); | ^~~ a.cc:57:23: error: 'calc' was not declared in this scope 57 | mat[i][j]=calc(cir[i],cir[j]); | ^~~~ a.cc:64:21: error: 'dis' was not declared in this scope; did you mean 'vis'? 64 | printf("%.9f\n",dis[n]); | ^~~ | vis
s855597360
p03864
C++
#include <iostream> #include <algorithm> using namespace std; int main(){ int n, x; cin >> n >> x; int a[n]; for(int i=0; i<n; i++) cin >> a[i]; int ans=0; for(int i=1; i<n; i++){ long sum = a[i-1]+a[i]; if(sum > x){ a[i] -= min(a[i], sum-x); } } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:13:18: error: no matching function for call to 'min(int&, long int)' 13 | a[i] -= min(a[i], sum-x); | ~~~^~~~~~~~~~~~~ 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:13:18: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long int') 13 | a[i] -= min(a[i], sum-x); | ~~~^~~~~~~~~~~~~ /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 In file included from /usr/include/c++/14/algorithm:61, from a.cc:2: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:13:18: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 13 | a[i] -= min(a[i], sum-x); | ~~~^~~~~~~~~~~~~
s620552696
p03864
C++
#include<bits/stdc++.h> using namespace std; #define int long long int main(){ int n,x,ans=0; int a[100009]; cin>>n>>x; for(int i=0;i<n;i++)cin>>a[i]; for(int i=0;i<n-1;i++){ if(a[i]+a[i+1]>x){ int temp=a[i]+a[i+1]-x; ans+=temp; a[i+1]-=temp; if(a[i+1]<0)a[i+1]=0; } } cout<<ans<<endl; return(0); }
cc1plus: error: '::main' must return 'int'
s124083785
p03864
C++
#include <iostream> #include <set> #include <vector> #include <algorithm> #include <string> #define REP(i,n) for(int i=0;i<(n);i++) using namespace std; int main(){ long long int n,x; long long int a[100100]; cin>>n>>x; REP(i,n)cin>>a[i]; long long int ans=0; for(int i=1;i<n;i++){ if(a[i]+a[i-1]>x){ ans+=(a[i]+a[i-1]-x); a[i]=max(0,x-a[i-1]); } } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:17:15: error: no matching function for call to 'max(int, long long int)' 17 | a[i]=max(0,x-a[i-1]); | ~~~^~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:17:15: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 17 | a[i]=max(0,x-a[i-1]); | ~~~^~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:4: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:17:15: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 17 | a[i]=max(0,x-a[i-1]); | ~~~^~~~~~~~~~~~
s151491570
p03864
C++
#include<iostream> using namespace std; int main(){ int n; cin >> n; long x; cin >> x; long a[n]; for(int i = 0;i < n;i++){ cin >> a[i]; } long y = 0; long ans = 0; for(int i = 0;i < n;i++){ if(x < a[i] + y){ ans += a[i] + y - x; y = x - y } else{ y = a[i]; } } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:19:22: error: expected ';' before '}' token 19 | y = x - y | ^ | ; 20 | } | ~
s594920537
p03864
C++
#include <stdio.h> #include <iostream> using namespace std; int main(){ int n,x; int a[100010]; cin>>n>x; for(int i=0;i<n;i++) cin>>a[i]; long long ans=0ll; for(int i=0;i<n-1;i++){ if(a[i]+a[i+1]>x){ if(a[i]>x){ a[i+1]=0; ans+=x; } else{ a[i+1]=x-a[i]; ans+=(a[i]+a[i+1]-x); } } } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:9:11: error: no match for 'operator>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'int') 9 | cin>>n>x; | ~~~~~~^~ | | | | | int | std::basic_istream<char>::__istream_type {aka std::basic_istream<char>} a.cc:9:11: note: candidate: 'operator>(int, int)' (built-in) 9 | cin>>n>x; | ~~~~~~^~ a.cc:9:11: note: no known conversion for argument 1 from 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'int' In file included from /usr/include/c++/14/string:48, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:2: /usr/include/c++/14/bits/stl_iterator.h:462:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 462 | operator>(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:462:5: note: template argument deduction/substitution failed: a.cc:9:12: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 9 | cin>>n>x; | ^ /usr/include/c++/14/bits/stl_iterator.h:507:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 507 | operator>(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:507:5: note: template argument deduction/substitution failed: a.cc:9:12: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 9 | cin>>n>x; | ^ /usr/include/c++/14/bits/stl_iterator.h:1714:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1714 | operator>(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1714:5: note: template argument deduction/substitution failed: a.cc:9:12: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 9 | cin>>n>x; | ^ /usr/include/c++/14/bits/stl_iterator.h:1774:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1774 | operator>(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1774:5: note: template argument deduction/substitution failed: a.cc:9:12: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 9 | cin>>n>x; | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h:1058:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1058 | operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1058:5: note: template argument deduction/substitution failed: a.cc:9:12: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::pair<_T1, _T2>' 9 | cin>>n>x; | ^ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:695:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 695 | operator> (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:695:5: note: template argument deduction/substitution failed: a.cc:9:12: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 9 | cin>>n>x; | ^ /usr/include/c++/14/string_view:702:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 702 | operator> (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:702:5: note: template argument deduction/substitution failed: a.cc:9:12: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 9 | cin>>n>x; | ^ /usr/include/c++/14/string_view:710:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 710 | operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:710:5: note: template argument deduction/substitution failed: a.cc:9:12: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int' 9 | cin>>n>x; | ^ /usr/include/c++/14/bits/basic_string.h:3915:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3915 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3915:5: note: template argument deduction/substitution failed: a.cc:9:12: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 9 | cin>>n>x; | ^ /usr/include/c++/14/bits/basic_string.h:3929:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3929 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3929:5: note: template argument deduction/substitution failed: a.cc:9:12: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 9 | cin>>n>x; | ^ /usr/include/c++/14/bits/basic_string.h:3942:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3942 | operator>(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3942:5: note: template argument deduction/substitution failed: a.cc:9:12: note: mismatched types 'const _CharT*' and 'std::basic_istream<char>' 9 | cin>>n>x; | ^ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2619:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator>(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2619 | operator>(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2619:5: note: template argument deduction/substitution failed: a.cc:9:12: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::tuple<_UTypes ...>' 9 | cin>>n>x; | ^
s130675424
p03864
C++
#include <stdio.h> #include <iostream> using namespace std; int main(){ int n,x; int a[100010]; cin>>n>x; for(int i=0;i<n;i++) cin>>a[i]; long long ans=0ll; for(int i=0;i<n-1;i++){ if(a[i]+a[i+1]>x){ if(a[i]>x){ a[i+1]=0; ans+=x; } else{ a[i+1]=x-a[i]; ans+=(a[i]+a[i+1]-x); } } } out<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:9:11: error: no match for 'operator>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'int') 9 | cin>>n>x; | ~~~~~~^~ | | | | | int | std::basic_istream<char>::__istream_type {aka std::basic_istream<char>} a.cc:9:11: note: candidate: 'operator>(int, int)' (built-in) 9 | cin>>n>x; | ~~~~~~^~ a.cc:9:11: note: no known conversion for argument 1 from 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'int' In file included from /usr/include/c++/14/string:48, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:2: /usr/include/c++/14/bits/stl_iterator.h:462:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 462 | operator>(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:462:5: note: template argument deduction/substitution failed: a.cc:9:12: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 9 | cin>>n>x; | ^ /usr/include/c++/14/bits/stl_iterator.h:507:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 507 | operator>(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:507:5: note: template argument deduction/substitution failed: a.cc:9:12: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 9 | cin>>n>x; | ^ /usr/include/c++/14/bits/stl_iterator.h:1714:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1714 | operator>(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1714:5: note: template argument deduction/substitution failed: a.cc:9:12: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 9 | cin>>n>x; | ^ /usr/include/c++/14/bits/stl_iterator.h:1774:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1774 | operator>(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1774:5: note: template argument deduction/substitution failed: a.cc:9:12: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 9 | cin>>n>x; | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h:1058:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1058 | operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1058:5: note: template argument deduction/substitution failed: a.cc:9:12: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::pair<_T1, _T2>' 9 | cin>>n>x; | ^ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:695:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 695 | operator> (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:695:5: note: template argument deduction/substitution failed: a.cc:9:12: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 9 | cin>>n>x; | ^ /usr/include/c++/14/string_view:702:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 702 | operator> (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:702:5: note: template argument deduction/substitution failed: a.cc:9:12: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 9 | cin>>n>x; | ^ /usr/include/c++/14/string_view:710:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 710 | operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:710:5: note: template argument deduction/substitution failed: a.cc:9:12: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int' 9 | cin>>n>x; | ^ /usr/include/c++/14/bits/basic_string.h:3915:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3915 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3915:5: note: template argument deduction/substitution failed: a.cc:9:12: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 9 | cin>>n>x; | ^ /usr/include/c++/14/bits/basic_string.h:3929:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3929 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3929:5: note: template argument deduction/substitution failed: a.cc:9:12: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 9 | cin>>n>x; | ^ /usr/include/c++/14/bits/basic_string.h:3942:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3942 | operator>(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3942:5: note: template argument deduction/substitution failed: a.cc:9:12: note: mismatched types 'const _CharT*' and 'std::basic_istream<char>' 9 | cin>>n>x; | ^ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2619:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator>(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2619 | operator>(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2619:5: note: template argument deduction/substitution failed: a.cc:9:12: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::tuple<_UTypes ...>' 9 | cin>>n>x; | ^ a.cc:25:5: error: 'out' was not declared in this scope 25 | out<<ans<<endl; | ^~~
s512383855
p03864
C++
# include <iostream> # include <algorithm> # include <vector> # include <string> # include <set> # include <map> # include <cmath> # include <iomanip> # include <functional> # include <utility> # include <stack> # include <queue> # include <list> # include <bitset> # include <complex> # include <numeric> # include <tuple> using namespace std; using LL = long long; using ULL = unsigned long long; constexpr int INF = 2000000000; constexpr int HINF = INF / 2; constexpr double DINF = 100000000000000000.0; constexpr long long LINF = 9223372036854775807; constexpr long long HLINF = 4500000000000000000; const double PI = acos(-1); int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 }; #define ALL(x) (x).begin(),(x).end() #define UNIQ(c) (c).erase(unique(ALL((c))), end((c))) #define mp make_pair #define eb emplace_back typedef pair<LL, double> P; typedef pair<P, P> PP; struct edge { int to; double cost; }; #define int LL int x[1010], y[1010], r[1010]; double d[100100]; //距離 vector<edge> vec[100100]; void dijkstra() { for (int i = 0; i < 1100; i++)d[i] = DINF; priority_queue<P, std::vector<P>, std::greater<P>> pq; d[0] = 0; pq.push(make_pair(d[0], 0));//cost,to while (!pq.empty()) { P p = pq.top(); pq.pop(); int i = p.second; if (d[i] < p.first)continue; for (int k = 0; k < vec[i].size(); k++) { edge e = vec[i][k]; if (d[e.to] <= d[i] + e.cost)continue; d[e.to] = d[i] + e.cost; pq.push(make_pair(d[e.to], e.to)); } } } int main() { int n; cin >> x[0] >> y[0] >> x[1000 + 1] >> y[1000 + 1]; cin >> n; x[n + 1] = x[1001], y[n + 1] = y[1001]; for (int i = 1; i <= n; i++) { cin >> x[i] >> y[i] >> r[i]; } for (int i = 0; i <= n+1; i++) { for (int j = 0; j <= n + 1;j++) { if (i == j)continue; double num = sqrt(abs(x[i] - x[j])*abs(x[i] - x[j]) + abs(y[i] - y[j])*abs(y[i] - y[j])); vec[i].emplace_back(edge{ j,max(0.0,num - r[i] - r[j]) }); } } dijkstra(); cout <<fixed<<setprecision(20)<< d[n + 1] << endl; //cout << dijkstra() << endl; //system("pause"); }
a.cc:37:13: error: '::main' must return 'int' 37 | #define int LL | ^~ a.cc:64:1: note: in expansion of macro 'int' 64 | int main() { | ^~~ a.cc: In function 'int main()': a.cc:76:51: warning: narrowing conversion of 'j' from 'LL' {aka 'long long int'} to 'int' [-Wnarrowing] 76 | vec[i].emplace_back(edge{ j,max(0.0,num - r[i] - r[j]) }); | ^
s041168746
p03864
C++
#include <iostream> using namespace std; typedef long long ll; int main(){ ll N, x; ll a[100100]; cin >> N >> x; for(int i = 0; i < N; i++){ cin >> a[i]; } ll res = 0; for(int i = 0; i < N-1; i++){ if(a[i] + a[i+1] > x){ int r = a[i] + a[i+1] - x; res += r; a[i+1] = max(0, a[i+1]-r); } } cout << res << endl; return 0; }
a.cc: In function 'int main()': a.cc:19:19: error: no matching function for call to 'max(int, ll)' 19 | a[i+1] = max(0, a[i+1]-r); | ~~~^~~~~~~~~~~~~ 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:19:19: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'}) 19 | a[i+1] = max(0, a[i+1]-r); | ~~~^~~~~~~~~~~~~ /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
s718277862
p03864
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i,n) for( int i = 0; i < n; i++ ) #define dump(x) cerr << #x << " = " << (x) << endl; #define INF 2000000000 #define mod 1000000007 #define INF2 1000000000000000000 #define int long long int signed main(void) { cin.tie(0); ios::sync_with_stdio(false); int N, x; cin >> N >> x; int a[N]; rep(i ,N) cin >> a[i]; int count = 0; count += max(0,a[0] - x); a[0] -= max(0,a[0] - x); count += max(0,a[N-1] - x); a[N-1] -= max(0,a[N-1] - x); //cout << count << endl; rep(i, N-2) { count += max(0,((a[i] + a[i+1]) - x )); a[i+1] -= max(0,((a[i] + a[i+1]) - x )); } count += max(0,((a[N-2] + a[N-1]) - x )); a[N-1] -= max(0,((a[N-2] + a[N-1]) - x )); //rep(i, N) cout << a[i] << " "; //cout << endl; cout << count << endl; return 0; }
a.cc: In function 'int main()': a.cc:20:17: error: no matching function for call to 'max(int, long long int)' 20 | count += max(0,a[0] - x); | ~~~^~~~~~~~~~~~ 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:20:17: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 20 | count += max(0,a[0] - x); | ~~~^~~~~~~~~~~~ /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:20:17: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 20 | count += max(0,a[0] - x); | ~~~^~~~~~~~~~~~ a.cc:21:16: error: no matching function for call to 'max(int, long long int)' 21 | a[0] -= max(0,a[0] - x); | ~~~^~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:21:16: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 21 | a[0] -= max(0,a[0] - x); | ~~~^~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:21:16: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 21 | a[0] -= max(0,a[0] - x); | ~~~^~~~~~~~~~~~ a.cc:22:17: error: no matching function for call to 'max(int, long long int)' 22 | count += max(0,a[N-1] - x); | ~~~^~~~~~~~~~~~~~ /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:22:17: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 22 | count += max(0,a[N-1] - x); | ~~~^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:22:17: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 22 | count += max(0,a[N-1] - x); | ~~~^~~~~~~~~~~~~~ a.cc:23:18: error: no matching function for call to 'max(int, long long int)' 23 | a[N-1] -= max(0,a[N-1] - x); | ~~~^~~~~~~~~~~~~~ /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:23:18: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 23 | a[N-1] -= max(0,a[N-1] - x); | ~~~^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:23:18: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 23 | a[N-1] -= max(0,a[N-1] - x); | ~~~^~~~~~~~~~~~~~ a.cc:26:21: error: no matching function for call to 'max(int, long long int)' 26 | count += max(0,((a[i] + a[i+1]) - x )); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:26:21: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 26 | count += max(0,((a[i] + a[i+1]) - x )); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:26:21: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 26 | count += max(0,((a[i] + a[i+1]) - x )); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:27:22: error: no matching function for call to 'max(int, long long int)' 27 | a[i+1] -= max(0,((a[i] + a[i+1]) - x )); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:27:22: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 27 | a[i+1] -= max(0,((a[i] + a[i+1]) - x )); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp>
s806805535
p03864
C++
import sequtils,strutils,math var N, x : int A : seq[int] cnt : int (N, x) = stdin.readline.split.map(parseInt) A = stdin.readline.split.map(parseInt) for i in 1..A.high: if A[i] + A[i - 1] > x: var j = A[i] + A[i - 1] - x A[i] -= min(j, A[i]) cnt += j echo cnt
a.cc:8:10: error: too many decimal points in number 8 | for i in 1..A.high: | ^~~~~~~~~ a.cc:1:1: error: 'import' does not name a type 1 | import sequtils,strutils,math | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
s385086255
p03864
C++
#include <bits/stdc++.h> using namespace std; #define ll long long struct circle { double x, y, r; }; double x1, y1, x2, y2; double dist(double x, double y) { return ((x1 - x) * (x1 - x)) + ((y1 - y) * (y1 - y)); } double meh(double a1, double b1, double a2, double b2) { return sqrt(((a1 - a2) * (a1 - a2)) + ((b1 - b2) * (b1 - b2))); } int main() { cin >> x1 >> y1 >> x2 >> y2; int n; cin >> n; circle arr[1010]; for (int i = 0; i < n; i++) cin >> arr[i].x >> arr[i].y >> arr[i].r; for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { if (dist(arr[i].x, arr[i].y) > dist(arr[j].x, arr[j].y)) swap(arr[i], arr[j]); } } double mini = 1e18; for (int i = 0; i < n; i++) { double d = 0; double prevx = x1, prevy = y1, prevr = 0; for (int j = i; j < n; j++) { d += max(0.0, meh(arr[j].x, arr[j].y, prevx, prevy) - arr[j].r - prevr); prevx = arr[j].x, prevy = arr[j].y, prevr = arr[j].r; } d += max(0.0, meh(x2, y2, prevx, prevy) - prevr); mini = min(mini, d); } cout << fixed << setprecision(10) << mini << "\n"; return 0; }
a.cc:8:12: error: 'double y1' redeclared as different kind of entity 8 | double x1, y1, x2, y2; | ^~ 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/cassert:43, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:33, from a.cc:1: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:257:1: note: previous declaration 'double y1(double)' 257 | __MATHCALL (y1,, (_Mdouble_)); | ^~~~~~~~~~ a.cc: In function 'double dist(double, double)': a.cc:10:41: error: invalid operands of types 'double(double) noexcept' and 'double' to binary 'operator-' 10 | return ((x1 - x) * (x1 - x)) + ((y1 - y) * (y1 - y)); | ~~ ^ ~ | | | | | double | double(double) noexcept a.cc:10:52: error: invalid operands of types 'double(double) noexcept' and 'double' to binary 'operator-' 10 | return ((x1 - x) * (x1 - x)) + ((y1 - y) * (y1 - y)); | ~~ ^ ~ | | | | | double | double(double) noexcept a.cc: In function 'int main()': a.cc:17:15: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'double(double) noexcept') 17 | cin >> x1 >> y1 >> x2 >> y2; | ~~~~~~~~~ ^~ ~~ | | | | | double(double) noexcept | std::basic_istream<char>::__istream_type {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: /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:17:18: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'double (*)(double) noexcept' 17 | cin >> x1 >> y1 >> x2 >> y2; | ^~ /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:17:18: error: invalid conversion from 'double (*)(double) noexcept' to 'short int' [-fpermissive] 17 | cin >> x1 >> y1 >> x2 >> y2; | ^~ | | | double (*)(double) noexcept a.cc:17:18: error: cannot bind rvalue '(short int)y1' to 'short int&' /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:17:18: error: invalid conversion from 'double (*)(double) noexcept' to 'short unsigned int' [-fpermissive] 17 | cin >> x1 >> y1 >> x2 >> y2; | ^~ | | | double (*)(double) noexcept a.cc:17:18: error: cannot bind rvalue '(short unsigned int)y1' to 'short unsigned int&' /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:17:18: error: invalid conversion from 'double (*)(double) noexcept' to 'int' [-fpermissive] 17 | cin >> x1 >> y1 >> x2 >> y2; | ^~ | | | double (*)(double) noexcept a.cc:17:18: error: cannot bind rvalue '(int)y1' to 'int&' /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:17:18: error: invalid conversion from 'double (*)(double) noexcept' to 'unsigned int' [-fpermissive] 17 | cin >> x1 >> y1 >> x2 >> y2; | ^~ | | | double (*)(double) noexcept a.cc:17:18: error: cannot bind rvalue '(unsigned int)y1' to 'unsigned int&' /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:17:18: error: invalid conversion from 'double (*)(double) noexcept' to 'long int' [-fpermissive] 17 | cin >> x1 >> y1 >> x2 >> y2; | ^~ | | | double (*)(double) noexcept a.cc:17:18: error: cannot bind rvalue '(long int)y1' to 'long int&' /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:17:18: error: invalid conversion from 'double (*)(double) noexcept' to 'long unsigned int' [-fpermissive] 17 | cin >> x1 >> y1 >> x2 >> y2; | ^~ | | | double (*)(double) noexcept a.cc:17:18: error: cannot bind rvalue '(long unsigned int)y1' to 'long unsigned int&' /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:17:18: error: invalid conversion from 'double (*)(double) noexcept' to 'long long int' [-fpermissive] 17 | cin >> x1 >> y1 >> x2 >> y2; | ^~ | | | double (*)(double) noexcept a.cc:17:18: error: cannot bind rvalue '(long long int)y1' to 'long long int&' /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:17:18: error: invalid conversion from 'double (*)(double) noexcept' to 'long long unsigned int' [-fpermissive] 17 | cin >> x1 >> y1 >> x2 >> y2; | ^~ | | | double (*)(double) noexcept a.cc:17:18: error: cannot bind rvalue '(long long unsigned int)y1' to 'long long unsigned int&' /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:17:18: error: invalid conversion from 'double (*)(double) noexcept' to 'void*' [-fpermissive] 17 | cin >> x1 >> y1 >> x2 >> y2; | ^~ | | | double (*)(double) noexcept a.cc:17:18: error: cannot bind rvalue '(void*)y1' 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:17:18: error: invalid conversion from 'double (*)(double) noexcept' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::
s511083334
p03864
C++
#include <bits/stdc++.h> using namespace std; #define ll long long struct circle { double x, y, r; }; double x1, y1, x2, y2; double dist(double x, double y) { return ((x1 - x) * (x1 - x)) + ((y1 - y) * (y1 - y)); } double meh(double a1, double b1, double a2, double b2) { return sqrt(((a1 - a2) * (a1 - a2)) + ((b1 - b2) * (b1 - b2))); } int main() { cin >> x1 >> y1 >> x2 >> y2; int n; cin >> n; circle arr[1010]; for (int i = 0; i < n; i++) cin >> arr[i].x >> arr[i].y >> arr[i].r; for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { if (dist(arr[i].x, arr[i].y) > dist(arr[j].x, arr[j].y)) swap(arr[i], arr[j]); } } double mini = 1e18; for (int i = 0; i < n; i++) { double d = 0; double prevx = x1, prevy = y1, prevr = 0; for (int j = i; j < n; j++) { d += max(0.0, meh(arr[j].x, arr[j].y, prevx, prevy) - arr[j].r - prevr); prevx = arr[j].x, prevy = arr[j].y, prevr = arr[j].r; } d += max(0.0, meh(x2, y2, prevx, prevy) - prevr); mini = min(mini, d); } cout << fixed << setprecision(10) << mini << "\n"; return 0; }
a.cc:8:12: error: 'double y1' redeclared as different kind of entity 8 | double x1, y1, x2, y2; | ^~ 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/cassert:43, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:33, from a.cc:1: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:257:1: note: previous declaration 'double y1(double)' 257 | __MATHCALL (y1,, (_Mdouble_)); | ^~~~~~~~~~ a.cc: In function 'double dist(double, double)': a.cc:10:41: error: invalid operands of types 'double(double) noexcept' and 'double' to binary 'operator-' 10 | return ((x1 - x) * (x1 - x)) + ((y1 - y) * (y1 - y)); | ~~ ^ ~ | | | | | double | double(double) noexcept a.cc:10:52: error: invalid operands of types 'double(double) noexcept' and 'double' to binary 'operator-' 10 | return ((x1 - x) * (x1 - x)) + ((y1 - y) * (y1 - y)); | ~~ ^ ~ | | | | | double | double(double) noexcept a.cc: In function 'int main()': a.cc:17:15: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'double(double) noexcept') 17 | cin >> x1 >> y1 >> x2 >> y2; | ~~~~~~~~~ ^~ ~~ | | | | | double(double) noexcept | std::basic_istream<char>::__istream_type {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: /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:17:18: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'double (*)(double) noexcept' 17 | cin >> x1 >> y1 >> x2 >> y2; | ^~ /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:17:18: error: invalid conversion from 'double (*)(double) noexcept' to 'short int' [-fpermissive] 17 | cin >> x1 >> y1 >> x2 >> y2; | ^~ | | | double (*)(double) noexcept a.cc:17:18: error: cannot bind rvalue '(short int)y1' to 'short int&' /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:17:18: error: invalid conversion from 'double (*)(double) noexcept' to 'short unsigned int' [-fpermissive] 17 | cin >> x1 >> y1 >> x2 >> y2; | ^~ | | | double (*)(double) noexcept a.cc:17:18: error: cannot bind rvalue '(short unsigned int)y1' to 'short unsigned int&' /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:17:18: error: invalid conversion from 'double (*)(double) noexcept' to 'int' [-fpermissive] 17 | cin >> x1 >> y1 >> x2 >> y2; | ^~ | | | double (*)(double) noexcept a.cc:17:18: error: cannot bind rvalue '(int)y1' to 'int&' /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:17:18: error: invalid conversion from 'double (*)(double) noexcept' to 'unsigned int' [-fpermissive] 17 | cin >> x1 >> y1 >> x2 >> y2; | ^~ | | | double (*)(double) noexcept a.cc:17:18: error: cannot bind rvalue '(unsigned int)y1' to 'unsigned int&' /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:17:18: error: invalid conversion from 'double (*)(double) noexcept' to 'long int' [-fpermissive] 17 | cin >> x1 >> y1 >> x2 >> y2; | ^~ | | | double (*)(double) noexcept a.cc:17:18: error: cannot bind rvalue '(long int)y1' to 'long int&' /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:17:18: error: invalid conversion from 'double (*)(double) noexcept' to 'long unsigned int' [-fpermissive] 17 | cin >> x1 >> y1 >> x2 >> y2; | ^~ | | | double (*)(double) noexcept a.cc:17:18: error: cannot bind rvalue '(long unsigned int)y1' to 'long unsigned int&' /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:17:18: error: invalid conversion from 'double (*)(double) noexcept' to 'long long int' [-fpermissive] 17 | cin >> x1 >> y1 >> x2 >> y2; | ^~ | | | double (*)(double) noexcept a.cc:17:18: error: cannot bind rvalue '(long long int)y1' to 'long long int&' /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:17:18: error: invalid conversion from 'double (*)(double) noexcept' to 'long long unsigned int' [-fpermissive] 17 | cin >> x1 >> y1 >> x2 >> y2; | ^~ | | | double (*)(double) noexcept a.cc:17:18: error: cannot bind rvalue '(long long unsigned int)y1' to 'long long unsigned int&' /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:17:18: error: invalid conversion from 'double (*)(double) noexcept' to 'void*' [-fpermissive] 17 | cin >> x1 >> y1 >> x2 >> y2; | ^~ | | | double (*)(double) noexcept a.cc:17:18: error: cannot bind rvalue '(void*)y1' 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:17:18: error: invalid conversion from 'double (*)(double) noexcept' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::
s511407214
p03864
C++
#include <bits/stdc++.h> #define REP(i,n) for(int i=0;i<(int)(n);i++) #define ALL(x) (x).begin(),(x).end() #define LL long long using namespace std; int main(){ LL N,x;cin>>N>>x; LL a[N]; REP(i,N)cin>>a[i]; LL sum[N-1]; REP(i,N-1)sum[i]=a[i]+a[i+1]; LL ans=0; REP(i,N-1){ if(sum[i]>x){ ans+=sum[i]-x; if(i<N-2){ sum[i+1]-=(sum[i]-x); sum[i+1]=max(0,sum[i+1]); } sum[i]=x; } } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:22:29: error: no matching function for call to 'max(int, long long int&)' 22 | sum[i+1]=max(0,sum[i+1]); | ~~~^~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:22:29: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 22 | sum[i+1]=max(0,sum[i+1]); | ~~~^~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:22:29: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 22 | sum[i+1]=max(0,sum[i+1]); | ~~~^~~~~~~~~~~~
s078157861
p03864
Java
import java.io.*; import java.util.*; class Main { private static InputReader in; private static PrintWriter out; public static void main(String args[]) throws IOException { in = new InputReader(); out = new PrintWriter(System.out); //String x = in.next(); //while (!x.equals("*")) { solve(); // x = in.next(); //} out.close(); } private static void solve() throws IOException { int n = in.nextInt(); long x = in.nextLong(); long[] a = new long[n]; long ans = 0; for (int i = 0; i < n; i++) { a[i] = in.nextLong(); } if (n == 1) { throw new RuntimeException(); if (a[0] < x) { out.print(0); } else { out.print(a[0] - x); } } for (int i = 1; i < n; i++) { if (a[i] == 0) continue; if (a[i - 1] + a[i] <= x) continue; ans += a[i] - (x - a[i - 1]); a[i] = x - a[i - 1]; } out.print(ans); } static class InputReader { final private int BUFFER_SIZE = 1 << 16; private DataInputStream din; private byte[] buffer; private int bufferPointer, bytesRead; public InputReader() { din = new DataInputStream(System.in); buffer = new byte[BUFFER_SIZE]; bufferPointer = bytesRead = 0; } public InputReader(String file_name) throws IOException { din = new DataInputStream(new FileInputStream(file_name)); buffer = new byte[BUFFER_SIZE]; bufferPointer = bytesRead = 0; } public String next() throws IOException { byte[] buf = new byte[64]; // line length int cnt = 0, c; while ((c = read()) != -1) { if (c == ' ' || c == '\n') break; buf[cnt++] = (byte) c; } return new String(buf, 0, cnt); } public String nextLine() throws IOException { byte[] buf = new byte[64]; // line length int cnt = 0, c; while ((c = read()) != -1) { if (c == '\n') break; buf[cnt++] = (byte) c; } return new String(buf, 0, cnt); } public int nextInt() throws IOException { int ret = 0; byte c = read(); while (c <= ' ') c = read(); boolean neg = (c == '-'); if (neg) c = read(); do { ret = ret * 10 + c - '0'; } while ((c = read()) >= '0' && c <= '9'); if (neg) return -ret; return ret; } public long nextLong() throws IOException { long ret = 0; byte c = read(); while (c <= ' ') c = read(); boolean neg = (c == '-'); if (neg) c = read(); do { ret = ret * 10 + c - '0'; } while ((c = read()) >= '0' && c <= '9'); if (neg) return -ret; return ret; } public double nextDouble() throws IOException { double ret = 0, div = 1; byte c = read(); while (c <= ' ') c = read(); boolean neg = (c == '-'); if (neg) c = read(); do { ret = ret * 10 + c - '0'; } while ((c = read()) >= '0' && c <= '9'); if (c == '.') { while ((c = read()) >= '0' && c <= '9') { ret += (c - '0') / (div *= 10); } } if (neg) return -ret; return ret; } private void fillBuffer() throws IOException { bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); if (bytesRead == -1) buffer[0] = -1; } private byte read() throws IOException { if (bufferPointer == bytesRead) fillBuffer(); return buffer[bufferPointer++]; } public void close() throws IOException { if (din == null) return; din.close(); } } }
Main.java:28: error: unreachable statement if (a[0] < x) { ^ 1 error
s848745648
p03864
C++
#include <iostream> #include <vector> using namespace std; int main() { int n, x; cin >> n >> x; vector<int> ns(n, 0); for (int i = 0; i < n; i++) { cin >> ns[i]; } long long int ans = 0; for (int i = 0; i < n - 1; i++) { long long int sum = ns[i] + ns[i + 1]; long long int diff = sum - x; if (diff <= 0) { continue; } ans += diff; long long int m1 = min(diff, ns[i + 1]); ns[i + 1] -= m1; long long int m2 = diff - m1; if (m2 > 0) { ns[i] -= m2; } } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:18:27: error: no matching function for call to 'min(long long int&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)' 18 | long long int m1 = min(diff, ns[i + 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:18:27: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}) 18 | long long int m1 = min(diff, ns[i + 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
s939664884
p03864
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n,x; long long int a[100000]; cin >> n >> x; long long int cnt = 0; for(int i = 0; i < n; i++){ cin >> a[i]; if(a[i] > x){ cnt += (a[i] - x); a[i] = x; } } for(int i = 0; i < n-1; i++){ if(a[i] + a[i+1] > x){ cnt += (a[i]+a[i+1]-x); a[i+1] -= (a[i]+a[i+1]-x); } cout << cnt << endl; }
a.cc: In function 'int main()': a.cc:21:2: error: expected '}' at end of input 21 | } | ^ a.cc:3:11: note: to match this '{' 3 | int main(){ | ^
s808964924
p03864
C
#include<stdio.h> int main(void){ long i,r,n,x,a[100000]; scanf("%ld%ld",&n,&x); for(i = 0;i < n;i++){ scanf("%ld",&a[i]); } for(i = 0;i < n - 1;i++){ r = a[i] + a[i + 1] - x; if(r > 0){ if(a[i + 1] >= r){ a[i + 1] -= r; }else{ a[i + 1] = 0; } k += r; } } printf("%ld\n",k); return 0; }
main.c: In function 'main': main.c:16:13: error: 'k' undeclared (first use in this function) 16 | k += r; | ^ main.c:16:13: note: each undeclared identifier is reported only once for each function it appears in
s896770261
p03864
C
#include<stdio.h> int main(void){ long i,r,n,x,a[100000]; scanf("%d%d",&n,&x); for(i = 0;i < n;i++){ scanf("%d",&a[i]); } for(i = 0;i < n - 1;i++){ r = a[i] + a[i + 1] - x; if(r > 0){ if(a[i + 1] >= r){ a[i + 1] -= r; }else{ a[i + 1] = 0; } k += r; } } printf("%d\n",k); return 0; }
main.c: In function 'main': main.c:16:13: error: 'k' undeclared (first use in this function) 16 | k += r; | ^ main.c:16:13: note: each undeclared identifier is reported only once for each function it appears in
s843164344
p03864
C++
#include <stdio.h> int n,x,c[100001]; long long int cnt; int main() { scanf("%d%d",&n,&x); for(int i=0;i<n;i++) scanf("%d",c+i); for(int i=1;i<n;i++) { int t=c[i-1]+c[i]; int tx=t-x; if(t>x) { if(c[i]>=tx) { c[i]-=tx; cnt+=tx; } else { cnt+=tx; c[i-1]-=(tx-c[i]); c[i]=0; } } } print("%lld\n",cnt); }
a.cc: In function 'int main()': a.cc:23:9: error: 'print' was not declared in this scope; did you mean 'printf'? 23 | print("%lld\n",cnt); | ^~~~~ | printf
s109215688
p03864
C++
__message_10823=%7B%22t%22%3A%22error%22%2C%22h%22%3A%22%3Cspan+class%3D%5C%22lang%5C%22%3E%3Cspan+class%3D%5C%22lang-en%5C%22%3EYou+failed+to+sign+in.%3C%5C%2Fspan%3E%3Cspan+class%3D%5C%22lang-ja%5C%22%3E%5Cu30ed%5Cu30b0%5Cu30a4%5Cu30f3%5Cu306b%5Cu5931%5Cu6557%5Cu3057%5Cu307e%5Cu3057%5Cu305f%3C%5C%2Fspan%3E%3C%5C%2Fspan%3E%22%2C%22c%22%3A%22%3Cspan+class%3D%5C%22lang%5C%22%3E%3Cspan+class%3D%5C%22lang-en%5C%22%3EWrong+user+ID+or+password.%3C%5C%2Fspan%3E%3Cspan+class%3D%5C%22lang-ja%5C%22%3E%5Cu30e6%5Cu30fc%5Cu30b6%5Cu540d%5Cu3068%5Cu30d1%5Cu30b9%5Cu30ef%5Cu30fc%5Cu30c9%5Cu306e%5Cu7d44%5Cu307f%5Cu5408%5Cu308f%5Cu305b%5Cu304c%5Cu9593%5Cu9055%5Cu3063%5Cu3066%5Cu3044%5Cu307e%5Cu3059%3C%5C%2Fspan%3E%3C%5C%2Fspan%3E%22%7D; expires=Sat, 10-Dec-2016 12:14:54 GMT; Max-Age=60; path=/; domain=arc064.contest.atcoder.jp
a.cc:1:31: error: exponent has no digits 1 | __message_10823=%7B%22t%22%3A%22error%22%2C%22h%22%3A%22%3Cspan+class%3D%5C%22lang%5C%22%3E%3Cspan+class%3D%5C%22lang-en%5C%22%3EYou+failed+to+sign+in.%3C%5C%2Fspan%3E%3Cspan+class%3D%5C%22lang-ja%5C%22%3E%5Cu30ed%5Cu30b0%5Cu30a4%5Cu30f3%5Cu306b%5Cu5931%5Cu6557%5Cu3057%5Cu307e%5Cu3057%5Cu305f%3C%5C%2Fspan%3E%3C%5C%2Fspan%3E%22%2C%22c%22%3A%22%3Cspan+class%3D%5C%22lang%5C%22%3E%3Cspan+class%3D%5C%22lang-en%5C%22%3EWrong+user+ID+or+password.%3C%5C%2Fspan%3E%3Cspan+class%3D%5C%22lang-ja%5C%22%3E%5Cu30e6%5Cu30fc%5Cu30b6%5Cu540d%5Cu3068%5Cu30d1%5Cu30b9%5Cu30ef%5Cu30fc%5Cu30c9%5Cu306e%5Cu7d44%5Cu307f%5Cu5408%5Cu308f%5Cu305b%5Cu304c%5Cu9593%5Cu9055%5Cu3063%5Cu3066%5Cu3044%5Cu307e%5Cu3059%3C%5C%2Fspan%3E%3C%5C%2Fspan%3E%22%7D; expires=Sat, 10-Dec-2016 12:14:54 GMT; Max-Age=60; path=/; domain=arc064.contest.atcoder.jp | ^~~~~~~ a.cc:1:90: error: exponent has no digits 1 | __message_10823=%7B%22t%22%3A%22error%22%2C%22h%22%3A%22%3Cspan+class%3D%5C%22lang%5C%22%3E%3Cspan+class%3D%5C%22lang-en%5C%22%3EYou+failed+to+sign+in.%3C%5C%2Fspan%3E%3Cspan+class%3D%5C%22lang-ja%5C%22%3E%5Cu30ed%5Cu30b0%5Cu30a4%5Cu30f3%5Cu306b%5Cu5931%5Cu6557%5Cu3057%5Cu307e%5Cu3057%5Cu305f%3C%5C%2Fspan%3E%3C%5C%2Fspan%3E%22%2C%22c%22%3A%22%3Cspan+class%3D%5C%22lang%5C%22%3E%3Cspan+class%3D%5C%22lang-en%5C%22%3EWrong+user+ID+or+password.%3C%5C%2Fspan%3E%3Cspan+class%3D%5C%22lang-ja%5C%22%3E%5Cu30e6%5Cu30fc%5Cu30b6%5Cu540d%5Cu3068%5Cu30d1%5Cu30b9%5Cu30ef%5Cu30fc%5Cu30c9%5Cu306e%5Cu7d44%5Cu307f%5Cu5408%5Cu308f%5Cu305b%5Cu304c%5Cu9593%5Cu9055%5Cu3063%5Cu3066%5Cu3044%5Cu307e%5Cu3059%3C%5C%2Fspan%3E%3C%5C%2Fspan%3E%22%7D; expires=Sat, 10-Dec-2016 12:14:54 GMT; Max-Age=60; path=/; domain=arc064.contest.atcoder.jp | ^~ a.cc:1:128: error: exponent has no digits 1 | __message_10823=%7B%22t%22%3A%22error%22%2C%22h%22%3A%22%3Cspan+class%3D%5C%22lang%5C%22%3E%3Cspan+class%3D%5C%22lang-en%5C%22%3EYou+failed+to+sign+in.%3C%5C%2Fspan%3E%3Cspan+class%3D%5C%22lang-ja%5C%22%3E%5Cu30ed%5Cu30b0%5Cu30a4%5Cu30f3%5Cu306b%5Cu5931%5Cu6557%5Cu3057%5Cu307e%5Cu3057%5Cu305f%3C%5C%2Fspan%3E%3C%5C%2Fspan%3E%22%2C%22c%22%3A%22%3Cspan+class%3D%5C%22lang%5C%22%3E%3Cspan+class%3D%5C%22lang-en%5C%22%3EWrong+user+ID+or+password.%3C%5C%2Fspan%3E%3Cspan+class%3D%5C%22lang-ja%5C%22%3E%5Cu30e6%5Cu30fc%5Cu30b6%5Cu540d%5Cu3068%5Cu30d1%5Cu30b9%5Cu30ef%5Cu30fc%5Cu30c9%5Cu306e%5Cu7d44%5Cu307f%5Cu5408%5Cu308f%5Cu305b%5Cu304c%5Cu9593%5Cu9055%5Cu3063%5Cu3066%5Cu3044%5Cu307e%5Cu3059%3C%5C%2Fspan%3E%3C%5C%2Fspan%3E%22%7D; expires=Sat, 10-Dec-2016 12:14:54 GMT; Max-Age=60; path=/; domain=arc064.contest.atcoder.jp | ^~~~~ a.cc:1:166: error: exponent has no digits 1 | __message_10823=%7B%22t%22%3A%22error%22%2C%22h%22%3A%22%3Cspan+class%3D%5C%22lang%5C%22%3E%3Cspan+class%3D%5C%22lang-en%5C%22%3EYou+failed+to+sign+in.%3C%5C%2Fspan%3E%3Cspan+class%3D%5C%22lang-ja%5C%22%3E%5Cu30ed%5Cu30b0%5Cu30a4%5Cu30f3%5Cu306b%5Cu5931%5Cu6557%5Cu3057%5Cu307e%5Cu3057%5Cu305f%3C%5C%2Fspan%3E%3C%5C%2Fspan%3E%22%2C%22c%22%3A%22%3Cspan+class%3D%5C%22lang%5C%22%3E%3Cspan+class%3D%5C%22lang-en%5C%22%3EWrong+user+ID+or+password.%3C%5C%2Fspan%3E%3Cspan+class%3D%5C%22lang-ja%5C%22%3E%5Cu30e6%5Cu30fc%5Cu30b6%5Cu540d%5Cu3068%5Cu30d1%5Cu30b9%5Cu30ef%5Cu30fc%5Cu30c9%5Cu306e%5Cu7d44%5Cu307f%5Cu5408%5Cu308f%5Cu305b%5Cu304c%5Cu9593%5Cu9055%5Cu3063%5Cu3066%5Cu3044%5Cu307e%5Cu3059%3C%5C%2Fspan%3E%3C%5C%2Fspan%3E%22%7D; expires=Sat, 10-Dec-2016 12:14:54 GMT; Max-Age=60; path=/; domain=arc064.contest.atcoder.jp | ^~ a.cc:1:204: error: exponent has no digits 1 | __message_10823=%7B%22t%22%3A%22error%22%2C%22h%22%3A%22%3Cspan+class%3D%5C%22lang%5C%22%3E%3Cspan+class%3D%5C%22lang-en%5C%22%3EYou+failed+to+sign+in.%3C%5C%2Fspan%3E%3Cspan+class%3D%5C%22lang-ja%5C%22%3E%5Cu30ed%5Cu30b0%5Cu30a4%5Cu30f3%5Cu306b%5Cu5931%5Cu6557%5Cu3057%5Cu307e%5Cu3057%5Cu305f%3C%5C%2Fspan%3E%3C%5C%2Fspan%3E%22%2C%22c%22%3A%22%3Cspan+class%3D%5C%22lang%5C%22%3E%3Cspan+class%3D%5C%22lang-en%5C%22%3EWrong+user+ID+or+password.%3C%5C%2Fspan%3E%3Cspan+class%3D%5C%22lang-ja%5C%22%3E%5Cu30e6%5Cu30fc%5Cu30b6%5Cu540d%5Cu3068%5Cu30d1%5Cu30b9%5Cu30ef%5Cu30fc%5Cu30c9%5Cu306e%5Cu7d44%5Cu307f%5Cu5408%5Cu308f%5Cu305b%5Cu304c%5Cu9593%5Cu9055%5Cu3063%5Cu3066%5Cu3044%5Cu307e%5Cu3059%3C%5C%2Fspan%3E%3C%5C%2Fspan%3E%22%7D; expires=Sat, 10-Dec-2016 12:14:54 GMT; Max-Age=60; path=/; domain=arc064.contest.atcoder.jp | ^~ a.cc:1:308: error: exponent has no digits 1 | __message_10823=%7B%22t%22%3A%22error%22%2C%22h%22%3A%22%3Cspan+class%3D%5C%22lang%5C%22%3E%3Cspan+class%3D%5C%22lang-en%5C%22%3EYou+failed+to+sign+in.%3C%5C%2Fspan%3E%3Cspan+class%3D%5C%22lang-ja%5C%22%3E%5Cu30ed%5Cu30b0%5Cu30a4%5Cu30f3%5Cu306b%5Cu5931%5Cu6557%5Cu3057%5Cu307e%5Cu3057%5Cu305f%3C%5C%2Fspan%3E%3C%5C%2Fspan%3E%22%2C%22c%22%3A%22%3Cspan+class%3D%5C%22lang%5C%22%3E%3Cspan+class%3D%5C%22lang-en%5C%22%3EWrong+user+ID+or+password.%3C%5C%2Fspan%3E%3Cspan+class%3D%5C%22lang-ja%5C%22%3E%5Cu30e6%5Cu30fc%5Cu30b6%5Cu540d%5Cu3068%5Cu30d1%5Cu30b9%5Cu30ef%5Cu30fc%5Cu30c9%5Cu306e%5Cu7d44%5Cu307f%5Cu5408%5Cu308f%5Cu305b%5Cu304c%5Cu9593%5Cu9055%5Cu3063%5Cu3066%5Cu3044%5Cu307e%5Cu3059%3C%5C%2Fspan%3E%3C%5C%2Fspan%3E%22%7D; expires=Sat, 10-Dec-2016 12:14:54 GMT; Max-Age=60; path=/; domain=arc064.contest.atcoder.jp | ^~ a.cc:1:324: error: exponent has no digits 1 | __message_10823=%7B%22t%22%3A%22error%22%2C%22h%22%3A%22%3Cspan+class%3D%5C%22lang%5C%22%3E%3Cspan+class%3D%5C%22lang-en%5C%22%3EYou+failed+to+sign+in.%3C%5C%2Fspan%3E%3Cspan+class%3D%5C%22lang-ja%5C%22%3E%5Cu30ed%5Cu30b0%5Cu30a4%5Cu30f3%5Cu306b%5Cu5931%5Cu6557%5Cu3057%5Cu307e%5Cu3057%5Cu305f%3C%5C%2Fspan%3E%3C%5C%2Fspan%3E%22%2C%22c%22%3A%22%3Cspan+class%3D%5C%22lang%5C%22%3E%3Cspan+class%3D%5C%22lang-en%5C%22%3EWrong+user+ID+or+password.%3C%5C%2Fspan%3E%3Cspan+class%3D%5C%22lang-ja%5C%22%3E%5Cu30e6%5Cu30fc%5Cu30b6%5Cu540d%5Cu3068%5Cu30d1%5Cu30b9%5Cu30ef%5Cu30fc%5Cu30c9%5Cu306e%5Cu7d44%5Cu307f%5Cu5408%5Cu308f%5Cu305b%5Cu304c%5Cu9593%5Cu9055%5Cu3063%5Cu3066%5Cu3044%5Cu307e%5Cu3059%3C%5C%2Fspan%3E%3C%5C%2Fspan%3E%22%7D; expires=Sat, 10-Dec-2016 12:14:54 GMT; Max-Age=60; path=/; domain=arc064.contest.atcoder.jp | ^~ a.cc:1:378: error: exponent has no digits 1 | __message_10823=%7B%22t%22%3A%22error%22%2C%22h%22%3A%22%3Cspan+class%3D%5C%22lang%5C%22%3E%3Cspan+class%3D%5C%22lang-en%5C%22%3EYou+failed+to+sign+in.%3C%5C%2Fspan%3E%3Cspan+class%3D%5C%22lang-ja%5C%22%3E%5Cu30ed%5Cu30b0%5Cu30a4%5Cu30f3%5Cu306b%5Cu5931%5Cu6557%5Cu3057%5Cu307e%5Cu3057%5Cu305f%3C%5C%2Fspan%3E%3C%5C%2Fspan%3E%22%2C%22c%22%3A%22%3Cspan+class%3D%5C%22lang%5C%22%3E%3Cspan+class%3D%5C%22lang-en%5C%22%3EWrong+user+ID+or+password.%3C%5C%2Fspan%3E%3Cspan+class%3D%5C%22lang-ja%5C%22%3E%5Cu30e6%5Cu30fc%5Cu30b6%5Cu540d%5Cu3068%5Cu30d1%5Cu30b9%5Cu30ef%5Cu30fc%5Cu30c9%5Cu306e%5Cu7d44%5Cu307f%5Cu5408%5Cu308f%5Cu305b%5Cu304c%5Cu9593%5Cu9055%5Cu3063%5Cu3066%5Cu3044%5Cu307e%5Cu3059%3C%5C%2Fspan%3E%3C%5C%2Fspan%3E%22%7D; expires=Sat, 10-Dec-2016 12:14:54 GMT; Max-Age=60; path=/; domain=arc064.contest.atcoder.jp | ^~ a.cc:1:416: error: exponent has no digits 1 | __message_10823=%7B%22t%22%3A%22error%22%2C%22h%22%3A%22%3Cspan+class%3D%5C%22lang%5C%22%3E%3Cspan+class%3D%5C%22lang-en%5C%22%3EYou+failed+to+sign+in.%3C%5C%2Fspan%3E%3Cspan+class%3D%5C%22lang-ja%5C%22%3E%5Cu30ed%5Cu30b0%5Cu30a4%5Cu30f3%5Cu306b%5Cu5931%5Cu6557%5Cu3057%5Cu307e%5Cu3057%5Cu305f%3C%5C%2Fspan%3E%3C%5C%2Fspan%3E%22%2C%22c%22%3A%22%3Cspan+class%3D%5C%22lang%5C%22%3E%3Cspan+class%3D%5C%22lang-en%5C%22%3EWrong+user+ID+or+password.%3C%5C%2Fspan%3E%3Cspan+class%3D%5C%22lang-ja%5C%22%3E%5Cu30e6%5Cu30fc%5Cu30b6%5Cu540d%5Cu3068%5Cu30d1%5Cu30b9%5Cu30ef%5Cu30fc%5Cu30c9%5Cu306e%5Cu7d44%5Cu307f%5Cu5408%5Cu308f%5Cu305b%5Cu304c%5Cu9593%5Cu9055%5Cu3063%5Cu3066%5Cu3044%5Cu307e%5Cu3059%3C%5C%2Fspan%3E%3C%5C%2Fspan%3E%22%7D; expires=Sat, 10-Dec-2016 12:14:54 GMT; Max-Age=60; path=/; domain=arc064.contest.atcoder.jp | ^~~~~~~ a.cc:1:458: error: exponent has no digits 1 | __message_10823=%7B%22t%22%3A%22error%22%2C%22h%22%3A%22%3Cspan+class%3D%5C%22lang%5C%22%3E%3Cspan+class%3D%5C%22lang-en%5C%22%3EYou+failed+to+sign+in.%3C%5C%2Fspan%3E%3Cspan+class%3D%5C%22lang-ja%5C%22%3E%
s246749402
p03864
Java
import java.util.Scanner; public class BoxesAndCandies { public static void main(String[] args) { Scanner sc = new Scanner(System.in); // standard input int numBoxes = sc.nextInt(); int numLimit = sc.nextInt(); int[] candyArray = new int[numBoxes]; for (int i = 0; i < numBoxes; i++) { candyArray[i] = sc.nextInt(); } // int totalAteCandies = 0; for (int i = 1; i < numBoxes; i++) { int numExcessCandies = calculateExcessCandies(numLimit, candyArray[i - 1], candyArray[i]); totalAteCandies += numExcessCandies; eatCandies(candyArray, i, numExcessCandies); } System.out.println(totalAteCandies); } public static int calculateExcessCandies(int limit, int candy1, int candy2) { int numCandies = candy1 + candy2 - limit; if (numCandies < 0) { return 0; } else { return numCandies; } } public static void eatCandies(int[] array, int index, int numExcessCandies) { array[index] -= numExcessCandies; if (array[index] < 0) { array[index - 1] += array[index]; array[index] = 0; } } }
Main.java:3: error: class BoxesAndCandies is public, should be declared in a file named BoxesAndCandies.java public class BoxesAndCandies { ^ 1 error
s537658107
p03864
C++
5555
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 5555 | ^~~~
s667955699
p03864
C++
#include<cstdio> #include<cstring> #include<cstdlib> #include<vector> #include<cmath> #include<queue> using namespace std; int main(void){ long double a[1002][1002]; int n=0; int x[1002]; int y[1002]; int r[1002]; long double d[1002]; int e[1002]; for(int i=0;i<1002;i++){ for(int j=;j<1002;j++){ a[i][j]=0; } x[i]=0; y[i]=0; r[i]=0; d[i]=4000000000; e[i]=0; } priority_queue<pair<double, int>> t; pair<double, int> pai; long long z=0; long long c=0; int p=0; int q=0; int s=0; int k=0; int zz=0; scanf("%d %d %d %d",&s, &k, &p, &q); scanf("%d", &n); x[0] = s; y[0] = k; x[n + 1] = p; y[n + 1] = q; r[0] = 0; r[n + 1] = 0; for (int i = 1; i <= n; i++){ scanf("%d %d %d", &x[i], &y[i], &r[i]); } for (int i = 0; i < n + 2; i++){ for (int j = i+1; j < n + 2; j++){ z = (y[j] - y[i])*(y[j] - y[i]); z = (x[j] - x[i])*(x[j] - x[i]) + z; a[i][j] = sqrt(z)-r[i]-r[j]; a[j][i] = sqrt(z)-r[i]-r[j]; } a[i][i] = 1; d[i] = 4000000000; e[i] = 0; } d[0] = 0; t.push(make_pair(d[0], 0)); for (int i = 0; t.empty() == 0&&e[n+1]==0; i++){ zz = 0; for (int j = 0; t.empty() == 0 && zz == 0; j++){ pai = t.top(); z = pai.second; if (e[z] == 0)zz++; else t.pop(); } if (zz == 0)break; e[z] = 1; for (int j = 0; j < n+2; j++){ if (d[z] + a[z][j] < d[j]) { d[j] = d[z] + a[z][j]; t.push(make_pair(-d[j],j)); } } t.pop(); } double m; long long dd[20]; for(int i=0;i<20;i++){ dd[i]=0; } m = d[n + 1]; for (int i = 0; i < 11; i++){ if (i<10)dd[i] = round(m - 0.4999999999); else dd[i] = round(m); if (dd[i] != m)dd[i] = round(m - 0.5); m = m - dd[i]; m = m * 10; printf("%lld", dd[i]); if (i == 0)printf("."); } printf("\n"); return 0; }
a.cc: In function 'int main()': a.cc:17:11: error: expected primary-expression before ';' token 17 | for(int j=;j<1002;j++){ | ^
s114177815
p03864
C++
<>=~$";$\+=$-=$%+$_-$',$%=$_-$-for glob<>;print
a.cc:1:6: warning: missing terminating " character 1 | <>=~$";$\+=$-=$%+$_-$',$%=$_-$-for glob<>;print | ^ a.cc:1:6: error: missing terminating " character 1 | <>=~$";$\+=$-=$%+$_-$',$%=$_-$-for glob<>;print | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:1:1: error: expected unqualified-id before '<' token 1 | <>=~$";$\+=$-=$%+$_-$',$%=$_-$-for glob<>;print | ^
s595027677
p03864
C++
#include <algorithm> #include <complex> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (n); i++) #define rrep(i, n) for (int i = (n)-1; i >= 0; i--) using namespace std; typedef long long int lli; lli MOD = 1000000007; struct P { complex<double> p; double r; P(double a, double b, double c) { p = complex<double>(a, b); r = c; } }; #define UF_MAX 1005 struct UFind { int par[UF_MAX]; int rank[UF_MAX]; int count[UF_MAX]; UFind(int n) { rep(i, n) { par[i] = i; rank[i] = 0; count[i] = 1; } } int find(int x) { if (par[x] == x) { return x; } else { return par[x] = find(par[x]); } } void unite(int x, int y) { x = find(x); y = find(y); if (x == y) return; if (rank[x] < rank[y]) { par[x] = y; count[y] += count[x]; } else { par[y] = x; count[x] += count[y]; if (rank[x] == rank[y]) rank[x]++; } } bool same(int x, int y) { return find(x) == find(y); } }; int main() { double a, b, c, cc; cin >> a >> b >> c >> cc; complex<double> s = complex<double>(a, b), t = complex<double>(c, cc); int n; cin >> n; vector<P> d; vector<pair<int, double>> e[1005]; rep(i, n) { cin >> a >> b >> c; d.push_back(P(a, b, c)); } d.push_back(P(s.real(), s.imag(), 0)); d.push_back(P(t.real(), t.imag(), 0)); UFind uf(n + 2); rep(i, n + 2) rep(j, n + 2) { if (j == i) continue; double dis = max(0.0, sqrt(norm(d[i].p - d[j].p)) - d[i].r - d[j].r); e[i].push_back(make_pair(j, dis)); e[j].push_back(make_pair(i, dis)); if (dis == 0.0) { uf.unite(i, j); } } // priority_queue<pair<double, int>, vector<pair<double, int>>, greater<pair<double, int>>> que; double ed[1005][1005]; rep(i, 1005) rep(j, 1005) ed[i][j] = -1; rep(i, n + 2) { int par = uf.find(i); rep(j, e[i].size()) { int to = e[i][j].first; double dd = e[i][j].second; if (uf.find(to) == par) continue; if (dd == 0.0) continue; if (ed[uf.find(to)][uf.find(par)] == -1) { ed[uf.find(to)][uf.find(par)] = dd; ed[uf.find(par)][uf.find(to)] = dd; } else if (ed[uf.find(to)][uf.find(par)] > dd) { ed[uf.find(to)][uf.find(par)] = dd; ed[uf.find(par)][uf.find(to)] = dd; } } } priority_queue<pair<double, int>, vector<pair<double, int>>> que; double di[1010]; rep(i, 1010) di[i] = -1; que.push(make_pair(0.0, n)); set<int> kouho; rep(i, n + 2) kouho.insert(uf.find(i)); int cnt = 0; while (!que.empty()) { if (cnt >= max(n * n, 1e7)) break; cnt++; pair<double, int> cur = que.top(); que.pop(); int now = cur.second; double nd = cur.first; if (di[uf.find(now)] < nd && di[uf.find(now)] != -1) continue; di[uf.find(now)] = nd; if (uf.same(now, n + 1)) break; bool used[1005] = {}; for (auto to : kouho) { if (ed[uf.find(now)][uf.find(to)] == -1) continue; if (!used[uf.find(to)] && (di[uf.find(to)] == -1 || di[uf.find(to)] > nd + ed[uf.find(now)][uf.find(to)])) { used[uf.find(to)] = true; que.push(make_pair(nd + ed[uf.find(now)][uf.find(to)], uf.find(to))); } } } printf("%.10f\n", di[uf.find(n + 1)]); //cout << di[n + 1] << endl; }
a.cc: In function 'int main()': a.cc:128:23: error: no matching function for call to 'max(int, double)' 128 | if (cnt >= max(n * n, 1e7)) | ~~~^~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, 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:128:23: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'double') 128 | if (cnt >= max(n * n, 1e7)) | ~~~^~~~~~~~~~~~ /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:128:23: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 128 | if (cnt >= max(n * n, 1e7)) | ~~~^~~~~~~~~~~~
s450172628
p03864
C++
#include <iostream> 2.using namespace std; 3.int a[100010]; 4.int main() { 5. int n,x; 6. cin>>n>>x; 7. for(int i=1;i<=n;i++){ 8. cin>>a[i]; 9. } 10. int ans=0; 11. for(int i=2;i<=n;i++){ 12. if(a[i]+a[i-1]>x){ 13. ans+=a[i]+a[i-1]-x; 14. a[i]-=a[i]+a[i-1]-x; 15. 16. } 17. } 18. cout<<ans; 19. return 0; 20.}
a.cc:3:1: error: expected unqualified-id before numeric constant 3 | 2.using namespace std; | ^~~~~~~ a.cc:5:1: error: expected unqualified-id before numeric constant 5 | 3.int a[100010]; | ^~~~~ a.cc:7:1: error: expected unqualified-id before numeric constant 7 | 4.int main() { | ^~~~~
s270984936
p03864
C++
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main(){ int N, x, cnt=0,sum=0; cin>>N>>x; bool flg=true; vector<int> a(N), b(N-1); for(int i=0;i<N;i++){ cin>>a[i]; if(i){ b[i-1]=a[i-1]+a[i]; if(b[i-1]>x) flg=false; } sum+=a[i]; } if(flg){cout<<cnt<<endl; return 0;} if(!x){cout<<sum<<endl; return 0;} for(int i=0;i<N-1;i++){ if(b[i]>x){ cnt+=b[i]-x; if(i!=N-2){ b[i+1]-=b[i]-x; b[i+1]=max(b[i+1],0); } } cout<<cnt<<endl; return 0; }
a.cc: In function 'int main()': a.cc:29:2: error: expected '}' at end of input 29 | } | ^ a.cc:6:11: note: to match this '{' 6 | int main(){ | ^
s588782057
p03864
C++
/*Code is modified from others*/ #include<cstdio> #include<algorithm> #include<vector> #include <iostream> #define FL(i,j,k) for(int i=j;i<k;++i) const int MAXN = 2e6; using namespace std; typedef long long ll; ll A[100000]; ll construct[100000]={0}; int main(){ ios_base::sync_with_stdio(false);cin.tie(0); int n,x;cin>>n>>x; FL(i, 0, n)cin>>A[i]; construct[0]=min(A[0],x); FL(i, 1, n){ if(construct[i]+construct[i-1]<x){ construct[i]=min(A[i],x-construct[i]-construct[i-1]); } } ll sum=0; FL(i, 0, n)sum+=A[i]-construct[i]; cout<<sum; }
a.cc: In function 'int main()': a.cc:16:21: error: no matching function for call to 'min(ll&, int&)' 16 | construct[0]=min(A[0],x); | ~~~^~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from a.cc:3: /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:16:21: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 16 | construct[0]=min(A[0],x); | ~~~^~~~~~~~ /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 In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:16:21: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 16 | construct[0]=min(A[0],x); | ~~~^~~~~~~~
s302576894
p03864
C
#include<stdio.h> int main(){ long int maxi,mini,sum,n,x,a[100010]; scanf("%ld%ld",&n,&x); for(i=0;i<n;i++){ scanf("%ld",&a[i]); } int count=0,i; for(i=0;i<n-1;i++){ if(a[i]+a[i+1]>x){ sum=a[i]+a[i+1]; maxi=(a[i]>a[i+1])?a[i]:a[i+1]; mini=(a[i]<a[i+1])?a[i]:a[i+1]; if(a[i+1]==a[i]){ maxi=a[i+1]; mini=a[i]; } if(maxi>sum-x){ maxi=maxi-sum+x; count++; } else{ maxi=0; mini=mini-(sum-x-maxi); count++; } } } return 0; }
main.c: In function 'main': main.c:5:5: error: 'i' undeclared (first use in this function) 5 | for(i=0;i<n;i++){ | ^ main.c:5:5: note: each undeclared identifier is reported only once for each function it appears in
s648426482
p03864
C
#include<stdio.h> int main(){ long int maxi,mini,sum,n,x,a[100010]; scanf("%ld%ld",&n,&x) for(i=0;i<n;i++){ scanf("%ld",&a[i]); } int count=0; for(i=0;i<n-1;i++){ if(a[i]+a[i+1]>x){ sum=a[i]+a[i+1]; maxi=(a[i]>a[i+1])?a[i]:a[i+1]; mini=(a[i]<a[i+1])?a[i]:a[i+1]; if(a[i+1]==a[i]){ maxi=a[i+1]; mini=a[i]; } if(maxi>sum-x){ maxi=maxi-sum+x; count++; } else{ maxi=0; mini=mini-(sum-x-maxi); count++; } } } return 0; }
main.c: In function 'main': main.c:4:22: error: expected ';' before 'for' 4 | scanf("%ld%ld",&n,&x) | ^ | ; 5 | for(i=0;i<n;i++){ | ~~~ main.c:9:5: error: 'i' undeclared (first use in this function) 9 | for(i=0;i<n-1;i++){ | ^ main.c:9:5: note: each undeclared identifier is reported only once for each function it appears in main.c:20:1: error: 'count' undeclared (first use in this function) 20 | count++; | ^~~~~
s853598476
p03864
C++
#include <iostream> #include <sstream> #include <algorithm> #include <string> #include <vector> #include <map> #include <set> #include <queue> #include <deque> #include <stack> #include <memory> #include <complex> #include <numeric> #include <cstdio> #include <iomanip> #define REP(i,m,n) for(int i=int(m);i<int(n);i++) #define EACH(i,c) for (auto &(i): c) #define all(c) begin(c),end(c) #define EXIST(s,e) ((s).find(e)!=(s).end()) #define SORT(c) sort(begin(c),end(c)) #define pb emplace_back #define MP make_pair #define SZ(a) int((a).size()) #ifdef LOCAL #define DEBUG(s) cout << (s) << endl #define dump(x) cerr << #x << " = " << (x) << endl #define BR cout << endl; #else #define DEBUG(s) do{}while(0) #define dump(x) do{}while(0) #define BR #endif using namespace std; using UI = unsigned int; using UL = unsigned long; using LL = long long int; using ULL = unsigned long long; using VI = vector<int>; using VVI = vector<VI>; using VLL = vector<LL>; using VS = vector<string>; using PII = pair<int,int>; using VP = vector<PII>; //struct edge {int from, to, cost;}; constexpr double EPS = 1e-10; constexpr double PI = acos(-1.0); //constexpr int INF = INT_MAX; template<class T> inline T sqr(T x) {return x*x;} int main() { LL n, x; cin >> n >> x; VI a(n); REP(i,0,n) cin >> a[i]; LL prev; prev = min(x, a[0]); LL cnt = max(0,a[0]-x); REP(i,1,n) { //cout << i << " " << prev << " " << a[i] << endl; if (prev + a[i] > x) { cnt += (LL)prev + a[i] - x; } prev = max(0,x - prev); } prev = min(x, a[n-1]); LL cnt2 = max(0,a[n-1]-x); REP(i,1,n) { //cout << i << " " << prev << " " << a[i] << endl; if (prev + a[n-1-i] > x) { cnt2 += (LL)prev + a[n-1-i] - x; } prev = max(0,x - prev); } cout << min(cnt,cnt2) << endl; //cout << cnt << endl; return 0; }
a.cc: In function 'int main()': a.cc:62:19: error: no matching function for call to 'min(LL&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)' 62 | prev = min(x, a[0]); | ~~~^~~~~~~~~ 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:62:19: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}) 62 | prev = min(x, a[0]); | ~~~^~~~~~~~~ /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 In file included from /usr/include/c++/14/algorithm:61, from a.cc:3: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:62:19: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 62 | prev = min(x, a[0]); | ~~~^~~~~~~~~ a.cc:63:21: error: no matching function for call to 'max(int, LL)' 63 | LL cnt = max(0,a[0]-x); | ~~~^~~~~~~~~~ /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:63:21: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'LL' {aka 'long long int'}) 63 | LL cnt = max(0,a[0]-x); | ~~~^~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:63:21: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 63 | LL cnt = max(0,a[0]-x); | ~~~^~~~~~~~~~ a.cc:69:27: error: no matching function for call to 'max(int, LL)' 69 | prev = max(0,x - prev); | ~~~^~~~~~~~~~~~ /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:69:27: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'LL' {aka 'long long int'}) 69 | prev = max(0,x - prev); | ~~~^~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:69:27: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 69 | prev = max(0,x - prev); | ~~~^~~~~~~~~~~~ a.cc:72:19: error: no matching function for call to 'min(LL&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)' 72 | prev = min(x, a[n-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:72:19: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}) 72 | prev = min(x, a[n-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 /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:72:19: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 72 | prev = min(x, a[n-1]); | ~~~^~~~~~~~~~~ a.cc:73:22: error: no matching function for call to 'max(int, LL)' 73 | LL cnt2 = max(0,a[n-1]-x); | ~~~^~~~~~~~~~~~ /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:73:22: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'LL' {aka 'long long int'}) 73 | LL cnt2 = max(0,a[n-1]-x); | ~~~^~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:73:22: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 73 | LL cnt2 = max(0,a[n-1]-x); | ~~~^~~~~~~~~~~~ a.cc:79:27: error: no matching function for call to 'max(int, LL)' 79 | prev = max(0,x - prev); | ~~~^~~~~~~~~~~~ /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:79:27: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'LL' {aka 'long long int'}) 79 | prev = max(0,x - prev); | ~~~
s923849572
p03864
C++
#include <iostream> #include <string> #include <queue> #include <stack> #include <algorithm> #include <list> #include <vector> #include <complex> #include <utility> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <climits> #include <bitset> #include <ctime> #include <map> #include <unordered_map> #include <set> #include <unordered_set> #include <cassert> #include <cstddef> #include <iomanip> #include <numeric> #include <tuple> #include <sstream> #include <fstream> using namespace std; #define REP(i, n) for (int (i) = 0; (i) < (n); (i)++) #define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++) #define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--) #define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--) #define DEBUG(C) cerr << #C << " = " << C << endl; using LL = long long; using VI = vector<int>; using VVI = vector<VI>; using VL = vector<LL>; using VVL = vector<VL>; using VD = vector<double>; using VVD = vector<VD>; using PII = pair<int, int>; using PDD = pair<double, double>; using PLL = pair<LL, LL>; using VPII = vector<PII>; template<typename T> using VT = vector<T>; #define ALL(a) begin((a)), end((a)) #define RALL(a) rbegin((a)), rend((a)) #define SORT(a) sort(ALL((a))) #define RSORT(a) sort(RALL((a))) #define REVERSE(a) reverse(ALL((a))) #define MP make_pair #define FORE(a, b) for (auto &&a : (b)) #define FIND(s, e) ((s).find(e) != (s).end()) #define EB emplace_back const int INF = 1e9; const int MOD = INF + 7; const LL LLINF = 1e18; #define int LL int N, x; VI a, asum; VPII pp; //(num, idx) signed main(void) { scanf("%lld%lld", &N, &x); a.resize(N); asum.resize(N - 1); pp.resize(N); for_each(ALL(a), [](int &e){scanf("%lld", &e);}); int cnt = 0; REP(i, N - 1) { int sum = a[i] + a[i + 1]; if (sum <= x) continue; int buf = sum - x; if (buf <= 0) { a[i] = a[i + 1] = 0; cnt += buf; continue; } a[i + 1] -= buf; cnt += buf; if (a[i + 1] < 0) { a[i] -= a[i + 1]; } } cout << cnt << endl; }
In file included from /usr/include/c++/14/algorithm:61, from a.cc:5: /usr/include/c++/14/bits/stl_algo.h: In instantiation of '_Funct std::for_each(_IIter, _IIter, _Funct) [with _IIter = __gnu_cxx::__normal_iterator<int*, vector<int> >; _Funct = main()::<lambda(LL&)>]': a.cc:70:13: required from here 70 | for_each(ALL(a), [](int &e){scanf("%lld", &e);}); | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:3786:12: error: no match for call to '(main()::<lambda(LL&)>) (int&)' 3786 | __f(*__first); | ~~~^~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:3786:12: note: candidate: 'void (*)(LL&)' {aka 'void (*)(long long int&)'} (conversion) /usr/include/c++/14/bits/stl_algo.h:3786:12: note: conversion of argument 2 would be ill-formed: /usr/include/c++/14/bits/stl_algo.h:3786:12: error: cannot bind non-const lvalue reference of type 'LL&' {aka 'long long int&'} to a value of type 'int' a.cc:70:22: note: candidate: 'main()::<lambda(LL&)>' (near match) 70 | for_each(ALL(a), [](int &e){scanf("%lld", &e);}); | ^ a.cc:70:22: note: conversion of argument 1 would be ill-formed: a.cc:70:22: error: cannot bind non-const lvalue reference of type 'LL&' {aka 'long long int&'} to a value of type 'int'
s804996464
p03864
C++
#define _CRT_SECURE_NO_WARNINGS #include "bits/stdc++.h" using namespace std; #define int int64_t #define CHOOSE(a) CHOOSE2 a #define CHOOSE2(a0,a1,a2,a3,x,...) x #define REP1(i, s, cond, cal) for (signed i = signed(s); i cond; i cal) #define REP2(i, s, n) REP1(i, s, < signed(n), ++) #define REP3(i, n) REP2(i, 0, n) #define rep(...) CHOOSE((__VA_ARGS__,REP1,REP2,REP3))(__VA_ARGS__) #define rrep(i, s) rep(i, s, >= 0, --) #define all(c) begin(c), end(c) #define maxup(ans, x) (ans = (ans < x ? x : ans)) #define minup(ans, x) (ans = (ans > x ? x : ans)) #define breakif(cond) if(cond) break; else using VV = vector<vector<int>>; using V = vector<int>; using P = pair<int, int>; using IP = pair<int, P>; template<typename T> inline void input(vector<T>& v) { for (auto& x : v) cin >> x; } signed main() { int n, x; cin >> n >> x; V v(n); input(v); int ans = 0; rep(i, 0, n - 1) { int sum = v[i] + v[i + 1]; if (sum > x) { ans += max(0ll, sum - x); v[i + 1] = max(0ll, v[i + 1] - (sum - x)); } } cout << ans << endl; system("pause"); }
a.cc: In function 'int main()': a.cc:36:35: error: no matching function for call to 'max(long long int, int64_t)' 36 | ans += max(0ll, sum - x); | ~~~^~~~~~~~~~~~~~ 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:2: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:36:35: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int64_t' {aka 'long int'}) 36 | ans += max(0ll, sum - x); | ~~~^~~~~~~~~~~~~~ /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:36:35: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 36 | ans += max(0ll, sum - x); | ~~~^~~~~~~~~~~~~~ a.cc:37:39: error: no matching function for call to 'max(long long int, __gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type)' 37 | v[i + 1] = max(0ll, v[i + 1] - (sum - x)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ /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:37:39: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type' {aka 'long int'}) 37 | v[i + 1] = max(0ll, v[i + 1] - (sum - x)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:37:39: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 37 | v[i + 1] = max(0ll, v[i + 1] - (sum - x)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
s307341896
p03864
C++
#include "stdio.h" int cand[100004]; int main() { int x,n,i; __int64 sum; while (scanf ("%d%d",&n,&x) != EOF) { sum = 0; for (i=0;i<n;i++) { scanf ("%d",&cand[i]); } if (cand[0] > x) { sum = cand[0]-x; cand[0] = x; } for (i=1;i<n;i++) { if (cand[i]+cand[i-1] > x) { sum += cand[i]+cand[i-1]-x; cand[i] -= cand[i]+cand[i-1]-x; } } printf ("%I64d\n",sum); } return 0; }
a.cc: In function 'int main()': a.cc:7:5: error: '__int64' was not declared in this scope; did you mean '__int64_t'? 7 | __int64 sum; | ^~~~~~~ | __int64_t a.cc:10:9: error: 'sum' was not declared in this scope 10 | sum = 0; | ^~~
s955177513
p03864
C++
#include <cstdio> #include <climits> #include <cassert> #include <iostream> #include <string> #include <algorithm> #include <numeric> #include <functional> #include <tuple> #include <list> #include <map> #include <queue> #include <stack> #include <set> #include <vector> #define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++) #define FOR(x,xs) for(auto &x: xs) using namespace std; typedef long long ll; typedef pair<int,int> PI; typedef pair<ll,ll> PL; typedef vector<int> VI; typedef vector<ll> VL; ll solve(const VL &as, ll x) { ll ans = 0; if(as[0] > x) { ans += as[0] - x; as[0] -= x; } REP(i,0,N-1) { ll s = as[i] + as[i+1]; if(s > x) { ans += s - x; as[i+1] -= s - x; } } return ans; } int main() { ios::sync_with_stdio(false); int N; ll x; cin >> N >> x; VL as(N); FOR(a,as) { cin >> a; } ll a1 = solve(as, x); reverse(as.begin(), as.end()); ll a2 = solve(as, x); cout << min(a1, a2) << endl; return 0; }
a.cc: In function 'll solve(const VL&, ll)': a.cc:31:11: error: assignment of read-only location '(& as)->std::vector<long long int>::operator[](0)' 31 | as[0] -= x; a.cc:33:11: error: 'N' was not declared in this scope 33 | REP(i,0,N-1) { | ^ a.cc:17:47: note: in definition of macro 'REP' 17 | #define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++) | ^ a.cc:37:15: error: assignment of read-only location '(& as)->std::vector<long long int>::operator[](((std::vector<long long int>::size_type)(i + 1)))' 37 | as[i+1] -= s - x;
s385665870
p03864
C++
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <iomanip> #include <map> #include <cmath> using namespace std; typedef long long int; int main() { int n, x; cin >> n >> x; int cnt = 0; vector<int>A(n); for (int i = 0; i < n; i++) { int a; cin >> a; if (a > x) { cnt += a - x; a = x; } A[i] = a; } vector<int>A1(A); int cnt1 = 0; for (int i = 1; i < n; i++) { if (A1[i] + A1[i - 1] > x) { cnt1 += A1[i] + A1[i - 1] - x; A1[i] = x - A1[i - 1]; } } vector<int>A2(A); int cnt2 = 0; for (int i = n-2; i >= 0; i--) { if (A2[i] + A2[i + 1] > x) { cnt2 += A2[i] + A2[i + 1] - x; A2[i] = x - A2[i + 1]; } } cout << cnt+min(cnt1,cnt2) << endl; return 0; }
a.cc:9:19: error: declaration does not declare anything [-fpermissive] 9 | typedef long long int; | ^~~
s935271712
p03864
C++
#include <string> #include <vector> #include <algorithm> #include <iomanip> #include <map> #include <cmath> using namespace std; int main() { int n, x; cin >> n >> x; int cnt = 0; vector<int>A(n); for (int i = 0; i < n; i++) { int a; cin >> a; if (a > x) { cnt += a - x; a = x; } A[i] = a; } vector<int>A1(A); int cnt1 = 0; for (int i = 1; i < n; i++) { if (A1[i] + A1[i - 1] > x) { cnt1 += A1[i] + A1[i - 1] - x; A1[i] = x - A1[i - 1]; } } vector<int>A2(A); int cnt2 = 0; for (int i = n-2; i >= 0; i--) { if (A2[i] + A2[i + 1] > x) { cnt2 += A2[i] + A2[i + 1] - x; A2[i] = x - A2[i + 1]; } } cout << cnt+min(cnt1,cnt2) << endl; return 0; }
a.cc: In function 'int main()': a.cc:11:19: error: 'cin' was not declared in this scope 11 | int n, x; cin >> n >> x; | ^~~ a.cc:7:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 6 | #include <cmath> +++ |+#include <iostream> 7 | using namespace std; a.cc:39:9: error: 'cout' was not declared in this scope 39 | cout << cnt+min(cnt1,cnt2) << endl; | ^~~~ a.cc:39:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
s032504467
p03864
C++
#include<cstdio> #include<iostream> #include<cmath> #include<vector> #include<string> #include<algorithm> #include<queue> #include<stack> #include<map> #include<set> #include<iomanip> #define rep(i,a,N) for(int i=0+a;i<N;i++) #define lint long long int #define SIZE 100005 #define pb push_back using namespace std; int main(){ lint n,x; cin>>n>>x; lint a[SIZE],ans=0; for(lint i=0;i<n,i++){ cin>>a[i]; } for(lint i=0;i<n-1;i++){ if(a[i]+a[i+1]>x){ ans+=a[i]+a[i+1]-x; a[i+1]-=a[i]+a[i+1]-x; } } cout<<ans; return 0; }
a.cc: In function 'int main()': a.cc:24:29: error: expected ';' before ')' token 24 | for(lint i=0;i<n,i++){ | ^ | ;
s070627233
p03864
Java
/* * Code Author: Akshay Miterani * DA-IICT */ import java.io.*; import java.math.BigInteger; import java.math.RoundingMode; import java.text.DecimalFormat; import java.util.*; public class MainA { static double eps=(double)1e-6; static long mod=(long)1e9+7; static final long INF = Long.MAX_VALUE / 100; public static void main(String args[]) throws FileNotFoundException{ InputReader in = new InputReader(System.in); OutputStream outputStream = System.out; PrintWriter out = new PrintWriter(outputStream); //----------------My Code------------------ int n=in.nextInt(); long k=in.nextInt(); long a[]=new long[n]; for(int i=0;i<n;i++){ a[i]=in.nextLong(); } long ans=0; for(int i=0;i<n-1;i++){ long del=a[i+1]+a[i]-k; if(del<=0) continue; if(del<=a[i+1]){ a[i+1]-=del; } else{ a[i]-=del-a[i+1]; a[i+1]=0; } ans+=del; } System.out.println(ans); out.close(); //----------------The End------------------ } static boolean isPrime(long x){ for(int i=2;i<=Math.sqrt(x)+1;i++){ if(x%i==0 && i!=x) return false; } return true; } static long modulo(long a,long b,long c) { long x=1; long y=a; while(b > 0){ if(b%2 == 1){ x=(x*y)%c; } y = (y*y)%c; // squaring the base b /= 2; } return x%c; } static long gcd(long x, long y) { if(x==0) return y; if(y==0) return x; long r=0, a, b; a = (x > y) ? x : y; // a is greater number b = (x < y) ? x : y; // b is smaller number r = b; while(a % b != 0) { r = a % b; a = b; b = r; } return r; } static class Pair implements Comparable<Pair>{ int x; int y; Pair(int xx,int yy){ x=xx; y=yy; } @Override public int compareTo(Pair o) { if(Long.compare(this.x, o.x)!=0) return Long.compare(this.x, o.x); else return Long.compare(this.y, o.y); } } public static void debug(Object... o) { System.out.println(Arrays.deepToString(o)); } static class InputReader { public BufferedReader reader; public StringTokenizer tokenizer; public InputReader(InputStream inputstream) { reader = new BufferedReader(new InputStreamReader(inputstream)); tokenizer = null; } public String nextLine(){ String fullLine=null; while (tokenizer == null || !tokenizer.hasMoreTokens()) { try { fullLine=reader.readLine(); } catch (IOException e) { throw new RuntimeException(e); } return fullLine; } return fullLine; } public String next() { while (tokenizer == null || !tokenizer.hasMoreTokens()) { try { tokenizer = new StringTokenizer(reader.readLine()); } catch (IOException e) { throw new RuntimeException(e); } } return tokenizer.nextToken(); } public long nextLong() { return Long.parseLong(next()); } public int nextInt() { return Integer.parseInt(next()); } } }
Main.java:11: error: class MainA is public, should be declared in a file named MainA.java public class MainA { ^ 1 error
s023254336
p03864
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; int n; ll a[200005]; ll x; int main() { ios::sync_with_stdio(0); cin >> n >>x; ll ans = 0; for(int i=0; i<n; i++) { cin >> a[i]; if (i) { ll sum = a[i] + a[i-1]; ll now = max(0LL, sum - x); a[i] -= now; a[i] = max(a[i],0); ans += now; } } cout << ans << "\n"; return 0; }
a.cc: In function 'int main()': a.cc:17:23: error: no matching function for call to 'max(ll&, int)' 17 | a[i] = max(a[i],0); | ~~~^~~~~~~~ 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:17:23: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 17 | a[i] = max(a[i],0); | ~~~^~~~~~~~ /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:17:23: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 17 | a[i] = max(a[i],0); | ~~~^~~~~~~~
s887911140
p03864
C++
#include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <climits> #include <iostream> #include <vector> #include <string> #include <sstream> #include <algorithm> #include <utility> #include <set> #include <map> #include <stack> #include <queue> #include <deque> #include <functional> using namespace std; #define int long long #define fst first #define scd second #define PB push_back #define MP make_pair #define all(a) a.begin(),a.end() #define rall(a) a.rbegin(),a.rend() #define omajinai ios::sync_with_stdio(false);cin.tie(0) #define rep(i,x) for(int i=0;i<(int)(x);++i) #define rep1(i,x) for(int i=1;i<=(int)(x);++i) using ll=long long; using ld=long double; using vi=vector<int>; using vvi=vector<vi>; using pii=pair<int, int>; using vpii=vector<pii>; template<class T,class U>ostream&operator<<(ostream&os,const pair<T,U>p){os<<"("<<p.fst<<", "<<p.scd<<")";return os;} template<class T>ostream&operator<<(ostream&os,const vector<T>v){rep(i,v.size()){if(i)os<<", ";os<<v[i];}return os;} template<typename T>T&max(T&a,T&b){if(a>=b)return a;return b;} template<typename T>T&min(T&a,T&b){if(a < b)return a;return b;} template<typename T>bool chmax(T&a,T b){if(a < b){a=b;return true;}return false;} template<typename T>bool chmin(T&a,T b){if(a > b){a=b;return true;}return false;} constexpr int inf = 1e9; constexpr ll linf = 3e18; constexpr double eps = 1e-9; int main() { int N, x; cin >> N >> x; vi a(N); rep(i, N) cin >> a[i]; ll ans = 0; for (int i = 1; i < N; ++i) { if (a[i] + a[i - 1] > x) { int v = a[i] + a[i - 1] - x; ans += v; a[i] -= v; } } cout << ans << endl; }
cc1plus: error: '::main' must return 'int'
s482718246
p03865
C++
#include<bits/stdc++.h> int main() { using namespace std; string S; cin >> S; puts((s.size() & 1) ^ (S[0] == S.back()) ? "First" : "Second"); return 0; }
a.cc: In function 'int main()': a.cc:7:11: error: 's' was not declared in this scope 7 | puts((s.size() & 1) ^ (S[0] == S.back()) ? "First" : "Second"); | ^
s483106542
p03865
C++
#include<bits/stdc++.h> using namespace std; main(){ string s; cin>>s; cout<<(s.front()==s.back())&(s.size()%2)?"Second":"first"<<endl; }
a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 3 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:5:30: error: no match for 'operator&' (operand types are 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}) 5 | cout<<(s.front()==s.back())&(s.size()%2)?"Second":"first"<<endl; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~ | | | | | std::__cxx11::basic_string<char>::size_type {aka long unsigned int} | std::basic_ostream<char>::__ostream_type {aka std::basic_ostream<char>} a.cc:5:30: note: candidate: 'operator&(int, std::__cxx11::basic_string<char>::size_type {aka long unsigned int})' (built-in) 5 | cout<<(s.front()==s.back())&(s.size()%2)?"Second":"first"<<endl; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~ a.cc:5:30: note: no known conversion for argument 1 from 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} to 'int' In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52, from a.cc:1: /usr/include/c++/14/bitset:1557:5: note: candidate: 'template<long unsigned int _Nb> std::bitset<_Nb> std::operator&(const bitset<_Nb>&, const bitset<_Nb>&)' 1557 | operator&(const bitset<_Nb>& __x, const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT | ^~~~~~~~ /usr/include/c++/14/bitset:1557:5: note: template argument deduction/substitution failed: a.cc:5:42: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::bitset<_Nb>' 5 | cout<<(s.front()==s.back())&(s.size()%2)?"Second":"first"<<endl; | ^ In file included from /usr/include/c++/14/valarray:605, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166: /usr/include/c++/14/bits/valarray_after.h:411:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)' 411 | _DEFINE_EXPR_BINARY_OPERATOR(&, struct std::__bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:411:5: note: template argument deduction/substitution failed: a.cc:5:42: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 5 | cout<<(s.front()==s.back())&(s.size()%2)?"Second":"first"<<endl; | ^ /usr/include/c++/14/bits/valarray_after.h:411:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)' 411 | _DEFINE_EXPR_BINARY_OPERATOR(&, struct std::__bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:411:5: note: template argument deduction/substitution failed: a.cc:5:42: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 5 | cout<<(s.front()==s.back())&(s.size()%2)?"Second":"first"<<endl; | ^ /usr/include/c++/14/bits/valarray_after.h:411:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 411 | _DEFINE_EXPR_BINARY_OPERATOR(&, struct std::__bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:411:5: note: template argument deduction/substitution failed: a.cc:5:42: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} 5 | cout<<(s.front()==s.back())&(s.size()%2)?"Second":"first"<<endl; | ^ /usr/include/c++/14/bits/valarray_after.h:411:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)' 411 | _DEFINE_EXPR_BINARY_OPERATOR(&, struct std::__bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:411:5: note: template argument deduction/substitution failed: a.cc:5:42: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 5 | cout<<(s.front()==s.back())&(s.size()%2)?"Second":"first"<<endl; | ^ /usr/include/c++/14/bits/valarray_after.h:411:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const valarray<typename _Dom::value_type>&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 411 | _DEFINE_EXPR_BINARY_OPERATOR(&, struct std::__bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:411:5: note: template argument deduction/substitution failed: a.cc:5:42: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} 5 | cout<<(s.front()==s.back())&(s.size()%2)?"Second":"first"<<endl; | ^ /usr/include/c++/14/valarray:1202:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__bitwise_and, _Tp>::result_type> std::operator&(const valarray<_Tp>&, const valarray<_Tp>&)' 1202 | _DEFINE_BINARY_OPERATOR(&, __bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1202:1: note: template argument deduction/substitution failed: a.cc:5:42: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::valarray<_Tp>' 5 | cout<<(s.front()==s.back())&(s.size()%2)?"Second":"first"<<endl; | ^ /usr/include/c++/14/valarray:1202:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__bitwise_and, _Tp>::result_type> std::operator&(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)' 1202 | _DEFINE_BINARY_OPERATOR(&, __bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1202:1: note: template argument deduction/substitution failed: a.cc:5:42: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::valarray<_Tp>' 5 | cout<<(s.front()==s.back())&(s.size()%2)?"Second":"first"<<endl; | ^ /usr/include/c++/14/valarray:1202:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__bitwise_and, _Tp>::result_type> std::operator&(const typename valarray<_Tp>::value_type&, const valarray<_Tp>&)' 1202 | _DEFINE_BINARY_OPERATOR(&, __bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1202:1: note: template argument deduction/substitution failed: a.cc:5:42: note: mismatched types 'const std::valarray<_Tp>' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} 5 | cout<<(s.front()==s.back())&(s.size()%2)?"Second":"first"<<endl; | ^ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41: /usr/include/c++/14/cstddef:141:3: note: candidate: 'constexpr std::byte std::operator&(byte, byte)' 141 | operator&(byte __l, byte __r) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:141:18: note: no known conversion for argument 1 from 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} to 'std::byte' 141 | operator&(byte __l, byte __r) noexcept | ~~~~~^~~ In file included from /usr/include/c++/14/streambuf:43, from /usr/include/c++/14/bits/streambuf_iterator.h:35, from /usr/include/c++/14/iterator:66, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54: /usr/include/c++/14/bits/ios_base.h:84:3: note: candidate: 'constexpr std::_Ios_Fmtflags std::operator&(_Ios_Fmtflags, _Ios_Fmtflags)' 84 | operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW | ^~~~~~~~ /usr/include/c++/14/bits/ios_base.h:84:27: note: no known conversion for argument 1 from 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} to 'std::_Ios_Fmtflags' 84 | operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ios_base.h:134:3: note: candidate: 'constexpr std::_Ios_Openmode std::operator&(_Ios_Openmode, _Ios_Openmode)' 134 | operator&(_Ios_Openmode __a, _Ios_Openmode
s323222508
p03865
C++
char buf[114514]; main(n){ n=read(0,buf,114514); n--; puts(n+(buf[0]==buf[n])&1?"First":"Second"); }
a.cc:2:5: error: expected constructor, destructor, or type conversion before '(' token 2 | main(n){ | ^
s344989362
p03865
C++
#ifndef _GLIBCXX_NO_ASSERT #include <cassert> #endif #include <cctype> #include <cerrno> #include <cfloat> #include <ciso646> #include <climits> #include <clocale> #include <cmath> #include <csetjmp> #include <csignal> #include <cstdarg> #include <cstddef> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #if __cplusplus >= 201103L #include <ccomplex> #include <cfenv> #include <cinttypes> #include <cstdalign> #include <cstdbool> #include <cstdint> #include <ctgmath> #include <cwchar> #include <cwctype> #endif #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <locale> #include <map> #include <memory> #include <new> #include <numeric> #include <ostream> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdexcept> #include <streambuf> #include <string> #include <typeinfo> #include <utility> #include <valarray> #include <vector> #if __cplusplus >= 201103L #include <array> #include <atomic> #include <chrono> #include <condition_variable> #include <forward_list> #include <future> #include <initializer_list> #include <mutex> #include <random> #include <ratio> #include <regex> #include <scoped_allocator> #include <system_error> #include <thread> #include <tuple> #include <typeindex> #include <type_traits> #include <unordered_map> #include <unordered_set> #endif #define y0 qvya13579 #define y1 qvyb24680 #define j0 qvja13579 #define j1 qvjb24680 #define next qvne13579xt #define prev qvpr13579ev #define INF 1000000007 #define MOD 1000000007 #define PI acos(-1.0) #define endl "\n" #define IOS cin.tie(0);ios::sync_with_stdio(false) #define M_P make_pair #define PU_B push_back #define PU_F push_front #define PO_B pop_back #define PO_F pop_front #define U_B upper_bound #define L_B lower_bound #define B_S binary_search #define PR_Q priority_queue #define FIR first #define SEC second #if __cplusplus < 201103L #define stoi(argument_string) atoi((argument_string).c_str()) #define stoll(argument_string) atoll((argument_string).c_str()) #endif #define REP(i,n) for(int i=0;i<(int)(n);++i) #define REP_R(i,n) for(int i=((int)(n)-1);i>=0;--i) #define FOR(i,m,n) for(int i=((int)(m));i<(int)(n);++i) #define FOR_R(i,m,n) for(int i=((int)(m)-1);i>=(int)(n);--i) #define ALL(v) (v).begin(),(v).end() #define RALL(v) (v).rbegin(),(v).rend() #define SIZ(x) ((int)(x).size()) #define CIN(x) cin>>(x) #define CIN2(x,y) cin>>(x)>>(y) #define CIN3(x,y,z) cin>>(x)>>(y)>>(z) #define CIN4(x,y,z,w) cin>>(x)>>(y)>>(z)>>(w) #define CIN5(x,y,z,w,u) cin>>(x)>>(y)>>(z)>>(w)>>(u) #define SCAND(x) scanf("%d",&(x)) #define SCAND2(x,y) scanf("%d%d",&(x),&(y)) #define SCAND3(x,y,z) scanf("%d%d%d",&(x),&(y),&(z)) #define SCAND4(x,y,z,w) scanf("%d%d%d%d",&(x),&(y),&(z),&(w)) #define SCAND5(x,y,z,w,u) scanf("%d%d%d%d%d",&(x),&(y),&(z),&(w),&(u)) #define SCANLLD(x) scanf("%lld",&(x)) #define SCANLLD2(x,y) scanf("%lld%lld",&(x),&(y)) #define SCANLLD3(x,y,z) scanf("%lld%lld%lld",&(x),&(y),&(z)) #define SCANLLD4(x,y,z,w) scanf("%lld%lld%lld%lld",&(x),&(y),&(z),&(w)) #define SCANLLD5(x,y,z,w,u) scanf("%lld%lld%lld%lld%lld",&(x),&(y),&(z),&(w),&(u)) #define I64DSCAN(x) scanf("%I64d",&(x)) #define I64DSCAN2(x,y) scanf("%I64d%I64d",&(x),&(y)) #define I64DSCAN3(x,y,z) scanf("%I64d%I64d%I64d",&(x),&(y),&(z)) #define I64DSCAN4(x,y,z,w) scanf("%I64d%I64d%I64d%I64d",&(x),&(y),&(z),&(w)) #define I64DSCAN5(x,y,z,w,u) scanf("%I64d%I64d%I64d%I64d%I64d",&(x),&(y),&(z),&(w),&(u)) #define PRINTD(x) printf("%d\n",(x)) #define PRINTLLD(x) printf("%lld\n",(x)) #define PRINTI64D(x) printf("%I64d\n",(x)) #define DEBUG(argument) cerr<<(#argument)<<" : "<<(argument)<<"\n" typedef long long int lli; using namespace std; bool compare_by_2nd(pair<int,int> a, pair<int,int> b) { if( a.second != b.second ) { return a.second < b.second; } else { return a.first < b.first; } } int ctoi(char c) { if( c >= '0' and c <= '9' ) { return (int)(c-'0'); } return -1; } int alphabet_pos(char c) { if( c >= 'a' and c <= 'z' ) { return (int)(c-'a'); } return -1; } int alphabet_pos_capital(char c) { if( c >= 'A' and c <= 'Z' ) { return (int)(c-'A'); } return -1; } vector<string> split(string str, char ch) { int first = 0; int last = str.find_first_of(ch); if(last == string::npos) { last = SIZ(str); } vector<string> result; while( first < SIZ(str) ) { string Ssubstr(str, first, last - first); result.push_back(Ssubstr); first = last + 1; last = str.find_first_of(ch, first); if(last == string::npos) { last = SIZ(str); } } return result; } int gcd( int a , int b ) // assuming a,b >= 1 { if( a < b ) { swap(a,b); } if( a == 0 ) { return b; } if( a % b == 0 ) { return b; } return gcd( b , a % b ); } long long gcd( long long a , long long b ) // assuming a,b >= 1 { if( a < b ) { swap(a,b); } if( a == 0LL ) { return b; } if( a % b == 0 ) { return b; } return gcd( b , a % b ); } int lcm( int a , int b ) // assuming a,b >= 1 { return a * b / gcd( a , b ); } long long lcm( long long a , long long b ) // assuming a,b >= 1 { return a * b / gcd( a , b ); } long long pow_fast( long long x, long long n_power , long long modulus ) { if( n_power == 0 ) { return 1; } if( n_power % 2 == 0) { return pow_fast( x * x % modulus , n_power / 2 , modulus ); } return x * pow_fast( x , n_power - 1 , modulus ) % modulus; } struct CombinationTable { vector<vector<long long> > val; CombinationTable( int size ) : val( size+1 , vector<long long>( size+1 ) ) //constructor { for( int i = 0 ; i <= size ; ++ i ) // note that 0 <= i <= size { for( int j = 0 ; j <= i ; ++ j ) { if( j == 0 or j == i ) { val[i][j] = 1LL; } else { val[i][j] = val[i-1][j-1] + val[i-1][j]; } } } } }; void print_vector(vector<int>& h) { int L = h.size(); for(int i = 0; i < L; ++ i) { printf("%d",h[i]); if( i != L-1 ) { printf(" "); } else { printf("\n"); } } } void print_vector(vector<long long>& h) { int L = h.size(); for(int i = 0; i < L; ++ i) { printf("%lld",h[i]); if( i != L-1 ) { printf(" "); } else { printf("\n"); } } } void print_matrix2D(vector<vector<int> >& h) { int Ly = h.size(); int Lx = h[0].size(); for(int i = 0; i < Ly; ++ i) { for(int j = 0; j < Lx; ++ j) { printf("%d",h[i][j]); if( j != Lx-1 ) { printf(" "); } else { printf("\n"); } } } } void print_matrix2D(vector<vector<long long> >& h) { int Ly = h.size(); int Lx = h[0].size(); for(int i = 0; i < Ly; ++ i) { for(int j = 0; j < Lx; ++ j) { printf("%lld",h[i][j]); if( j != Lx-1 ) { printf(" "); } else { printf("\n"); } } } } void print_matrix2D(vector<string>& h) { int Ly = h.size(); int Lx = h[0].size(); for(int i = 0; i < Ly; ++ i) { for(int j = 0; j < Lx; ++ j) { printf("%c",h[i][j]); } printf("\n"); } } struct UnionFind //size-based { vector<int> parent, treesize; UnionFind( int size ) : parent( size ) , treesize( size , 1 ) //constructor { for( int i = 0 ; i < size ; ++ i ) { parent[i] = i; } } int root( int x ) { if( parent[x] == x ) { return x; } return parent[x] = root(parent[x]); } void unite( int x, int y ) { x = root(x); y = root(y); if( x == y ) { return; } if( treesize[x] < treesize[y] ) { parent[x] = y; treesize[y] += treesize[x]; } else { parent[y] = x; treesize[x] += treesize[y]; } } bool sametree( int x, int y ) { return root(x) == root(y); } int gettreesize( int x ) { return treesize[root(x)]; } }; template< typename Type_value > struct SegmentTree //Range Minimum Query (RMQ) { private: int n; vector<Type_value> node; Type_value identity_element_segmenttree; public: SegmentTree( vector<Type_value> v, Type_value identity_element_st ) //constructor { int sz = v.size(); identity_element_segmenttree = identity_element_st; n = 1; while(n < sz) { n <<= 1; } node.resize(2*n-1, identity_element_segmenttree); for( int i = 0 ; i < sz ; ++ i ) { node[i+n-1] = v[i]; } for( int i = n-2 ; i >= 0 ; -- i ) { node[i] = min(node[2*i+1], node[2*i+2]); } } void update(int x, Type_value val) { x += (n - 1); node[x] = val; while( x > 0 ) { x = (x - 1) / 2; node[x] = min(node[2*x+1], node[2*x+2]); } } Type_value getmin( int a, int b, int k = 0, int l = 0, int r = -1 ) //getting minimum value in [a,b) { // k : index of the referred node // [l,r) : range covered by the k-th node if( r < 0 ) { r = n; } if( r <= a or b <= l ) { return identity_element_segmenttree; } if( a <= l and r <= b ) { return node[k]; } Type_value vl = getmin(a, b, 2*k+1, l, (l+r)/2); Type_value vr = getmin(a, b, 2*k+2, (l+r)/2, r); return min(vl, vr); } }; template< typename Type_value > struct BinaryIndexedTree //Range Sum Query (RSQ), 0-indexed { private: int size_; vector< Type_value > data; public: BinaryIndexedTree(int sz, Type_value identity_element_binaryindexedtree = 0.0 ) // constructor { size_ = sz; data.resize(sz+1,identity_element_binaryindexedtree); } Type_value sum(int i) //sum within [0,i) { if( i <= 0 ) { return (Type_value) 0.0; } if( i > size_ ) { i = size_; } Type_value sm = 0.0; while( i > 0 ) { sm += data[i]; i -= i & -i; } return sm; } void add(int i, Type_value x) { if( i < 0 or i >= size_ ) { return; } ++ i; while( i <= size_ ) { data[i] += x; i += i & -i; } } }; /*------------------ the end of the template -----------------------*/ signed main() { IOS; /* making cin faster */ string S; CIN(S); if( S[0] == S[N-1] ) { if( N % 2 == 0 ) { cout << "First" << endl; } else { cout << "Second" << endl; } } else { if( N % 2 == 1 ) { cout << "First" << endl; } else { cout << "Second" << endl; } } }
a.cc: In function 'int main()': a.cc:621:17: error: 'N' was not declared in this scope 621 | if( S[0] == S[N-1] ) | ^
s746420273
p03865
C++
#ifndef _GLIBCXX_NO_ASSERT #include <cassert> #endif #include <cctype> #include <cerrno> #include <cfloat> #include <ciso646> #include <climits> #include <clocale> #include <cmath> #include <csetjmp> #include <csignal> #include <cstdarg> #include <cstddef> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #if __cplusplus >= 201103L #include <ccomplex> #include <cfenv> #include <cinttypes> #include <cstdalign> #include <cstdbool> #include <cstdint> #include <ctgmath> #include <cwchar> #include <cwctype> #endif #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <locale> #include <map> #include <memory> #include <new> #include <numeric> #include <ostream> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdexcept> #include <streambuf> #include <string> #include <typeinfo> #include <utility> #include <valarray> #include <vector> #if __cplusplus >= 201103L #include <array> #include <atomic> #include <chrono> #include <condition_variable> #include <forward_list> #include <future> #include <initializer_list> #include <mutex> #include <random> #include <ratio> #include <regex> #include <scoped_allocator> #include <system_error> #include <thread> #include <tuple> #include <typeindex> #include <type_traits> #include <unordered_map> #include <unordered_set> #endif #define y0 qvya13579 #define y1 qvyb24680 #define j0 qvja13579 #define j1 qvjb24680 #define next qvne13579xt #define prev qvpr13579ev #define INF 1000000007 #define MOD 1000000007 #define PI acos(-1.0) #define endl "\n" #define IOS cin.tie(0);ios::sync_with_stdio(false) #define M_P make_pair #define PU_B push_back #define PU_F push_front #define PO_B pop_back #define PO_F pop_front #define U_B upper_bound #define L_B lower_bound #define B_S binary_search #define PR_Q priority_queue #define FIR first #define SEC second #if __cplusplus < 201103L #define stoi(argument_string) atoi((argument_string).c_str()) #define stoll(argument_string) atoll((argument_string).c_str()) #endif #define REP(i,n) for(int i=0;i<(int)(n);++i) #define REP_R(i,n) for(int i=((int)(n)-1);i>=0;--i) #define FOR(i,m,n) for(int i=((int)(m));i<(int)(n);++i) #define FOR_R(i,m,n) for(int i=((int)(m)-1);i>=(int)(n);--i) #define ALL(v) (v).begin(),(v).end() #define RALL(v) (v).rbegin(),(v).rend() #define SIZ(x) ((int)(x).size()) #define CIN(x) cin>>(x) #define CIN2(x,y) cin>>(x)>>(y) #define CIN3(x,y,z) cin>>(x)>>(y)>>(z) #define CIN4(x,y,z,w) cin>>(x)>>(y)>>(z)>>(w) #define CIN5(x,y,z,w,u) cin>>(x)>>(y)>>(z)>>(w)>>(u) #define SCAND(x) scanf("%d",&(x)) #define SCAND2(x,y) scanf("%d%d",&(x),&(y)) #define SCAND3(x,y,z) scanf("%d%d%d",&(x),&(y),&(z)) #define SCAND4(x,y,z,w) scanf("%d%d%d%d",&(x),&(y),&(z),&(w)) #define SCAND5(x,y,z,w,u) scanf("%d%d%d%d%d",&(x),&(y),&(z),&(w),&(u)) #define SCANLLD(x) scanf("%lld",&(x)) #define SCANLLD2(x,y) scanf("%lld%lld",&(x),&(y)) #define SCANLLD3(x,y,z) scanf("%lld%lld%lld",&(x),&(y),&(z)) #define SCANLLD4(x,y,z,w) scanf("%lld%lld%lld%lld",&(x),&(y),&(z),&(w)) #define SCANLLD5(x,y,z,w,u) scanf("%lld%lld%lld%lld%lld",&(x),&(y),&(z),&(w),&(u)) #define I64DSCAN(x) scanf("%I64d",&(x)) #define I64DSCAN2(x,y) scanf("%I64d%I64d",&(x),&(y)) #define I64DSCAN3(x,y,z) scanf("%I64d%I64d%I64d",&(x),&(y),&(z)) #define I64DSCAN4(x,y,z,w) scanf("%I64d%I64d%I64d%I64d",&(x),&(y),&(z),&(w)) #define I64DSCAN5(x,y,z,w,u) scanf("%I64d%I64d%I64d%I64d%I64d",&(x),&(y),&(z),&(w),&(u)) #define PRINTD(x) printf("%d\n",(x)) #define PRINTLLD(x) printf("%lld\n",(x)) #define PRINTI64D(x) printf("%I64d\n",(x)) #define DEBUG(argument) cerr<<(#argument)<<" : "<<(argument)<<"\n" typedef long long int lli; using namespace std; bool compare_by_2nd(pair<int,int> a, pair<int,int> b) { if( a.second != b.second ) { return a.second < b.second; } else { return a.first < b.first; } } int ctoi(char c) { if( c >= '0' and c <= '9' ) { return (int)(c-'0'); } return -1; } int alphabet_pos(char c) { if( c >= 'a' and c <= 'z' ) { return (int)(c-'a'); } return -1; } int alphabet_pos_capital(char c) { if( c >= 'A' and c <= 'Z' ) { return (int)(c-'A'); } return -1; } vector<string> split(string str, char ch) { int first = 0; int last = str.find_first_of(ch); if(last == string::npos) { last = SIZ(str); } vector<string> result; while( first < SIZ(str) ) { string Ssubstr(str, first, last - first); result.push_back(Ssubstr); first = last + 1; last = str.find_first_of(ch, first); if(last == string::npos) { last = SIZ(str); } } return result; } int gcd( int a , int b ) // assuming a,b >= 1 { if( a < b ) { swap(a,b); } if( a == 0 ) { return b; } if( a % b == 0 ) { return b; } return gcd( b , a % b ); } long long gcd( long long a , long long b ) // assuming a,b >= 1 { if( a < b ) { swap(a,b); } if( a == 0LL ) { return b; } if( a % b == 0 ) { return b; } return gcd( b , a % b ); } int lcm( int a , int b ) // assuming a,b >= 1 { return a * b / gcd( a , b ); } long long lcm( long long a , long long b ) // assuming a,b >= 1 { return a * b / gcd( a , b ); } long long pow_fast( long long x, long long n_power , long long modulus ) { if( n_power == 0 ) { return 1; } if( n_power % 2 == 0) { return pow_fast( x * x % modulus , n_power / 2 , modulus ); } return x * pow_fast( x , n_power - 1 , modulus ) % modulus; } struct CombinationTable { vector<vector<long long> > val; CombinationTable( int size ) : val( size+1 , vector<long long>( size+1 ) ) //constructor { for( int i = 0 ; i <= size ; ++ i ) // note that 0 <= i <= size { for( int j = 0 ; j <= i ; ++ j ) { if( j == 0 or j == i ) { val[i][j] = 1LL; } else { val[i][j] = val[i-1][j-1] + val[i-1][j]; } } } } }; void print_vector(vector<int>& h) { int L = h.size(); for(int i = 0; i < L; ++ i) { printf("%d",h[i]); if( i != L-1 ) { printf(" "); } else { printf("\n"); } } } void print_vector(vector<long long>& h) { int L = h.size(); for(int i = 0; i < L; ++ i) { printf("%lld",h[i]); if( i != L-1 ) { printf(" "); } else { printf("\n"); } } } void print_matrix2D(vector<vector<int> >& h) { int Ly = h.size(); int Lx = h[0].size(); for(int i = 0; i < Ly; ++ i) { for(int j = 0; j < Lx; ++ j) { printf("%d",h[i][j]); if( j != Lx-1 ) { printf(" "); } else { printf("\n"); } } } } void print_matrix2D(vector<vector<long long> >& h) { int Ly = h.size(); int Lx = h[0].size(); for(int i = 0; i < Ly; ++ i) { for(int j = 0; j < Lx; ++ j) { printf("%lld",h[i][j]); if( j != Lx-1 ) { printf(" "); } else { printf("\n"); } } } } void print_matrix2D(vector<string>& h) { int Ly = h.size(); int Lx = h[0].size(); for(int i = 0; i < Ly; ++ i) { for(int j = 0; j < Lx; ++ j) { printf("%c",h[i][j]); } printf("\n"); } } struct UnionFind //size-based { vector<int> parent, treesize; UnionFind( int size ) : parent( size ) , treesize( size , 1 ) //constructor { for( int i = 0 ; i < size ; ++ i ) { parent[i] = i; } } int root( int x ) { if( parent[x] == x ) { return x; } return parent[x] = root(parent[x]); } void unite( int x, int y ) { x = root(x); y = root(y); if( x == y ) { return; } if( treesize[x] < treesize[y] ) { parent[x] = y; treesize[y] += treesize[x]; } else { parent[y] = x; treesize[x] += treesize[y]; } } bool sametree( int x, int y ) { return root(x) == root(y); } int gettreesize( int x ) { return treesize[root(x)]; } }; template< typename Type_value > struct SegmentTree //Range Minimum Query (RMQ) { private: int n; vector<Type_value> node; Type_value identity_element_segmenttree; public: SegmentTree( vector<Type_value> v, Type_value identity_element_st ) //constructor { int sz = v.size(); identity_element_segmenttree = identity_element_st; n = 1; while(n < sz) { n <<= 1; } node.resize(2*n-1, identity_element_segmenttree); for( int i = 0 ; i < sz ; ++ i ) { node[i+n-1] = v[i]; } for( int i = n-2 ; i >= 0 ; -- i ) { node[i] = min(node[2*i+1], node[2*i+2]); } } void update(int x, Type_value val) { x += (n - 1); node[x] = val; while( x > 0 ) { x = (x - 1) / 2; node[x] = min(node[2*x+1], node[2*x+2]); } } Type_value getmin( int a, int b, int k = 0, int l = 0, int r = -1 ) //getting minimum value in [a,b) { // k : index of the referred node // [l,r) : range covered by the k-th node if( r < 0 ) { r = n; } if( r <= a or b <= l ) { return identity_element_segmenttree; } if( a <= l and r <= b ) { return node[k]; } Type_value vl = getmin(a, b, 2*k+1, l, (l+r)/2); Type_value vr = getmin(a, b, 2*k+2, (l+r)/2, r); return min(vl, vr); } }; template< typename Type_value > struct BinaryIndexedTree //Range Sum Query (RSQ), 0-indexed { private: int size_; vector< Type_value > data; public: BinaryIndexedTree(int sz, Type_value identity_element_binaryindexedtree = 0.0 ) // constructor { size_ = sz; data.resize(sz+1,identity_element_binaryindexedtree); } Type_value sum(int i) //sum within [0,i) { if( i <= 0 ) { return (Type_value) 0.0; } if( i > size_ ) { i = size_; } Type_value sm = 0.0; while( i > 0 ) { sm += data[i]; i -= i & -i; } return sm; } void add(int i, Type_value x) { if( i < 0 or i >= size_ ) { return; } ++ i; while( i <= size_ ) { data[i] += x; i += i & -i; } } }; /*------------------ the end of the template -----------------------*/ signed main() { IOS; /* making cin faster */ string S; CIN(S); if( S[0] == S[N-1] ) { if( N % 2 == 0 ) { cout << "First" << endl; } else { cout << "Second" << endl; } else { if( N % 2 == 1 ) { cout << "First" << endl; } else { cout << "Second" << endl; } } }
a.cc: In function 'int main()': a.cc:621:17: error: 'N' was not declared in this scope 621 | if( S[0] == S[N-1] ) | ^ a.cc:634:3: error: expected '}' before 'else' 634 | else | ^~~~ a.cc:622:5: note: to match this '{' 622 | { | ^
s453627084
p03865
C++
#include <bits/stdc++.h> using namespace std; int main(){ string s; cin >> s; printf("%s",((s[0]==s[s.size()-1])^(n%2==0))?"Second":"First"); }
a.cc: In function 'int main()': a.cc:6:41: error: 'n' was not declared in this scope 6 | printf("%s",((s[0]==s[s.size()-1])^(n%2==0))?"Second":"First"); | ^
s225717335
p03865
C++
#include "bits/stdc++.h" using namespace std; int main() { string s; cin >> s; if (s.size() % 2 == 0 ^ s[0] == s[s.size() - 1])puts("Second"); else puts("First"); }
a.cc:6:5: error: extended character   is not valid in an identifier 6 | else puts("First"); | ^ a.cc: In function 'int main()': a.cc:6:5: error: 'else\U00003000puts' was not declared in this scope 6 | else puts("First"); | ^~~~~~~~~~
s714514709
p03865
C++
#include <iostream> #include <string> #include <utility> #include <stack> #include <vector> #include <queue> #include <algorithm> #include <map> #include <climits> #include <set> using namespace std; int main(){ string S; cin >> S; if(S[0] != S[S.size() - 1]){ if(S.size() % 2 == 0){ cout << "Second" << endl; } else { cout << "First" << endl; } } else { if(S.size() % 2 = 0){ cout << "First" << endl; } else { cout << "Second" << endl; } } return 0; }
a.cc: In function 'int main()': a.cc:24:21: error: lvalue required as left operand of assignment 24 | if(S.size() % 2 = 0){ | ~~~~~~~~~^~~
s948223963
p03865
C++
#include <bits/stdc++.h> #define REP(i,n) for(int i=0;i<n;i++) #define REPP(i,n) for(int i=1;i<=n;i++) const double PI = acos(-1); const double EPS = 1e-15; long long INF=(long long)1E17; #define i_7 (long long)(1E9+7) long mod(long a){ long long c=a%i_7; if(c>=0)return c; return c+i_7; } using namespace std; bool prime(int n){ if(n==1){ return false; }else if(n==2){ return true; }else{ for(int i=2;i<=sqrt(n);i++){ if(n%i==0){ return false; } } return true; } } long long gcd(long long a, long long b){ if(a<b){ swap(a,b); } if(a%b==0){ return b; }else{ return gcd(b,a%b); } } long long lcm(long long x, long long y){ return (x/gcd(x,y))*y; } class UnionFind { public: //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。 vector<int> Parent; //クラスを作るときは、Parentの値を全て-1にする。 //以下のようにすると全てバラバラの頂点として解釈できる。 UnionFind(int N) { Parent = vector<int>(N, -1); } //Aがどのグループに属しているか調べる int root(int A) { if (Parent[A] < 0) return A; return Parent[A] = root(Parent[A]); } //自分のいるグループの頂点数を調べる int size(int A) { return -Parent[root(A)];//先祖をrootで取っておきたい。 } //AとBをくっ付ける bool connect(int A, int B) { //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける A = root(A); B = root(B); if (A == B) { //すでにくっついてるからくっ付けない return false; } //大きい方(A)に小さいほう(B)をくっ付けたい //大小が逆だったらAとBをひっくり返す。 if (size(A) < size(B)) swap(A, B); //Aのサイズを更新する Parent[A] += Parent[B]; //Bの親をAに変更する Parent[B] = A; return true; } }; int main(){ string s; cin>>s; bool type,odd; bool turn_odd; if((int)s.size%2==1){ odd = true; }else{ odd = false; } if(s[0]==s[-1]){ type = true; }else{ type = false; } if(type){ if(odd){ turn_odd = false; }else{ turn_odd = true; } }else{ if(odd){ turn_odd = true; }else{ turn_odd = false; } } if(turn_odd){ cout<<"Second"<<endl; }else{ cout<<"First"<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:94:13: 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 '()' ?) 94 | if((int)s.size%2==1){ | ~~^~~~ | ()
s298329422
p03865
C++
#include <stdio.h> #include <algorithm> #include <iostream> #include <vector> #include <assert.h> #include <map> #include <set> #include <unordered_set> #include <unordered_map> #include <math.h> #include <string> #include <string.h> #include <queue> #include <complex> #include <iomanip> #include <stack> using namespace std; typedef long long int ll; typedef unsigned long long int ull; ll mod=1e9+7; double eps=1e-7; ll exp(ll x,ll y){if(y<0) return 0; ll ret=1;for(;y;y>>=1,x=(x*x)%mod){if(y&1)ret=(ret*x)%mod;}return ret;} ull pexp(ull x,ull y){if(y<0) return 0; ull ret=1; for(;y;y>>=1,x=(x*x)){if(y&1)ret=(ret*x);}return ret;} ll gcd(ll x,ll y){if(!x||!y) return x+y; return x%y==0?y:gcd(y,x%y);} ll lcm(ll x,ll y){return x*(y/gcd(x,y));} ll bsum(ll u,ll b){ll ret=0;if(u<b)return u;while(u){ret+=u%b;u/=b;}return ret;} ll prival(ll u,ll p){ll cn=0;while(u%p==0){cn++;u=u/p;}return cn;} ll minv(ll a,ll b){return 1<a?b-minv(b%a,a)*b/a:1;} ll extm(ll a,ll b){ll ret=0;while(a!=0){if(a%2==1){ret+=b;ret%=mod;}a>>=1;b=(2*b)%mod;}return ret;} ll eaphi(ll x){ll t=x,ret=x,i;for(i=2;i*i<=x;i++){if(t%i==0){ret-=ret/i;while(t%i==0) t/=i;}}if(t!=1) ret-=ret/t;return ret;} ll eadivc(ll x){ll ret=0;ll i;for(i=1;i*i<=x;i++){if(x%i==0 && i*i!=x) ret+=2;if(x%i==0 && i*i==x) ret+=1;}return ret;} ll eadivs(ll x){ll ret=0;ll i;for(i=1;i*i<=x;i++){if(x%i==0 && i*i!=x) ret+=i+x/i;if(x%i==0 && i*i==x) ret+=i;}return ret;} ll ndig(ll x, ll b){ll ret=0;while(x){x/=b; ret++;}return ret;} ll rev(ll n, ll b){ll ret=0;while(n){ret=b*ret+n%b; n/=b;}return ret;} ll sq(ll x){ll t=(ll)sqrt(x); for(ll i=t-2 ; i<=t+2 ; i++) if(i*i==x) return abs(i); return -1;} ll extexp(ll x,ll y){if(y<0) return 0; ll ret=1;for(;y;y>>=1,x=extm(x,x)){if(y&1)ret=extm(ret,x);}return ret;} bool isprime(ll x){if(x<=1) return false; for(ll i=2;i*i<=x;i++){if(x%i==0){return false;}}return true;} string s; int n, u, v; int main(void) { cin>>s; n=s.length(); u=n%2; if(s[0]==s[n-1]) v=1; if(u==v) cout<<"Second"; else cout<<"First" return 0; } // it may be easier than you think // it may be harder than you think // ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
a.cc: In function 'int main()': a.cc:45:27: error: expected ';' before 'return' 45 | else cout<<"First" | ^ | ; 46 | return 0; | ~~~~~~
s559934131
p03865
C++
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int l = s.length(); bool f = if ((s[0] == s[l-1]) ^ (l % 2 == 1)) { cout << "Second"; } else { cout << "First"; } cout << endl; }
a.cc: In function 'int main()': a.cc:11:3: error: expected primary-expression before 'if' 11 | if ((s[0] == s[l-1]) ^ (l % 2 == 1)) { | ^~
s701052321
p03865
C++
#include<iostream> #include <string> using namespace std; int main(){ string s; cin>>s; cout<<((s.size()%2==0)==(s[0]==s[s.size()-1])?"First":"Second")<<endl }
a.cc: In function 'int main()': a.cc:7:72: error: expected ';' before '}' token 7 | cout<<((s.size()%2==0)==(s[0]==s[s.size()-1])?"First":"Second")<<endl | ^ | ; 8 | } | ~
s906755153
p03865
C++
/*input */ #include<bits/stdc++.h> using namespace std; #define int long long #define double long double #define f first #define s second #define mp make_pair #define pb push_back #define RE(i,n) for (int i = 1; i <= n; i++) #define RED(i,n) for (int i = n; i > 0; i--) #define REPS(i,n) for(int i = 1; (i*i) <= n; i++) #define REP(i,n) for (int i = 0; i < n; i++) #define FOR(i,a,b) for (int i = a; i < b; i++) #define REPD(i,n) for (int i = n-1; i >= 0; i--) #define FORD(i,a,b) for (int i = a; i >= b; i--) #define remax(a,b) a = max(a,b) #define remin(a,b) a = min(a,b) #define all(v) v.begin(),v.end() #define pii pair<int,int> #define mii map<int,int> #define vi vector<int> #define vvi vector<vi> #define WL(t) while(t --) #define gcd(a,b) __gcd((a),(b)) #define lcm(a,b) ((a)*(b))/gcd((a),(b)) #define print(arr) for (auto it = arr.begin(); it != arr.end(); ++it) cout << *it << " "; cout << endl; #define debug(x) cout << x << endl; #define debug2(x,y) cout << x << " " << y << endl; #define debug3(x,y,z) cout << x << " " << y << " " << z << endl; const int INF = 1e18+1; const int MOD = 1e9+7; const double PI = 3.14159265358979323846264338; int fast_ex(int a,int n,int m){ if(n == 0)return 1; if(n == 1)return a; int x = 1; x *= fast_ex(a,n/2,m); x %= m; x *= x; x %= m; if(n%2)x*= a; x %= m; return x; } void solve(){ string a;cin >> a; int i = 0; int j = a.size();j--; while(i < j){ if(a[i] != a[j]){cout << "Second";return 0;} i++;j--; } cout << "First"; } signed main(){ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); //freopen(".in","r",stdin);freopen(".out","w",stdout); int t = 1;//cin >> t; WL(t)solve(); return 0; }
a.cc: In function 'void solve()': a.cc:57:58: error: return-statement with a value, in function returning 'void' [-fpermissive] 57 | if(a[i] != a[j]){cout << "Second";return 0;} | ^
s326827781
p03865
C++
#include <algorithm> #include <iostream> #include <vector> #include <math.h> #include <set> #include <map> #include <string> #include <stack> #include <queue> #include <iomanip> #include <numeric> #include <tuple> #include <bitset> #include <complex> #include <unistd.h> #include <cassert> #include <cctype> #include <random> #define _USE_MATH_DEFINES #define _GLIBCXX_DEBUG using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> plglg; typedef pair<double, ll> pdlg; typedef tuple<int, int, int> tiii; typedef tuple<ll, ll, ll> tlglglg; typedef tuple<double, double, double> tddd; typedef complex<double> xy_t; int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; double pi = 3.141592653589793; ll mod = 1000000007; int intmax = 2147483647; int intmin = -2147483648; ll llmax = 9223372036854775807; ll llmin = -9223372036854775807; int iinf = intmax / 8; ll inf = llmax / 8; double eps = 1e-11; int main() { string s; cin >> s; int len = s.size(); char fir = s[0]; char las = s[len - 1]; if (far == las) { if (len % 2 == 0) { cout << "First" << endl; } else { cout << "Second" << endl; } } else { if (len % 2 == 0) { cout << "Second" << endl; } else { cout << "First" << endl; } } }
a.cc: In function 'int main()': a.cc:48:9: error: 'far' was not declared in this scope; did you mean 'fir'? 48 | if (far == las) { | ^~~ | fir
s882336369
p03865
C++
#include <bits/stdc++.h> using namespace std; int main(){ string s; cin >> s; int n = s.size(); cout << ( ( (s[0] == s[n-1]) ^ (n%2 == 1)) )? "First" : "Second") << endl; }
a.cc: In function 'int main()': a.cc:9:75: error: expected ';' before ')' token 9 | cout << ( ( (s[0] == s[n-1]) ^ (n%2 == 1)) )? "First" : "Second") << endl; | ^ | ;
s417079661
p03865
C++
#include <iostream> #include <climits> #include <stack> #include <queue> #include <string> #include <random> #include <utility> #include <cmath> #include <string.h> #include <iomanip> #include <stdlib.h> #include <algorithm> #include <vector> using namespace std; typedef long long ll; typedef pair<ll,ll> P; long long int INF = 1e18; double Pi = 3.141592653589; const int mod = 1000000007; // memset(a,0,sizeof(a)); →全部0にする struct edge{int to,cost;}; vector<int> G[100005]; long long int n,m,i,j=1,t; int dx[8]={1,0,-1,0,1,1,-1,-1}; int dy[8]={0,1,0,-1,1,-1,-1,1,}; std::vector<P> tree[100010]; long long int dp[100005]; bool used[100005]; char s[100005]; int main(){ cin>>s; m=0 n=strlen(s); if(s[0]==s[n-1])m++; if(n%2==0)m++; if(m%2==0)cout<<"First"; else cout<<"Second"; cout<<endl; return 0; }
a.cc: In function 'int main()': a.cc:40:12: error: expected ';' before 'n' 40 | m=0 | ^ | ; 41 | n=strlen(s); | ~
s976722714
p03865
C++
#include <bits/stdc++.h> using namespace std; int main(){ string s; cin >> s; char L=s[0], R=s[s.size()-1]; if(L == R && s.size()%2 == 0 || L != R && s.size()%2 == 1){ cout << first << endl; }else{ cout << second << endl; } }
a.cc: In function 'int main()': a.cc:9:17: error: 'first' was not declared in this scope 9 | cout << first << endl; | ^~~~~ a.cc:11:17: error: 'second' was not declared in this scope 11 | cout << second << endl; | ^~~~~~
s729599665
p03865
C++
# include <iostream> # include <algorithm> # include <vector> # include <string> # include <set> # include <map> # include <cmath> # include <iomanip> # include <functional> # include <utility> # include <stack> # include <queue> # include <list> using namespace std; using LL = long long; constexpr long long MOD = 1000000000 + 7; constexpr long long INF = 1000000000; const double PI = acos(-1); int main() { string s; cin >> s; cout << (s.size() % 2 == 0 ^ (s[0] == s[s.size() - 1]) ? "Second" : "First") << endl; }# include <iostream> # include <algorithm> # include <vector> # include <string> # include <set> # include <map> # include <cmath> # include <iomanip> # include <functional> # include <utility> # include <stack> # include <queue> # include <list> using namespace std; using LL = long long; constexpr long long MOD = 1000000000 + 7; constexpr long long INF = 1000000000; const double PI = acos(-1); int main() { string s; cin >> s; cout << (s.size() % 2 == 0 ^ (s[0] == s[s.size() - 1]) ? "Second" : "First") << endl; }
a.cc:24:2: error: stray '#' in program 24 | }# include <iostream> | ^ a.cc:24:4: error: 'include' does not name a type 24 | }# include <iostream> | ^~~~~~~ a.cc:39:21: error: redefinition of 'constexpr const long long int MOD' 39 | constexpr long long MOD = 1000000000 + 7; | ^~~ a.cc:16:21: note: 'constexpr const long long int MOD' previously defined here 16 | constexpr long long MOD = 1000000000 + 7; | ^~~ a.cc:40:21: error: redefinition of 'constexpr const long long int INF' 40 | constexpr long long INF = 1000000000; | ^~~ a.cc:17:21: note: 'constexpr const long long int INF' previously defined here 17 | constexpr long long INF = 1000000000; | ^~~ a.cc:41:14: error: redefinition of 'const double PI' 41 | const double PI = acos(-1); | ^~ a.cc:18:14: note: 'const double PI' previously defined here 18 | const double PI = acos(-1); | ^~ a.cc:43:5: error: redefinition of 'int main()' 43 | int main() { | ^~~~ a.cc:20:5: note: 'int main()' previously defined here 20 | int main() { | ^~~~
s636319743
p03865
C++
#include <bits/stdc++.h> #include <math.h> #define uint unsigned long long #define ll long long #define db double #define ls rt << 1 #define rs rt << 1 | 1 #define pb push_back #define mp make_pair #define pii pair<int, int> #define X first #define Y second #define pcc pair<char, char> #define vi vector<int> #define vl vector<ll> #define rep(i, x, y) for(int i = x; i <= y; i ++) #define rrep(i, x, y) for(int i = x; i >= y; i --) #define eps 1e-9 using namespace std; inline int read() { int x = 0, f = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); } while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); } return x * f; } const db pi = acos(-1); const int N = 1e5 + 10; string ch; int main() { cin >> ch; int n = ch.size(); int x = ch.size() - 2; rep(i, 1, n - 1) if(ch[i - 1] != ch[i + 1]) break; else x --; rrep(i, n - 2, 1) if(ch[i - 1] != ch[i + 1]) break; else x --; if(x <= 0) puts("Second"); else uts((ch.size() + (ch[0] == ch[n - 1] ? 1 : 0)) % 2 == 0 ? "Second" : "First"); return 0; }
a.cc: In function 'int main()': a.cc:43:14: error: 'uts' was not declared in this scope; did you mean 'puts'? 43 | else uts((ch.size() + (ch[0] == ch[n - 1] ? 1 : 0)) % 2 == 0 ? "Second" : "First"); | ^~~ | puts
s328368663
p03865
C++
#include<string> #include<deque> #include<queue> #include<vector> #include<algorithm> #include<iostream> #include<set> #include<cmath> #include<tuple> #include<chrono> #include<functional> #include<iterator> #include<random> #include<unordered_set> #include<map> using namespace std; typedef long long int llint; #define mp make_pair #define mt make_tuple #define pub push_back #define puf push_front #define pob pop_back #define pof pop_front #define fir first #define sec second #define res resize #define ins insert #define era erase const int mod=1000000007; const llint big=1e18+10; const long double pai=3.141592653589793238462643383279502884197; const long double eps=1e-9; template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}} template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}} int gcd(int a,int b){if(a%b==0){return b;}else return gcd(b,a%b);}//a>b class in_t{public: int a;in_t(){cin>>a;} operator int() {return a;} }; class lin_t{public: llint a;lin_t(){cin>>a;} operator llint() {return a;} }; class ld_t{public: long double a;ld_t(){cin>>a;} operator long double() {return a;} }; int main(void){ string str;cin>str; int a; if(str.front()==str.back()){a=1;}else{a=0;} if((str.size()+a)%2==0){cout<<"Second"<<endl;} else{cout<<"First"<<endl;} return 0; }
a.cc: In function 'int main()': a.cc:49:23: error: no match for 'operator>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::string' {aka 'std::__cxx11::basic_string<char>'}) 49 | string str;cin>str; | ~~~^~~~ | | | | | std::string {aka std::__cxx11::basic_string<char>} | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/14/string:48, from a.cc:1: /usr/include/c++/14/bits/stl_iterator.h:462:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 462 | operator>(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:462:5: note: template argument deduction/substitution failed: a.cc:49:24: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 49 | string str;cin>str; | ^~~ /usr/include/c++/14/bits/stl_iterator.h:507:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 507 | operator>(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:507:5: note: template argument deduction/substitution failed: a.cc:49:24: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 49 | string str;cin>str; | ^~~ /usr/include/c++/14/bits/stl_iterator.h:1714:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1714 | operator>(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1714:5: note: template argument deduction/substitution failed: a.cc:49:24: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 49 | string str;cin>str; | ^~~ /usr/include/c++/14/bits/stl_iterator.h:1774:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1774 | operator>(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1774:5: note: template argument deduction/substitution failed: a.cc:49:24: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 49 | string str;cin>str; | ^~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h:1058:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1058 | operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1058:5: note: template argument deduction/substitution failed: a.cc:49:24: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::pair<_T1, _T2>' 49 | string str;cin>str; | ^~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:695:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 695 | operator> (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:695:5: note: template argument deduction/substitution failed: a.cc:49:24: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 49 | string str;cin>str; | ^~~ /usr/include/c++/14/string_view:702:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 702 | operator> (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:702:5: note: template argument deduction/substitution failed: a.cc:49:24: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 49 | string str;cin>str; | ^~~ /usr/include/c++/14/string_view:710:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 710 | operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:710:5: note: template argument deduction/substitution failed: a.cc:49:24: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 49 | string str;cin>str; | ^~~ /usr/include/c++/14/bits/basic_string.h:3915:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3915 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3915:5: note: template argument deduction/substitution failed: a.cc:49:24: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 49 | string str;cin>str; | ^~~ /usr/include/c++/14/bits/basic_string.h:3929:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3929 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3929:5: note: template argument deduction/substitution failed: a.cc:49:24: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 49 | string str;cin>str; | ^~~ /usr/include/c++/14/bits/basic_string.h:3942:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3942 | operator>(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3942:5: note: template argument deduction/substitution failed: a.cc:49:24: note: mismatched types 'const _CharT*' and 'std::basic_istream<char>' 49 | string str;cin>str; | ^~~ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2619:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator>(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2619 | operator>(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2619:5: note: template argument deduction/substitution failed: a.cc:49:24: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::tuple<_UTypes ...>' 49 | string str;cin>str; | ^~~ In file included from /usr/include/c++/14/deque:66, from a.cc:2: /usr/include/c++/14/bits/stl_deque.h:2349:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator>(const deque<_Tp, _Alloc>&, const deque<_Tp, _Alloc>&)' 2349 | operator>(const deque<_Tp, _Alloc>& __x, const deque<_Tp, _Alloc>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_deque.h:2349:5: note: template argument deduction/substitution failed: a.cc:49:24: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::deque<_Tp, _Alloc>' 49 | string str;cin>str; | ^~~ In file included from /usr/include/c++/14/vector:66, from /usr/include/c++/14/queue:63, from a.cc:3: /usr/include/c++/14/bits/stl_vector.h:2102:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator>(const vector<_Tp, _Alloc>&, const vector<_Tp, _Alloc>&)' 2102 | operator>(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:2102:5: note: template argument deduction/substitution failed: a.cc:49:24: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::vector<_Tp, _Alloc>' 49 | string str;cin>str; | ^~~ In file included from /usr/include/c++/14/queue:66: /usr/include/c++/14/bits/stl_queue.h:411:5: note: candidate: 'template<class _Tp, class _Seq> bool std::operator>(const queue<_Tp, _Seq>&, const queue<_Tp, _Seq>&)' 411 | operator>(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:411:5: note: template argument deduction/substitution failed: a.cc:49:24: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::queue<_Tp, _Seq>' 49 | string str;cin>str; | ^~~ In file included from /usr/include/c++/14/set:63, from a.cc:7: /usr/include/c++/14/bits/stl_set.h:1039:5: note: candidate: 'template<class _Key, class _Compare, class _Alloc> bool std::operator>(const set<_Key, _Compare, _Allocator>&, const set<_Key, _Compare, _Allocator>&)' 1039 | operator>(c
s467348870
p03865
C++
#include <iostream> #include <cstdio> #include <vector> #include <algorithm> #include <cstring> #include <string> #include <queue> #include <set> #include <map> #include <bitset> #include <cmath> #include <stack> #include <ctime> #include <unordered_map> #include <unordered_set> #include <list> #include <cassert> #include <iomanip> #include <complex> using namespace std; typedef long long ll; typedef long double ld; const ll inf=1000000000000000LL; const int maxn=1e5+10; const int mod=1000000007; string s; int main(){ //freopen("output.txt", "r", stdin); //freopen("answers.txt", "w", stdout); ios_base::sync_with_stdio(0); cin.tie(0); cin>>s; if(((s[0]==s.back())+sz(s))%2==0) cout<<"Second"<<endl; else cout<<"First"<<endl; return 0; }
a.cc: In function 'int main()': a.cc:35:26: error: 'sz' was not declared in this scope; did you mean 's'? 35 | if(((s[0]==s.back())+sz(s))%2==0) | ^~ | s