This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
import java.util.*;
public class biscuits {
    HashMap<Long, Long> freq = new HashMap<>();
    long[] keys = new long[61 * 10001];
    long[] vals = new long[61 * 10001];
    long count_tastiness(long x, long[] a) {
        freq.clear();
        freq.put(a[0], 1l);
        for (int pos = 0; pos < a.length - 1; pos++) {
            int p = 0;
            for (Map.Entry<Long, Long> entry : freq.entrySet()) {
                keys[p] = entry.getKey();
                vals[p] = entry.getValue();
                p++;
            }
            freq.clear();
            for (int i = 0; i < p; i++) {
                long y = keys[i], value = vals[i];
                long val = a[pos + 1] + (y >> 1);
                freq.put(val, freq.getOrDefault(val, 0l) + value);
                if (y >= x) {
                    val = a[pos + 1] + ((y - x) >> 1);
                    freq.put(val, freq.getOrDefault(val, 0l) + value);
                }
            }
        }
        long ans = 0;
        for (long y : freq.keySet()) {
            ans += freq.get(y) * (y / x + 1);
        }
        return ans;
    }
}
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... |