# Help with "Candy Cane Feast" 2023 Dec. Bronze

Candy Cane Feast
https://usaco.org/index.php?page=viewproblem2&cpid=1347

## Question

Not sure why my code isn’t working.

## My Work

``````#include <bits/stdc++.h>
#include <exception>
using namespace std;

int main() {
long long n, m;
long long bottom;
long long current_cane_units;
cin >> n >> m;
vector<long long> cowh;
for(long long i=0;i<n;i++) {
long long h;
cin >> h;
cowh.push_back(h);
}
vector<long long> cane;
for(long long j=0;j<m;j++) {
long long k;
cin >> k;
cane.push_back(k);
}
for(long long a=0;a<m;a++) {
bottom = 0;
current_cane_units = cane[a];
for(long long b=0;b<n;b++) {
long long eaten;
if(cowh[b]>=bottom) {
eaten = (min(cowh[b]-bottom, cane[a]));
bottom = cowh[b];
cowh[b] += (eaten);
current_cane_units -= eaten;
if(current_cane_units <= 0) {
break;
}
}

}
}
for(long long l=0;l<n;l++) {
cout << cowh[l] << "\n";
}
}
``````

Screenshot of test cases:

`eaten = (min(cowh[b]-bottom, cane[a]));`
`eaten = min(cowh[b],cane[a]) - bottom;`
`bottom += eaten;`