B - Медведь и малина

public
yeskendir.sultanov Apr 26, 2024 Never 43
Clone
1
n, c = map(int, input().split())
2
x = [int(x) for x in input().split()]
3
ans = 0
4
for d in range(n - 1):
5
if x[d] > x[d + 1] + c:
6
ans = max(ans, (x[d] - x[d + 1] - c))
7
print(ans)