Harryxun/stf_run huggingface dataset:
import copy
n=int(input())
a=[int(input()) for i in range(n)]
maxa=max(a)
maxa2=sorted(set(nums))[-2]
maxs=a.count(maxa)
for i in range(n):
  if maxs==1:
    print(maxa if a[i]!=maxa else maxa2)
  else:
    print(maxa)

### FIXED CODE ###

import copy
n=int(input())
a=[int(input()) for i in range(n)]
maxa=max(a)
if len(set(a))!=1:
  maxa2=sorted(set(a))[-2]
maxs=a.count(maxa)
for i in range(n):
  if maxs==1:
    print(maxa if a[i]!=maxa else maxa2)
  else:
    print(maxa)
# 各々の要素が何番目に何回数えられるかを考える。
import sys

input = sys.stdin.buffer.readline

n = int(input())
C = list(map(int, input().split()))
C.sort(reverse=True)
mod = 10 ** 9 + 7
N = n + 5
bikkuri = [0] * N
bikkuri[0] = 1
gyaku = [0] * N
for i in range(1, N):
    bikkuri[i] = (i * bikkuri[i - 1]) % mod
gyaku[N - 1] = pow(bikkuri[N - 1], mod - 2, mod)
for i in range(N - 1, -1, -1):
    gyaku[i - 1] = (gyaku[i] * i) % mod


def comb(n, r):
    if r < 0 or n - r < 0:
        return 0
    return (bikkuri[n] * gyaku[r] * gyaku[n - r]) % mod


ans = 0
for i in range(n):
    ans += pow(2, i - 1, mod) * (i + 2) * C[i] * pow(2, n - (i + 1), mod)
    ans %= mod
ans *= pow(2, n, mod)
ans %= mod
print(ans)


### FIXED CODE ###

# 各々の要素が何番目に何回数えられるかを考える。
import sys

input = sys.stdin.buffer.readline

n = int(input())
C = list(map(int, input().split()))
C.sort(reverse=True)
mod = 10 ** 9 + 7
N = n + 5
bikkuri = [0] * N
bikkuri[0] = 1
gyaku = [0] * N
for i in range(1, N):
    bikkuri[i] = (i * bikkuri[i - 1]) % mod
gyaku[N - 1] = pow(bikkuri[N - 1], mod - 2, mod)
for i in range(N - 1, -1, -1):
    gyaku[i - 1] = (gyaku[i] * i) % mod


def comb(n, r):
    if r < 0 or n - r < 0:
        return 0
    return (bikkuri[n] * gyaku[r] * gyaku[n - r]) % mod


ans = 0
for i in range(n):
    ans += (i + 2) * C[i] * pow(2, 2 * n - 2, mod)
    ans %= mod
print(ans)
def fib(n):
    if n>0:
        return n+fib(n-1)
    else:
         return n

a,b=map(int,input().split())
memo=[0 for i in range(1000)]
s=b-a
for i in range(1000):
    if fib(i+1)-fib(i)==s:
        print(fib(i)-a)
        break

### FIXED CODE ###

a, b = map(int, input().split())

x = b - a
s = 0
for i in range(1,x,1):
  s += i

ans = s - a
print(ans)
import math
a,b,c = map(int,input().split())
G = math.sqrt(c)-(math.sqrt(a) + math.sqrt(b))
if G > 0:
  print('Yes')
  sys.exit(0)
print('No')


### FIXED CODE ###

from decimal import *
import sys
a,b,c = map(int,input().split())
getcontext().prec = 500
if a + b >= c:
  print('No')
  sys.exit(0)
if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():
  print('Yes')
  sys.exit(0)
print('No')
N,K = map(int,input().split())
A = list(map(int,input().split()))
visited = []
search = set()
now = 1#最初の街にいる
count = 0
next_town = A[now-1]
while(count<=N):
    if next_town in search:#もし次の街が訪れたことがある場合
        break#ループするので抜け出す
    visited.append(now)#今いる街は訪れたこととなるので記録する
    search.add(now)
    next_town = A[now-1]#次に行く街を探す
    now = next_town#次の街に着いたこととして変数を代入
    count += 1

first_roop_city = A[visited[-1]-1]#最初にループした街
first_roop_city_index = visited.index(first_roop_city)#何回目のテレポートにループが始まったか
if K <= len(visited):
    print(visited[K])
else:
    visited = visited[first_roop_city_index:]
    L = len(visited)
    print(visited[(K-first_roop_city_index)%L])

### FIXED CODE ###

N,K = map(int,input().split())
A = list(map(int,input().split()))
visited = []
search = set()
now = 1#最初の街にいる
next_town = A[now-1]
count = 1
while(count<=N):
    if next_town in search:#もし次の街が訪れたことがある場合
        break#ループするので抜け出す
    visited.append(now)#今いる街は訪れたこととなるので記録する
    search.add(now)
    next_town = A[now-1]#次に行く街を探す
    now = next_town#次の街に着いたこととして変数を代入
    count += 1

first_roop_city = A[visited[-1]-1]#最初にループした街
first_roop_city_index = visited.index(first_roop_city)#何回目のテレポートにループが始まったか
if K < len(visited):
    print(visited[K])
else:
    visited = visited[first_roop_city_index:]
    L = len(visited)
    print(visited[(K-first_roop_city_index)%L])
#!/usr/bin/python3
# -*- coding: utf-8 -*-

import sys

class G(object):
    def __init__(self, i):
        self.i = i
        self.a = []

    def add(self, v, d):
        self.a.append((v, d))

    def path(self, j, s):
        if self.i == j:
            return s
        for v in self.a:
            d = v[0].path(j, s + v[1])
            if d >= 0:
                return d
        return -1

def main():
    n, m = tuple(map(int, input().split()))
    lrds = tuple(map(int, input().split()) for _ in range(m))

    g = dict()
    for lrd in lrds:
        (l, r, d) = lrd
        if l not in g:
            g[l] = G(l)
        if r not in g:
            g[r] = G(r)
        pd = g[l].path(r, 0)
        if pd != -1 and pd != d or g[r].path(l, 0) != -1:
            print('No')
            sys.exit()
        g[l].add(g[r], d)

    print('Yes')

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/python3
# -*- coding: utf-8 -*-

import sys

def main():
    n, m = map(int, sys.stdin.readline().split())
    lrds = ((map(int, line.split())) for line in sys.stdin.readlines())

    g = tuple([] for _ in range(n))
    x = [None] * n

    for l, r, d in lrds:
        l -= 1
        r -= 1
        g[l].append((r, d))
        g[r].append((l, -d))

    for i in range(n):
        if x[i] is not None:
            continue
        stack = [i]
        x[i] = 0
        while len(stack):
            v = stack.pop()
            for u, d in g[v]:
                if x[u] is None:
                    stack.append(u)
                    x[u] = x[v] + d

    for v in range(n):
        for u, d in g[v]:
            if x[v] + d != x[u]:
                print('No')
                sys.exit()

    print('Yes')

if __name__ == '__main__':
    main()
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, S, X):
    Xs = []
    for x in X:
        t = x - S
        if t < 0:
            t *= -1
        elif t == 0:
            continue
        Xs.append(t)

    if N == 1:
        return Xs[0]
    ans = math.gcd(Xs[0], Xs[1])
    for i in range(2, N):
        ans = math.gcd(ans, Xs[i])

    return ans


def main():
    N, S = read_int_n()
    X = read_int_n()
    print(slv(N, S, X))


if __name__ == '__main__':
    main()


### FIXED CODE ###

# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, S, X):
    Xs = []
    for x in X:
        t = abs(x - S)
        Xs.append(t)

    if N == 1:
        return Xs[0]
    ans = gcd(Xs[0], Xs[1])
    for i in range(2, N):
        ans = gcd(ans, Xs[i])

    return ans


def gcd(a, b):
    if a < b:
        return gcd(b, a)
    if b == 0:
        return a
    return gcd(b, a % b)


def main():
    N, S = read_int_n()
    X = read_int_n()
    print(slv(N, S, X))

    # N = 10000
    # S = random.randint(1, 10**9)
    # # X = [random.randint(1, 10**9) for _ in range(N)]
    # S = 1
    # X = list(range(N))
    # print(slv(N, S, X))


if __name__ == '__main__':
    main()
a, b, c, d = map(int, input().split())

if abs (a - c) <= d:
    print('Yes')
elif abs(a - b) <= d:
    print('Yes')
elif abs(b - c) <= d:
if d >= abs(a - c) or (d >= abs(a - b) and d >= abs(b - c)):
    print('Yes')
else:
    print('No') 

### FIXED CODE ###

a, b, c, d = map(int, input().split())

if d >= abs(a - c) or (d >= abs(a - b) and d >= abs(b - c)):
    print('Yes')
else:
    print('No')
import numpy as np
import sympy
n=int(input())
a=[(sympy.divisor_count(i)*i) for i in range(1,n+1)]
print(np.sum(a))

### FIXED CODE ###

n = int(input())
ans=0
for i in range(1,n+1):
    a=n//i
    ans+=i*a*(a+1)/2
print(int(ans))
N = int(input())
a = list(map(int, input().split()))

def sort_reverse(n):
    n.sort(reverse=True)
    return n

N_Even = list(range(0, N+1, 2))
N_Odd = list(range(1, N+1, 2))
a1 = sort_reverse(a)
sum1 = 0
sum2 = 0

for i in N_Even:
    sum1 += a1[i]
for j in N_Odd:
    sum2 += a1[i]

print(sum1 - sum2)

### FIXED CODE ###

N = int(input())
a = list(map(int, input().split()))

def sort_reverse(n):
    n.sort(reverse=True)
    return n

N_Even = list(range(0, N, 2))
N_Odd = list(range(1, N, 2))
a1 = sort_reverse(a)
sum1 = 0
sum2 = 0

for i in N_Even:
    sum1 += a1[i]
for j in N_Odd:
    sum2 += a1[j]

print(sum1 - sum2)
s = input()
t = input()
count=0
for i in len(s):
  if s[i] != t[i]:
    count+=1
print(count)


### FIXED CODE ###

s = input()
t = input()
count=0
for (i,j) in zip(s,t):
  if i != j:
    count+=1
print(count)
n, m = map(int, input().split())
d = {}
for i in range(m):
    p, s = input().split()
    d.setdefault(p, [])
    d[p].append(s)

correct = 0
cnt = 0
for v in d.values():
    tmp = len(v[:v.index("AC")])
    if tmp > 0: correct += 1
    cnt += len(v[:v.index("AC")])

print(correct, cnt)

### FIXED CODE ###

n, m = map(int, input().split())
d = {}
for i in range(m):
    p, s = input().split()
    d.setdefault(p, [])
    d[p].append(s)

cnt = 0; correct = 0
for v in d.values():
    if "AC" not in v:
        continue
    correct += 1
    cnt += v.index("AC") 

print(correct, cnt)
S = input()

ans = 'WA'

if S[0] == 'A' and S[2:-1].count('C') == 1:
    a = S[2:-1].replace('C','c')
    if a.islower() and S[-1].islower()
        ans='AC'
        
print(ans)
    
    

### FIXED CODE ###



S = input()

ans = 'WA'

if S[0] == 'A' and S[2:-1].count('C') == 1:
    a = S[2:-1].replace('C','c')
    if a.islower() and S[-1].islower() and S[1].islower():
        ans='AC'
        
print(ans)
import math
a,b,c = map(int, input().split())

cc=c**2
aa=a**2
bb=b**2
ab=math.sqrt(2ab)

if cc-aa-bb-ab>0:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

import math
a,b,c = map(int, input().split())
x=a**2+b**2+c**2+2*a*b-2*b*c-2*a*c
y=4*a*b

if c-b-a>0 and x-y>0 :
    print("Yes")
else:
    print("No")
import sys
input = lambda: sys.stdin.readline().rstrip()
from collections import defaultdict
from itertools import accumulate

N, K = map(int, input().split())

sushi = defaultdict(list)

for i in range(N):
    t, d = map(int, input().split())
    sushi[t].append(d)

first = []
second = []
for key in sushi:
    sushi[key].sort(reverse=True)
    first.append(sushi[key][0])
    second += sushi[key][1:]

first.sort(reverse=True)
second.sort(reverse=True)

first_cum = [0] + list(accumulate(first))
second_cum = [0] + list(accumulate(second))


ans = 0
for i in range(1, K+1):
    if K - i <= len(second_cum)-1:
        ans = max(ans, first_cum[i] + second_cum[K-i] + i*i)

print(ans)

### FIXED CODE ###

import sys
input = lambda: sys.stdin.readline().rstrip()
from collections import defaultdict
from itertools import accumulate

N, K = map(int, input().split())

sushi = defaultdict(list)

for i in range(N):
    a,b = map(int, input().split())
    sushi[a].append(b)

first = []
second = []

for nums in sushi.values():
    nums.sort(reverse=True)
    for i, j in enumerate(nums):
        if i == 0:
            first.append(j)
        else:
            second.append(j)
first.sort(reverse=True)
second.sort(reverse=True)

first_cum = [0] + list(accumulate(first))
second_cum = [0] + list(accumulate(second))

ans = 0

for i in range(K, 0, -1):
    neta = min(i, len(first))
    tmp = neta * neta + first_cum[neta]

    if K - neta > len(second):
        break
    
    tmp += second_cum[K - neta]

    ans = max(ans, tmp)

print(ans)
a,b,c = map(int, input().split())
if a+b >= c-1:
  print(b+c)
else:
  print(a+2b+1)


### FIXED CODE ###

a,b,c = map(int, input().split())
if a+b >= c-1:
  print(b+c)
else:
  print(a+2*b+1)
#!/opt/local/bin/python
# coding: UTF-8
num = int(raw_input())
Taro = 0
Hanako = 0
for i in xrange(num):
	animal = raw_input().split()
	if animal[0] > animal[1]:
		Tato += 3
	elif animal[0] < animal[1]:
		Hanako += 3
	else:
		Taro += 1
		Hanako += 1
print Taro,Hanako

### FIXED CODE ###

#!/opt/local/bin/python
# coding: UTF-8
num = int(raw_input())
Taro = 0
Hanako = 0
for i in xrange(num):
	animal = raw_input().split()
	if animal[0] > animal[1]:
		Taro += 3
	elif animal[0] < animal[1]:
		Hanako += 3
	else:
		Taro += 1
		Hanako += 1
print Taro,Hanako
import bisect

n, d, a = map(int, input().split())
xh = []
for i in range(n):
    xh.append(list(map(int, input().split())))
xh.sort()
count = 0
min_x = 0
x = [xh[i][0] for i in range(n)]
sum_h = sum([xh[i][1] for i in range(n)])
while sum_h > 0:
    flag == True
    place = xh[min_x][0] + d
    num = (xh[min_x][1] - 1) // a + 1
    count += num
    for i in range(min_x, bisect.bisect(x, place + d)):
        new_h = max(0, xh[i][1] - a * num)
        sum_h -= (xh[i][1] - new_h)
        if new_h == 0:
            if flag == True:
                min_x += 1
        else:
            flag = False
        xh[i][1] = new_h
print(count)

### FIXED CODE ###

import bisect

n, d, a = map(int, input().split())
xh = []
for i in range(n):
    xh.append(list(map(int, input().split())))
xh.sort()
x = [xh[i][0] for i in range(n)]
h = [xh[i][1] for i in range(n)]
count = 0
min_x = 0
acm = [0] * (n + 1)
dif = [0] * (n + 1)
while min_x < n:
    place = x[min_x] + d
    num = (h[min_x] - acm[min_x + 1] - 1) // a + 1
    count += num
    dif[min_x] += num
    dif[bisect.bisect(x, place + d)] -= num
    for i in range(min_x, bisect.bisect(x, place + d)):
        acm[i + 1] = acm[i] + dif[i] * a
        if acm[i + 1] >= h[i]:
            min_x += 1
            continue
        else:
            break
print(count)
from math import factorial

M, N = map(int, input().split())

def combinations_count(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))

sum_n = combinations_count(M, 2) + combinations_count(N, 2)
print(sum_n)

### FIXED CODE ###


from math import factorial

M, N = map(int, input().split())

def combinations_count(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))

if M > 1 and N > 1:
    sum_n = combinations_count(M, 2) + combinations_count(N, 2)

elif M > 1:
    sum_n = combinations_count(M, 2)

elif N > 1:
    sum_n = combinations_count(N, 2)

else:
    sum_n = 0

print(sum_n)
n, r = int(input())

if n >= 10 :
    ans = r
else :
    ans = r - 100 * (10 - n)


### FIXED CODE ###

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

if n >= 10 :
    ans = r
else :
    ans = r + 100 * (10 - n)

print(ans)
# -*- coding: utf-8 -*-

s = str(input())
n = len(s)

G = 0
P = 0

dic = dict()
for c in s:
	dic[c] = dic.get(c, 0) + 1

if n % 2 == 0:
	ans = n / 2 - dic['p']
else:
	ans = (n - 1) / 2 - dic['p']

print(int(ans))



### FIXED CODE ###

# -*- coding: utf-8 -*-

s = str(input())
n = len(s)

G = s.count('g')
P = s.count('p')

ans = (G - P) // 2

print(ans)
R = float(input)
print(R * 2 * 3.1416)

### FIXED CODE ###

R = int(input())
print(R * 2 * 3.1416)
H, W = map(int, input().split())
data = []
for i in range(H):
  S.append(input())
# 参考https://atcoder.jp/contests/abc075/submissions/5409794
for i in range(H):
  for j in range(W):
    if S[i][j] == ".":
      cnt = 0
      if i != 0:
        cnt += S[i-1][min(0, j-1) : min(j+1, W-1) + 1].count("#")
      cnt += S[i][min(0, j-1) : min(j+1, W-1) + 1].count("#")
      if i != H-1:
        cnt += S[i+1][min(0, j-1) : min(j+1, W-1) + 1].count("#")
      S[i][j] = cnt
for i in range(H):
	print("".join(S[i]))

### FIXED CODE ###

H, W = map(int, input().split())
S = []
for i in range(H):
  S.append(list(i for i in input()))
# 参考https://atcoder.jp/contests/abc075/submissions/5409794
for i in range(H):
  for j in range(W):
    if S[i][j] == ".":
      cnt = 0
      if i != 0:
        cnt += S[i-1][max(0, j-1) : min(j+1, W-1) + 1].count("#")
      cnt += S[i][max(0, j-1) : min(j+1, W-1) + 1].count("#")
      if i != H-1:
        cnt += S[i+1][max(0, j-1) : min(j+1, W-1) + 1].count("#")
      S[i][j] = str(cnt)
for i in range(H):
	print("".join(S[i]))
# -*- coding: utf-8 -*-
"""
Created on Thu Apr  4 14:43:20 2019

@author: fumito
"""

def create_sub(lr,S):
    sub = S[int(lr[0])-1:int(lr[1])]
    list = [i for i in sub]
    return list

def A_index(sub):
    A_index = [i for i,x in enumerate(sub) if x == 'A']
    return A_index

def count(sub,index):
    count = 0
    for i in index:
        if sub[i+1] == 'C':
            count += 1
        else:
            pass
    return count

if __name__ == "__main__":
    N,Q = map(int,input().split())
    S = str(input())
    lr = [input().split() for i in range(Q)]
    
    ans = []
    for i in range(Q):
        Sub = create_sub(lr[i],S)
        Index = A_index(Sub)
        Count = count(Sub,Index)
        ans.append(Count)
    for j in ans:
        print(j)
    a = create_sub([1,4],'ACAAAC')   
    b = A_index(a)


### FIXED CODE ###

N,Q = map(int,input().split())
S = str(input())
l,r = [0]*Q,[0]*Q
for i in range(Q):
    l[i],r[i] = map(int,input().split())
    
count_list = []
count = 0
count_list.append(0)
for i in range(1,N):
    if S[i-1] == "A" and S[i] == "C":
        count += 1
        count_list.append(count)
    else:
        count_list.append(count)
    
for j in range(Q):
    print(count_list[r[j]-1]-count_list[l[j]-1])
# coding: utf-8
import numpy as np

a,b,c = map(long,input().split())

# print(a,b,c)
# if np.sqrt(a)+np.sqrt(b)<np.sqrt(c):
#     print("Yes")
# else:
#     print("No")
if -2*a*b-2*b*c-2*a*c>0:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

# coding: utf-8
import numpy as np

a,b,c = map(int,input().split())

# print(a,b,c)
# if np.sqrt(a)+np.sqrt(b)<np.sqrt(c):
#     print("Yes")
# else:
#     print("No")
d = c-a-b
if d>0 and 4*a*b<d*d :
    print("Yes")
else:
    print("No")
import math
a,b,x = map(int,input().split())
t = math.atan(2*((a**2)*b - x)/(a**3))
deg = math.degree(t)

### FIXED CODE ###

import math
a,b,x = map(int,input().split())
if x == b*(a**2):
  print(0)
elif x >= (a**2)*b/2 and x < b*(a**2):
  t = math.atan(2*((a**2)*b - x)/(a**3))
  deg = math.degrees(t)
  print(deg)

else:
  t = math.atan(a*(b**2)/(2*x))
  deg = math.degrees(t)
  print(deg)
from collections import deque


h, w = map(int, input().split())
hs, ws = set(range(h)), set(range(w))
a = []
d = deque([])
memo = [[None] * w for j in hs]
move = [[1, 0], [0, 1], [-1, 0], [0, -1]]
for i in hs:
    a.append(list(input()))
for i in hs:
    for j in ws:
        if a[i][j] == '#':
            d.append([i, j])
            memo[i][j] = 0


def d_list_update(d, hmax, wmax):
    dh, dw = d.popleft()
    for i, j in move:
        if (0 <= dh + i < hmax) and (0 <= dw + j < wmax) and not(memo[dh + i][dw + j]):
            memo[dh + i][dw + j] = memo[dh][dw] + 1
            d.append([dh + i, dw + j])
    return d


hw = set(range(h*w))
for i in hw:
    d = d_list_update(d, h, w)
ans = max([max(e) for e in memo])
print(ans)

### FIXED CODE ###

from collections import deque
 
 
h, w = map(int, input().split())
hs, ws = set(range(h)), set(range(w))
d = deque()
memo = [[-1] * w for j in hs]
move = [[1, 0], [0, 1], [-1, 0], [0, -1]]
a = tuple(input() for _ in hs)
b = [[i, j] for i in hs for j in ws if a[i][j] == '#']
for i, j in b:
    d.append((i, j))
    memo[i][j] = 0
while d:
    dh, dw = d.popleft()
    for i, j in move:
        dhn, dwn = dh + i, dw + j
        if (0 <= dhn < h) and (0 <= dwn < w) and (memo[dhn][dwn] < 0):
            d.append((dhn, dwn))
            memo[dhn][dwn] = memo[dh][dw] + 1
ans = max([max(e) for e in memo])
print(ans)
n,a = map(int, [input() for i range(2)])
if n%500 <= a:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

n = int(input())
a = int(input())
if n%500 <= a:
  print('Yes')
else:
  print('No')
N, K = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
Z = []
for i in range(1, N):
    Z.append(abs(A[i] - A[i - 1]))
Z.sort()
i = 0
while True:
    if i <= len(A):
        break
    if Z[i] == 0:
        del Z[i]
        i -= 1
    i += 1

    
for i in range(1, len(Z)):
    ans = -1
    if Z[i - 1] % Z[i] != 0:
        ans = 1
    
for i in A:
    if K == i:
        ans = 1
        
if K >= max(A):
    ans = -1
    
if ans == -1:
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")


### FIXED CODE ###

N, K = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
import copy
Z = copy.deepcopy(A)
#for i in range(1, N):
 #   Z.append(abs(A[i] - A[i - 1]))
Z.sort()
i = 0

while True:
    if i >= len(Z):
        break
    if Z[i] == 0:
        del Z[i]
        i -= 1
    elif i > 0 and Z[i] == Z[i - 1]:
        del Z[i]
        i -= 1
    i += 1

ans = -1

import fractions
gcd = Z[0]
for i in range(1, len(Z)):
    gcd = fractions.gcd(gcd, Z[i])

if K % gcd == 0:
    ans = 1
    
if K > max(A):
    ans = -1
       
for i in A:
    if K == i:
        ans = 1
        break

if ans == -1:
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")
s,t=input().split()
a,b=map(int,input(),split()
u=input()
if u==s:
  a-=1
else:
  b-=1
print(a,b)


### FIXED CODE ###

S,T=input().split()
A,B=map(int,input().split())
U=input()
if S==U:
    A-=1
else:
    B-=1
print(A,B)
import numpy as np
 
n, k = map(int, input().split())
arr = list(map(int, input().split())) + [0] * k
 
INF = 1 << 60
 
# dp初期化
dp = [INF] * (n + k)
dp[0] = 0
 
for i in range(n):
    for j in range(1, k + 1):
        dp[i + j] = min(dp[i + j], dp[i] + abs(arr[i + j] - arr[i]))
 
print(dp[n - 1])

### FIXED CODE ###

n, k = map(int, input().split())
arr = list(map(int, input().split()))

# dp初期化
dp = [float("inf")] * n
dp[0] = 0

for i in range(1, n):
    dp[i] = min(dp[j] + abs(arr[i] - arr[j]) for j in range(max(i - k, 0), i))

print(dp[n - 1])
N,M = map(int,input().split())
A = [int(input()) for _ in range(M)]
mod = 1000000007
dp=[0]*(N+1)
dp[0]=1
if A[0]!=1:dp[1]=1 
else:dp[1]=0
    
for i in range(2,N+1):
    if i in A:
        dp[i]=0
    else:
        dp[i] = (dp[i-1]+dp[i-2])%mod

print(dp[-1])

### FIXED CODE ###

mod = 10**9+7
n,m = map(int,input().split())
a = set()
for i in range(m):
  a.add(int(input()))
dp = [0]*(n+1)
dp[0] = 1
for i in range(1,n+1) :
    dp[i] = (dp[i-1] + dp[i-2]) % mod
    if i in a :
        dp[i] = 0
print(dp[n])