본문 바로가기
Beakjoon&프로그래머스/파이썬

[백준/파이썬] 31962번 등교

by 현장 2024. 6. 18.

-Code

res = []

n, x = map(int, input().split())

for _ in range(n):
    s, t = map(int, input().split())

    if s + t <= x:
        res.append(s)

print(sorted(res)[-1] if len(res) > 0 else -1)