# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1103699 | zephyrion | Tuna (COCI17_tuna) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
n = int(input())
x = int(input())
ans = 0
for i in range(n):
p1, p2 = map(int, input().split())
if abs(p1 - p2) <= X:
ans += max(p1, p2)
else:
ans += int(input())
print(ans)