submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s157734346
p03862
C++
#include<bits/stdc++.h> # define ll long long using namespace std; int main(){ ll n,x; cin >> n >> x; ll arr[n]; ll sum;ll ans; for ( int i = 0 ; i < n ;i++){ cin >> a[i]; } if ( a[0] > x ) { ans += a[0] - x; a[0] = x; } sum = a[0]; for ( int i = 1 ; i < n ; i++){ sum += a[i]; if (sum > x){ ...
a.cc: In function 'int main()': a.cc:11:10: error: 'a' was not declared in this scope 11 | cin >> a[i]; | ^ a.cc:13:8: error: 'a' was not declared in this scope 13 | if ( a[0] > x ) { | ^ a.cc:17:15: error: 'a' was not declared in this scope 17 | sum = a[0]; | ...
s641855768
p03862
Java
mport java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int x = sc.nextInt(); int ops = 0; int[] candies = new int[n]; for(int i = 0; i < n; i++){ candies[i] = sc.nextInt(); } for(int i ...
Main.java:1: error: class, interface, enum, or record expected mport java.util.Scanner; ^ 1 error
s598076555
p03862
C++
#include <bits/stdc++.h> using namespace std; const int MAX_N = 1e5+5; typedef long long ll; ll a[MAX_N]; int main() { ll n, x, ans = 0; cin >> n >> x; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 1; i < n; i++) { if (a[i]+a[i-1] > x) ans += a[i]+a[i-1]-x, a[i] = max(0, x-a[i-1]); } cout << ans << e...
a.cc: In function 'int main()': a.cc:15:70: error: no matching function for call to 'max(int, ll)' 15 | if (a[i]+a[i-1] > x) ans += a[i]+a[i-1]-x, a[i] = max(0, x-a[i-1]); | ~~~^~~~~~~~~~~~~ In file included from /usr/include/c++...
s062058736
p03862
C++
#include <bits/stdc++.h> using namespace std; const int MAX_N = 1e5+5; typedef long long ll; ll a[MAX_N]; int main() { ll n, x, ans = 0; cin >> n >> x; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 1; i < n; i++) { if (a[i]+a[i+1] > x) ans += a[i]+a[i-1]-x, a[i] = max(0, x-a[i-1]); } cout << ans << e...
a.cc: In function 'int main()': a.cc:15:70: error: no matching function for call to 'max(int, ll)' 15 | if (a[i]+a[i+1] > x) ans += a[i]+a[i-1]-x, a[i] = max(0, x-a[i-1]); | ~~~^~~~~~~~~~~~~ In file included from /usr/include/c++...
s954428124
p03862
C++
#include<bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0; i<n; i++) int main(){ unsigned long long int N, x; cin >> N >> x; unsigned long long int a[N]; rep(i,N) cin >> a[i]; unsigned long long int cnt = 0; rep(i,N-1){ int b = a[i+1] + a[i]; if(i % 2 == 0){ ...
a.cc: In function 'int main()': a.cc:15:29: error: no matching function for call to 'max(long long unsigned int, int)' 15 | a[i+1] = max(a[i+1]-(b-x), 0); | ~~~^~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x...
s507154693
p03862
C++
#include <iostream> #include <string> #include <vector> #include <deque> #include <queue> #include <algorithm> #include <set> #include <map> #define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c)) #define vvi std::vector<std::vector<int> > #define vvl std::vector<std::vector<ll> > #define MODs 1000000007; typedef...
a.cc: In function 'int main(int, const char**)': a.cc:24:30: error: operands to '?:' have different types 'std::pair<int, long long int>' and 'std::pair<long long int, long long int>' 24 | if(i==0) dp[0] = (A[0]<=X?make_pair(0, A[0]):make_pair(A[0]-X, X)); a.cc:24:30: note: and each type can be converted to th...
s782447482
p03862
C++
#include<bits/stdc++.h> using namespace std; int main() { int n,x; cin>>n>>x; vector<int> a(n); for(auto &i:a) cin>>i; long long int ans=0; for(int i=0;i<n-1;i++) if(a[i]+a[i+1]>x) { long long sub = a[i+1]+a[i]-x; ans += sub; a[i+1]=max(a[i+1]-sub,0); } if(a[n...
a.cc: In function 'int main()': a.cc:17:19: error: no matching function for call to 'max(long long int, int)' 17 | a[i+1]=max(a[i+1]-sub,0); | ~~~^~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++....
s411175063
p03862
C
;;; 048 C - Boxes and Candies (define (input n) (let loop ((ls ()) (n n)) (if (zero? n) ls (loop (cons (read) ls) (- n 1))))) (define (main arg) (let* ((n (read)) (x (read)) (ls (input n))) (let loop ((ls ls) (ans 0)) (cond ((null? (cdr ls)) (print ans)) (else (let ((ret 0)) (set! ...
main.c:1:5: error: invalid digit "8" in octal constant 1 | ;;; 048 C - Boxes and Candies | ^~~ main.c:1:5: error: expected identifier or '(' before numeric constant
s441839985
p03862
C++
℣#include <bits/stdc++.h> using namespace std; using ll = long long; using db = double; #define fi first #define se second #define pb push_back #define all(v) (v).begin(),(v).end() #define siz(v) (ll)(v).size() #define rep(i,n) for(ll i=0;i<(ll)(n);i++) #define repn(i,n) for(ll i=0;i<=(ll)(n);i++) typedef pair<int,int>...
a.cc:1:2: error: stray '#' in program 1 | ℣#include <bits/stdc++.h> | ^ a.cc:1:1: error: '\U00002123' does not name a type 1 | ℣#include <bits/stdc++.h> | ^ a.cc:12:9: error: 'pair' does not name a type 12 | typedef pair<int,int> P; | ^~~~ a.cc:13:9: error: 'pair' does not name a t...
s447920101
p03862
C++
#include <bits/stdc++.h> using namespace std; int n,a[100000],x,sum=0; int main(){ cin>>n>>x; for(int i=0;i<n;i++) cin>>a[i]; for(int i=0;i<n-1;i++) { if((a[i]+a[i+1])>x) { sum+=m; if(a[k+1]>=m) a[k+1]-=m; else{a[k+1]=0;} } cout<<sum; return 0; }
a.cc: In function 'int main()': a.cc:13:22: error: 'm' was not declared in this scope 13 | { sum+=m; | ^ a.cc:14:14: error: 'k' was not declared in this scope 14 | if(a[k+1]>=m) a[k+1]-=m; | ^ a.cc:19:2: error: expected '}' at end of input 19 ...
s280172714
p03862
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll N, x; cin >> N >> x; vector<ll> A(N, 0); for (int i = 0; i < N; i++) { cin >> A[i]; } ll count = 0; for (int i = 1; i < N; i++) { ll oldi = A[i]; if (A[i - 1] + A[i] > x) { // count +=...
a.cc: In function 'int main()': a.cc:19:10: error: expected primary-expression before '.' token 19 | }. | ^ a.cc:20:5: error: expected unqualified-id before '}' token 20 | } | ^
s209936617
p03862
C++
#include<cstdio> int main(){ int n; long long x; scanf("%d %lld", &n, &x); long long a[100000]; for(int i=0; i<n; i++) scanf("%lld", &a[i]); long long ans = 0; if(a[0]>x){ ans = a[0] - x; a[0] -= x; if(x == 0){ ans = a[0]; a[0] = 0; } for(int i=0; i<(n-1); i++){ ...
a.cc: In function 'int main()': a.cc:30:2: error: expected '}' at end of input 30 | } | ^ a.cc:2:11: note: to match this '{' 2 | int main(){ | ^
s875755629
p03862
C++
#include<cstdio> int main(){ int n; long long x; scanf("%d %lld", &n, &x); long long a[10000000000]; for(int i=0; i<n; i++) scanf("%lld", &a[i]); long long ans = 0; if(a[0]>x){ ans = a[0] - x; a[0] -= x; } for(int i=0; i<(n-1); i++){ if( a[i]+a[i+1] >= x ){ diff = a[i+1]...
a.cc: In function 'int main()': a.cc:19:7: error: 'diff' was not declared in this scope 19 | diff = a[i+1] - x; | ^~~~
s340163152
p03862
C++
#include<cstdio> int main(){ int n, x; scanf("%d %d", &n, &x); long int a[]; for(int i=0; i<n, i++) scanf("%d", &a[i]); long long ans = 0; while(a[0]>x){ a[0]--; ans++; } for(int i; i<(n-1); i++){ while( a[i]+a[i+1] >= x ){ a[i+1]--; ans++; } } printf("%lld", an...
a.cc: In function 'int main()': a.cc:6:12: error: storage size of 'a' isn't known 6 | long int a[]; | ^ a.cc:7:24: error: expected ';' before ')' token 7 | for(int i=0; i<n, i++) | ^ | ;
s523251444
p03862
C++
#include <iostream> #include <cstdio> #include <string> #include <algorithm> #include <cmath> #include <vector> #define rep(i, n) for(int i = 0; i < n; i++) using namespace std; typedef long long ll; int main() { int N, x; cin >> N >> x; rep(i, N) { cin >> a[i]; } ll ans = 0; rep(i, N-...
a.cc: In function 'int main()': a.cc:15:16: error: 'a' was not declared in this scope 15 | cin >> a[i]; | ^ a.cc:20:12: error: 'a' was not declared in this scope 20 | if(a[i]+a[i+1] <= x) { | ^
s463093189
p03862
C++
#include <bits/stdc++.h> using namespace std; const long long MOD = 1000000007LL; long long GCD(long long a, long long b){return b == 0 ? a : GCD(b, a % b);} long long arr[100002]; int main(){ cin.sync_with_stdio(0); cin.tie(0); cout.tie(0); //freopen("input.txt", "r", stdin); //freopen("output.txt", ...
a.cc: In function 'int main()': a.cc:25:19: error: no matching function for call to 'max(int, long long int)' 25 | tot += max(0, arr[i] - x); | ~~~^~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc+...
s257783155
p03862
C++
#include<iostream> #include<string> #include<algorithm> #include<vector> #include<iomanip> #include<math.h> #include<complex> #include<queue> #include<deque> #include<stack> #include<map> #include<set> #include<bitset> using namespace std; #define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i ) #define rep(i,n) REP(i...
a.cc: In function 'int main()': a.cc:34:13: error: no matching function for call to 'max(int, ll)' 34 | temp=max(0,x-temp); | ~~~^~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c+...
s939262794
p03862
C++
#include<stdio.h> #include<stdlib.h> #include<iostream> #include<string> #include<algorithm> #include<vector> #include<limits> #include<numeric> #include<type_traits> #include<math.h> using namespace std; typedef long long ll; #define rep(i, n) for(int i = 0; i < (int)(n); i++) #define repi(i,a,b) for(int i = (int)(a...
a.cc: In function 'int main()': a.cc:31:28: error: no matching function for call to 'max(ll, int)' 31 | pre=max(x-pre,0); | ~~~^~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, ...
s093373948
p03862
C++
#include<stdio.h> #include<stdlib.h> #include<iostream> #include<string> #include<algorithm> #include<vector> #include<limits> #include<numeric> #include<type_traits> #include<math.h> using namespace std; typedef long long ll; #define rep(i, n) for(int i = 0; i < (int)(n); i++) #define repi(i,a,b) for(int i = (int)(a...
a.cc: In function 'int main()': a.cc:31:28: error: no matching function for call to 'max(ll, int)' 31 | pre=max(x-pre,0); | ~~~^~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, ...
s689486834
p03862
C++
import java.util.*; import java.lang.*; public class Main{ public static void main(String[] args) { Scanner scanner=new Scanner(System.in); int n=scanner.nextInt(); int x=scanner.nextInt(); int[] a=new int[n]; for(int i=0;i<n;i++)a[i]=scanner.nextInt(); int cnt=0; for(int i=0;i<n-2;i++) { while((a[i]+a[i+1]...
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.*; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:2:1: error: 'import' does not name a type 2 | import java.lang.*; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1...
s396381271
p03862
C++
#include <iostream> #include <math.h> using namespace std; typedef long long int ll; int main() { ll N, x, a1, a2, ans = 0; cin >> N >> x >> a1; for(ll i = 1; i < N; i++) { cin >> a2; ll sum = a1 + a2; if(sum > x) { ans += sum - x; a1 = max(0ll, b - sum - x); ...
a.cc: In function 'int main()': a.cc:13:27: error: 'b' was not declared in this scope 13 | a1 = max(0ll, b - sum - x); | ^
s203741713
p03862
C++
#include <bits/stdc++.h> #define REP(i, n) for(int i = 0; i < n; i++) using namespace std; using ll = long long; int main() { cin.tie(0); ios::sync_with_stdio(false); int N, x; cin >> N >> x; vector<int> a(N); REP(i, N) cin >> a[i]; int ans = 0; //まず左端 while(a[0] + a[1] > x) { if(a[1] >= 0) { ...
a.cc: In function 'int main()': a.cc:46:4: error: expected '}' at end of input 46 | } | ^ a.cc:6:12: note: to match this '{' 6 | int main() { | ^
s847851879
p03862
C++
#include <bits/stdc++.h> //JuniorMonster a.k.a Sho10 #define ll long long #pragma GCC optimize("O3") #pragma GCC optimize("Ofast") #define all(a) (a).begin(), (a).end() #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #define sz size #define f first #define s second #define pb push_back #de...
a.cc: In function 'int32_t main()': a.cc:33:8: error: expected primary-expression before '<' token 33 | cout < <ans; | ^
s323000822
p03862
C++
#include <vector> #include <cstdio> #include <iostream> #include <cmath> #include <string> #include <cstring> #include <algorithm> #include <numeric> #include <cstdlib> #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #define REP(i,n) for(int i=0;i<n;i++) #define SORT(...
a.cc: In function 'int main()': a.cc:34:22: error: 'tmp' was not declared in this scope; did you mean 'tm'? 34 | ll diff = (pre + tmp) - x; | ^~~ | tm
s606363572
p03862
C++
#include<iostream> #include<string> #include<vector> #include<algorithm> #include<unordered_map> #include<stdio.h> using namespace std; typedef long long ll; ll mod = 998244353; int main(){ int N; cin>>N; vector<ll> A(N); vector<ll> B(N, 0); ll x; cin>>x; cin>>A[0]; B[0] = A[0]; for(int i = 1; i < N; i++){ ...
a.cc: In function 'int main()': a.cc:36:33: error: expected ';' before ')' token 36 | A[i] < 0)em = abs(A[i]); | ^ | ;
s118566091
p03862
C++
#include <vector> #include <queue> #include <algorithm> #include <iostream> #include <string> #include <tuple> #include <set> #include <map> #include <complex> #include <iomanip> #include <cmath> using namespace std; typedef long long ll; int main() { ll n, x; cin >> n >> x; ll a[n]; cin >> a[0]; for (int i ...
a.cc: In function 'int main()': a.cc:29:5: error: 'ans' was not declared in this scope; did you mean 'abs'? 29 | ans += count; | ^~~ | abs a.cc:31:11: error: 'ans' was not declared in this scope; did you mean 'abs'? 31 | cout << ans << endl; | ^~~ | abs
s286119261
p03862
C++
#include <vector> #include <queue> #include <algorithm> #include <iostream> #include <string> #include <tuple> #include <set> #include <map> #include <complex> #include <iomanip> #include <cmath> using namespace std; typedef long long ll; int main() { ll n, x; cin >> n >> x; ll a[n]; cin >> a[0]; for (int i ...
a.cc: In function 'int main()': a.cc:29:5: error: 'ans' was not declared in this scope; did you mean 'abs'? 29 | ans += count; | ^~~ | abs a.cc:31:8: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and '<unresolved overloaded function type>'...
s674520049
p03862
Java
import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int x = sc.nextInt(); int[] a = new int[N]; for(int i = 0; i<N; i++) { a[i] = sc.nextInt(); } long ans = 0; ...
Main.java:16: error: incompatible types: possible lossy conversion from long to int a[i] = Math.max(0, a[i]-sum); ^ 1 error
s813053809
p03862
C++
#include<bits/stdc++.h> using namespace std; typedef long long ll; int main(){ int n; ll x; cin >> n >> x; ll ans = 0; ll a[100010]; for(int i = 0; i < n; i++) { cin >> a[i]; } for(int i = 0; i < n-1; i++) { if(i==0) ans+= max(0, a[i]-x); if(a[i]+a[i+1]...
a.cc: In function 'int main()': a.cc:19:27: error: no matching function for call to 'max(int, ll)' 19 | if(i==0) ans+= max(0, a[i]-x); | ~~~^~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h...
s762009894
p03862
C++
#include <bits/stdc++.h> #define REP(i, n) for(int i = 0;i < n;i++) #define REPR(i, n) for(int i = n;i >= 0;i--) #define FOR(i, m, n) for(int i = m;i < n;i++) #define FORR(i, m, n) for(int i = m;i >= n;i--) #define SORT(v, n) sort(v, v+n); #define VSORT(v) sort(v.begin(), v.end()) #define VRSORT(v) sort(v.rbegin(), v.r...
a.cc: In function 'int main()': a.cc:37:27: error: no matching function for call to 'max(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type, int)' 37 | ll minus = max(a[i]+a[i+1] - x,0); | ~~~^~~~~~~~~~~~~~~~~~~ In file included from /usr/incl...
s937251698
p03862
C++
#include <cstdio> #include<iostream> using namespace std; int box[100005]; int main() { int n,x; scanf("%d%d",&n,&x); for (int i=1;i<=n;i++) scanf("%d",&box[i]); long long all=0; if (box[1]>x) { all+=box[1]-x; box[1]=x; } ...
a.cc: In function 'int main()': a.cc:9:24: error: expected ';' before '\U0000ff1b' 9 | scanf("%d%d",&n,&x); | ^~ | ; a.cc:11:22: error: 'i' was not declared in this scope 11 | for (int i=1;i<=n;i++) | ^
s056006590
p03862
C++
#include <iostream> #include <vector> #define vrev(v) reverse((v).begin(), (v).end()) using namespace std; using ll = long long; int main(int argc, const char * argv[]) { ll n, x; cin >> n >> x; vector<ll> v1(n), v2(n); for (ll i = 0; i < n; i++) { cin >> v1[i]; v2[i] = v1[i]; } ...
a.cc: In function 'int main(int, const char**)': a.cc:4:17: error: 'reverse' was not declared in this scope 4 | #define vrev(v) reverse((v).begin(), (v).end()) | ^~~~~~~ a.cc:26:5: note: in expansion of macro 'vrev' 26 | vrev(v2); | ^~~~
s142478641
p03862
C++
#include <iostream> #include<vector> #include<algorithm> #include<string> #include<map> using namespace std; typedef long long ll; typedef vector<int> VI; #define REP(i,n) for(int i=0;i<n;i++) #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define SORT(c) sort((c).begin(),(c).end()) #define INF 1000000000 #define mod 1000...
a.cc: In function 'int main()': a.cc:34:2: error: expected '}' at end of input 34 | } | ^ a.cc:15:11: note: to match this '{' 15 | int main(){ | ^
s470163775
p03862
Java
import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int number = sc.nextInt(); long max = sc.nextLong(); int count = 0; long[] c = new long[number]; for(int i = 0; i < number; i++){ long a = sc.nextLong(); c[i]=a; } for(int i =...
Main.java:15: error: cannot find symbol if(((a[i-1]+a[i])-x) < a[i]){ ^ symbol: variable a location: class Main Main.java:15: error: cannot find symbol if(((a[i-1]+a[i])-x) < a[i]){ ^ symbol: variable a location: class Main Main.java:15: error: cannot find symbol if(((a[...
s519338327
p03862
C++
3 3 2 2 2
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 3 3 | ^
s971687427
p03862
C++
#include < bits / stdc++.h > using namespace std; typedef long long int ll; typedef pair<ll, ll> pll; #define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i)) #define REP(i, n) FOR(i, n, 0) #define OF64 std::setprecision(10) const ll MOD = 1000000007; const ll INF = (ll)1e15; ll A[100005]; int main() { int N, ...
a.cc:1:10: fatal error: bits / stdc++.h : No such file or directory 1 | #include < bits / stdc++.h > | ^~~~~~~~~~~~~~~~~~~ compilation terminated.
s720300795
p03862
C++
#inclde < bits / stdc++.h > using namespace std; typedef long long int ll; typedef pair<ll, ll> pll; #define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i)) #define REP(i, n) FOR(i, n, 0) #define OF64 std::setprecision(10) const ll MOD = 1000000007; const ll INF = (ll)1e15; ll A[100005]; int main() { int N, x...
a.cc:1:2: error: invalid preprocessing directive #inclde; did you mean #include? 1 | #inclde < bits / stdc++.h > | ^~~~~~ | include a.cc:5:9: error: 'pair' does not name a type 5 | typedef pair<ll, ll> pll; | ^~~~ a.cc: In function 'int main()': a.cc:19:5: error: 'cin' was not declar...
s717591499
p03862
C++
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); long long n, x; cin >> n >> x; vector<long long> a(n); for(int i = 0; i < n; i++) { cin >> a[i]; } int cnt = 0; for(int i = 1; i < n; i++) { long long adj = a[i] + a[i - 1]; if(adj > x) { cnt += adj...
a.cc: In function 'int main()': a.cc:19:35: error: no matching function for call to 'max(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type, int)' 19 | a[i] = max(a[i] - (adj - x), 0); | ~~~^~~~~~~~~~~~~~~~~~~~~ In file inc...
s846377251
p03862
C++
#include<iostream> using namespace std; int main(){ int n,x; int c=0; cin>>n>>x; int arr[n]; for(int i=0;i<n;i++)cin>>arr[i]; if(arr[0]>x){ c = arr[0]-x; arr[0]=x; } for(int i==1; i <n; i++){ int a; a = arr[i] + arr[i-1]; if(a > x){ c+=a-x; arr[i] =a-x; } } }
a.cc: In function 'int main()': a.cc:13:12: error: expected ';' before '==' token 13 | for(int i==1; i <n; i++){ | ^~ | ; a.cc:13:12: error: expected primary-expression before '==' token 13 | for(int i==1; i <n; i++){ | ^~ a.cc:13:21: error: expected ')' befo...
s008751644
p03862
C++
/** * @Author : MeGaCrazy * @InitTime : Sun Dec 30 14:56:45 2018 * @Idea : * * * * * * Happy Solving :) **/ #include <bits/stdc++.h> using namespace std; const int N=1e5+7; long long a[N]; int main(){ #ifndef ONLINE_JUDGE // freopen("in","r",stdin); //freopen("out","w",stdout); #endif long long n,m; ...
a.cc: In function 'int main()': a.cc:32:24: error: no matching function for call to 'max(int, long long int)' 32 | a[i+1]=max(0,a[i+1]-dif); | ~~~^~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bi...
s007438306
p03862
C++
#include <bits/stdc++.h> #define dum(x) cout<<#x<<'='<<x<<endl #define ll long long using namespace std; int main() { int n, x; cin >> n >> x; ll c_all = 0; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a.at(i); c_all += a.at(i); } if (a.at(0) > x) a.at(0) = x; for (int i = 0; i < n - ...
a.cc: In function 'int main()': a.cc:18:15: error: expected initializer before '+=' token 18 | int tmp += a.at(i) + a.at(i + 1) - x; | ^~ a.cc:19:22: error: 'tmp' was not declared in this scope; did you mean 'tm'? 19 | a.at(i + 1) -= tmp; | ^~~ | ...
s141394762
p03862
C++
#include <iostream> #include <vector> #include <string> #include <algorithm> #include <math.h> #include <cstdio> #include <cstdlib> #include <cmath> #include <iomanip> #include <map> #include <utility> #include <numeric> #include <typeinfo> using namespace std; int main(){ int N; long long x; cin >> N >> x; v...
a.cc: In function 'int main()': a.cc:27:13: error: no matching function for call to 'max(int, long long int)' 27 | ans+=max(0,b-x); | ~~~^~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/inclu...
s438821165
p03862
C++
# include <bits/stdc++.h> # define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i) # define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i) # define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i) # define rreps(i, n) for(int i=((int)(n)); i>0; --i) # define ALL(x) (x).begin(), (x).end() # define SZ(x) ((int)(x...
a.cc:26:36: error: macro "rep" requires 2 arguments, but only 1 given 26 | rep (lint i = 0; i < N - 1; ++i) | ^ a.cc:2:10: note: macro "rep" defined here 2 | # define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i) | ^~~ a.cc: In function 'int main(...
s635314408
p03862
C++
#include<bits/stdc++.h> using namespace std; using ll = long long; using lli = long long int; ll MM = 1000000000; ll mod = MM + 7; #define INF (ll)1e18 #define pi acos(-1.0) int main(){ ll n, x, a[100001]; cin >> n >> x; ll cnt = 0; for(ll i = 0; i < n; i++){ cin >> a[i]; } if(a[0] > x)...
a.cc: In function 'int main()': a.cc:21:29: error: expected ')' before '{' token 21 | for(ll i = 1; i < n; i++{ | ~ ^ | )
s364207136
p03862
C++
#include<bits/stdc++.h> using namespace std; using ll = long long; using lli = long long int; ll MM = 1000000000; ll mod = MM + 7; #define INF (ll)1e18 #define pi acos(-1.0) int main(){ ll n, x, a[100001]; cin >> n >> x; ll cnt = 0; for(ll i = 0; i < n; i++){ cin >> a[i]; } if(a[0] > x)...
a.cc: In function 'int main()': a.cc:18:18: error: 'i' was not declared in this scope 18 | cnt += a[i] -x; | ^ a.cc:21:29: error: expected ')' before '{' token 21 | for(ll i = 1; i < n; i++{ | ~ ^ | )
s296209198
p03862
C++
#include <bits/stdc++.h> using namespace std; int main () { int N; long x; cin >> N >> x; vector<long> a(N); for (int i = 0; i < N; i++) { cin >> a.at(i); } long ans = 0; for (int i = 0; i < N-1; i++) { if (a.at(i) + a.at(i+1) > x) { long p = a.at(i) + a.at(i+1) -x; ans += p; ...
a.cc: In function 'int main()': a.cc:17:22: error: no matching function for call to 'max(int, __gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type)' 17 | a.at(i+1) = max(0, a.at(i+1)-p); | ~~~^~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, ...
s037389057
p03862
C++
#include<bits/stdc++.h> using namespace std; int main(){ int N,K,res=0; cin>>N>>K; vector<int> a(N,0); for(int c,i=0;i<N;++i){ cin>>c; if(i<N-1)a[i]+=c; if(i>0)a[i-1]+=c; } for(int i=1;i<N;++i){ int c=max(0,a[i-1]-K); c=max(0,a[i]-c) a[i]-=c; a[i-1]-=c; res+=c; /*do{ if(a[i...
a.cc: In function 'int main()': a.cc:14:20: error: expected ';' before 'a' 14 | c=max(0,a[i]-c) | ^ | ; 15 | a[i]-=c; a[i-1]-=c; res+=c; | ~
s684030888
p03862
C++
#include <cstdio> #include <algorithm> #include <iostream> #include <vector> #include <map> #include <unordered_map> #include <cmath> #include <queue> #include <set> using namespace std; typedef long long ll; typedef pair<int, int> P; #define INF int(1e9) #define REP(i, n) for(int i = 0; i < (int)(n); i++) #define REP...
a.cc: In function 'void solve()': a.cc:34:57: error: expected ',' or ';' before ')' token 34 | ll temp = min(a[i + 1], a[i] + a[i + 1] - x)); | ^
s008026935
p03862
C++
#include <bits/stdc++.h> using namespace std; #define FOR(i,a,b) for (int i = a; i < b; i++) #define REP(i,b) FOR(i,0,b) #define RFOR(i,a,b) for (int i = a-1; i >= b; i--) #define RREP(i,a) RFOR(i,a,0) #define REPALL(v) for (int i = 0; i < v.size(); i++) #define SORT(v) sort(v.begin(), v.end()) #define MIN_ELEMENT(v) m...
a.cc: In function 'int main()': a.cc:33:20: error: no matching function for call to 'min(ll&, int&)' 33 | a[i+1] -= min(ans, 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, ...
s635296340
p03862
C++
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for(int i = 0; i < (n); i++) #define rep1(i, n) for(int i = 1; i <= (n); i++) #define co(x) cout << (x) << "\n" #define cosp(x) cout << (x) << " " #define ce(x) cerr << (x) << "\n" #define cesp(x) cerr << (x) << " " #define pb push_bac...
a.cc: In function 'int main()': a.cc:29:32: error: no matching function for call to 'max(int, ll)' 29 | ll herasu = max(0, A[i] + A[i + 1] - X); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x...
s427897959
p03862
C++
#include <bits/stdc++.h> using namespace std; int main() { int N,x; cin >> N >> x; vector<int> a(100010); for(int i=0;i<N;i++){cin >> a[i];} int c=0; int d=0; for(int i=1;i<N;i++){ if(a[i-1]+a[i]>x){ c+=a[i-1]+a[i]-x; a[i]-=a[i-1]+a[i]-x; } } for(int i=N-2;i>=0;i--){ if(a[i+1]+...
a.cc: In function 'int main()': a.cc:22:2: error: expected '}' at end of input 22 | } | ^ a.cc:4:12: note: to match this '{' 4 | int main() { | ^
s061135617
p03862
C++
#include<bits/stdc++.h> using namespace std; long long a[100002]; int main(){ long long n,x,ans=0; cin>>n>>x; for(int i=1;i<=n;i++) cin>>a[i]; for(int i=2;i<=n;i++){ if(a[i]+a[i-1]>x){ ans+=(a[i-1]+a[i])-x; if(a[i-1]>x){ a[i]=0; a[i-1]-=a[i-1]-x }else{ a[i]-=((a[i-1]+a[i])-x); } } } co...
a.cc: In function 'int main()': a.cc:13:49: error: expected ';' before '}' token 13 | a[i-1]-=a[i-1]-x | ^ | ; 14 | }else{ | ...
s234935458
p03862
C++
#include<bits/stdc++.h> using namespace std; int main() { int n,m,ans,s; cin>>n>>m; for(int i=0;i<=n;i++)cin>>s[i]; for(int i=0;i<n;i++) { if(s[i]+s[i+1]>m) { ans+=s[i+1]+s[i]-m; s[i]-m; } } cout<<ans; return 0; }
a.cc: In function 'int main()': a.cc:7:36: error: invalid types 'int[int]' for array subscript 7 | for(int i=0;i<=n;i++)cin>>s[i]; | ^ a.cc:10:21: error: invalid types 'int[int]' for array subscript 10 | if(s[i]+s[i+1]>m) | ...
s127422829
p03862
C++
#include<bits/stdc++.h> using namespace std; int a[101]; int main(){ int n,i,j,x,sum=0; cin>>n>>x; for(i=1;i<=n;i++) cin>>a[i]; for(i=1;i<n;i++) for(j=2;j<=n;j++) if(a[j]-a[i]>xa[i]-a[j]>x) sum++; cout<<sum; return 0; }
a.cc: In function 'int main()': a.cc:11:38: error: 'xa' was not declared in this scope; did you mean 'x'? 11 | if(a[j]-a[i]>xa[i]-a[j]>x) sum++; | ^~ | x
s036861526
p03862
C++
C - Boxes and Candies
a.cc:1:1: error: 'C' does not name a type 1 | C - Boxes and Candies | ^
s241849844
p03862
C++
#include<bits/stdc++.h> using namespace std; int a[101] int main(){ int n,i,j,x,sum=0; cin>>n>>x; for(i=1;i<=n;i++) cin>>a[i]; for(i=1;i<n;i++) for(j=2;j<=n;j++) if(a[j]-a[i]>xa[i]-a[j]>x) sum++; cout<<sum; return 0; }
a.cc:4:1: error: expected initializer before 'int' 4 | int main(){ | ^~~
s812800730
p03862
C++
#include<bits/stdc++.h> using namespace std; int a[101] int main(){ int n,i,j,xsum=0; cin>>n>>x; for(i=1;i<=n;i++) cin>>a[i]; for(i=1;i<n;i++) for(j=2;j<=n;j++) if(a[j]-a[i]>xa[i]-a[j]>x) sum++; cout<<sum; return 0; }
a.cc:4:1: error: expected initializer before 'int' 4 | int main(){ | ^~~
s425527008
p03862
C++
#include<iostream> #include<algorithm> #include<string> #include<functional> #include<utility> #include<stack> #include<queue> #include<cmath> #include<list> #include<cstdint> #include<vector> #include<map> #include<deque> #define rep(i,rept) for(int i = 0; i<(int)rept;++i) typedef long long ll; const ll MOD = 1e9 + 7;...
a.cc:59:10: error: redefinition of 'const ll MOD' 59 | const ll MOD = 1e9 + 7; | ^~~ a.cc:16:10: note: 'const ll MOD' previously defined here 16 | const ll MOD = 1e9 + 7; | ^~~ a.cc:62:5: error: redefinition of 'int main()' 62 | int main() { | ^~~~ a.cc:19:5: note: 'int ...
s407178716
p03862
C++
#include<iostream> #include<iomanip> #include<algorithm> #include<cmath> #include<vector> #include<string> #include<bitset> #include<queue> #include<set> #include<map> using namespace std; #define FOR(i,a,b) for (int i=(a);i<(b);++i) #define ROF(i,b,a) for (int i=(b);i>(a);--i) #define REP(i,n) FOR(i,0,n) #define PER(...
a.cc: In function 'int main()': a.cc:38:28: error: expected ';' before '}' token 38 | else a[i+1] = 0 | ^ | ; 39 | } | ~
s891453682
p03862
C
#include<stdio.H> int main(){ int n; long a[100000],x,cnt=0; scanf("%d %ld",&n,&x); scanf("%ld",a[0]); if(a[0]>x){ cnt+=a[0]-x; a[0]=x; } for(int i=1;i<n;i++){ scanf("%ld",&a[i]); if(a[i]+a[i-1]>x){ cnt+=a[i]+a[i-1]-x; a[i]-=a[i]+a[i-1]-x; } } printf("%ld\n",cnt); }
main.c:1:9: fatal error: stdio.H: No such file or directory 1 | #include<stdio.H> | ^~~~~~~~~ compilation terminated.
s521202775
p03862
C++
#include <bits/stdc++.h> typedef long long ll; int main(int argc, char const *argv[]) { ll N, x; std::cin >> N >> x; ll a[N]; for (size_t i = 0; i < N; i++) { std::cin >> a[i]; } ll count = 0; for (size_t i = 0; i < N - 1; i++) { if (a[i] + a[i + 1] > x) { count ...
a.cc:30:5: error: redefinition of 'int main(int, const char**)' 30 | int main(int argc, char const *argv[]) { | ^~~~ a.cc:4:5: note: 'int main(int, const char**)' previously defined here 4 | int main(int argc, char const *argv[]) { | ^~~~
s947957295
p03862
C++
#include<iostream> #include<climits> #include<math.h> #include<vector> #include<algorithm> #include<cstdio> #include<stdio.h> #include <string> #include <complex> #include <functional> using namespace std; typedef pair<int,int> P; double dat[100][100]; int dp[6][1010];//動的計画法 int prime[10000001]; char str[1010][1010]; ...
a.cc: In function 'int main()': a.cc:37:9: error: 'out' was not declared in this scope 37 | out<<ans<<endl; | ^~~
s144396846
p03862
C++
#include <iostream> #include <cstdint> #include <algorithm> int main() { std::int_fast64_t n, x; std::cin >> n >> x; std::vector<std::int_fast64_t> a(n); for (std::int_fast64_t i = 0; i < n; ++i) { std::cin >> a[i]; } std::int_fast64_t result = 0; for (std::int_fast64_t i = 1; i < n; ++i) { cons...
a.cc: In function 'int main()': a.cc:8:8: error: 'vector' is not a member of 'std' 8 | std::vector<std::int_fast64_t> a(n); | ^~~~~~ a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 3 | #include <algorithm> +++ |+#include <vec...
s790935853
p03862
C++
N, x = gets.split.map(&:to_i) a = gets.split.map(&:to_i) ans = 0 (N-1).times do |i| tmp = a[i] + a[i+1] - x if tmp > 0 a[i+1] -= tmp ans += tmp end end print ans, "\n"
a.cc:1:1: error: 'N' does not name a type 1 | N, x = gets.split.map(&:to_i) | ^
s602249246
p03862
C++
#include <cstdlib> #include <iostream> #include <string> #include <time.h> #include <cstdio> #include <algorithm> #include <cmath> #include <sstream> #include <iomanip> //#include "bits/stdc++.h" using namespace std; #define rep(i,a,b) for(int i=(a);i<(b);++i) #define huge 1000000007 typedef long long ll; int main(v...
a.cc: In function 'int main()': a.cc:56:18: error: expected '}' at end of input 56 | return 0; | ^ a.cc:18:16: note: to match this '{' 18 | int main(void) { | ^
s792600545
p03862
C
#include <bits/stdc++.h> using namespace std; int num[100005]; int main() { int n,k; scanf("%d%d",&n,&k); int sum=0; for(int i=0;i<n;i++) { scanf("%d",&num[i]); if(i>=1) { if(num[i-1]<=num[i]&&num[i-1]+num[i]>k) { sum+=num[i]-k+num[i-...
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory 1 | #include <bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s895673433
p03862
C++
#include <bits/stdc++.h> using namespace std; /* define const */ /* end up defineing const */ long nnn = 0; long a[1000000010]; long x = 0; int main() { cin >> nnn >> x; for (int i = 0; i < nnn; i++) cin >> a[i]; // end up inputting long cnt = 0; for (int i = 0; i < nnn-1; i++) { if (a[i]+a[i+1] > x)...
/tmp/ccBE3E8J.o: in function `main': a.cc:(.text+0x27): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccBE3E8J.o a.cc:(.text+0xcb): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccBE3E8J.o a.cc:(.text+0x111): relocation trun...
s245147451
p03862
C++
#include <bits/stdc++.h> using namespace std; /* define const */ /* end up defineing const */ long n = 0; long a[1000000010]; long x = 0; int main() { cin >> n >> x; for (int i = 0; i < n; i++) cin >> a[i]; // end up inputting long cnt = 0; for (int i = 0; i < n-1; i++) { if (a[i]+a[i+1] > x) { ...
/tmp/cc40wXH4.o: in function `main': a.cc:(.text+0x27): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/cc40wXH4.o a.cc:(.text+0xcb): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/cc40wXH4.o a.cc:(.text+0x111): relocation trun...
s036499010
p03862
C++
#include <bits/stdc++.h> using namespace std; /* define const */ /* end up defineing const */ long n; long a[1000000010]; long x; int main() { cin >> n >> x; for (int i = 0; i < n; i++) cin >> a[i]; // end up inputting long cnt = 0; for (int i = 0; i < n-1; i++) { if (a[i]+a[i+1] > x) { long su...
/tmp/ccLVkmXw.o: in function `main': a.cc:(.text+0x27): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccLVkmXw.o a.cc:(.text+0xcb): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccLVkmXw.o a.cc:(.text+0x111): relocation trun...
s439345517
p03862
C++
#include <bits/stdc++.h> using namespace std; /* define const */ /* end up defineing const */ long N; long a[1000000010]; long x; int main() { cin >> N >> x; for (int i = 0; i < N; i++) cin >> a[i]; // end up inputting long cnt = 0; for (int i = 0; i < N-1; i++) { if (a[i]+a[i+1] > x) { long su...
/tmp/ccLWBbPn.o: in function `main': a.cc:(.text+0x27): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccLWBbPn.o a.cc:(.text+0xcb): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccLWBbPn.o a.cc:(.text+0x111): relocation trun...
s751427301
p03862
C++
#include <iostream> using namespace std; int main() { int n, x; cin >> n >> x; int a[100010]; for (int i = 0; i < n; i++) { cin >> a[i]; } long long d, ans = 0; for (int i = 0; i < n-1; i++) { d = a[i] + a[i+1] - x; if (d > 0) { ans += d; ...
a.cc: In function 'int main()': a.cc:23:25: error: no matching function for call to 'max(long long int, int)' 23 | a[i+1] = max(a[i+1] - d, 0); | ~~~^~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classe...
s337997803
p03862
C++
#include <iostream> using namespace std; int main() { int n, x; cin >> n >> x; int a[100010]; for (int i = 0; i < n; i++) { cin >> a[i]; } long long ans = 0; for (int i = 0; i < n-1; i++) { d = a[i] + a[i+1] - x; if (d > 0) { ans += d; ...
a.cc: In function 'int main()': a.cc:19:9: error: 'd' was not declared in this scope 19 | d = a[i] + a[i+1] - x; | ^
s792424516
p03862
C++
#include <iostream> using namespace std; int f(int x) { if (n == -1) return 0; return n / x + 1; } int main(int argc, char *argv[]) { long a, b, x; cin >> a >> b >> x; cout << f(b) - f(a - 1) << endl; return 0; }
a.cc: In function 'int f(int)': a.cc:6:13: error: 'n' was not declared in this scope 6 | if (n == -1) return 0; | ^ a.cc:7:16: error: 'n' was not declared in this scope 7 | return n / x + 1; | ^
s275713409
p03862
C++
#include <iostream> #include <algorithm> #include <array> #include <cmath> #include <string> using namespace std; int main() { cin>>x; if(x==3){ cout<<1<<endl; } if(x==6){ cout<<11<<endl; } if(x==5){ cout<<0<<endl; } if(x==2){ cout<<10<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:9:14: error: 'x' was not declared in this scope 9 | cin>>x; | ^
s034704762
p03862
C++
#include <iostream> #define rep(i,n) for(long long i = 0;i<n;i++) #define REP(i,k,n) for(long long i=k;i<n;i++) using namespace std; int main(){ long long n,x; long long a[100100]; cin >> n >> x; rep(i,n){ cin >> a[i]; } long long ans = 0 if(a[0]>x){ ans += x-a[0]; a[0] = x; } for(long lo...
a.cc: In function 'int main()': a.cc:14:3: error: expected ',' or ';' before 'if' 14 | if(a[0]>x){ | ^~
s709182554
p03862
C++
#include<bits/stdc++.h> #define vi vector<int> #define vvi vector<vector<int> > #define vl vector<ll> #define vvl vector<vector<ll>> #define vb vector<bool> #define vc vector<char> #define vs vector<string> using ll = long long; using ld =long double; #define int ll #define INF 1e9 #define EPS 0.0000000001 #define rep(...
a.cc: In function 'int main()': a.cc:32:23: error: no matching function for call to 'max(int, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)' 32 | v[i+1]=max(0,v[i+1]-(v[i]+v[i+1]-x)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /us...
s966421560
p03862
C++
import Data.Array.IO main :: IO () main = do [n, x] <- (map read . words) <$> getLine :: IO [Int] as <- (map read . words) <$> getLine :: IO [Int] asArr <- newListArray (0, n - 1) as :: IO (IOArray Int Int) print =<< solve asArr 1 n x 0 solve :: IOArray Int Int -> Int -> Int -> Int -> Int -> IO Int solve asAr...
a.cc:1:1: error: 'import' does not name a type 1 | import Data.Array.IO | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
s772967859
p03862
C++
#include <iostream> #include<cstdlib> #include<queue> #include<set> #include<vector> #include<string> #include<algorithm> #include<stack> #include<map> #include<cstdio> using namespace std; #define rep(i,a) for(int i=0;i<a;i++) #define mp make_pair #define pb push_back #define P pair<int,int> #define ll __int64 //#defi...
a.cc:16:12: error: '__int64' does not name a type; did you mean '__int64_t'? 16 | #define ll __int64 | ^~~~~~~ a.cc:20:1: note: in expansion of macro 'll' 20 | ll ans,cnt; | ^~ a.cc: In function 'int main()': a.cc:26:25: error: 'ans' was not declared in this scope; did you mean 'abs'? 26...
s320644511
p03862
C++
#include "bits/stdc++.h" using namespace std; typedef long long ll; #define INF (1<<30) #define INFLL (1ll<<60) typedef pair<ll, int> P; #define MOD (1000000007ll) ll sq(ll x){ return x*x; } int main(void){ int n,i; ll a[123456],ans=0ll,x; cin >> n >> x; for(i=0; i<n; ++i){ cin >> a[i]; } for(i=1; i<n; i++){...
a.cc: In function 'int main()': a.cc:22:36: error: no matching function for call to 'max(int, ll)' 22 | a[i] = min(a[i],max(0,x-a[i-1])); | ~~~^~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu...
s638312778
p03862
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> int descending_compare(const void *a, const void *b){ if (*(int*)a > *(int*)b){ return -1; }else if (*(int*)a == *(int*)b){ return 0; }else{ return 1; } } int ascending_compare(const void *a, const vo...
main.c:72:14: error: expected identifier or '(' before '[' token 72 | int long long[100005]; | ^ main.c: In function 'main': main.c:80:24: error: 'a' undeclared (first use in this function) 80 | scanf("%lld", &a[i]); | ^ main.c:80:24: note: each undeclared i...
s923308832
p03862
C++
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <queue> #include <set> #include <map> using namespace std; long long N; long long x; long long a[100010]; int main() { cin >> N; cin >> x; for(long long i = 1;i <= N;i++) { cin >> a[i]; } long long r...
a.cc: In function 'int main()': a.cc:38:30: error: no matching function for call to 'max(int, long long int)' 38 | long long l = max(0,sum - x); | ~~~^~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_clas...
s939928945
p03862
C++
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <queue> #include <set> #include <map> using namespace std; long long N; long long x; long long a[100010]; int main() { cin >> N; cin >> x; for(long long i = 1;i <= N;i++) { cin >> a[i]; } long long r...
a.cc: In function 'int main()': a.cc:29:26: error: no matching function for call to 'max(int, const long long int&)' 29 | long long r = max(0,min(a[i],sum - x)); | ~~~^~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/...
s558440711
p03862
C++
#include <algorithm> #include <bitset> #include <chrono> #include <complex> #include <cstdint> #include <cstring> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <ostream> #include <queue> #include <random> #include <regex> #include <set> #include <sstream> #inclu...
a.cc: In member function 'void Solution::solve(std::istream&, std::ostream&)': a.cc:37:32: error: no matching function for call to 'max(long long int, __gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type)' 37 | a[i + 1] -= max(0LL, a[i + 1] + a[i] - x); | ...
s061355871
p03862
C++
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int MAXN=1e5+5; int n,x,a[MAXN]; int main(){ scanf("%d%d",&n,&x); for(int i=0;i<n;i++)scanf("%d",&a[i]); ll ans=0; for(int i=1;i<n;i++){ ll sum=a[i]+a[i-1]; ll res=max(sum-x,0); ans+=res;a[i]-=res; } ...
a.cc: In function 'int main()': a.cc:14:19: error: no matching function for call to 'max(ll, int)' 14 | ll res=max(sum-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, ...
s700003789
p03862
C++
#include<bits/stdc++.h> using namespace std; #define int long long signed main(){ int n,x; cin>>n>>x; vector<int> vec; for(int i=0;i<n;i++){ int t; cin>>t; vec.push_back(t); } int ans=0; for(int i=1;i<vec.size();i++){ int t=max(0,vec[i]+vec[i-1]-x); ve...
a.cc: In function 'int main()': a.cc:15:18: error: no matching function for call to 'max(int, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)' 15 | int t=max(0,vec[i]+vec[i-1]-x); | ~~~^~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/alg...
s730424203
p03862
C
#include<stdio.h> int main() { int i, j, count1 = count2 = 0; int n, x; scanf("%d%d", &n, &x); int arr[n]; int sum; for(i=0; i<n; i++) { scanf("%d", &arr[i]); } for(i=1; i<n; i+=2) { sum = arr[i] + arr[i-1]; if(sum>x) count1 += sum-x; } for(i=n-2; i>=0; i-=2) { sum = arr[i] + arr[i+1]; if(sum>x) cou...
main.c: In function 'main': main.c:3:28: error: 'count2' undeclared (first use in this function); did you mean 'count1'? 3 | int i, j, count1 = count2 = 0; | ^~~~~~ | count1 main.c:3:28: note: each undeclared identifier is reported only once ...
s110960973
p03862
C++
#include<bits/stdc++.h> #define fr(i1,m) for(int i1=0;i1<m;i1++) using namespace std; int main() { long n,m; while(cin>>n>>m) { long a[100100],s=0,x,y,i; fr(i,n) cin>>a[i]; for(i=1;i<n;i++) { x=a[i]+a[i-1]; ...
a.cc: In function 'int main()': a.cc:22:29: error: no matching function for call to 'max(long int&, int)' 22 | 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/std...
s576752542
p03862
C++
#include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<climits> #include<iostream> #include<sstream> #include<utility> #include<map> #include<vector> #include<queue> #include<algorithm> #include<set> #include<stack> using namespace std; typedef long long ll; typedef pair<int,int>P; ll N,X,A[10000...
a.cc: In function 'int main()': a.cc:26:24: error: 'i' was not declared in this scope 26 | res+=A[i]-(A[i]-X); | ^
s075931046
p03862
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> #include <algorithm> using namespace std; #define inf 0x3fffffff int main() { int i, n,x,a[110000]; long long sum; while (~scanf("%d%d", &n, &x)) { sum = 0; for (i = 1; i <= n; i++) scanf("%d", &a[i]); if (a[1] > x) { sum +...
main.c:5:10: fatal error: algorithm: No such file or directory 5 | #include <algorithm> | ^~~~~~~~~~~ compilation terminated.
s421830054
p03862
C
/* C - Boxes and Candies <http://abc048.contest.atcoder.jp/tasks/arc064_a> [Tips] ・callocはヒープ領域からメモリの割り当てを行うため遅い<https://oshiete.goo.ne.jp/qa/1726895.html> */ #include <stdio.h> typedef long int int int64_t; int main(int argc, char const *argv[]) { int64_t N, x, a, a_next; int64_t i; int64_t cnt; s...
main.c:10:18: error: two or more data types in declaration specifiers 10 | typedef long int int int64_t; | ^~~
s881278394
p03862
C
/* C - Boxes and Candies <http://abc048.contest.atcoder.jp/tasks/arc064_a> [Tips] ・callocはヒープ領域からメモリの割り当てを行うため遅い<https://oshiete.goo.ne.jp/qa/1726895.html> */ #include <stdio.h> typedef long int int32_t int main(int argc, char const *argv[]) { int32_t N, x, a, a_next; int32_t i; int32_t cnt; scanf(...
main.c:10:25: error: expected ';' before 'int' 10 | typedef long int int32_t | ^ | ; 11 | 12 | int main(int argc, char const *argv[]) { | ~~~ main.c: In function 'main': main.c:14:3: error: unknown type name 'int32_t' 1...
s807672029
p03862
C++
//I_F_A #include "bits/stdc++.h" using namespace std; int main(){ long long n,x; cin >> n >> x; long long arr[n+1]; for(long long i=1;i<=n;i++){ cin >> arr[i]; } for(long long i=2;i<=n;i++){ if(arr[i] + arr[i-1] > x){ long long pr = arr[i-1]; arr[i-1] = max(0LL,(x-arr[i-1])); ans = ans + abs(p...
a.cc: In function 'int main()': a.cc:22:25: error: 'ans' was not declared in this scope; did you mean 'abs'? 22 | ans = ans + abs(pr-arr[i-1]); | ^~~ | abs a.cc:28:25: error: 'ans' was not declared in this scope; did you mean 'abs'? ...
s381222920
p03862
C++
//I_F_A #include "bits/stdc++.h" using namespace std; int main(){ long long n,x; cin >> n >> x; long long arr[n+1]; for(long long i=1;i<=n;i++){ cin >> arr[i]; } for(long long i=2;i<=n;i++){ if(arr[i] + arr[i-1] > x){ long long pr = arr[i-1]; arr[i-1] = max(0LL,(x-arr[i-1])) ans = ans + abs(pr...
a.cc: In function 'int main()': a.cc:21:57: error: expected ';' before 'ans' 21 | arr[i-1] = max(0LL,(x-arr[i-1])) | ^ | ; 22 | ans = ans + ab...
s831070080
p03862
C++
#include<iostream> #include<vector> #include<cinttypes> #include<limits> #include<algorithm> #include<numeric> //2≤ N ≤10^5 //0≤ a[i] ≤10^9 //0≤ x ≤10^9 using n_type = std::uint32_t; using a_type = std::int64_t; using x_type = std::uint32_t; using veca = std::vector<a_type>; template<class T> void print(std::vecto...
a.cc: In function 'int main()': a.cc:44:40: error: no matching function for call to 'max(long long int, __gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type)' 44 | v[i] = std::max( 0LL,v[i]- t);// | ~~~~~~~~^~~~~~~~~~~~~~ In file inclu...
s115532575
p03862
C++
//AGC 007-A #define _USE_MATH_DEFINES #include <iostream> #include <cmath> #include <stdlib.h> #include <algorithm> #include <cstdio> #include <vector> #include <cstring> #include <numeric> #include <string> #include <map> #include <sstream> using namespace std; int main(){ int N, x, a[100000] long ans = 0; ...
a.cc: In function 'int main()': a.cc:19:9: error: expected initializer before 'long' 19 | long ans = 0; | ^~~~ a.cc:22:24: error: 'a' was not declared in this scope 22 | cin >> a[i]; | ^ a.cc:24:25: error: 'ans' was not declared in this scope; did...
s000945189
p03862
C++
#include "bits/stdc++.h" using namespace std; #define int long long #define DBG 1 #define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;} #define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;} #define rep(i,a,b) for(int i=(a);i<(b);i++) #define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--) #define each(it,c) ...
a.cc: In function 'int main()': a.cc:23:35: error: no matching function for call to 'max(int, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type&)' 23 | a[i] = max(0, a[i]); | ~~~^~~~~~~~~ In file included from /usr/include...
s095209106
p03862
C++
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <cstdlib> using namespace std; int main(){ cin.tie(0); ios::sync_with_stdio(false); int n; int *a; int x; int ans =0; cin >> n >> x; a = new int[n]; vector b(n - 1); for(int i = 0; i < n; ++i){ cin >> a[i]; } ...
a.cc: In function 'int main()': a.cc:19:24: error: class template argument deduction failed: 19 | vector b(n - 1); | ^ a.cc:19:24: error: no matching function for call to 'vector(int)' In file included from /usr/include/c++/14/vector:66, from a.cc:2: /usr/includ...
s326635301
p03862
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n,x; cin >> n >> x; vector<int> a(n); for(int i=0;i<n;i++){ cin >> a[i]; } long long int ans=0; vector<int> b(n-1); for(int i=1;i<a.size();i++){ b[i-1] = a[i-1] + a[i]; } for(int i=0;i<b.size();i++){ long long int z = max(b[i] - x,0); b...
a.cc: In function 'int main()': a.cc:20:27: error: no matching function for call to 'min(long long int, int)' 20 | b[i+1]=min(b[i+1]-z,0); | ~~~^~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/...
s557285491
p03862
C++
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define ll long long #define INF (1 << 30) #define INFLL (1LL << 60) #define FOR(i,a,b) for(ll i = (a...
a.cc: In function 'int main()': a.cc:46:44: error: no matching function for call to 'max(long long int, int)' 46 | ans1 += max(a[i] + maxLR - x, 0); | ~~~^~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, ...
s103954100
p03862
C++
#include <iostream> #include <map> #include <string> using namespace std; int main() { long long a[100000]; int n, x: long long cnt = 0; cin >> n >> x; for (int i = 0; i < n; ++i) { cin >> a[i]; } for (int i = 1; i < n; ++i) { if (a[i] + a[i - 1] > x) { int tmp = a[i] + a[i - 1] - x; a[i] -= tmp; cn...
a.cc: In function 'int main()': a.cc:7:17: error: expected initializer before ':' token 7 | int n, x: | ^ a.cc:9:21: error: 'x' was not declared in this scope 9 | cin >> n >> x; | ^ a.cc:17:25: error: 'cnt' was not declared in this scope; did you m...