submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s147181063
p03861
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vint; typedef pair<int,int> pint; typedef vector<pint> vpint; #define rep(i,n) for(int i=0;i<(n);i++) #define reps(i,f,n) for(int i=(f);i<(n);i++) #define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++) #define all(v) (v).begin(),(v).end() #define pb push_back #define mp make_pair #define fi first #define se second #define chmax(a, b) a = (((a)<(b)) ? (b) : (a)) #define chmin(a, b) a = (((a)>(b)) ? (b) : (a)) const int MOD = 1e9 + 7; const int INF = 1e9; int main(void){ ll a, b; cin >> a >> b; ll x; cin >> x; ll ans = (b / x) - ((max(a - 1, 0)) / x); cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:23:33: error: no matching function for call to 'max(ll, int)' 23 | ll ans = (b / x) - ((max(a - 1, 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:23:33: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 23 | ll ans = (b / x) - ((max(a - 1, 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:23:33: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 23 | ll ans = (b / x) - ((max(a - 1, 0)) / x); | ~~~^~~~~~~~~~
s273819028
p03861
C++
package main import ( "fmt" ) func main() { var a, b, x int64 fmt.Scan(&a, &b, &x) if a%x == 0 && b%x == 0 { fmt.Println((b-a)/x + int64(1)) } else { fmt.Println((b - a) / x) } }
a.cc:1:1: error: 'package' does not name a type 1 | package main | ^~~~~~~
s947304135
p03861
C++
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, x, ans = 0; cin >> a >> b >> x; if (x == 1) ans = b - a + 1; else { long long double q = ceil(((double)a - 1) / x); if (a != x * q + 1) { ans++; a = x * q + 1; } ans += (b - a + 1) / x; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:8:10: error: 'long long' specified with 'double' 8 | long long double q = ceil(((double)a - 1) / x); | ^~~~
s293803307
p03861
C++
#include <iostream> #include <cmath> using namespace std; using ll = long long; int main() { ll a, b, x; cin >> a >> b >> x; cout << b / x - max(a-1, 0) / x << endl; }
a.cc: In function 'int main()': a.cc:10:24: error: no matching function for call to 'max(ll, int)' 10 | cout << b / x - max(a-1, 0) / x << endl; | ~~~^~~~~~~~ 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:10:24: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 10 | cout << b / x - max(a-1, 0) / x << endl; | ~~~^~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
s643971427
p03861
C++
#include <iostream> using namespace std; using ll = long long; int main() { ll a, b, x; cin >> a >> b >> x; cout << b / x - max(a-1, 0) / x << endl; }
a.cc: In function 'int main()': a.cc:9:24: error: no matching function for call to 'max(ll, int)' 9 | cout << b / x - max(a-1, 0) / x << endl; | ~~~^~~~~~~~ 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:9:24: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 9 | cout << b / x - max(a-1, 0) / x << endl; | ~~~^~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
s627020773
p03861
C++
#include<bits/stdc++.h> using namespace std; typedef long long ll; int main(){ ll a,b,x; cin>>a>>b>>x; if(!n) cout<<b/x+1<<endl; else cout<<b/x-(a-1)/x<<endl; return 0; }
a.cc: In function 'int main()': a.cc:8:9: error: 'n' was not declared in this scope 8 | if(!n) cout<<b/x+1<<endl; | ^
s086106113
p03861
C++
#include<bits/stdc++.h> using namespace std; int main(){ long long int a,b,c,ans cin >> a >> b >> c; if(a != 0){ a--; ans=(b/c)-(a/c); } else{ ans=(b/c)-(a/c); ans++; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:5:3: error: expected initializer before 'cin' 5 | cin >> a >> b >> c; | ^~~ a.cc:8:5: error: 'ans' was not declared in this scope; did you mean 'abs'? 8 | ans=(b/c)-(a/c); | ^~~ | abs a.cc:10:5: error: 'ans' was not declared in this scope; did you mean 'abs'? 10 | ans=(b/c)-(a/c); | ^~~ | abs a.cc:14:11: error: 'ans' was not declared in this scope; did you mean 'abs'? 14 | cout << ans << endl; | ^~~ | abs
s498699959
p03861
C++
#include<iostream> #include <string> using namespace std; int main() { // string buf; __int64 i1, i2, i3; int ret; // cin >> buf; cin >> i1 >> i2 >> i3; ret = 0; for (__int64 i = i1; i <= i2; i++) { if (i % i3 == 0) ret++; } cout << ret; system("pause"); return 0; }
a.cc: In function 'int main()': a.cc:8:9: error: '__int64' was not declared in this scope; did you mean '__int64_t'? 8 | __int64 i1, i2, i3; | ^~~~~~~ | __int64_t a.cc:13:16: error: 'i1' was not declared in this scope 13 | cin >> i1 >> i2 >> i3; | ^~ a.cc:13:22: error: 'i2' was not declared in this scope 13 | cin >> i1 >> i2 >> i3; | ^~ a.cc:13:28: error: 'i3' was not declared in this scope 13 | cin >> i1 >> i2 >> i3; | ^~ a.cc:17:21: error: expected ';' before 'i' 17 | for (__int64 i = i1; i <= i2; i++) | ^~ | ; a.cc:17:30: error: 'i' was not declared in this scope 17 | for (__int64 i = i1; i <= i2; i++) | ^
s234884578
p03861
C++
#include <iostream> int main() { using namespace std; unsigned long long a, b, x; unsigned long long count = 0; cin >> a >> b >> x; for (int i = a; i <= b; i++) { if (i%x == 0) { count++; } } cout << count;
a.cc: In function 'int main()': a.cc:16:23: error: expected '}' at end of input 16 | cout << count; | ^ a.cc:3:12: note: to match this '{' 3 | int main() { | ^
s703533711
p03861
C
ソースコード #include <stdio.h> int main(void) { unsigned long long a, b, x; unsigned long long res = 0; scanf("%llu %llu %llu", &a, &b, &x); res = (b - a) / x; if( (a % x) == 0 ) res++; printf("%llu", res); }
main.c:1:13: error: expected ';' before 'typedef' 1 | ソースコード | ^ | ;
s485909162
p03861
C
#include <stdio.h> int main(void) { unsigned long long a, b, x; unsigned long long ans = 0; scanf("%llu %llu %llu", &a, &b, &x); res = (b - a) / x; if( (a % x) == 0 ) res++; printf("%llu", res); }
main.c: In function 'main': main.c:10:9: error: 'res' undeclared (first use in this function) 10 | res = (b - a) / x; | ^~~ main.c:10:9: note: each undeclared identifier is reported only once for each function it appears in
s600649313
p03861
C++
#include <iostream> #include <algorithm> #include <string> #include <vector> #include <queue> #include <stack> #define rep(i,n) for (int i=0;i<(n);i++;) using namespace std; #define int long long int int ans(int); int a, b, x; unsigned main(){ cin >> a >> b >> x; cout << ans(b) - ans(a - 1) << endl; } int ans(int n){ int an; n == -1 ? an = 0 : an = (n / x) + 1; return an; }
cc1plus: error: '::main' must return 'int'
s487476214
p03861
C++
#include <bits/stdc++.h> //#include <iostream> //#include <cstdio> #define FOR(i, a, b) for(int i = a; i < b; i++) #define REP(i, n) FOR(i, 0, n) #define MOD 1000000007 #define INF 2000000000 typedef long long ll; typedef unsigned long long ull; //typedef Pair<int,int> P; using namespace std; int main(void){ ll a, b, x; cin>>a>>b>>x; if(a==0){ cout<<b/x+1<<endl; return; } cout<<b/x-(a - 1)/x<<endl; return 0; }
a.cc: In function 'int main()': a.cc:21:17: error: return-statement with no value, in function returning 'int' [-fpermissive] 21 | return; | ^~~~~~
s503876250
p03861
C++
#include <stdio.h> int main(){ long long int a,b,x; scanf("%11d,%11d,%11d",&&a,&&b,&&x); long long int A = [a/x]; long long int B = [b/x]; long long int ans = B-A; printf("%11d",ans); return 0; }
a.cc: In function 'int main()': a.cc:5:21: error: expected ',' before '/' token 5 | long long int A = [a/x]; | ^ | , a.cc:5:21: error: expected identifier before '/' token a.cc: In lambda function: a.cc:5:24: error: expected '{' before ';' token 5 | long long int A = [a/x]; | ^ a.cc: In function 'int main()': a.cc:5:19: error: cannot convert 'main()::<lambda()>' to 'long long int' in initialization 5 | long long int A = [a/x]; | ^~~~~ | | | main()::<lambda()> a.cc:6:21: error: expected ',' before '/' token 6 | long long int B = [b/x]; | ^ | , a.cc:6:21: error: expected identifier before '/' token a.cc: In lambda function: a.cc:6:24: error: expected '{' before ';' token 6 | long long int B = [b/x]; | ^ a.cc: In function 'int main()': a.cc:6:19: error: cannot convert 'main()::<lambda()>' to 'long long int' in initialization 6 | long long int B = [b/x]; | ^~~~~ | | | main()::<lambda()> a.cc:4:26: error: label 'a' used but not defined 4 | scanf("%11d,%11d,%11d",&&a,&&b,&&x); | ^ a.cc:4:30: error: label 'b' used but not defined 4 | scanf("%11d,%11d,%11d",&&a,&&b,&&x); | ^ a.cc:4:34: error: label 'x' used but not defined 4 | scanf("%11d,%11d,%11d",&&a,&&b,&&x); | ^
s357004885
p03861
C++
a, b, x = map(int, input().split()) if x == 1: print(b - a + 1) elif a == 0: print(b // x) else: print(b // x - (a - 1) // x)
a.cc:1:1: error: 'a' does not name a type 1 | a, b, x = map(int, input().split()) | ^
s653022540
p03861
C++
#include <bits/stdc++.h> #define rep(i, a, n) for(int i = a; i < n; i++) #define repb(i, a, b) for(int i = a; i >= b; i--) #define all(a) a.begin(), a.end() #define o(a) cout << a << endl #define int long long using namespace std; typedef pair<int, int> P; int a, b, x; int f(n){ if(n == -1) return 0; return n / x + 1; } signed main(){ cin >> a >> b >> x; cout << f(b) - f(a - 1) << endl; }
a.cc:12:7: error: 'n' was not declared in this scope; did you mean 'yn'? 12 | int f(n){ | ^ | yn a.cc: In function 'int main()': a.cc:19:14: error: 'f' cannot be used as a function 19 | cout << f(b) - f(a - 1) << endl; | ~^~~ a.cc:19:21: error: 'f' cannot be used as a function 19 | cout << f(b) - f(a - 1) << endl; | ~^~~~~~~
s694723739
p03861
C++
#include<iostream> #include<string.h> #include<string> #include<cstdio> #include<stdlib.h> #include<algorithm> #include<stack> #include<queue> #include<vector> #include<cmath> #include<utility> #include<set> #define ll long long int #define ld long double #define INF 1000000000 #define EPS 0.0000000001 #define rep(i,n) for(i=0;i<n;i++) using namespace std; typedef pair<int, int> pii; int main() { ll a,b,x; ll ans=b/x; ans-=max(a-1,0)/x; cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:25:9: error: no matching function for call to 'max(long long int, int)' 25 | ans-=max(a-1,0)/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:25:9: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 25 | ans-=max(a-1,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, 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:25:9: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 25 | ans-=max(a-1,0)/x; | ~~~^~~~~~~
s004984942
p03861
C++
#include<iostream> #include<string.h> #include<string> #include<cstdio> #include<stdlib.h> #include<algorithm> #include<stack> #include<queue> #include<vector> #include<cmath> #include<utility> #include<set> #define ll long long int #define ld long double #define INF 1000000000 #define EPS 0.0000000001 #define rep(i,n) for(i=0;i<n;i++) using namespace std; typedef pair<int, int> pii; int main() { ll a,b,x; ll ans=b/x; ans-=max((a-1,0)/x; cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:25:19: error: expected ')' before ';' token 25 | ans-=max((a-1,0)/x; | ~ ^ | )
s825070759
p03861
C++
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, x; cin >> a >> b >> x; cout << (b / x - max((a - 1), 0) / x) << endl; return 0; }
a.cc: In function 'int main()': a.cc:8:29: error: no matching function for call to 'max(long long int, int)' 8 | cout << (b / x - max((a - 1), 0) / x) << endl; | ~~~^~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:8:29: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 8 | cout << (b / x - max((a - 1), 0) / x) << endl; | ~~~^~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:8:29: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 8 | cout << (b / x - max((a - 1), 0) / x) << endl; | ~~~^~~~~~~~~~~~
s820729880
p03861
C
#include <stdio.h> int main() { unsigned long long a, b, x, ; scanf("%llu%llu%llu", &a, &b, &x); printf("%llu", (a%x==0?1:0)+b/x-a/x); return(0); }
main.c: In function 'main': main.c:5:30: error: expected identifier or '(' before ';' token 5 | unsigned long long a, b, x, ; | ^
s681227529
p03861
C++
#include <bits/stdc++.h> using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x<(to);x++) #define FORR(x,arr) for(auto& x:arr) #define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++) #define ALL(a) (a.begin()),(a.end()) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) //------------------------------------------------------- ll A,B,X; void solve() { int i,j,k,l,r,x,y; string s; cin>>A>>B>>X; cout<<(B/X)-max(0,A-1)/X<<endl; } int main(int argc,char** argv){ string s;int i; if(argc==1) ios::sync_with_stdio(false), cin.tie(0); FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin); solve(); return 0; }
a.cc: In function 'void solve()': a.cc:20:24: error: no matching function for call to 'max(int, ll)' 20 | cout<<(B/X)-max(0,A-1)/X<<endl; | ~~~^~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:20:24: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'}) 20 | cout<<(B/X)-max(0,A-1)/X<<endl; | ~~~^~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:20:24: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 20 | cout<<(B/X)-max(0,A-1)/X<<endl; | ~~~^~~~~~~
s753292252
p03861
C
#include <stdio.h> int main() { long double a, b, x; scanf("%lf%lf%lf", &a, &b, &x); printf("%lf", (a%x==0?1:0)+(double)((long long)(b-a)/x)); return(0); }
main.c: In function 'main': main.c:7:18: error: invalid operands to binary % (have 'long double' and 'long double') 7 | printf("%lf", (a%x==0?1:0)+(double)((long long)(b-a)/x)); | ^
s870720122
p03861
C++
void test2(){ long long a,b,x; while(cin>>a>>b>>x){ //cout<<a<<" "<<b<<" "<<x<<endl; long long t1=a%x,t2=b%x; long long k1=a/x,k2=b/x; if(t1==0&&t2==0)cout<<(k2-k1+1)<<endl; else cout<< k2-k1<<endl; } return; } int main() { //freopen("data","r",stdin); test2(); return 0; }
a.cc: In function 'void test2()': a.cc:3:11: error: 'cin' was not declared in this scope 3 | while(cin>>a>>b>>x){ | ^~~ a.cc:7:25: error: 'cout' was not declared in this scope 7 | if(t1==0&&t2==0)cout<<(k2-k1+1)<<endl; | ^~~~ a.cc:7:42: error: 'endl' was not declared in this scope 7 | if(t1==0&&t2==0)cout<<(k2-k1+1)<<endl; | ^~~~ a.cc:8:14: error: 'cout' was not declared in this scope 8 | else cout<< k2-k1<<endl; | ^~~~ a.cc:8:28: error: 'endl' was not declared in this scope 8 | else cout<< k2-k1<<endl; | ^~~~
s213835800
p03861
C++
#include<iostream> #include <string> using namespace std; int main2(){ int a,b,x,i,N; int flag =0; cin >>a>>b>>x; for(i = 0; i< N; i++){ if(((a + i)%x)==0 ){ flag++; } } cout << flag; return 0; } int main(){ int a,b,x,i; int a_1,b_1; int sum; cin >>a>>b>>x; b_1= b/x; a_1=a/x; sum=b_1-a_1 if((a%x)==0){ sum = sum+1; } cout << sum; return 0; }
a.cc: In function 'int main()': a.cc:25:12: error: expected ';' before 'if' 25 | sum=b_1-a_1 | ^ | ; 26 | if((a%x)==0){ | ~~
s733668666
p03861
C
#include <stdio.h> int main(void) { long long int a,b,x,y,z; scanf("%lld %lld %lld",&a,&b,&x); y=b/x; if(a>1); z=(a-1)/x; else z=0; printf("%lld",y-z); return 0; }
main.c: In function 'main': main.c:10:9: error: 'else' without a previous 'if' 10 | else | ^~~~
s948802979
p03861
Java
import java.util.Scanner; /** * @Author oreid * @Release 04/12/2016 */ public class MainA2 { public static void main(String[] args){ Scanner scanner = new Scanner(System.in); long a = scanner.nextLong(); long b = scanner.nextLong(); long x = scanner.nextLong(); long cnt = 0; scanner.close(); cnt = numDivs(a ,b ,x); System.out.print(cnt); } public static long numDivs(long a, long b, long x) { long fDiv = a%x == 0 ? a : a + (x - a%x); long lDiv = b%x == 0 ? b : b - b%x; return (lDiv - fDiv)/x + 1; } }
Main.java:7: error: class MainA2 is public, should be declared in a file named MainA2.java public class MainA2 { ^ 1 error
s580512572
p03861
Java
import java.util.*; public class AbetweenB{ public static void main(String[] args) { Scanner scan = new Scanner(System.in); String chaineNombre = scan.nextLine(); String[] numberString = chaineNombre.split(" "); double a = Double.parseDouble(numberString[0]); double b = Double.parseDouble(numberString[1]); double x = Double.parseDouble(numberString[2]); double compteur = 0; while (a <= b){ if (a % x == 0){ compteur++; } a++; } System.out.println(compteur); } }
Main.java:3: error: class AbetweenB is public, should be declared in a file named AbetweenB.java public class AbetweenB{ ^ 1 error
s348375611
p03861
C
#include <stdio.h> int main() { long long a, b, x, i, ans=0; scanf("%lld%lld%lld", &a, &b, &x); for(i=a; i<=b; i+=x) ans++: printf("%lld", ans); return(0); }
main.c: In function 'main': main.c:7:28: error: expected ';' before ':' token 7 | for(i=a; i<=b; i+=x) ans++: | ^ | ;
s265219139
p03861
C
#include <stdio.h> int main() { long long a, b, x, i, ans=0; scanf("%lld%lld%lld", &a, &b, &x); for(i=a, i<=b; i+=x) ans++: printf("%lld", ans); return(0); }
main.c: In function 'main': main.c:7:21: error: expected ';' before ')' token 7 | for(i=a, i<=b; i+=x) ans++: | ^ | ; main.c:7:28: error: expected ';' before ':' token 7 | for(i=a, i<=b; i+=x) ans++: | ^ | ;
s616966611
p03861
C++
i = [int(x) for x in input().split()] c =0 for x in range(i[0],i[1]+1): if x%i[2] == 0: c+=1 print(c)
a.cc:1:1: error: 'i' does not name a type 1 | i = [int(x) for x in input().split()] | ^
s920840501
p03862
Java
import java.util.*; public class bzbz { public static void main(String[] args) { Scanner no=new Scanner(System.in); int n=no.nextInt(); int m=no.nextInt(); int arr[]=new int[n]; int sum=0; for(int i=0;i<n;i++){ arr[i]=no.nextInt(); } for(int i=0;i<n-1;i++){ if(arr[0]>m){ sum=sum+arr[0]-m; arr[0]=m; } if(arr[i]+arr[i+1]<=m){ continue; } else if(arr[i]+arr[i+1]>m){ /* if(arr[i]<arr[i+1]){ while(arr[i]+arr[i+1]>m&&arr[i]!=0){ arr[i]=arr[i]-1; sum++; } if(arr[i]+arr[i+1]>m){ while(arr[i]+arr[i+1]>m&&arr[i+1]!=0){ arr[i+1]=arr[i+1]-1; sum++; } } } else{*/ while(arr[i]+arr[i+1]>m&&arr[i+1]!=0){ arr[i+1]=arr[i+1]-1; sum++; } if(arr[i]+arr[i+1]>m){ while(arr[i]+arr[i+1]>m&&arr[i]!=0){ arr[i]=arr[i]-1; sum++; } } } } System.out.println(sum); } }
Main.java:2: error: class bzbz is public, should be declared in a file named bzbz.java public class bzbz { ^ 1 error
s647957406
p03862
C++
#include<bits/stdc++.h> #include <stdio.h> #pragma GCC optimize ("O3") #pragma GCC target ("sse4") using namespace std; #define newl "\n" #define ll long long #define ull unsigned long long #define FORM(m) for (auto const& x : m) cout << x.first << " : " << x.second << newl #define FORV(v) cout << '\n'; for(auto &x : v) cout << x << ' '; cout << '\n' #define FO(i,n) for (ll i = 0; i < n; ++i) #define FOR(i,k,n) for (auto i = k; i <= n; ++i) #define FORR(i,k,n) for (auto i = k; i >= n; --i) #define deb(x) cout << #x << " = " << x << newl #define deb2(x, y) cout << #x << " = " << x << ", " << #y << " = " << y << newl #define pb push_back #define eb emplace_back #define mp make_pair #define all(x) x.begin(), x.end() #define clr(x) memset(x, 0, sizeof(x)) #define sortall(x) sort(all(x)) #define tr(it, a) for(auto it = a.begin(); it != a.end(); ++it) #define mod 1000000007 // modulo 10e9 + 7 #define PI 3.1415926535897932384626 #define ConvertMicrosecondsToSeconds(duration) duration / 1e+6 typedef pair<int, int> pii; typedef pair<ll, ll> pl; typedef vector<int> vi; typedef vector<ll> vl; typedef vector<pii> vpii; typedef vector<pl> vpl; typedef vector<vi> vvi; typedef vector<vl> vvl; mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count()); template<typename... T> void read(T&... args) { ((cin >> args), ...); } template<typename... T> void write(T&&... args) { ((cout << args << ' '), ...); } void getVecIndex(vector<int> v, int K) { auto it = find(all(v), K); if (it != v.end()) { cout << distance(v.begin(), it); } else cout << -1; } bool isPrime(int num) { if (num <= 1) return false; if (num == 2) return true; if (num % 2 == 0) return false; int counter = 3; while ((counter * counter) <= num) { if (num % counter == 0) { return false; } else { counter += 2; } } return true; } ull fpow(ull base, ull exp) { base %= mod; ull result = 1; while (exp > 0) { if (exp & 1) result = (static_cast<ull>(result * base)) % mod; base = (static_cast<ull>(base * base)) % mod; exp >>= 1; } return result; } ll binarySearch(int a[], int l, int r, int x) { while (l <= r) { int mid_index = l + (r - l) / 2; if (a[mid_index] == x) return mid_index; else if ( x > a[mid_index]) { l = mid_index + 1; } else if ( x < a[mid_index]) { r = mid_index - 1; } } return -1; } void permuteString(string s) { sortall(s); do { cout << s << newl; } while (next_permutation(all(s))); } void permuteArray(int array[], int n) { sort(array, array + n); do { FOR(i, 0, n - 1) cout << array[i] << ' '; cout << newl; } while (next_permutation(array, array + n)); } void permuteVector(vector<int> v) { sortall(v); do { FORV(v); cout << newl; } while (next_permutation(all(v))); } ull largestPrimeFactor(ull n) { for (int factor = 2; factor * factor <= n; ++factor) { while (n % factor == 0 and n != factor) n /= factor; } return n; } ull numberOfDivisors(ull n) { ull divisors = 0; if (n == 1) return 1; for (ull i = 1; i * i <= n; ++i) // we need to CHECK at least sqrt(n) TIMES (inclusive) if 'i' is a divisor of n. { if (n % i == 0) { divisors += 2; } } return divisors; } // greatest common divisor ll gcd( ll a, ll b ) { if (b == 0) { return a; } else { return gcd( b, a % b ); } } // least common multiplication ll lcm (ll a, ll b) { return (a * b) / gcd(a, b); } //check how many X's are divisible in range <a,b> ll check_divisibility_of_x_in_range(ll a, ll b, ll x) { return b / x - a / x + (a % x == 0); } // ∈ //======================= void solve() { ll n, x; read(n, x); vector<ll> v(n, 0); FO(i, n) { read(v[i]); } ll ans = 0; FO(i, n - 1) { ll diff = (v[i] + v[i + 1]) - x; if (diff > 0) { ans += diff; v[i + 1] = max(ll(0), v[i + 1] - diff); } } cout << ans; } /* IDEAS: */ /* TESTS: */ int32_t main() { //-------------------------------- ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); auto t1 = std::chrono::high_resolution_clock::now(); int t = 1; //cin >> t; while (t--) { solve(); cout << newl; } auto t2 = std::chrono::high_resolution_clock::now(); auto duration = std::chrono::duration_cast<std::chrono::microseconds>( t2 - t1 ).count(); cerr << "\nDuration of the algo: " << ConvertMicrosecondsToSeconds(duration) << " secs\n\n"; return 0; }
a.cc: In function 'void solve()': a.cc:10:12: error: expected primary-expression before 'long' 10 | #define ll long long | ^~~~ a.cc:216:40: note: in expansion of macro 'll' 216 | v[i + 1] = max(ll(0), v[i + 1] - diff); | ^~
s205705078
p03862
C++
¥#include <iostream> #include <vector> using namespace std; typedef long long ll; int main(){ ll N,X; cin>>N>>X; vector<ll> a(N); for(int i=0; i<N; i++) cin>>a[i]; ll ans = 0; for(int i=1; i<N; i += 2){ ll sum = a[i] + a[i-1]; if(sum > X){ ans += sum-X; if(sum-X > a[i]){ a[i] = 0; a[i-1] -= sum-X-a[i]; }else{ a[i] -= sum-X; } } } cout<<ans<<endl; }
a.cc:1:1: error: extended character ¥ is not valid in an identifier 1 | ¥#include <iostream> | ^ a.cc:1:2: error: stray '#' in program 1 | ¥#include <iostream> | ^ a.cc:1:1: error: '\U000000a5' does not name a type 1 | ¥#include <iostream> | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/vector:62, from a.cc:2: /usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity 164 | __is_null_pointer(std::nullptr_t) | ^ /usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)' 159 | __is_null_pointer(_Type) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std' 164 | __is_null_pointer(std::nullptr_t) | ^~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/type_traits:295:27: error: 'size_t' has not been declared 295 | template <typename _Tp, size_t = sizeof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std' 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:984:26: error: 'size_t' has not been declared 984 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std' 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std' 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std' 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std' 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1451:32: error: 'size_t' was not declared in this scope 1451 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 63 | #include <bits/version.h> +++ |+#include <cstddef> 64 | /usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid 1451 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared 1453 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope 1454 | struct extent<_Tp[_Size], 0> | ^~~~~ /usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid 1454 | struct extent<_Tp[_Size], 0> | ^ /usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~ /usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid 1455 | : public integral_constant<size_t, _Size> { }; | ^ /usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid /usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared 1457 | template<typename _Tp, unsigned _Uint, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope 1458 | struct extent<_Tp[_Size], _Uint> | ^~~~~ /usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid 1458 | struct extent<_Tp[_Size], _Uint> | ^ /usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope 1463 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid 1463 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type 1857 | { static constexpr size_t __size = sizeof(_Tp); }; | ^~~~~~ /usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~~~~ /usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~ /usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp' 1860 | struct __select; | ^~~~~~~~ /usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared 1862 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^~~ /usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^ /usr/include/c++/14/type_traits:1866:14: error: 'size_t' has not been declared 1866 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1867:23: error: '_Sz' was not declared in this scope 1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false>
s458327751
p03862
C++
#include <bits/stdc++.h> #define ll long long int #define F(i,j,k,in) for(int i=j;i<k;i+=in) #define DF(i,j,k,in) for(int i=j;i>=k;i-=in) #define feach(it,l) for (auto it = l.begin(); it != l.end(); ++it) #define fitr(it,it1,itr2) for(auto it=itr1;it!=itr2;++it) #define fall(a) a.begin(),a.end() #define pb push_back #define ub upper_bound #define lb lower_bound #define eq equal_range #define fs first #define ss second #define ins insert #define mkp make_pair #define PI 3.1415926535897932384626433832795 #define endl "\n" using namespace std; typedef vector<ll> vll; typedef vector<int> vin; typedef vector<char> vch; typedef vector<string> vst; typedef vector<vector<ll>> vvll; typedef vector<pair<ll,ll>> vpll; typedef set<ll> sll; typedef set<int> sint; typedef set<char> sch; typedef set<string> sst; typedef queue<ll> qll; typedef priority_queue<ll> pqll; typedef map<ll,ll> mll; typedef pair<ll,ll> pll; const ll MOD=1000000007; ll pwr(ll b,ll p){ll res=1;while(p){if(p&1) {res*=b; p--;}else{b*=b; p>>=1;}}return res;} int main() { ios_base::sync_with_stdio(false) , cin.tie(NULL) , cout.tie(NULL); ll n, x; cin>>n>>x; vll A (n); F (i,0,n,1) cin>>A[i]; ll cnt=0; F (i,1,n,1) { if (x<A[i-1]+A[i]) { ll take= (A[i-1]+A[i])-x; cnt+=take; A[i]=max(0,A[i]-take); } } cout<<cnt; return 0; }
a.cc: In function 'int main()': a.cc:46:26: error: no matching function for call to 'max(int, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)' 46 | cnt+=take; A[i]=max(0,A[i]-take); | ~~~^~~~~~~~~~~~~ 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:46:26: 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'}) 46 | cnt+=take; A[i]=max(0,A[i]-take); | ~~~^~~~~~~~~~~~~ /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:46:26: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 46 | cnt+=take; A[i]=max(0,A[i]-take); | ~~~^~~~~~~~~~~~~
s086887469
p03862
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; const long long INF = 1LL << 60; int main(){ int N, x; cin >> N >> x; vector<ll> a(N); for(int i=0; i<N; i++) cin >> a[i]; ll count = 0; for(int i=0; i<N-1; i++) { if(a[i]+a[i+1] > x) { ll div = a[i]+a[i+1] - x; a[i+1] -= div; count += div; a[i+1] = max(0, a[i+1]); } } cout << count << endl; }
a.cc: In function 'int main()': a.cc:17:25: error: no matching function for call to 'max(int, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type&)' 17 | a[i+1] = max(0, 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:17:25: 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'}) 17 | a[i+1] = max(0, 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:17:25: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 17 | a[i+1] = max(0, a[i+1]); | ~~~^~~~~~~~~~~
s366557014
p03862
C++
#include <iostream> #include <string> using namespace std; int main() { long int n; long long int x; int ans=0; cin>>n>>x; long long int e[n]; for(int i=0;i<n;i++){ cin>>e[i]; } for(int i=1;i<n;i++){ int sum=e[i]+e[i+1]; if(sum<=x)continue; int steps=sum-x; ans+=steps; if(steps<=e[i]) e[i]-=steps; else e[i]=0; } cout<<ans;S }
a.cc: In function 'int main()': a.cc:33:11: error: 'S' was not declared in this scope 33 | cout<<ans;S | ^
s202985967
p03862
Java
import java.util.*; import java.io.*; import java.math.*; public class Main{ //Don't have to see. start------------------------------------------ static class InputIterator{ ArrayList<String> inputLine = new ArrayList<String>(1024); int index = 0; int max; String read; InputIterator(){ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); try{ while((read = br.readLine()) != null){ inputLine.add(read); } }catch(IOException e){} max = inputLine.size(); } boolean hasNext(){return (index < max);} String next(){ if(hasNext()){ return inputLine.get(index++); }else{ throw new IndexOutOfBoundsException("There is no more input"); } } } static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>(); static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem. static PrintWriter out = new PrintWriter(System.out); static void flush(){out.flush();} static void myout(Object t){out.println(t);} static void myerr(Object t){System.err.print("debug:");System.err.println(t);} static String next(){return ii.next();} static boolean hasNext(){return ii.hasNext();} static int nextInt(){return Integer.parseInt(next());} static long nextLong(){return Long.parseLong(next());} static double nextDouble(){return Double.parseDouble(next());} static ArrayList<String> nextStrArray(){return myconv(next(), 8);} static ArrayList<String> nextCharArray(){return myconv(next(), 0);} static ArrayList<Integer> nextIntArray(){ ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size()); for(int i = 0; i < input.size(); i++){ ret.add(Integer.parseInt(input.get(i))); } return ret; } static ArrayList<Long> nextLongArray(){ ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size()); for(int i = 0; i < input.size(); i++){ ret.add(Long.parseLong(input.get(i))); } return ret; } static String myconv(Object list, int no){//only join String joinString = CONVSTR.get(no); if(list instanceof String[]){ return String.join(joinString, (String[])list); }else if(list instanceof ArrayList){ return String.join(joinString, (ArrayList)list); }else{ throw new ClassCastException("Don't join"); } } static ArrayList<String> myconv(String str, int no){//only split String splitString = CONVSTR.get(no); return new ArrayList<String>(Arrays.asList(str.split(splitString))); } public static void main(String[] args){ CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, ""); solve();flush(); } //Don't have to see. end------------------------------------------ static void solve(){//Here is the main function ArrayList<Integer> one = nextIntArray(); int N = one.get(0); int x = one.get(1); ArrayList<Integer> list = nextIntArray(); long output = 0; for(int i = 1; i < N; i++){ int mae = list.get(i - 1); int ato = list.get(i); if(mae + ato > x){ int minus = (mae + ato) - K; output += minus; list.set(i, Math.max(0, list.get(i) - minus)); if(ato < minus){ minus -= ato; list.set(i - 1, Math.max(0, list.get(i - 1) - minus)); } } } myout(output); } //Method addition frame start //Method addition frame end }
Main.java:81: error: cannot find symbol int minus = (mae + ato) - K; ^ symbol: variable K location: class Main Note: Main.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 1 error
s999859967
p03862
C++
#include<bits/stdc++.h> using namespace std; #define debug(n) cerr << #n << ':' << n << endl; #define dline cerr << __LINE__ << endl; using ll = long long; using ull = unsigned long long; template<class T, class U> using P = pair<T,U>; template<class T> using Heap = priority_queue<T>; template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>; template<class T,class U> using umap = unordered_map<T,U>; template<class T> using uset = unordered_set<T>; template<class T> bool ChangeMax(T&a,const T&b){ if(a >= b) return false; a = b; return true; } template<class T> bool ChangeMin(T&a,const T&b){ if(a <= b) return false; a = b; return true; } template<class T, size_t N, class U> void Fill(T (&a)[N], const U&v){ fill((U*)a,(U*)(a+N),v); } template<class T> istream& operator >> (istream&is, vector<T>&v){ for(auto&e:v)is >> e; return is; } int main(){ int n,x; cin >> n >> x; vector<int> v(n); cin >> v; ll ans = 0; int for(int i = 0; i < n-1; ++i){ if(v[i] + v[i+1] > x){ ans += v[i] + v[i+1] - x; v[i+1] -= min(x,v[i+1]); } } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:45:3: error: expected unqualified-id before 'for' 45 | for(int i = 0; i < n-1; ++i){ | ^~~ a.cc:45:18: error: 'i' was not declared in this scope 45 | for(int i = 0; i < n-1; ++i){ | ^
s259891081
p03862
C++
#include <iostream> using namespace std; int main() { int N, x; int arr[N]; for (int i = 0; i < N; i ++){ cin >> arr[i]; } int spet = 0; for (int i = 0; i < N - 1; i ++){ arr[i] + arr[i + 1] = x; spet += arr[i] + arr[i + 1] - x; } cout << spet << '\n'; }
a.cc: In function 'int main()': a.cc:12:24: error: lvalue required as left operand of assignment 12 | arr[i] + arr[i + 1] = x; | ~~~~~~~^~~~~~~~~~~~
s684954053
p03862
C++
#include <bits/stdc++.h> #include <math.h> #include <float.h> #define rep(i, n) for(int i = 0; i < (n); i++) #define rrep(i, n) for(int i = 0; i <= (n); i++) using namespace std; typedef long long ll; const ll INF = 1LL<<62; template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } // 多次元 vector 生成 template<class T> vector<T> make_vec(size_t a){ return vector<T>(a); } template<class T, class... Ts> auto make_vec(size_t a, Ts... ts){ return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...)); } const int MOD = 1000000007; int main(){ ll N,x; cin >> N >> x; vector<ll> a(N); rep(i,N) cin >> a[i]; ll ans = 0; rep(i,N-1){ ll total = a[i]+a[i+1]; if (total > x){ ans += total-x; a[i+1] -= ans; a[i+1] = min(0,a[i+1]); } } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:35:25: error: no matching function for call to 'min(int, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type&)' 35 | a[i+1] = min(0,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: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:35:25: 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'}) 35 | a[i+1] = min(0,a[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 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:35:25: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 35 | a[i+1] = min(0,a[i+1]); | ~~~^~~~~~~~~~
s925338452
p03862
Java
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long x = sc.nextLong(); long[] a = new long[n]; for(int i = 0; i < n; i++) { a[i] = sc.nextLong(); } long ans = 0; for(int i = 1; i < n; i++) { if(a[i - 1] <= x) { ans += Math.max(0, (a[i - 1] + a[i] - x)); a[i] -= Math.max(0, (a[i - 1] + a[i] - x)); } else { ans += Math.max(0, (a[i - 1] + a[i] - x)); a[i] = 0; } } System.out.println(ans); }
Main.java:23: error: reached end of file while parsing } ^ 1 error
s783095807
p03862
C++
#include <iostream> #include <algorithm> using namespace std; void solve() { int n, x; int ans; cin >> n >> x; vector <int> a(n); for (int &ai: a) cin >> ai; ans = 0; for (int i = 1; i < n; ++i) { if (a[i] + a[i-1] > x) { ans += a[i] + a[i-1] - x; if (a[i-1] - x <= 0) { a[i] -= a[i] + a[i-1] - x; } else { a[i-1] -= a[i-1] - x; a[i] = 0; } } } cout << ans; } int main() { solve(); return 0; }
a.cc: In function 'void solve()': a.cc:10:5: error: 'vector' was not declared in this scope 10 | vector <int> a(n); | ^~~~~~ a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 2 | #include <algorithm> +++ |+#include <vector> 3 | a.cc:10:13: error: expected primary-expression before 'int' 10 | vector <int> a(n); | ^~~ a.cc:11:19: error: 'a' was not declared in this scope; did you mean 'ai'? 11 | for (int &ai: a) | ^ | ai a.cc:15:13: error: 'a' was not declared in this scope 15 | if (a[i] + a[i-1] > x) { | ^
s397359285
p03862
C++
#define loop(i,n) for(int i = 0;i < int(n);i++) #define sz(s) (int)(s.size()) #define all(x) x.begin(), x.end() #define allr(x) x.rbegin(), x.rend() #define fr first #define sc second #define NumofDigits(n) ((long long)log10(n)+1) using namespace std; using namespace __gnu_pbds; typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set; const int maxn=1e5+5; const double EPS = 1e-9; const int MOD = 1e9+7; /* ll gcd(ll a, ll b) { return !b ? a : gcd(b, a % b); } ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; } ll fastpow(ll b, ll p) {if(!p)return 1;ll ret = fastpow(b, p >> 1);ret *= ret;if(p&1)ret*= b;return ret;} int dx[] = {- 1, 0, 0, 1, 0 }; int dy[] = { 0,- 1, 1, 0, 0 };*/ void File() { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); #endif } ll arr[maxn],suf[maxn],x; int main() { ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0); int n; cin>>n>>x; for(int i=0;i<n;i++) cin>>arr[i]; int cnt=0; for(int i=0;i<n-1;i++) { suf[i]=arr[i]+arr[i+1]; while(suf[i]>x) { arr[i]=max(0*1ll,arr[i]-1); arr[i+1]=max(0*1ll,arr[i+1]-1); suf[i]=max(0*1ll,suf[i]-1); cnt++; } } cout<<cnt; }
a.cc:9:17: error: '__gnu_pbds' is not a namespace-name 9 | using namespace __gnu_pbds; | ^~~~~~~~~~ a.cc:10:9: error: 'tree' does not name a type 10 | typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set; | ^~~~ a.cc: In function 'void File()': a.cc:24:31: error: 'stdin' was not declared in this scope 24 | freopen("input.txt", "r", stdin); | ^~~~~ a.cc:1:1: note: 'stdin' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | #define loop(i,n) for(int i = 0;i < int(n);i++) a.cc:24:5: error: 'freopen' was not declared in this scope 24 | freopen("input.txt", "r", stdin); | ^~~~~~~ a.cc: At global scope: a.cc:27:1: error: 'll' does not name a type; did you mean 'all'? 27 | ll arr[maxn],suf[maxn],x; | ^~ | all a.cc: In function 'int main()': a.cc:30:5: error: 'ios_base' has not been declared 30 | ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0); | ^~~~~~~~ a.cc:30:34: error: 'cin' was not declared in this scope 30 | ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0); | ^~~ a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' +++ |+#include <iostream> 1 | #define loop(i,n) for(int i = 0;i < int(n);i++) a.cc:30:45: error: 'cout' was not declared in this scope 30 | ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0); | ^~~~ a.cc:30:45: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:32:13: error: 'x' was not declared in this scope 32 | cin>>n>>x; | ^ a.cc:34:14: error: 'arr' was not declared in this scope 34 | cin>>arr[i]; | ^~~ a.cc:38:9: error: 'suf' was not declared in this scope 38 | suf[i]=arr[i]+arr[i+1]; | ^~~ a.cc:38:16: error: 'arr' was not declared in this scope 38 | suf[i]=arr[i]+arr[i+1]; | ^~~ a.cc:41:19: error: 'max' was not declared in this scope; did you mean 'maxn'? 41 | arr[i]=max(0*1ll,arr[i]-1); | ^~~ | maxn
s708102886
p03862
C++
#include <iostream> using namespace std; int main() { int a, b; cin >> a >> b; int x[a], y[a]; for (int i = 0; i < a; i++) { cin >> x[i]; y[i] = x[i]; } if (x[0] > b) x[0] = b; for (int i = 0; i < a - 1; i++) { x[i + 1] -= x[i + 1] + x[i] - b; if (x[i + 1] < 0) { x[i] += x[i + 1] x[i + 1] = 0; } } int moves = 0; for (int i = 0; i < a; i++) { moves += y[i] - x[i]; } cout << moves << endl; return 0; }
a.cc: In function 'int main()': a.cc:18:23: error: expected ';' before 'x' 18 | x[i] += x[i + 1] | ^ | ; 19 | x[i + 1] = 0; | ~
s262566669
p03862
C++
#include <bits/stdc++.h> using namespace std; #define rep(i,a,b) for(int i=a;i<b;i++) typedef long long int ll; int main() { int n; ll a, b, x, d, op = 0 ; cin >> n >> x; cin >> a >> b; if( a + b > x ) { d = a + b - x; if( d <= b ){ b -= diff; } else { b = 0; } op += d; } a = b; rep(i,2,n) { cin >> b; if( a + b > x ) { d = a + b - x; if( d <= b ){ b -= diff; } else { b = 0; } op += d; } a = b; } cout << op<< endl; return 0; }
a.cc: In function 'int main()': a.cc:15:22: error: 'diff' was not declared in this scope 15 | b -= diff; | ^~~~ a.cc:31:30: error: 'diff' was not declared in this scope 31 | b -= diff; | ^~~~
s026232841
p03862
C++
#include<bits/stdc++.h> #define all(x) (x).begin(),(x).end() #define rep(i,n) for(ll i=0;i<(ll)(n);i++) using namespace std; typedef long long ll; int main(){ ll n,x; cin>>n>>x; vector<ll> a(n); rep(i,n) cin>>a[i]>>endl; ll cnt=0; rep(i,n-1){ if(a[i]+a[i+1]>x){ if(a[i]<=x){ cnt+=a[i+1]-(x-a[i]); a[i+1]=x-a[i]; }else{ cnt+=a[i+1]+(a[i]-x); a[i+1]=0; a[i]=x; } } } cout<<cnt<<endl; return 0; }
a.cc: In function 'int main()': a.cc:11:23: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and '<unresolved overloaded function type>') 11 | rep(i,n) cin>>a[i]>>endl; | ~~~~~~~~~^~~~~~ In file included from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127, from a.cc:1: /usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:24: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'bool&' 170 | operator>>(bool& __n) | ~~~~~~^~~ /usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:25: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short int&' 174 | operator>>(short& __n); | ~~~~~~~^~~ /usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:34: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short unsigned int&' 177 | operator>>(unsigned short& __n) | ~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'int&' 181 | operator>>(int& __n); | ~~~~~^~~ /usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'unsigned int&' 184 | operator>>(unsigned int& __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:24: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long int&' 188 | operator>>(long& __n) | ~~~~~~^~~ /usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:33: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long unsigned int&' 192 | operator>>(unsigned long& __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:29: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long int&' 199 | operator>>(long long& __n) | ~~~~~~~~~~~^~~ /usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:38: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long unsigned int&' 203 | operator>>(unsigned long long& __n) | ~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 219 | operator>>(float& __f) | ^~~~~~~~ /usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'float&' 219 | operator>>(float& __f) | ~~~~~~~^~~ /usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 223 | operator>>(double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'double&' 223 | operator>>(double& __f) | ~~~~~~~~^~~ /usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 227 | operator>>(long double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long double&' 227 | operator>>(long double& __f) | ~~~~~~~~~~~~~^~~ /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>]' 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:25: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'void*&' 328 | operator>>(void*& __p) | ~~~~~~~^~~ /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>]' 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]' 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:126:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:133:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 133 | operator>>(ios_base& (*__pf)(ios_base&)) | ^~~~~~~~ /usr/include/c++/14/istream:133:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::ios_base& (*)(std::ios_base&)' 133 | operator>>(ios_base& (*__pf)(ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:352:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; __streambuf_type = std::basic_streambuf<char>]' 352 | operator>>(__streambuf_type* __sb); | ^~~~~~~~ /usr/include/c++/14/istream:352:36: note: no known conversion for argument 1 f
s700312734
p03862
C++
#include<bits/stdc++.h> #define all(x) (x).begin(),(x).end() #define rep(i,n) for(ll i=0;i<(ll)(n);i++) using namespace std; typedef long long ll; int main(){ ll n,x; cin>>n>>x; vector<ll> a(n); rep(i,n) cin<<a[i]<<endl; ll cnt=0; rep(i,n-1){ if(a[i]+a[i+1]>x){ if(a[i]<=x){ cnt+=a[i+1]-(x-a[i]); a[i+1]=x-a[i]; }else{ cnt+=a[i+1]+(a[i]-x); a[i+1]=0; a[i]=x; } } } cout<<cnt<<endl; return 0; }
a.cc: In function 'int main()': a.cc:11:17: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}) 11 | rep(i,n) cin<<a[i]<<endl; a.cc:11:17: note: candidate: 'operator<<(int, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type {aka long long int})' (built-in) a.cc:11:17: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int' In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:1: /usr/include/c++/14/bits/regex.h:1715:5: note: candidate: 'template<class _Ch_type, class _Ch_traits, class _Bi_iter> std::basic_ostream<_CharT, _Traits>& std::__cxx11::operator<<(std::basic_ostream<_CharT, _Traits>&, const sub_match<_Bi_iter>&)' 1715 | operator<<(basic_ostream<_Ch_type, _Ch_traits>& __os, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1715:5: note: template argument deduction/substitution failed: a.cc:11:22: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 11 | rep(i,n) cin<<a[i]<<endl; | ^ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41: /usr/include/c++/14/cstddef:125:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator<<(byte, _IntegerType)' 125 | operator<<(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:125:5: note: template argument deduction/substitution failed: a.cc:11:14: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte' 11 | rep(i,n) cin<<a[i]<<endl; | ^~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/string_view:763:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, basic_string_view<_CharT, _Traits>)' 763 | operator<<(basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/string_view:763:5: note: template argument deduction/substitution failed: a.cc:11:22: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 11 | rep(i,n) cin<<a[i]<<endl; | ^ /usr/include/c++/14/bits/basic_string.h:4077:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 4077 | operator<<(basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4077:5: note: template argument deduction/substitution failed: a.cc:11:22: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 11 | rep(i,n) cin<<a[i]<<endl; | ^ /usr/include/c++/14/bitset:1687:5: note: candidate: 'template<class _CharT, class _Traits, long unsigned int _Nb> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const bitset<_Nb>&)' 1687 | operator<<(std::basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/bitset:1687:5: note: template argument deduction/substitution failed: a.cc:11:22: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 11 | rep(i,n) cin<<a[i]<<endl; | ^ In file included from /usr/include/c++/14/bits/ios_base.h:46, 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/system_error:339:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const error_code&)' 339 | operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e) | ^~~~~~~~ /usr/include/c++/14/system_error:339:5: note: template argument deduction/substitution failed: a.cc:11:22: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 11 | rep(i,n) cin<<a[i]<<endl; | ^ In file included from /usr/include/c++/14/memory:80, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:56: /usr/include/c++/14/bits/shared_ptr.h:70:5: note: candidate: 'template<class _Ch, class _Tr, class _Tp, __gnu_cxx::_Lock_policy _Lp> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __shared_ptr<_Tp, _Lp>&)' 70 | operator<<(std::basic_ostream<_Ch, _Tr>& __os, | ^~~~~~~~ /usr/include/c++/14/bits/shared_ptr.h:70:5: note: template argument deduction/substitution failed: a.cc:11:22: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 11 | rep(i,n) cin<<a[i]<<endl; | ^ In file included from /usr/include/c++/14/istream:41, from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/ostream:563:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _CharT)' 563 | operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c) | ^~~~~~~~ /usr/include/c++/14/ostream:563:5: note: template argument deduction/substitution failed: a.cc:11:22: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 11 | rep(i,n) cin<<a[i]<<endl; | ^ /usr/include/c++/14/ostream:573:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char)' 573 | operator<<(basic_ostream<_CharT, _Traits>& __out, char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:573:5: note: template argument deduction/substitution failed: a.cc:11:22: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 11 | rep(i,n) cin<<a[i]<<endl; | ^ /usr/include/c++/14/ostream:579:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char)' 579 | operator<<(basic_ostream<char, _Traits>& __out, char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:579:5: note: template argument deduction/substitution failed: a.cc:11:22: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 11 | rep(i,n) cin<<a[i]<<endl; | ^ /usr/include/c++/14/ostream:590:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char)' 590 | operator<<(basic_ostream<char, _Traits>& __out, signed char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:590:5: note: template argument deduction/substitution failed: a.cc:11:22: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 11 | rep(i,n) cin<<a[i]<<endl; | ^ /usr/include/c++/14/ostream:595:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char)' 595 | operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:595:5: note: template argument deduction/substitution failed: a.cc:11:22: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 11 | rep(i,n) cin<<a[i]<<endl; | ^ /usr/include/c++/14/ostream:654:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const _CharT*)' 654 | operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:654:5: note: template argument deduction/substitution failed: a.cc:11:22: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 11 | rep(i,n) cin<<a[i]<<endl; | ^ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:307:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const char*)' 307 | operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s) | ^~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:307:5: note: template argument deduction/substitution failed: a.cc:11:22: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 11 | rep(i,n) cin<<a[i]<<endl; | ^ /usr/include/c++/14/ostream:671:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const char*)' 671 | operator<<(basic_o
s163342405
p03862
C++
#include<iostream> #include<string> #include<vector> typedef long long ll; using namespace std; int main(){ ll N, x, c, ans; cin >> N >> x; std:::vector<int> v(N); for(int i=0; i<N; i++) cin >> v[i]; ans = 0; for(int i=0; i<N-1; i++){ if(v[i] + v[i+1] > x){ c = v[i+1] + v[i] - x; if(v[i+1] >= v[i]) v[i+1] -= c; else v[i] -= c; ans += c; } } cout << ans; }
a.cc: In function 'int main()': a.cc:9:10: error: expected unqualified-id before ':' token 9 | std:::vector<int> v(N); | ^ a.cc:10:36: error: 'v' was not declared in this scope 10 | for(int i=0; i<N; i++) cin >> v[i]; | ^ a.cc:13:12: error: 'v' was not declared in this scope 13 | if(v[i] + v[i+1] > x){ | ^
s414977257
p03862
C++
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; const long double PI = (acos(-1)); #define rep(i, x, n) for (int i = x; i < (int)(n); i++) #define sc(x) scanf("%d",&x) #define scll(x) scanf("%lld",&x) int main(){ ll n, x, tmp, ans = 0; sc(n), sc(x); vector<ll> a(n); rep(i, 0, n) sc(a[i]); rep(i, 1, n){ tmp = a[i]+a[i-1]; if (tmp > x) a[i] -= tmp-x, ans += tmp-x; a[i] = max(a[i], 0); } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:16:19: error: no matching function for call to 'max(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type&, int)' 16 | 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:16:19: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 16 | 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:16:19: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 16 | a[i] = max(a[i], 0); | ~~~^~~~~~~~~
s118129427
p03862
C++
#include <bits/stdc++.h> #define PI 3.14159265359 using namespace std; int main() { int64_t N, x; cin >> N >> x; vector<int64_t> v(N); for (int64_t i = 0; i < N; i++) { cin >> v.at(i); } int n = 0; int sum = 0; for (int64_t i = 1; i < N; i += 2) { int64_t& a = v.at(i - 1), & b = v.at(i), & c = n; if (i != N - 1) c = v.at(i + 1); int64_t type = 0; if (a + b > x) type = 1; if (b + c > x) type = 2; if ((a + b > x) && (b + c > x)) type = 3; if (type == 1) { int64_t d = (a + b) - x; if (d <= b) { b -= d; } else { b = 0; a -= (d - b); } sum += d; } else if (type == 2) { int64_t d = (b + c) - x; if (d <= c) { c -= d; } else { c = 0; b -= (d - c); } } else if (type == 3) { int64_t d1 = (b + c) - x, d2 = (a + b) - x; int64_t sml = min(d1, d2), bgr = max(d1, d2); //cout << "d1:" << d1 << ' ' << "d2:" << d2 << endl; if (bgr <= b) { b -= bgr; sum += bgr; } else { sum += d1 + d2 - b; b = 0; c -= (d1 - b); a -= (d2 - b); } } } cout << sum << endl; }
a.cc: In function 'int main()': a.cc:19:31: error: cannot bind non-const lvalue reference of type 'int64_t&' {aka 'long int&'} to a value of type 'int' 19 | & c = n; | ^
s804354213
p03862
C++
#include<iostream> #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int,int> pi; #define F first #define S second #define PB push_back #define MP make_pair #define what_is(x) cerr << #x << " is " << x << endl; #define MT make_tuple #define eb emplace_back #define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end))) #define REP(i,a,b) for (int i = a; i <= b; i++) #define FOR(i,n) for (int i=0;i < n ; i++) #define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); } void err(istream_iterator<string> it) {} template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) { cerr << *it << " = " << a << endl; err(++it, args...); } int func(ll a[], ll i, ll x){ ll sum=0; if(i==1) return max(0,a[0]+a[1]-x); if(a[i] +a[i-1] <= x) return func(a,i-1,x); else if(a[i] > x) { sum+=a[i]-x; a[i]-=a[i]-x; } if(a[i] + a[i-1]> x ){ sum+=a[i]+a[i-1]-x; a[i-1]-=a[i-1]+a[i]-x; } return func(a,i-1,x)+sum; } int main(){ ll n,x; cin >> n >> x; ll a[n]; FOR(i,n) cin >> a[i]; cout << func(a,n-1,x); return 0; }
a.cc: In function 'int func(ll*, ll, ll)': a.cc:33:28: error: no matching function for call to 'max(int, ll)' 33 | if(i==1) return max(0,a[0]+a[1]-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:33:28: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'}) 33 | if(i==1) return max(0,a[0]+a[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, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, 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:33:28: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 33 | if(i==1) return max(0,a[0]+a[1]-x); | ~~~^~~~~~~~~~~~~~~
s164518882
p03862
C++
#include <bits/stdc++.h> using namespace std; #define pb(s) push_back(s) #define ALL(v) v.begin(), v.end() #define ALLA(arr, sz) arr, arr + sz #define SORT(v) sort(ALL(v)) #define REVERSE(v) reverse(ALL(v)) #define SORTA(arr, sz) sort(ALLA(arr, sz)) #define REVERSEA(arr, sz) reverse(ALLA(arr, sz)) typedef long long ll; ll N, x; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin>>N>>x; vector<ll> vi; for(int i=0;i<N;++i){ ll a; cin>>a; vi.pb(a); } ll sum=0; for(int i=1;i<N;++i){ if(vi[i]+vi[i-1]>x){ ll dif=(vi[i]+vi[i-1])-x; if(vi[i]>=dif){ vi[i]-=dif; sum+=dif; } else{ sum+=vi[i]; vi[i]=0; vi[i-1]-=(diff-vi[i]); sum+=diff-vi[i-1]; } } } cout<<sum; return 0; }
a.cc: In function 'int main()': a.cc:40:27: error: 'diff' was not declared in this scope; did you mean 'dif'? 40 | vi[i-1]-=(diff-vi[i]); | ^~~~ | dif
s493762463
p03862
C++
#include <bits/stdc++.h> using namespace std; #define pb(s) push_back(s) #define ALL(v) v.begin(), v.end() #define ALLA(arr, sz) arr, arr + sz #define SORT(v) sort(ALL(v)) #define REVERSE(v) reverse(ALL(v)) #define SORTA(arr, sz) sort(ALLA(arr, sz)) #define REVERSEA(arr, sz) reverse(ALLA(arr, sz)) typedef long long ll; ll N, x; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin>>N>>x; vector<ll> vi; for(int i=0;i<N;++i){ ll a; cin>>a; vi.pb(a); } ll sum=0; for(int i=1;i<N;++i){ if(vi[i]+vi[i-1]>x){ ll dif=(vi[i]+vi[i-1])-x; if(vi[i]>=dif){ vi[i]-=dif; ans+=dif; } else{ ans+=vi[i]; vi[i]=0; vi[i-1]-=(diff-vi[i]); ans+=diff-vi[i-1]; } } } cout<<sum; return 0; }
a.cc: In function 'int main()': a.cc:35:17: error: 'ans' was not declared in this scope; did you mean 'abs'? 35 | ans+=dif; | ^~~ | abs a.cc:38:17: error: 'ans' was not declared in this scope; did you mean 'abs'? 38 | ans+=vi[i]; | ^~~ | abs a.cc:40:27: error: 'diff' was not declared in this scope; did you mean 'dif'? 40 | vi[i-1]-=(diff-vi[i]); | ^~~~ | dif
s064799789
p03862
C++
// Problem : C - Boxes and Candies // Contest : AtCoder - AtCoder Beginner Contest 048 // URL : https://atcoder.jp/contests/abc048/tasks/arc064_a // Memory Limit : 256 MB // Time Limit : 2000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) #include <bits/stdc++.h> #define spc ' ' #define endl '\n' using namespace std; int main(){ ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0); ll n, x, t = 0, c; cin >> n >> x; vector<int> v(n); for(auto &it:v) cin >> it; for(int i = 1; i < n; i++){ if(v[i-1]+v[i] > x){ c = v[i-1] + v[i] -x; if(v[i]>c){ v[i]-=c; } else{ v[i] = 0; v[i-1]-=c-v[i]; } t+=c; } } cout << t; return 0; }
a.cc: In function 'int main()': a.cc:19:9: error: 'll' was not declared in this scope 19 | ll n, x, t = 0, c; | ^~ a.cc:20:16: error: 'n' was not declared in this scope; did you mean 'yn'? 20 | cin >> n >> x; | ^ | yn a.cc:20:21: error: 'x' was not declared in this scope 20 | cin >> n >> x; | ^ a.cc:25:17: error: 'c' was not declared in this scope 25 | c = v[i-1] + v[i] -x; | ^ a.cc:33:17: error: 't' was not declared in this scope 33 | t+=c; | ^ a.cc:36:17: error: 't' was not declared in this scope 36 | cout << t; | ^
s028465434
p03862
C++
#include<iostream> #include <string> // string, to_string, stoi #include <vector> // vector #include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound #include <utility> // pair, make_pair #include <tuple> // tuple, make_tuple #include <cstdint> // int64_t, int*_t #include <cstdio> // printf #include <map> // map #include <queue> // queue, priority_queue #include <set> // set #include <stack> // stack #include <deque> // deque #include <unordered_map> // unordered_map #include <unordered_set> // unordered_set #include <bitset> // bitset #include <cctype> // isupper, islower, isdigit, toupper, tolower #include <iomanip>//setprecision #include<math.h> #include <functional> #include<climits> using namespace std; #define rep(i, n) for(int i=0; i<(int)(n); ++i) int main(){ long long int a,b,c=0,e=INT_MAX; cin>>a>>b; vector<long long int>d(a); rep(i,a){ cin>>d[i]; } rep(i,a-1){ c+=max(d[i]+d[i+1]-b,0); //cout<<max(d[i]+d[i+1]-b,0); if(d[i]+d[i+1]-b>0)d[i+1]=max(0,d[i+1]-(d[i]+d[i+1]-b)); } cout<<c; }
a.cc: In function 'int main()': a.cc:32:11: error: no matching function for call to 'max(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type, int)' 32 | c+=max(d[i]+d[i+1]-b,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:32:11: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 32 | c+=max(d[i]+d[i+1]-b,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: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:32:11: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 32 | c+=max(d[i]+d[i+1]-b,0); | ~~~^~~~~~~~~~~~~~~~~ a.cc:34:34: error: no matching function for call to 'max(int, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)' 34 | if(d[i]+d[i+1]-b>0)d[i+1]=max(0,d[i+1]-(d[i]+d[i+1]-b)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ /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:34:34: 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'}) 34 | if(d[i]+d[i+1]-b>0)d[i+1]=max(0,d[i+1]-(d[i]+d[i+1]-b)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided /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:34:34: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 34 | if(d[i]+d[i+1]-b>0)d[i+1]=max(0,d[i+1]-(d[i]+d[i+1]-b)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
s479328735
p03862
C++
#include<iostream> #include <string> // string, to_string, stoi #include <vector> // vector #include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound #include <utility> // pair, make_pair #include <tuple> // tuple, make_tuple #include <cstdint> // int64_t, int*_t #include <cstdio> // printf #include <map> // map #include <queue> // queue, priority_queue #include <set> // set #include <stack> // stack #include <deque> // deque #include <unordered_map> // unordered_map #include <unordered_set> // unordered_set #include <bitset> // bitset #include <cctype> // isupper, islower, isdigit, toupper, tolower #include <iomanip>//setprecision #include<math.h> #include <functional> #include<climits> using namespace std; #define rep(i, n) for(int i=0; i<(int)(n); ++i) int main(){ long long int a,b,c=0,e=INT_MAX; cin>>a>>b; vector<int>d(a); rep(i,a){ cin>>d[i]; } rep(i,a-1){ c+=max(d[i]+d[i+1]-b,0); //cout<<max(d[i]+d[i+1]-b,0); if(d[i]+d[i+1]-b>0)d[i+1]=max(0,d[i+1]-(d[i]+d[i+1]-b)); } cout<<c; }
a.cc: In function 'int main()': a.cc:32:11: error: no matching function for call to 'max(long long int, int)' 32 | c+=max(d[i]+d[i+1]-b,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:32:11: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 32 | c+=max(d[i]+d[i+1]-b,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: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:32:11: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 32 | c+=max(d[i]+d[i+1]-b,0); | ~~~^~~~~~~~~~~~~~~~~ a.cc:34:34: error: no matching function for call to 'max(int, long long int)' 34 | if(d[i]+d[i+1]-b>0)d[i+1]=max(0,d[i+1]-(d[i]+d[i+1]-b)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ /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:34:34: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 34 | if(d[i]+d[i+1]-b>0)d[i+1]=max(0,d[i+1]-(d[i]+d[i+1]-b)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided /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:34:34: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 34 | if(d[i]+d[i+1]-b>0)d[i+1]=max(0,d[i+1]-(d[i]+d[i+1]-b)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
s650902385
p03862
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; #define REP(i, n) for (int i = 0; i < (int)(n); i++) #define ALL(x) (x).begin(), (x).end() int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); ll N, x; cin >> N >> x; vector<ll> a(N); REP(i, N) cin >> a[i]; ll ans = 0; if (a[0] > x) { ans += a[i] - x; ans = x; } REP(i, N-1) { ans += max(0LL, a[i+1] - (x - a[i])); a[i+1] = min(a[i+1], x - a[i]); } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:18:18: error: 'i' was not declared in this scope 18 | ans += a[i] - x; | ^
s631267313
p03862
C++
//https://atcoder.jp/contests/abc048/tasks/arc064_a //2020-04-27 #include <iostream> #include <string> #include <vector> #include <array> #include <queue> #include <stack> #include <deque> #include <algorithm> #include <functional> #include <cmath> #include <map> #include <iomanip> using namespace std; int_fast16_t main() { long long num; cin >> num; long long maximum; cin >> maximum; vector<long long> v; long long tmp; for(long long i=0;i<num;i++){ cin >> tmp; v.push_back(tmp); } long long ans =0; if(v[0]>maximum){ ans += maximum-v[0]; v[0]=maximum; } for(long long i=1;i<num;i++){ if(v[i-1]+v[i]>maximum){ ans += (v[i-1]+v[i])-maximum; v[i]=maximum-v[i-1]; } } cout << ans << endl; return 0; }
a.cc:17:1: error: 'int_fast16_t' does not name a type 17 | int_fast16_t main() | ^~~~~~~~~~~~
s542833590
p03862
C++
#include <bits/stdc++.h> using namespace std; typedef long long int ll; #define FOR(i,l,r) for(i=l;i<r;i++) #define REP(i,n) FOR(i,0,n) #define ALL(x) x.begin(),x.end() #define P pair<ll,ll> #define F first #define S second signed main(){ ll N,X,i,ans=0;cin>>N>>X;ll A[N]; REP(i,N)cin>>A[i]; if(A[0]>x)ans+=A[0]-x;A[0]=x; FOR(i,1,N)ans+=A[i]+A[i-1]-x; cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:13:11: error: 'x' was not declared in this scope 13 | if(A[0]>x)ans+=A[0]-x;A[0]=x; | ^ a.cc:13:30: error: 'x' was not declared in this scope 13 | if(A[0]>x)ans+=A[0]-x;A[0]=x; | ^
s474169235
p03862
C++
#include<bits/stdc++.h> using namespace std; int main(){ cin.tie(0); ios::sync_with_stdio(false); int n, c=0; long long x; cin>>n>>x; int a[n]; for(int i=0; i<n; i++) cin>>a[i]; for(int i=1; i<n; i++){ int temp = a[i-1]+a[i]; if( temp > x ){ int c+= temp - x; a[i]-= temp - x; } } //for(int i=0; i<n; i++) cout<<a[i]<<" "; cout<<c; }
a.cc: In function 'int main()': a.cc:16:18: error: expected initializer before '+=' token 16 | int c+= temp - x; | ^~
s464729807
p03862
C++
#include<iostream> #include<algorithm> #include<vector> using std::cin; using std::cout; using std::endl; using std::min; using std::vector; int main(void){ int n, x; vector<int> a; cin >> n >> x; for(int i=0; i<n; i++) cin >> a[i]; long long ans = 0LL; for(int i=1; i<n; i++) { long long dif = a[i] + (long long)a[i-1] - x; if (dif>0) { a[i] -= min(dif, a[i]); ans += dif; } } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:20:18: error: no matching function for call to 'min(long long int&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)' 20 | a[i] -= min(dif, a[i]); | ~~~^~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:61, from a.cc:2: /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:20:18: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 20 | a[i] -= min(dif, a[i]); | ~~~^~~~~~~~~~~ /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 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: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_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:20: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'}) 20 | a[i] -= min(dif, a[i]); | ~~~^~~~~~~~~~~
s611774514
p03862
C++
#include<iostream> #include<vector> int main(void){ int n, x; std::vector<int> a; std::cin >> n >> x; for(int i=0; i<n; i++) cin >> a[i]; long long ans = 0LL; for(int i=1; i<n; i++) { int dif = a[i] + a[i-1] - x; if (dif>0) { a[i] -= std::min(dif, a[i]); ans += dif; } } std::cout << ans << std::endl; return 0; }
a.cc: In function 'int main()': a.cc:8:26: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 8 | for(int i=0; i<n; i++) cin >> a[i]; | ^~~ | std::cin In file included from a.cc:1: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~
s860738047
p03862
C++
#include<iostream> #include<vector> int main(void){ int n, x; std::vector<int> a; std::cin >> n >> x; for(int i=0; i<n; i++) cin >> a[i]; long long ans = 0LL; for(int i=1; i<n; i++) { int dif = a[i] + a[i-1] - x; if (dif>0) { a[i] -= min(dif, a[i]); ans += dif; } } std::cout << ans << std::endl; return 0; }
a.cc: In function 'int main()': a.cc:8:26: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 8 | for(int i=0; i<n; i++) cin >> a[i]; | ^~~ | std::cin In file included from a.cc:1: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:14:15: error: 'min' was not declared in this scope; did you mean 'std::min'? 14 | a[i] -= min(dif, a[i]); | ^~~ | std::min In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41: /usr/include/c++/14/bits/stl_algobase.h:281:5: note: 'std::min' declared here 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~
s252366655
p03862
C++
#include <bits/stdc++.h> using namespace std; int main() { long long n, x, a, ans=0; cin >> n >> x; vector<long long> box(n); for(int i=0; i<n; i++) cin >> box.at(i); vector<long long> s(n-1); for(int i=0; i<n-1; i++) s.at(i)=box.at(i)+box.at(i+1); for(int i=0; i<n-2; i++) { a=max(s.at(i)-x, 0); s.at(i) -= a; s.at(i+1) -= a; box.at(i+1) -= a; ans += a; } a=max(s.at(0)-x, 0); s.at(0) -= a; box.at(0) -= a; ans += a; a=max(s.at(n-2)-x, 0); s.at(n-2) -= a; box.at(n-1) -= a; ans += a; cout << ans << endl; }
a.cc: In function 'int main()': a.cc:12:12: error: no matching function for call to 'max(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type, int)' 12 | a=max(s.at(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:12:12: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 12 | a=max(s.at(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:12:12: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 12 | a=max(s.at(i)-x, 0); | ~~~^~~~~~~~~~~~~~ a.cc:18:9: error: no matching function for call to 'max(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type, int)' 18 | a=max(s.at(0)-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:18:9: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 18 | a=max(s.at(0)-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:18:9: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 18 | a=max(s.at(0)-x, 0); | ~~~^~~~~~~~~~~~~~ a.cc:23:9: error: no matching function for call to 'max(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type, int)' 23 | a=max(s.at(n-2)-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:23:9: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 23 | a=max(s.at(n-2)-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:23:9: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 23 | a=max(s.at(n-2)-x, 0); | ~~~^~~~~~~~~~~~~~~~
s451532063
p03862
C++
#include<iostream> #include<string> #include<vector> #include<algorithm> #include<bits/stdc++.h> #include<cmath> #include<bitset> #include<queue> #define ll long long #define itn int #define co(ans) cout<<ans<<endl; #define COYE cout<<"YES"<<endl; #define COYe cout<<"Yes"<<endl; #define COye cout<<"yes"<<endl; #define CONO cout<<"NO"<<endl; #define CONo cout<<"No"<<endl; #define COno cout<<"no"<<endl; #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define FFOR(i,a,b) for(int i=(a);i<=(b);++i) #define REP(i,n) FOR(i,0,n) #define RREP(i,n) FFOR(i,1,n) #define SORT(V) sort((V).begin(),(V).end()) #define REVERSE(V) reverse((V).begin(),(V).end()) #define INF ((1LL<<62)-(1LL<<31)) #define MOD 1000000007 template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } using namespace std; int main(){ ll N,X,ans=0; cin>>N>>X; ll A[N]; REP(i,N) cin>>A[i]; if(A[0]>X){ ans+=A[0]+A[1]-X; A[i]=0; } if(A[0]<=X){ if(A[0]+A[1]>X){ ans+=A[0]+A[1]-X; A[1]=X-A[0]; } } for(int i=2; i<N; ++i){ if(A[i-1]+A[i]>X){ ans+=A[i-1]+A[i]-X; A[i]=X-A[i-1]; } } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:40:7: error: 'i' was not declared in this scope 40 | A[i]=0; | ^
s100160748
p03862
C++
#include<iostream> #include<string> #include<vector> #include<algorithm> #include<bits/stdc++.h> #include<cmath> #include<bitset> #include<queue> #define ll long long #define itn int #define co(ans) cout<<ans<<endl; #define COYE cout<<"YES"<<endl; #define COYe cout<<"Yes"<<endl; #define COye cout<<"yes"<<endl; #define CONO cout<<"NO"<<endl; #define CONo cout<<"No"<<endl; #define COno cout<<"no"<<endl; #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define FFOR(i,a,b) for(int i=(a);i<=(b);++i) #define REP(i,n) FOR(i,0,n) #define RREP(i,n) FFOR(i,1,n) #define SORT(V) sort((V).begin(),(V).end()) #define REVERSE(V) reverse((V).begin(),(V).end()) #define INF ((1LL<<62)-(1LL<<31)) #define MOD 1000000007 template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } using namespace std; int main(){ ll N,X,ans=0; cin>>N>>X; ll A[N]; REP(i,N) cin>>A[i]; if(A[0]>X){ ans+=A[i-1]+A[i]-X; A[i]=0; } if(A[0]<=X){ if(A[0]+A[1]>X){ ans+=A[0]+A[1]-X; A[1]=X-A[0]; } } for(int i=2; i<N; ++i){ if(A[i-1]+A[i]>X){ ans+=A[i-1]+A[i]-X; A[i]=X-A[i-1]; } } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:39:12: error: 'i' was not declared in this scope 39 | ans+=A[i-1]+A[i]-X; | ^
s170719226
p03862
C++
#include<bits/stdc++.h> using namespace std; int main() { long long sum=0//计数器,n,x; cin>>n>>x;//输入 long long a[n+1]; cin>>a[1];//处理第一个单独超限。 if(a[1]>x) { sum+=a[1]-x;//增加吃的量 a[1]=x;//a[i]>=x,要吃的最少,即是a[i]=x; } for(int i=2;i<=n;i++) { cin>>a[i];//输入 if(a[i]+a[i-1]>x)//照例处理 { sum+=a[i]+a[i-1]-x; a[i]=x-a[i-1]; } } cout<<sum;//输出 return 0;//养成好习惯 }
a.cc: In function 'int main()': a.cc:6:5: error: expected ',' or ';' before 'cin' 6 | cin>>n>>x;//输入 | ^~~ a.cc:7:17: error: 'n' was not declared in this scope; did you mean 'yn'? 7 | long long a[n+1]; | ^ | yn a.cc:8:10: error: 'a' was not declared in this scope 8 | cin>>a[1];//处理第一个单独超限。 | ^ a.cc:9:13: error: 'x' was not declared in this scope 9 | if(a[1]>x) | ^ a.cc:17:24: error: 'x' was not declared in this scope 17 | if(a[i]+a[i-1]>x)//照例处理 | ^
s535955013
p03862
C++
#include <bits/stdc++.h> using namespace std; typedef unsigned long long ull; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<double, double> pdd; //const ull mod = 1e9 + 7; const ll mod = 1e9 + 7; #define REP(i,n) for(int i=0;i<(int)n;++i) // debug #define dump(x) cerr << #x << " = " << (x) << endl; #define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl; template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){ os << "(" << v.first << ", " << v.second << ")"; return os; } template<class T> ostream& operator << (ostream& os, const vector<T> v){ for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os; } template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){ for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os; } template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; } // conversion number to bit string num2bit(ll num, ll len){ string bit = ""; REP(i, len){ bit += char('0'+(num>>i & 1)); } return bit; } int main(){ cin.tie(0); ios::sync_with_stdio(false); ll N, x; cin >> N >> x; vector<ll> a(N); REP(i, N) cin >> a[i]; ll res = 0; REP(i, N-1){ ll tori = max(a[i+1]+a[i]-x,a a[i+1]); a[i+1] -= tori; res += tori; tori = max(a[i+1]+a[i]-x, a[i]); a[i] -= tori; res += tori; } cout << res << endl; return 0; }
a.cc: In function 'int main()': a.cc:49:38: error: expected ')' before 'a' 49 | ll tori = max(a[i+1]+a[i]-x,a a[i+1]); | ~ ^~ | ) a.cc:49:22: error: no matching function for call to 'max(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type, std::vector<long long int>&)' 49 | ll tori = max(a[i+1]+a[i]-x,a 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:49:22: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'std::vector<long long int>') 49 | ll tori = max(a[i+1]+a[i]-x,a 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:49:22: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 49 | ll tori = max(a[i+1]+a[i]-x,a a[i+1]); | ~~~^~~~~~~~~~~~~~~~~~
s049169225
p03862
C++
#include <iostream> #include <algorithm> #include <cstring> #include <cmath> #include <vector> #include <set> #include <queue> #include <map> #include <string> #define rep(i, a, b) for ( int i = (a); i < (b); i++ ) #define per(i, a, b) for ( int i = (b)-1; i >= (a); i--) #define pb push_back #define mp make_pair #define bg begin() #define en end() using namespace std; typedef long long ll; static const long long MOD = 1000000007; int N; ll x, A[100005]; ll ans; int main(void) { scanf("%d %lld", &N, &x); rep(i, 0, N) scanf("%lld", &A[i]); rep(i, 1, N) { ll t = A[i-1]+A[i]; if (t > x) { ll t2 = t - x; A[i-1] -= max(0, t2 - A[i]); A[i] -= min(t2, A[i]); ans += t2; } } printf("%lld\n", ans); return 0; }
a.cc: In function 'int main()': a.cc:37:22: error: no matching function for call to 'max(int, ll)' 37 | A[i-1] -= max(0, t2 - A[i]); | ~~~^~~~~~~~~~~~~~ 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:37:22: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'}) 37 | A[i-1] -= max(0, t2 - A[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, 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:37:22: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 37 | A[i-1] -= max(0, t2 - A[i]); | ~~~^~~~~~~~~~~~~~
s217087437
p03862
C++
#include <bits/stdc++.h> using namespace std; int main() { long N, X, A, B, ans = 0; cin >> N >> X >> A; while (cin >> B) { ans += max(0, A + B - X); B -= (A + B > X) ? max(B, A + B - X) : 0; A = B; } cout << ans << "\n"; }
a.cc: In function 'int main()': a.cc:8:15: error: no matching function for call to 'max(int, long int)' 8 | ans += max(0, A + B - 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:8:15: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long int') 8 | ans += max(0, A + B - 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:8:15: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 8 | ans += max(0, A + B - X); | ~~~^~~~~~~~~~~~~~
s507793062
p03862
C++
#include <iostream> #include <math.h> #include <numeric> #include <vector> #include <map> #include <algorithm> #include <set> #include <queue> #include <tuple> #include <functional> #include <cstring> #define PI 3.14159265359 #define INF 1e9 #define LINF 1e18 #define IMOD 1000000007 #define irep(i,n) for(int i = 0; i < n; i++) #define irep2(i,a,n) for(int i = a; i < n; i++) #define lrep(i,n) for(long long i = 0; i < n; i++) #define lrep2(i,a,n) for(long long i = a; i < n; i++) typedef long long ll; typedef std::vector<int> v_int; typedef std::vector<std::vector<int> > v2_int; typedef std::vector<ll> v_ll; typedef std::vector<std::vector<ll> > v2_ll; typedef std::vector<std::string> v_string; typedef std::vector<std::vector<std::string> > v2_string; typedef std::vector<bool> v_bool; typedef std::vector<std::vector<bool> > v2_bool; typedef std::pair<ll, ll> pll; using namespace std; int main() { int n, x; cin >> n >> x; v_int a(n); v_int a2(n); v_int b(n); v_int b2(n); irep(i, n) { cin >> a[i]; b[n-i-1] = a[i]; } ll a_ans = 0; ll b_ans = 0; irep(i, n-1) { ll sum = a[i] + a[i+1]; if(sum > x) { a_ans += (a[i]+a[i+1] - x); if(a[i] <= a[i+1]) { a[i+1] -= (sum - x); } else { a[i] -= (sum - x); } if(a[i] + a[i] a_ans += (a[i]+a[i+1] - x); a[i+1] -= (a[i]+a[i+1] - x); } } irep(i, n-1) { if(b[i] + b[i+1] > x) { b_ans += (b[i]+b[i+1] - x); b[i+1] -= (b[i]+b[i+1] - x); } } cout << min(a_ans, b_ans); return 0; }
a.cc: In function 'int main()': a.cc:62:27: error: expected ';' before 'a_ans' 62 | if(a[i] + a[i] | ^ | ; 63 | a_ans += (a[i]+a[i+1] - x); | ~~~~~ a.cc:64:40: error: expected ')' before ';' token 64 | a[i+1] -= (a[i]+a[i+1] - x); | ^ | ) a.cc:62:15: note: to match this '(' 62 | if(a[i] + a[i] | ^
s449980164
p03862
C++
#include<bits/stdc++.h> #include <iostream> #include <string> #include <cmath> using namespace std; #define ll long long #define rep(i, n) for (ll i = 0; i < (n); i++) #define FOR(i,a,b) for(ll i=(a);i<(b);i++) #define FORR(i,a,b)for(ll i=(a);i<=(b);i++) #define repR(i,n) for(ll i=n;i>=0;i--) #define all(v)(v).begin(),(v).end() #define rall(v)(v).rbegin(),(v).rend() #define F first #define S second #define pb push_back #define pu push #define COUT(x) cout<<(x)<<endl #define PQ priority_queue<ll> #define PQR priority_queue<ll,vector<ll>,greater<ll>> #define YES(n) cout << ((n) ? "YES" : "NO" ) << endl #define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl #define mp make_pair #define maxs(x,y) (x = max(x,y)) #define mins(x,y) (x = min(x,y)) #define sz(x) (int)(x).size() #define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key))) #define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key))) typedef pair<int,int> pii; typedef pair<ll,ll> pll; const ll MOD = 1000000007LL; const ll INF = 1LL << 60; using vll = vector<ll>; using vvll = vector<vll>; using vstr = vector<string>; using pll = pair<ll, ll>; int main(){ ll n,x; cin>>n>>x; vll a(n); rep(i,n) cin>>a[i]; ll ans=0; rep(i,n-1){ if(a[i]+a[i+1]>x){ ll k=a[i]+a[i+1]-x; if(k>=a[i+1]){ a[i+1]-=k; ans+=k; } else{ a[i+1]=0; k-=a[i+1]; a[i]-=k; ans+=k; } } } ll anss=0; for(int i=n-1;i>0;i++){ if(a[i]+a[i-1]>x){ ll k=a[i]+a[i-1]-x; if(k>=a[i-1]){ a[i-1]-=k; anss+=k; } else{ a[i-1]=0; k-=a[i-1]; a[i]-=k; anss+=k; } } } COUT(min(anss,ans); }
a.cc:75:2: error: unterminated argument list invoking macro "COUT" 75 | } | ^ a.cc: In function 'int main()': a.cc:74:3: error: 'COUT' was not declared in this scope 74 | COUT(min(anss,ans); | ^~~~ a.cc:74:7: error: expected '}' at end of input 74 | COUT(min(anss,ans); | ^ a.cc:36:11: note: to match this '{' 36 | int main(){ | ^
s923509747
p03862
C++
#include<bits/stdc++.h> using namespace std; #define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++) #define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++) #define MOD 1000000007 #define int long long #define ALL(a) (a).begin(),(a).end() #define vi vector<int> #define vii vector<vi> #define pii pair<int,int> #define priq priority_queue<int> #define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key))) #define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key))) #define tii tuple<int,int,int> signed main(){ int N,K; cin>>N>>K; int memo; cin>>memo; int ans=0; if(memo>K){ ans+=memo-K; memo=K; } rep(i,0,N){ int X; cin>>X; if(X+memo>K){ int Y=memo+X-K; ans+=Z; X-=Z; } memo=X; } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:27:12: error: 'Z' was not declared in this scope 27 | ans+=Z; | ^
s398309945
p03862
C++
#include <vector> #include <algorithm> #include <iostream> #include <queue> #include <limits> #include <math.h> #include <map> using namespace std; typedef long long ll; int main() { int N; ll x; scanf("%d %lld", &N, &x); vector<ll> a(N); for (int i = 0; i < N; ++i) scanf("%d", &a[i]); ll ans = 0; for (int i = 0; i < N - 1; ++i) { if (a[i] + a[i + 1] > x) { ll diff = (a[i] + a[i + 1]) - x; ans += diff; a[i + 1] = max(0, a[i + 1] - diff); } } printf("%lld\n", ans); return 0; }
a.cc: In function 'int main()': a.cc:24:21: 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 + 1] = max(0, a[i + 1] - diff); | ~~~^~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/vector:62, 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:24:21: 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 + 1] = max(0, a[i + 1] - diff); | ~~~^~~~~~~~~~~~~~~~~~~~ /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:24:21: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 24 | a[i + 1] = max(0, a[i + 1] - diff); | ~~~^~~~~~~~~~~~~~~~~~~~
s461161330
p03862
C++
#include<bits/stdc++.h> using namespace std; int main() { int n, x; cin>>n>>x; int a[n]; //int sum = 0; for(int i = 0; i < n; i++) { cin>>a[i]; //sum += a[i]; } for(int i = 0; i < n-1; i++) { int d = x-a[i]; if(a[i+1]-d < 0) continue; res += a[i+1]-d; a[i+1] = d; } cout<<res<<"\n"; /*if(x == 0) cout<<sum<<"\n"; else { int res = 0; bool flag = true; for(int i = 0; i < n-1; i++) { if(a[i] + a[i+1] > x) { flag = false; break; } } if(flag == true) cout<<0<<"\n"; else { for(int i = 0; i < n-1; i++) { int d = x-a[i]; if(a[i+1]-d < 0) continue; res += a[i+1]-d; a[i+1] = d; } cout<<res<<"\n"; } }*/ return 0; }
a.cc: In function 'int main()': a.cc:20:9: error: 'res' was not declared in this scope 20 | res += a[i+1]-d; | ^~~ a.cc:23:15: error: 'res' was not declared in this scope 23 | cout<<res<<"\n"; | ^~~
s693142676
p03862
C++
#include <bits/stdc++.h> using namespace std; #define pb push_back #define all(x) (x).begin(),(x).end() #define SZ(x) ((int)(x).size()) #define REP(i,n) for(int _n=n, i=0;i<_n;++i) #define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i) #define FORD(i,a,b) for(int i=(a),_b=(b);i>=_b;--i) #define trav(a, x) for (auto& a : x) using ull = uint64_t; using ll = int64_t; using PII = pair<int, int>; using VI = vector<int>; #define INF (1ll<<60) string to_string(string s) { return '"' + s + '"'; } string to_string(const char* s) { return to_string((string) s); } string to_string(bool b) { return (b ? "true" : "false"); } template <typename A, typename B> string to_string(pair<A, B> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; } template <typename A> string to_string(A v) { bool first = true; string res = "{"; for (const auto &x : v) { if (!first) { res += ", "; } first = false; res += to_string(x); } res += "}"; return res; } void debug_out() { cerr << endl; } template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << to_string(H); debug_out(T...); } #define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__) int main() { ios::sync_with_stdio(false), cin.tie(0); ll N, x; cin >> N >> x; vector<ll> V(N); vector<ll> V1; REP(i, N) { cin >> V[i]; } V1 = V; ll cost = 0; FOR(i, 1, N-1) { ll sum = V[i] + V[i-1]; if (sum > x) { int k = V[i]; V[i] = max(0LL, V[i] - (sum - x)); sum = V[i-1] + V[i]; cost += k - V[i]; if (sum > x) { k = V[i-1]; V[i-1] = V[i-1] - (sum - x); cost += k - V[i-1]; } } } V = V1; ll cost1 = 0; FORD(i, N-2, 0) { ll sum = V[i] + V[i+1]; if (sum > x) { int k = V[i]; V[i] = max(0LL, V[i] - (sum - x)); sum = V[i+1] + V[i]; cost1 += k - V[i]; if (sum > x) { k = V[i+1]; V[i+1] = V[i+1] - (sum - x); cost1 += k - V[i+1]; } } } cout << min(cost, cost1) << endl; }
a.cc: In function 'int main()': a.cc:46:23: error: no matching function for call to 'max(long long int, __gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type)' 46 | V[i] = max(0LL, V[i] - (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: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:46:23: 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'}) 46 | V[i] = max(0LL, V[i] - (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:46:23: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 46 | V[i] = max(0LL, V[i] - (sum - x)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~ a.cc:62:23: error: no matching function for call to 'max(long long int, __gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type)' 62 | V[i] = max(0LL, V[i] - (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:62:23: 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'}) 62 | V[i] = max(0LL, V[i] - (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:62:23: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 62 | V[i] = max(0LL, V[i] - (sum - x)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~
s541344668
p03862
C++
#include <bits/stdc++.h> using namespace std; #define pb push_back #define all(x) (x).begin(),(x).end() #define SZ(x) ((int)(x).size()) #define REP(i,n) for(int _n=n, i=0;i<_n;++i) #define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i) #define FORD(i,a,b) for(int i=(a),_b=(b);i>=_b;--i) #define trav(a, x) for (auto& a : x) using ull = uint64_t; using ll = int64_t; using PII = pair<int, int>; using VI = vector<int>; #define INF (1ll<<60) string to_string(string s) { return '"' + s + '"'; } string to_string(const char* s) { return to_string((string) s); } string to_string(bool b) { return (b ? "true" : "false"); } template <typename A, typename B> string to_string(pair<A, B> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; } template <typename A> string to_string(A v) { bool first = true; string res = "{"; for (const auto &x : v) { if (!first) { res += ", "; } first = false; res += to_string(x); } res += "}"; return res; } void debug_out() { cerr << endl; } template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << to_string(H); debug_out(T...); } #define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__) int main() { ios::sync_with_stdio(false), cin.tie(0); ll N, x; cin >> N >> x; vector<ll> V(N); vector<ll> V1; REP(i, N) { cin >> V[i]; } V1 = V; ll cost = 0; FOR(i, 1, N-1) { ll sum = V[i] + V[i-1]; if (sum > x) { int k = V[i]; V[i] = max(0LL, V[i] - (sum - x)); sum = V[i-1] + V[i]; cost += k - V[i]; if (sum > x) { k = V[i-1]; V[i-1] = V[i-1] - (sum - x); cost += k - V[i-1]; } } } V = V1; ll cost1 = 0; FORD(i, N-2, 0) { ll sum = V[i] + V[i+1]; if (sum > x) { int k = V[i]; V[i] = max(0LL, V[i] - (sum - x)); sum = V[i+1] + V[i]; cost1 += k - V[i]; if (sum > x) { k = V[i+1]; V[i+1] = V[i+1] - (sum - x); cost1 += k - V[i+1]; } } } cout << min(cost, cost1) << endl; }
a.cc: In function 'int main()': a.cc:46:23: error: no matching function for call to 'max(long long int, __gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type)' 46 | V[i] = max(0LL, V[i] - (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: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:46:23: 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'}) 46 | V[i] = max(0LL, V[i] - (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:46:23: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 46 | V[i] = max(0LL, V[i] - (sum - x)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~ a.cc:62:23: error: no matching function for call to 'max(long long int, __gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type)' 62 | V[i] = max(0LL, V[i] - (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:62:23: 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'}) 62 | V[i] = max(0LL, V[i] - (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:62:23: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 62 | V[i] = max(0LL, V[i] - (sum - x)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~
s331949078
p03862
C++
#include<bits/stdc++.h> #define ll long long #define int ll #define fast ios_base::sync_with_stdio(false); cin.tie(NULL); using namespace std; int32_t main(){ fast; int N{},x{},c{}; cin>>N>>x; int A[N]{}; for(int i=0;i<N;i++) cin>>A[i]; for(int i=1;i<N;i++){ if(a[i]+a[i-1] > x){ c += A[i]+A[i-1]-x; A[i] -= A[i]+A[i-1]-x; } } cout<<c<<endl; return 0; }
a.cc: In function 'int32_t main()': a.cc:12:12: error: 'a' was not declared in this scope 12 | if(a[i]+a[i-1] > x){ | ^
s412770740
p03862
C++
#include<bits/stdc++.h> using namespace std; typedef long long int ll; ll Svec(vector<ll> v){ ll n=0; for(ll i=0;i<v.size();i++) n+=v[i]; return n; } int main(){ ll n,x,ans;cin>>n>>x; vector<ll> v(n); rep(i,n) cin>>v[i]; ans=Svec(v); if(v[0]>x) v[0]=x; for(ll i=0;i<n-1;i++){ if(v[i]+v[i+1]>x){ v[i+1]=x-v[i]; } } cout<<ans-Svec(v)<<endl; }
a.cc: In function 'int main()': a.cc:12:7: error: 'i' was not declared in this scope 12 | rep(i,n) cin>>v[i]; | ^ a.cc:12:3: error: 'rep' was not declared in this scope 12 | rep(i,n) cin>>v[i]; | ^~~
s983455628
p03862
C++
/*Function Template*/ #include<bits/stdc++.h> using namespace std; typedef long long int ll; const int mod = 1000000007; const ll MOD = 1000000000000000001; #define rep(i, n) for(ll i = 0; i < (n); i++) #define ALL(a) (a).begin(),(a).end() #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll Len(ll n) { ll s=0; while(n!=0) s++, n/=10; return s; } ll Sint(ll n) { ll m=0,s=0,a=n; while(a!=0) s++, a/=10; for(ll i=s-1;i>=0;i--) m+=n/((ll)pow(10,i))-(n/((ll)pow(10,i+1)))*10; return m; } ll Svec(vector<ll> v){ ll n=0; for(ll i=0;i<v.size();i++) n+=v[i]; return n; } ll GCD(ll a,ll b){ ll r,tmp; /*自然数 a > b を確認・入替*/ if(a<b){ tmp=a,a=b,b=tmp; } /*ユークリッドの互除法*/ r=a%b; while(r!=0){ a=b,b=r,r=a%b; } return b; } ll LCM(ll a,ll b){ ll c=a,d=b,r,tmp; /*自然数 a > b を確認・入替*/ if(a<b){ tmp=a,a=b,b=tmp; } /*ユークリッドの互除法*/ r=a%b; while(r!=0){ a=b,b=r,r=a%b; } return c/b*d; } ll Factorial(ll n){ ll m=1; while(n>=1) m*=n,n--; return m; } vector<pair<char,ll>> runlength(string s,vector<pair<char,ll>> p){ ll x=1; if(s.size()==1){ p.push_back(pair<char,ll>(s[0],1)); return p; } for(ll i=0;i<s.size()-1;i++){ if(s[i]==s[i+1]){ x++; if(i==s.size()-2){ p.push_back(pair<char,ll>(s[i],x)); } }else{ p.push_back(pair<char,ll>(s[i],x)); x=1; if(i==s.size()-2){ p.push_back(pair<char,ll>(s[s.size()-1],x)); } } } return p; } /*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/ int main() { IOS; ll n,ans=0,pre=0,tmp; cin>>n>>x; rep(i,n){ ll a; cin>>a; tmp=max((ll)0,pre+a-x); ans+=tmp; pre=a-tmp; } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:99:11: error: 'x' was not declared in this scope 99 | cin>>n>>x; | ^
s387113457
p03862
C++
#include<cstdio> #include<iostream> using namespace std; long long a[100005]; int main() { long long n,x,t; while(~scanf("%lld%lld",&n,&x)) { long long sum = 0; a[0] = 0; for(int i = 1; i <= n; i++) { scanf("%lld",&a[i]); if(a[i] + a[i-1] > x) { t = a[i] + a[i-1] - x; / / the number of the difference from the previous value sum += t; //Statistics to the sum a[i] -= t; / / Change the original value, so that the next number is judged } } printf("%lld\n",sum); } return 0; }
a.cc: In function 'int main()': a.cc:21:43: error: expected primary-expression before '/' token 21 | t = a[i] + a[i-1] - x; / / the number of the difference from the previous value | ^ a.cc:21:45: error: expected primary-expression before '/' token 21 | t = a[i] + a[i-1] - x; / / the number of the difference from the previous value | ^ a.cc:21:47: error: 'the' was not declared in this scope 21 | t = a[i] + a[i-1] - x; / / the number of the difference from the previous value | ^~~ a.cc:23:30: error: expected primary-expression before '/' token 23 | a[i] -= t; / / Change the original value, so that the next number is judged | ^ a.cc:23:32: error: expected primary-expression before '/' token 23 | a[i] -= t; / / Change the original value, so that the next number is judged | ^ a.cc:23:34: error: 'Change' was not declared in this scope 23 | a[i] -= t; / / Change the original value, so that the next number is judged | ^~~~~~
s138936064
p03862
C++
using namespace std; typedef long long ll; int main() { int n; cin >> n; ll x; cin >> x; vector<ll> a(n); for(ll i=0;i<n;i++){ cin >> a.at(i); } ll ans =0; for(ll i=1;i<n;i++){ if(a.at(i-1) + a.at(i) > x){ ans += cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:8:3: error: 'cin' was not declared in this scope 8 | cin >> n; | ^~~ a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' +++ |+#include <iostream> 1 | a.cc:11:3: error: 'vector' was not declared in this scope 11 | vector<ll> a(n); | ^~~~~~ a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' +++ |+#include <vector> 1 | a.cc:11:12: error: expected primary-expression before '>' token 11 | vector<ll> a(n); | ^ a.cc:11:14: error: 'a' was not declared in this scope 11 | vector<ll> a(n); | ^ a.cc:20:3: error: 'cout' was not declared in this scope 20 | cout << ans << endl; | ^~~~ a.cc:20:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:20:18: error: 'endl' was not declared in this scope 20 | cout << ans << endl; | ^~~~ a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' +++ |+#include <ostream> 1 | a.cc:22:2: error: expected '}' at end of input 22 | } | ^ a.cc:16:22: note: to match this '{' 16 | for(ll i=1;i<n;i++){ | ^ a.cc:22:2: error: expected '}' at end of input 22 | } | ^ a.cc:6:12: note: to match this '{' 6 | int main() { | ^
s027758618
p03862
C++
#include<iostream> #include<vector> using namespace std; long long main(){ long long n; long long maxc; cin >> n >> maxc; vector<long long>candies; for(long long i = 0;i<n;++i){ long long temp; cin >>temp; candies.push_back(temp); } long long sum = 0; for(long long j = 0;j<n-1;++j){ if(candies[j]+candies[j+1]>maxc){ if(candies[j]>=maxc){ sum+=candies[j+1]+candies[j]-maxc; candies[j+1]=0; }else{ long long temp=maxc-candies[j]; long long temp2 = candies[j+1]-temp; candies[j+1]=temp; sum+= temp2; } } } cout <<sum; return 0; }
cc1plus: error: '::main' must return 'int'
s884740352
p03862
C
# include <stdio.h> # include <math.h> # include <stdlib.h> int main() { int a[100000], x, i, k = 0; scanf("%d %d", &n, &x); for (i = 0; i < n; i++) { scanf("%d", &a[i]); if (a[i] > x) { k = k + (a[i] - x); a[i] = x; } } for (i = 0; i < (n - 1); i++) { if ((a[i] + a[i + 1]) > x) { if (i != 0) { do { a[i] = a[i] - 1; k++; } while ((a[i] + a[i + 1]) > x); } else { do { a[i + 1]--; k++; } while ((a[i] + a[i + 1]) > x); } } } printf("%d", k); return 0; }
main.c: In function 'main': main.c:8:25: error: 'n' undeclared (first use in this function) 8 | scanf("%d %d", &n, &x); | ^ main.c:8:25: note: each undeclared identifier is reported only once for each function it appears in
s429191484
p03862
C++
#include<bits/stdc++.h > #include<algorithm> #include<vector> typedef long long ll; #define rep(i,a,b) for(ll i=(a);i<(b);i++) using namespace std; ll N, x; vector<ll> a; int ans = 0; int main() { cin >> N >> x; rep(i, 0, N) { ll t; cin >> t; a.push_back(t); } if (a[0] > x) { ans += a[0] - x; a[0] = x; } rep(i, 1, N) { if ((a[i - 1] + a[i]) > x) { ans += (a[i - 1] + a[i]) - x; a[i] = x - a[i - 1]; } } cout << ans << endl; return 0; }
a.cc:1:9: fatal error: bits/stdc++.h : No such file or directory 1 | #include<bits/stdc++.h > | ^~~~~~~~~~~~~~~~ compilation terminated.
s513863863
p03862
C++
Last login: Fri Oct 11 10:11:46 on console pc026030m:~ 8289423578$ vim pc026030m:~ 8289423578$ vim test.cpp pc026030m:~ 8289423578$ cp test.cpp > init.cpp usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory pc026030m:~ 8289423578$ cp test.cpp init.cp pc026030m:~ 8289423578$ cp test.cpp init.cpp pc026030m:~ 8289423578$ rm init.cp pc026030m:~ 8289423578$ ls #exl.awk# eular.dat nbody2_anim 1.2 eular_1 nbody2_anim.cpp 1.2.cpp eular_1.cpp nbody2_anim.cpp~ 1.2.cpp~ eular_1.dat nbody2_anim.dat 1.2.dat euler_2 nbody2_anim.o Applications euler_2.cpp ngc1754.dat Desktop euler_2.cpp~ one_body Documents euler_2.dat one_body.cpp Downloads euler_3 one_body.cpp~ Library euler_3.cpp one_body.dat Makefile euler_3.cpp~ pgplot.sh Makefile~ euler_3.dat pleasepe.dat Movies eusar_1 pleiades.awk Music example.data pleiades.dat Pictures example.data~ pleseve.dat Public exl preasepe Untitled.ipynb exl.awk preasepe.awk Untitled1.ipynb exl.cpp preasepe.dat Untitled10.ipynb galaxy.awk preasepe~ Untitled2.ipynb galaxy.awk~ real_velocity..dat Untitled3.ipynb galaxy.dat real_velocity.awk Untitled4.ipynb galaxy.dat~ real_velocity.dat Untitled5.ipynb hr25pc.awk sdss.awk Untitled6.ipynb hr25pc.awk~ sdss.awk~ Untitled7.ipynb hr25pc.dat sdss.dat Untitled8.ipynb init.cpp sefide.awk Untitled9.ipynb kadai5 sefide.awk~ a.awk kadai5.cpp sefide.dat a.out kadai5.cpp~ sennsinnkagaku1.ipynb a.out.dSYM kadai5.dat setting.plt aaa lec02.pdf setting.plt~ cfa.awk lec03.pdf test.cpp cfa.awk~ lec05.pdf unicircle cfa.dat lec06.pdf unicircle.cpp circle lec07.pdf unicircle.cpp~ circle.cpp lec08.pdf unicircle.dat circle.cpp~ lec10.pdf vi.awk circle.o lec11.dat vi.awk~ d1 lec11.pdf vi.dat demo.cpp lec13.pdf emacs nbody pc026030m:~ 8289423578$ find -name init.cpp find: illegal option -- n usage: find [-H | -L | -P] [-EXdsx] [-f path] path ... [expression] find [-H | -L | -P] [-EXdsx] -f path [path ...] [expression] pc026030m:~ 8289423578$ cat init.cpp #include<iostream> using namespace std; int main(){ return 0; } pc026030m:~ 8289423578$ vim test.cpp pc026030m:~ 8289423578$ g++ test.cp clang: error: no such file or directory: 'test.cp' clang: error: no input files pc026030m:~ 8289423578$ g++ test.cpp test.cpp:3:24: error: implicit instantiation of undefined template 'std::__1::vector<int, std::__1::allocator<int> >' void subset(vector<int>a,int i){ ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/iosfwd:200:28: note: template is declared here class _LIBCPP_TEMPLATE_VIS vector; ^ test.cpp:4:8: error: use of undeclared identifier 'n' if(i==n){ ^ test.cpp:5:15: error: expected '(' for function-style cast or type construction foreach(int i:a)cout<<i<<" "; ~~~ ^ test.cpp:15:13: error: implicit instantiation of undefined template 'std::__1::vector<int, std::__1::allocator<int> >' vector<int>a; ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/iosfwd:200:28: note: template is declared here class _LIBCPP_TEMPLATE_VIS vector; ^ 4 errors generated. pc026030m:~ 8289423578$ vim test.cpp pc026030m:~ 8289423578$ g++ test.cpp test.cpp:5:8: error: use of undeclared identifier 'n' if(i==n){ ^ test.cpp:6:15: error: expected '(' for function-style cast or type construction foreach(int i:a)cout<<i<<" "; ~~~ ^ 2 errors generated. pc026030m:~ 8289423578$ vim test.cpp pc026030m:~ 8289423578$ g++ test.cpp test.cpp:4:32: error: unknown type name 'n' void subset(vector<int>a,int i,n){ ^ test.cpp:5:8: error: use of undeclared identifier 'n' if(i==n){ ^ test.cpp:6:15: error: expected '(' for function-style cast or type construction foreach(int i:a)cout<<i<<" "; ~~~ ^ test.cpp:8:16: error: use of undeclared identifier 'n' subset(a,i+1,n); ^ test.cpp:10:16: error: use of undeclared identifier 'n' subset(a,i+1,n); ^ 5 errors generated. pc026030m:~ 8289423578$ vim test.cpp pc026030m:~ 8289423578$ g++ test.cpp test.cpp:6:12: warning: range-based for loop is a C++11 extension [-Wc++11-extensions] for(int i:a)cout<<i<<" "; ^ 1 warning generated. pc026030m:~ 8289423578$ vim test.cpp pc026030m:~ 8289423578$ g++ test.cpp test.cpp:6:13: error: expected ';' in 'for' statement specifier for(int i in a)cout<<i<<" "; ^ test.cpp:6:13: error: unknown type name 'in' test.cpp:6:16: error: variable declaration in condition must have an initializer for(int i in a)cout<<i<<" "; ^ 3 errors generated. pc026030m:~ 8289423578$ vim test.cpp pc026030m:~ 8289423578$ g++ test.cpp test.cpp:6:15: error: expected '(' for function-style cast or type construction foreach(int i in a)cout<<i<<" "; ~~~ ^ 1 error generated. pc026030m:~ 8289423578$ cp init.cpp test.cpp pc026030m:~ 8289423578$ vim test.cpp pc026030m:~ 8289423578$ g++ test.cpp test.cpp:5:24: error: C++ requires a type specifier for all declarations vector<int> eat(const &vector<int>candy,int candy_max,int &sum){ ~~~~~ ^ test.cpp:5:24: error: 'vector' cannot be the name of a parameter test.cpp:5:35: error: expected ')' vector<int> eat(const &vector<int>candy,int candy_max,int &sum){ ^ test.cpp:5:16: note: to match this '(' vector<int> eat(const &vector<int>candy,int candy_max,int &sum){ ^ test.cpp:6:4: error: use of undeclared identifier 'candy' if(candy.size()==0) ^ test.cpp:7:20: error: expected '(' for function-style cast or type construction return vector<int>; ~~~~~~~~~~~^ test.cpp:9:8: error: use of undeclared identifier 'candy' while(candy[candy.size()-1]+candy[candy.size()-2]>candy_max){ ^ test.cpp:9:14: error: use of undeclared identifier 'candy' while(candy[candy.size()-1]+candy[candy.size()-2]>candy_max){ ^ test.cpp:9:30: error: use of undeclared identifier 'candy' while(candy[candy.size()-1]+candy[candy.size()-2]>candy_max){ ^ test.cpp:9:36: error: use of undeclared identifier 'candy' while(candy[candy.size()-1]+candy[candy.size()-2]>candy_max){ ^ test.cpp:9:52: error: use of undeclared identifier 'candy_max' while(candy[candy.size()-1]+candy[candy.size()-2]>candy_max){ ^ test.cpp:10:6: error: use of undeclared identifier 'candy' if(candy[candy.size()-2]>0){ ^ test.cpp:10:12: error: use of undeclared identifier 'candy' if(candy[candy.size()-2]>0){ ^ test.cpp:11:4: error: use of undeclared identifier 'candy' candy[candy.size()-2]--; ^ test.cpp:11:10: error: use of undeclared identifier 'candy' candy[candy.size()-2]--; ^ test.cpp:12:4: error: use of undeclared identifier 'sum' sum++; ^ test.cpp:14:4: error: use of undeclared identifier 'candy' candy[candy.size()-1]--; ^ test.cpp:14:10: error: use of undeclared identifier 'candy' candy[candy.size()-1]--; ^ test.cpp:15:4: error: use of undeclared identifier 'sum' sum++; ^ test.cpp:18:2: error: use of undeclared identifier 'candy' candy.pop_back(candy[candy.size()-1]); ^ fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated. pc026030m:~ 8289423578$ vim test.cpp pc026030m:~ 8289423578$ vim test.cpp pc026030m:~ 8289423578$ g++ test.cpp test.cpp:5:24: error: C++ requires a type specifier for all declarations vector<int> eat(const& vector<int>candy,int candy_max,int &sum){ ~~~~~ ^ test.cpp:5:24: error: 'vector' cannot be the name of a parameter test.cpp:5:35: error: expected ')' vector<int> eat(const& vector<int>candy,int candy_max,int &sum){ ^ test.cpp:5:16: note: to match this '(' vector<int> eat(const& vector<int>candy,int candy_max,int &sum){ ^ test.cpp:6:4: error: use of undeclared identifier 'candy' if(candy.size()==0) ^ test.cpp:7:20: error: expected '(' for function-style cast or type construction return vector<int>; ~~~~~~~~~~~^ test.cpp:9:8: error: use of undeclared identifier 'candy' while(candy[candy.size()-1]+candy[candy.size()-2]>candy_max){ ^ test.cpp:9:14: error: use of undeclared identifier 'candy' while(candy[candy.size()-1]+candy[candy.size()-2]>candy_max){ ^ test.cpp:9:30: error: use of undeclared identifier 'candy' while(candy[candy.size()-1]+candy[candy.size()-2]>candy_max){ ^ test.cpp:9:36: error: use of undeclared identifier 'candy' while(candy[candy.size()-1]+candy[candy.size()-2]>candy_max){ ^ test.cpp:9:52: error: use of undeclared identifier 'candy_max' while(candy[candy.size()-1]+candy[candy.size()-2]>candy_max){ ^ test.cpp:10:6: error: use of undeclared identifier 'candy' if(candy[candy.size()-2]>0){ ^ test.cpp:10:12: error: use of undeclared identifier 'candy' if(candy[candy.size()-2]>0){ ^ test.cpp:11:4: error: use of undeclared identifier 'candy' candy[candy.size()-2]--; ^ test.cpp:11:10: error: use of undeclared identifier 'candy' candy[candy.size()-2]--; ^ test.cpp:12:4: error: use of undeclared identifier 'sum' sum++; ^ test.cpp:14:4: error: use of undeclared identifier 'candy' candy[candy.size()-1]--; ^ test.cpp:14:10: error: use of undeclared identifier 'candy' candy[candy.size()-1]--; ^ test.cpp:15:4: error: use of undeclared identifier 'sum' sum++; ^ test.cpp:18:2: error: use of undeclared identifier 'candy' candy.pop_back(candy[candy.size()-1]); ^ fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated. pc026030m:~ 8289423578$ vim test.cpp pc026030m:~ 8289423578$ g++ test.cpp pc026030m:~ 8289423578$ cat test.cpp #include<iostream> #include<deque> #include<algorithm> using namespace std; int main(){ int n,max; cin >> n >> max; deque<int>candies; for(int i = 0;i<n;++i){ int temp; cin >>temp; candies.push_back(temp); } int sum = 0; for(int j = 0;j<n;++j){ while(candies[0]+candies[1]>max){ if(candies[1]>0){ candies[1]--; sum++; }else{ candies[0]--; sum++; } } candies.pop_front(); } cout <<sum; return 0; } pc026030m:~ 8289423578$ vim test.cpp deque<int>candies; for(int i = 0;i<n;++i){ int temp; cin >>temp; candies.push_back(temp); } int sum = 0; for(int j = 0;j<n;++j){ while(candies[0]+candies[1]>max){ if(candies[1]>0){ candies[1]--; sum++; }else{ candies[0]--; sum++; } } candies.pop_front(); } cout <<sum; return 0; }
a.cc:11:2: error: invalid preprocessing directive #exl 11 | #exl.awk# eular.dat nbody2_anim | ^~~ a.cc:13:1: error: too many decimal points in number 13 | 1.2.cpp eular_1.cpp nbody2_anim.cpp~ | ^~~~~~~ a.cc:14:1: error: too many decimal points in number 14 | 1.2.cpp~ eular_1.dat nbody2_anim.dat | ^~~~~~~ a.cc:15:1: error: too many decimal points in number 15 | 1.2.dat euler_2 nbody2_anim.o | ^~~~~~~ a.cc:64:42: warning: multi-character literal with 7 characters exceeds 'int' size of 4 bytes 64 | clang: error: no such file or directory: 'test.cp' | ^~~~~~~~~ a.cc:68:7: warning: multi-character literal with 48 characters exceeds 'int' size of 4 bytes 68 | 'std::__1::vector<int, std::__1::allocator<int> >' | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:82:7: warning: multi-character literal with 48 characters exceeds 'int' size of 4 bytes 82 | 'std::__1::vector<int, std::__1::allocator<int> >' | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:126:39: warning: multi-character character constant [-Wmultichar] 126 | test.cpp:6:13: error: expected ';' in 'for' statement specifier | ^~~~~ a.cc:129:41: warning: multi-character character constant [-Wmultichar] 129 | test.cpp:6:13: error: unknown type name 'in' | ^~~~ a.cc:146:23: warning: multi-character literal with 6 characters exceeds 'int' size of 4 bytes 146 | test.cpp:5:24: error: 'vector' cannot be the name of a parameter | ^~~~~~~~ a.cc:153:51: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes 153 | test.cpp:6:4: error: use of undeclared identifier 'candy' | ^~~~~~~ a.cc:159:51: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes 159 | test.cpp:9:8: error: use of undeclared identifier 'candy' | ^~~~~~~ a.cc:162:52: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes 162 | test.cpp:9:14: error: use of undeclared identifier 'candy' | ^~~~~~~ a.cc:165:52: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes 165 | test.cpp:9:30: error: use of undeclared identifier 'candy' | ^~~~~~~ a.cc:168:52: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes 168 | test.cpp:9:36: error: use of undeclared identifier 'candy' | ^~~~~~~ a.cc:171:52: warning: multi-character literal with 9 characters exceeds 'int' size of 4 bytes 171 | test.cpp:9:52: error: use of undeclared identifier 'candy_max' | ^~~~~~~~~~~ a.cc:174:52: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes 174 | test.cpp:10:6: error: use of undeclared identifier 'candy' | ^~~~~~~ a.cc:177:53: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes 177 | test.cpp:10:12: error: use of undeclared identifier 'candy' | ^~~~~~~ a.cc:180:52: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes 180 | test.cpp:11:4: error: use of undeclared identifier 'candy' | ^~~~~~~ a.cc:183:53: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes 183 | test.cpp:11:10: error: use of undeclared identifier 'candy' | ^~~~~~~ a.cc:186:52: warning: multi-character character constant [-Wmultichar] 186 | test.cpp:12:4: error: use of undeclared identifier 'sum' | ^~~~~ a.cc:189:52: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes 189 | test.cpp:14:4: error: use of undeclared identifier 'candy' | ^~~~~~~ a.cc:192:53: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes 192 | test.cpp:14:10: error: use of undeclared identifier 'candy' | ^~~~~~~ a.cc:195:52: warning: multi-character character constant [-Wmultichar] 195 | test.cpp:15:4: error: use of undeclared identifier 'sum' | ^~~~~ a.cc:198:52: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes 198 | test.cpp:18:2: error: use of undeclared identifier 'candy' | ^~~~~~~ a.cc:209:23: warning: multi-character literal with 6 characters exceeds 'int' size of 4 bytes 209 | test.cpp:5:24: error: 'vector' cannot be the name of a parameter | ^~~~~~~~ a.cc:216:51: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes 216 | test.cpp:6:4: error: use of undeclared identifier 'candy' | ^~~~~~~ a.cc:222:51: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes 222 | test.cpp:9:8: error: use of undeclared identifier 'candy' | ^~~~~~~ a.cc:225:52: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes 225 | test.cpp:9:14: error: use of undeclared identifier 'candy' | ^~~~~~~ a.cc:228:52: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes 228 | test.cpp:9:30: error: use of undeclared identifier 'candy' | ^~~~~~~ a.cc:231:52: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes 231 | test.cpp:9:36: error: use of undeclared identifier 'candy' | ^~~~~~~ a.cc:234:52: warning: multi-character literal with 9 characters exceeds 'int' size of 4 bytes 234 | test.cpp:9:52: error: use of undeclared identifier 'candy_max' | ^~~~~~~~~~~ a.cc:237:52: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes 237 | test.cpp:10:6: error: use of undeclared identifier 'candy' | ^~~~~~~ a.cc:240:53: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes 240 | test.cpp:10:12: error: use of undeclared identifier 'candy' | ^~~~~~~ a.cc:243:52: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes 243 | test.cpp:11:4: error: use of undeclared identifier 'candy' | ^~~~~~~ a.cc:246:53: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes 246 | test.cpp:11:10: error: use of undeclared identifier 'candy' | ^~~~~~~ a.cc:249:52: warning: multi-character character constant [-Wmultichar] 249 | test.cpp:12:4: error: use of undeclared identifier 'sum' | ^~~~~ a.cc:252:52: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes 252 | test.cpp:14:4: error: use of undeclared identifier 'candy' | ^~~~~~~ a.cc:255:53: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes 255 | test.cpp:14:10: error: use of undeclared identifier 'candy' | ^~~~~~~ a.cc:258:52: warning: multi-character character constant [-Wmultichar] 258 | test.cpp:15:4: error: use of undeclared identifier 'sum' | ^~~~~ a.cc:261:52: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes 261 | test.cpp:18:2: error: use of undeclared identifier 'candy' | ^~~~~~~ a.cc:1:1: error: 'Last' does not name a type 1 | Last login: Fri Oct 11 10:11:46 on console | ^~~~ In file included from /usr/include/c++/14/iosfwd:42, from /usr/include/c++/14/ios:40, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:57: /usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type 68 | typedef ptrdiff_t streamsize; // Signed integral type | ^~~~~~~~~ /usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 40 | #include <cwchar> // For mbstate_t +++ |+#include <cstddef> 41 | In file included from /usr/include/c++/14/bits/exception_ptr.h:38, from /usr/include/c++/14/exception:166, from /usr/include/c++/14/ios:41: /usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ In file included from /usr/include/wchar.h:35, from /usr/include/c++/14/cwchar
s555078820
p03862
C++
#include<iostream> #include<algorithm> #include<vector> typedef long long ll; #define rep(i,a,b) for(ll i=long long(a);i<long long(b);i++) using namespace std; ll N, x; vector<ll> a; int ans = 0; int main() { cin >> N >> x; rep(i, 0, N) { ll t; cin >> t; a.push_back(t); } if (a[0] > x) { ans += a[0] - x; a[0] = x; } rep(i, 1, N) { if ((a[i - 1] + a[i]) > x) { ans += (a[i - 1] + a[i]) - x; a[i] = x - a[i - 1]; } } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:5:29: error: expected primary-expression before 'long' 5 | #define rep(i,a,b) for(ll i=long long(a);i<long long(b);i++) | ^~~~ a.cc:14:9: note: in expansion of macro 'rep' 14 | rep(i, 0, N) { | ^~~ a.cc:5:44: error: expected primary-expression before 'long' 5 | #define rep(i,a,b) for(ll i=long long(a);i<long long(b);i++) | ^~~~ a.cc:14:9: note: in expansion of macro 'rep' 14 | rep(i, 0, N) { | ^~~ a.cc:5:44: error: expected ';' before 'long' 5 | #define rep(i,a,b) for(ll i=long long(a);i<long long(b);i++) | ^~~~ a.cc:14:9: note: in expansion of macro 'rep' 14 | rep(i, 0, N) { | ^~~ a.cc:5:44: error: expected primary-expression before 'long' 5 | #define rep(i,a,b) for(ll i=long long(a);i<long long(b);i++) | ^~~~ a.cc:14:9: note: in expansion of macro 'rep' 14 | rep(i, 0, N) { | ^~~ a.cc:5:44: error: expected ')' before 'long' 5 | #define rep(i,a,b) for(ll i=long long(a);i<long long(b);i++) | ~ ^~~~ a.cc:14:9: note: in expansion of macro 'rep' 14 | rep(i, 0, N) { | ^~~ a.cc:14:13: error: 'i' was not declared in this scope 14 | rep(i, 0, N) { | ^ a.cc:5:57: note: in definition of macro 'rep' 5 | #define rep(i,a,b) for(ll i=long long(a);i<long long(b);i++) | ^ a.cc:5:29: error: expected primary-expression before 'long' 5 | #define rep(i,a,b) for(ll i=long long(a);i<long long(b);i++) | ^~~~ a.cc:25:9: note: in expansion of macro 'rep' 25 | rep(i, 1, N) { | ^~~ a.cc:5:44: error: expected primary-expression before 'long' 5 | #define rep(i,a,b) for(ll i=long long(a);i<long long(b);i++) | ^~~~ a.cc:25:9: note: in expansion of macro 'rep' 25 | rep(i, 1, N) { | ^~~ a.cc:5:44: error: expected ';' before 'long' 5 | #define rep(i,a,b) for(ll i=long long(a);i<long long(b);i++) | ^~~~ a.cc:25:9: note: in expansion of macro 'rep' 25 | rep(i, 1, N) { | ^~~ a.cc:5:44: error: expected primary-expression before 'long' 5 | #define rep(i,a,b) for(ll i=long long(a);i<long long(b);i++) | ^~~~ a.cc:25:9: note: in expansion of macro 'rep' 25 | rep(i, 1, N) { | ^~~ a.cc:5:44: error: expected ')' before 'long' 5 | #define rep(i,a,b) for(ll i=long long(a);i<long long(b);i++) | ~ ^~~~ a.cc:25:9: note: in expansion of macro 'rep' 25 | rep(i, 1, N) { | ^~~
s603382364
p03862
C++
#include <iostream> #include <vector> using namespace std; int main(){ int N; long long int x; cin >> N >> x; vector<long long int> a(N,0LL); for(int i = 0; i < N; i++) cin >> a[i]; long long int ans = 0LL; for(int i = 0; i < N-1; i++){ if(a[i] + a[i+1] > x){ if(a[i + 1] >= (a[i] + a[i+1] - x)){ ans += (a[i] + a[i+1] - x); a[i+1] -= (a[i] + a[i+1] - x); else{ ans += a[i+1]; a[i+1] = 0; if(a[i] >= a[i] - x){ ans += (a[i] - x); a[i] -= (a[i] - x); } } } } cout << ans; }
a.cc: In function 'int main()': a.cc:20:7: error: expected '}' before 'else' 20 | else{ | ^~~~ a.cc:17:42: note: to match this '{' 17 | if(a[i + 1] >= (a[i] + a[i+1] - x)){ | ^
s242265456
p03862
C++
#include<bits/stdc++.h> typedef long long ll; using namespace std; int main(){ int n; cin >> n; ll x; cin >> x; ll ans = 0; vector<ll> a(n); for(int i = 0; i < n; i++){ cin >> a[i]; } if(a[0] > x;){ ans += a[0] - x; a[0] -= a[0] - x; } for(int i = 1; i < n; i++){ if(a[i-1] + a[i] > x){ ans += a[i-1] + a[i] - x; a[i] -= a[i-1] + a[i] - x; } } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:13:17: error: expected primary-expression before ')' token 13 | if(a[0] > x;){ | ^
s906333447
p03862
C++
#include <bits/stdc++.h> using namespace std; #define IOS ios::sync_with_stdio(false); cin.tie(0); #define FOR(i,s,n) for(int i = s; i < (n); i++) #define REP(i,n) FOR(i,0,n) #define ALL(n) (n).begin(), (n).end() #define RALL(n) (n).rbegin(), (n).rend() #define ATYN(n) cout << ( (n) ? "Yes":"No") << endl; #define CFYN(n) cout << ( (n) ? "YES":"NO") << endl; using ll = long long; using ull = unsigned long long; using pii = pair<int,int>; int main(void) { IOS int n,x; cin >> n >> x; vector<int> a(n); REP(i,n) cin >> a[i]; ll ans; REP(i,n-1) { ll tmp = a[i] + a[i+1]; if (tmp > x) { ll eat = tmp - x; ans += eat; a[i+1] = max(a[i+1] - eat,0); } } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:26:25: error: no matching function for call to 'max(ll, int)' 26 | a[i+1] = max(a[i+1] - eat,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:26:25: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 26 | a[i+1] = max(a[i+1] - 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 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:26:25: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 26 | a[i+1] = max(a[i+1] - eat,0); | ~~~^~~~~~~~~~~~~~~~
s505052073
p03862
C++
// https://atcoder.jp/contests/arc067/tasks/arc067_b #include <bits/stdc++.h> using namespace std; #define int int64_t #define REP(i, n) FOR(i, 0, n) #define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i) #define ALL(obj) (obj).begin(), (obj).end() #define ALLR(obj) (obj).rbegin(), (obj).rend() signed main() { ios::sync_with_stdio(false); cin.tie(0); int n, x; cin >> n >> x; vector<int> v(n); REP(i, n) cin >> v[i]; int sum = 0; REP(i, n - 1) { int t = v[i + 1] + v[i]; if (t > x) { sum += max(0LL, t - x); v[i + 1] = max(0LL, v[i + 1] - (t - x)); } } cout << sum << endl; return 0; }
a.cc: In function 'int main()': a.cc:21:23: error: no matching function for call to 'max(long long int, int64_t)' 21 | sum += max(0LL, t - 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:21:23: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int64_t' {aka 'long int'}) 21 | sum += max(0LL, t - 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:21:23: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 21 | sum += max(0LL, t - x); | ~~~^~~~~~~~~~~~ a.cc:22:27: error: no matching function for call to 'max(long long int, __gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type)' 22 | v[i + 1] = max(0LL, v[i + 1] - (t - 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:27: 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'}) 22 | v[i + 1] = max(0LL, v[i + 1] - (t - 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:27: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 22 | v[i + 1] = max(0LL, v[i + 1] - (t - x)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~
s849120522
p03862
C++
// https://atcoder.jp/contests/arc067/tasks/arc067_b #include <bits/stdc++.h> using namespace std; #define int int_fast64_t #define REP(i, n) FOR(i, 0, n) #define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i) #define ALL(obj) (obj).begin(), (obj).end() #define ALLR(obj) (obj).rbegin(), (obj).rend() signed main() { ios::sync_with_stdio(false); cin.tie(0); int n, x, t, sum = 0; cin >> n >> x; vector<int> v(n); REP(i, n) cin >> v[i]; REP(i, n - 1) { int t = v[i + 1] + v[i] - x; sum += max(0LL, t); if (i < n / 2) { v[i + 1] -= t; } else { v[i] -= t; } } cout << sum << endl; return 0; }
a.cc: In function 'int main()': a.cc:19:19: error: no matching function for call to 'max(long long int, int_fast64_t&)' 19 | sum += max(0LL, t); | ~~~^~~~~~~~ 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:19:19: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int_fast64_t' {aka 'long int'}) 19 | sum += max(0LL, t); | ~~~^~~~~~~~ /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:19:19: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 19 | sum += max(0LL, t); | ~~~^~~~~~~~
s834659954
p03862
C++
// https://atcoder.jp/contests/arc067/tasks/arc067_b #include <bits/stdc++.h> using namespace std; #define int int64_t #define REP(i, n) FOR(i, 0, n) #define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i) #define ALL(obj) (obj).begin(), (obj).end() #define ALLR(obj) (obj).rbegin(), (obj).rend() signed main() { ios::sync_with_stdio(false); cin.tie(0); int n, x, t, sum = 0; cin >> n >> x; vector<int> v(n); REP(i, n) cin >> v[i]; REP(i, n - 1) { int t = v[i + 1] + v[i] - x; sum += max(0LL, t); if (i < n / 2) { v[i + 1] -= t; } else { v[i] -= t; } } cout << sum << endl; return 0; }
a.cc: In function 'int main()': a.cc:19:19: error: no matching function for call to 'max(long long int, int64_t&)' 19 | sum += max(0LL, t); | ~~~^~~~~~~~ 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:19:19: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int64_t' {aka 'long int'}) 19 | sum += max(0LL, t); | ~~~^~~~~~~~ /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:19:19: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 19 | sum += max(0LL, t); | ~~~^~~~~~~~
s640239014
p03862
C++
// https://atcoder.jp/contests/arc067/tasks/arc067_b #include <bits/stdc++.h> using namespace std; #define int int64_t #define REP(i, n) FOR(i, 0, n) #define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i) #define ALL(obj) (obj).begin(), (obj).end() #define ALLR(obj) (obj).rbegin(), (obj).rend() signed main() { ios::sync_with_stdio(false); cin.tie(0); int n, x, t, sum = 0; cin >> n >> x; vector<int> v(n); REP(i, n) cin >> v[i]; REP(i, n - 1) { sum += max(0LL, v[i + 1] + v[i] - x); if (i < n / 2) { v[i + 1] -= v[i + 1] + v[i] - x; } else { v[i] -= v[i + 1] + v[i] - x; } } cout << sum << endl; return 0; }
a.cc: In function 'int main()': a.cc:18:19: error: no matching function for call to 'max(long long int, __gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type)' 18 | sum += max(0LL, v[i + 1] + v[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: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:18:19: 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'}) 18 | sum += max(0LL, v[i + 1] + v[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:18:19: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 18 | sum += max(0LL, v[i + 1] + v[i] - x); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
s278637887
p03862
C++
#include<bits/stdc++.h> using namespace std; int main(){ long long n,x,a2,res,num; cin>>n>>x; res = 0; num = 0; cin>>a1; for(long long i=1;i<n;i++){ cin>>a2; num = x<(a1+a2)?a1+a2-x:0; res += num; if(a2 >= num){ a2 -= num; }else{ a2 = 0 } a1 = a2; } cout<<res; return 0; }
a.cc: In function 'int main()': a.cc:8:10: error: 'a1' was not declared in this scope; did you mean 'a2'? 8 | cin>>a1; | ^~ | a2 a.cc:16:19: error: expected ';' before '}' token 16 | a2 = 0 | ^ | ; 17 | } | ~
s418317019
p03862
C++
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int (i)=0;(i)<(n);(i)++) #define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++) #define repm(i,n) for(int (i)=(n);(i)>=0;(i)--) typedef long long lint; int main(){ unsigned long long int N,x,ans=0,tmp=0; cin >>N>>x; lint M[N]; rep(i,N)cin >>M[i]; repp(i,1,N){ tmp=(M[i-1]+M[i]); if(tmp>x){ ans+=tmp-x; M[i]-=max(tmp-x,0); } tmp=0; } cout <<ans; }
a.cc: In function 'int main()': a.cc:18:16: error: no matching function for call to 'max(long long unsigned int, int)' 18 | M[i]-=max(tmp-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:18:16: note: deduced conflicting types for parameter 'const _Tp' ('long long unsigned int' and 'int') 18 | M[i]-=max(tmp-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:18:16: note: mismatched types 'std::initializer_list<_Tp>' and 'long long unsigned int' 18 | M[i]-=max(tmp-x,0); | ~~~^~~~~~~~~
s227252630
p03862
C++
#include<bits/stdc++.h> using namespace std; using int = long long; int main(){ int N, x; cin >> N >> x; vector<int> a(N); for(int i=0; i<N; i++){ cin >> a.at(i); } //操作 int ans = 0; if(a.at(0) > x){ ans += a.at(0) - x; a.at(0) = x; } for(int i=1; i<N; i++){ if(a.at(i-1) + a.at(i) > x){ ans += a.at(i-1) + a.at(i) - x; a.at(i) = x - a.at(i-1); } } cout << ans << endl; }
a.cc:3:7: error: expected nested-name-specifier before 'int' 3 | using int = long long; | ^~~
s078828354
p03862
C++
#include<bits/stdc++.h> using namespace std; using long long = int; int main(){ int N, x; cin >> N >> x; vector<int> a(N); for(int i=0; i<N; i++){ cin >> a.at(i); } //操作 int ans = 0; if(a.at(0) > x){ ans += a.at(0) - x; a.at(0) = x; } for(int i=1; i<N; i++){ if(a.at(i-1) + a.at(i) > x){ ans += a.at(i-1) + a.at(i) - x; a.at(i) = x - a.at(i-1); } } cout << ans << endl; }
a.cc:3:7: error: expected nested-name-specifier before 'long' 3 | using long long = int; | ^~~~
s704472542
p03862
C++
#include<bits/stdc++.h> using namespace std; long long a,b,n,x,ans,t; int main(){ cin>>n>>x; cin>>a; for(int i=2;i<=n;i++) { cin>>b; if(a+b>x)t=a+b-x,ans+=t, b=b-t,if(b<0)b=0; a=b; } cout<<ans; return 0; }
a.cc: In function 'int main()': a.cc:12:15: error: expected primary-expression before 'if' 12 | b=b-t,if(b<0)b=0; | ^~
s250045121
p03862
C++
#include <bits/stdc++.h> using namespace std; int main() { int n; int x; cin >> n; int arr[n]; for (int i = 0; i < n; i++) { cin >> arr[i]; } int answer = 0; for (int i = 0; i < n; i++) { if (arr[i] > x) { answer = answer + (arr[i] - x); } } for (int i = 0; i < n - 1; i++) { if (arr[i] + arr[i + 1] > x) { answer = answer + (arr[i + 1] - x < 0 ? arr[i + 1] : arr[i + 1] - x); arr[i + 1] = arr[i + 1] - x; if (arr[i + 1] < 0) { arr[i + 1] = 0; } } } if (arr[ n - 2] + arr[n - 1] > x) { answer = answer + (arr[n - 2] - x < 0 ? arr[i + 1] : arr[i + 1] - x); } cout << answer << endl; return 0; }
a.cc: In function 'int main()': a.cc:29:53: error: 'i' was not declared in this scope 29 | answer = answer + (arr[n - 2] - x < 0 ? arr[i + 1] : arr[i + 1] - x); | ^