Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import bisect
n=int(input())
a=[int(input()) for i in range(n)]
inf=10**6
tmp=[inf]*n
ans=0
for i in range(n-1,-1,-1):
  j= bisect.bisect_right(tmp,a[i])
  tmp[j]=a[i]
for i in range(n):
  if tmp[i]!=inf:
    ans+=1
print(ans)

Fixed submission:
import bisect
n=int(input())
a=[int(input()) for i in range(n)]
inf=10**9+1
tmp=[inf]*n
ans=0
for i in range(n-1,-1,-1):
  j= bisect.bisect_right(tmp,a[i])
  tmp[j]=a[i]
for i in range(n):
  if tmp[i]!=inf:
    ans+=1
print(ans)

Buggy python submission (verdict: Runtime Error):
import bisect
n=int(input())
a=[int(input()) for i in range(n)]
inf=10**6
tmp=[inf]*(n+1)
ans=0
for i in range(n-1,-1,-1):
  j= bisect.bisect_right(tmp,a[i])
  tmp[j]=a[i]
for i in range(n):
  if tmp[i]!=inf:
    ans+=1
print(ans)

Fixed submission:
import bisect
n=int(input())
a=[int(input()) for i in range(n)]
inf=10**9+1
tmp=[inf]*n
ans=0
for i in range(n-1,-1,-1):
  j= bisect.bisect_right(tmp,a[i])
  tmp[j]=a[i]
for i in range(n):
  if tmp[i]!=inf:
    ans+=1
print(ans)

Buggy python submission (verdict: Runtime Error):
import bisect
n=int(input())
a=[int(input()) for i in range(n)]
inf=10**6
tmp=[inf]*(n+1)
ans=0
for i in range(n-1,-1,-1):
  j= bisect.bisect_right(tmp,a[i])
  tmp[j]=a[i]
for i in range(n):
  if tmp[i]!=inf:
    ans+=1
print(ans)



Fixed submission:
import bisect
n=int(input())
a=[int(input()) for i in range(n)]
inf=10**9+1
tmp=[inf]*n
ans=0
for i in range(n-1,-1,-1):
  j= bisect.bisect_right(tmp,a[i])
  tmp[j]=a[i]
for i in range(n):
  if tmp[i]!=inf:
    ans+=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[int(input()) for i in range(n)]
tmp=[-1]*n
ans=0
for i in range(n):
  for j in range(n):
    if tmp[j]<a[i]:
      if tmp[j]==-1:ans+=1
      tmp[j]=a[i]
      break
print(ans)

Fixed submission:
import bisect
n=int(input())
a=[int(input()) for i in range(n)]
inf=10**9+1
tmp=[inf]*n
ans=0
for i in range(n-1,-1,-1):
  j= bisect.bisect_right(tmp,a[i])
  tmp[j]=a[i]
for i in range(n):
  if tmp[i]!=inf:
    ans+=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
l,r=map(int,input().split())
ans=2020
for i in range(l,r):
  for j in range(i+1,r+1):
    ans=min(ans,(i*j)%2019)
    if ans==0:
      break
print(ans)



Fixed submission:
l,r=map(int,input().split())
ans=2020
for i in range(l,r):
  for j in range(i+1,r+1):
    ans=min(ans,(i*j)%2019)
    if ans==0:
      print(ans)
      exit()
print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np
n=int(input())
a=np.array(list(map(int,input().split())))
x=np.zeros((n,n))
for i in range(n):
  x[i][i]=0.5
  if i!=n-1:
    x[i][i+1]=0.5
  else:
    x[i][0]=0.5
#inv_x=np.linalg.inv(x)
#ans=np.dot(inv_x,a)
ans=np.linalg.solve(x,a)
ans=ans.tolist()
ans=list(map(str,map(int,ans)))
print(" ".join(ans))


Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=[0]*n
ans[0]=sum(a[::2])-sum(a[1::2])
for i in range(1,n):
  ans[i]=2*a[i-1]-ans[i-1]
ans=list(map(str,ans))
print(" ".join(ans))

Buggy python submission (verdict: Runtime Error):
import numpy as np
n=int(input())
a=np.array(list(map(int,input().split())))
x=np.zeros((n,n))
for i in range(n):
  x[i][i]=0.5
  if i!=n-1:
    x[i][i+1]=0.5
  else:
    x[i][0]=0.5
inv_x=np.linalg.inv(x)
ans=np.dot(inv_x,a)
ans=ans.tolist()
ans=list(map(str,map(int,ans)))
print(" ".join(ans))


Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=[0]*n
ans[0]=sum(a[::2])-sum(a[1::2])
for i in range(1,n):
  ans[i]=2*a[i-1]-ans[i-1]
ans=list(map(str,ans))
print(" ".join(ans))

Buggy python submission (verdict: Runtime Error):
import numpy as np
n=int(input())
a=np.array(list(map(int,input().split())))
x=np.zeros((n,n))
for i in range(n):
  x[i][i]=0.5
  if i!=n-1:
    x[i][i+1]=0.5
  else:
    x[i][0]=0.5
inv_x=np.linalg.inv(x)
ans=np.dot(a.T,inv_x)
ans=np.insert(ans,0,ans[-1])
ans=np.delete(ans,n)
ans=ans.tolist()
ans=list(map(str,map(int,ans)))
print(" ".join(ans))


Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=[0]*n
ans[0]=sum(a[::2])-sum(a[1::2])
for i in range(1,n):
  ans[i]=2*a[i-1]-ans[i-1]
ans=list(map(str,ans))
print(" ".join(ans))
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**5)
nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]
n,k=map(int,input().split())
ans=[0]*k
for i in range(k):
  ans = cmb(n-k+1,i+1)*cmb(k-1,i)
  print(ans%(10**9+7))

Fixed submission:
import sys
sys.setrecursionlimit(10**5)
nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    r=min(r,n-r)
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]
n,k=map(int,input().split())
ans=[0]*k

for i in range(k):
  if n-k<i:
    print(0)
    continue
  ans = cmb(n-k+1,i+1)*cmb(k-1,i)
  print(ans%(10**9+7))

Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(3000)
nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]
n,k=map(int,input().split())
ans=[0]*k
for i in range(k):
  ans = cmb(n-k+1,i+1)*cmb(k-1,i)
  print(ans%(10**9+7))

Fixed submission:
import sys
sys.setrecursionlimit(10**5)
nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    r=min(r,n-r)
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]
n,k=map(int,input().split())
ans=[0]*k

for i in range(k):
  if n-k<i:
    print(0)
    continue
  ans = cmb(n-k+1,i+1)*cmb(k-1,i)
  print(ans%(10**9+7))
Buggy python submission (verdict: Time Limit Exceeded):
def func(n):
  if n==1:return 1
  if n==0:return 1
  if dp[n]!=-1:return dp[n]
  f1=func(n-1) if n-1 not in a else 0
  f2=func(n-2) if n-2 not in a else 0
  tmp=(f1+f2)%1000000007
  dp[n]=tmp
  return tmp
import sys
sys.setrecursionlimit(1000000)
n,m=map(int,input().split())
a=[int(input()) for i in range(m)]
dp=[-1]*(n+1)
print(func(n)%1000000007)

Fixed submission:
def func(n):
  if n==1:return 1
  if n==0:return 1
  if dp[n]!=-1:return dp[n]
  f1=func(n-1) if n-1 not in a else 0
  f2=func(n-2) if n-2 not in a else 0
  tmp=(f1+f2)%1000000007
  dp[n]=tmp
  return tmp
import sys
sys.setrecursionlimit(1000000)
n,m=map(int,input().split())
a={int(input()) for i in range(m)}
dp=[-1]*(n+1)
print(func(n)%1000000007)

Buggy python submission (verdict: Runtime Error):
def func(n):
  if n==1:return 1
  if n==0:return 1
  if dp[n]!=-1:return dp[n]
  f1=func(n-1) if n-1 not in a else 0
  f2=func(n-2) if n-2 not in a else 0
  tmp=(f1+f2)%1000000007
  dp[n]=tmp
  return tmp
import sys
sys.setrecursionlimit(1002)
n,m=map(int,input().split())
a=[int(input()) for i in range(m)]
dp=[-1]*(n+1)
print(func(n)%1000000007)

Fixed submission:
def func(n):
  if n==1:return 1
  if n==0:return 1
  if dp[n]!=-1:return dp[n]
  f1=func(n-1) if n-1 not in a else 0
  f2=func(n-2) if n-2 not in a else 0
  tmp=(f1+f2)%1000000007
  dp[n]=tmp
  return tmp
import sys
sys.setrecursionlimit(1000000)
n,m=map(int,input().split())
a={int(input()) for i in range(m)}
dp=[-1]*(n+1)
print(func(n)%1000000007)

Buggy python submission (verdict: Runtime Error):
def func(n):
  if n==1:return 1
  if n==0:return 1
  if dp[n]!=-1:return dp[n]
  f1=func(n-1) if n-1 not in a else 0
  f2=func(n-2) if n-2 not in a else 0
  dp[n]=f1+f2
  return f1+f2

n,m=map(int,input().split())
a=[int(input()) for i in range(m)]
dp=[-1]*(n+1)
print(func(n)%1000000007)

Fixed submission:
def func(n):
  if n==1:return 1
  if n==0:return 1
  if dp[n]!=-1:return dp[n]
  f1=func(n-1) if n-1 not in a else 0
  f2=func(n-2) if n-2 not in a else 0
  tmp=(f1+f2)%1000000007
  dp[n]=tmp
  return tmp
import sys
sys.setrecursionlimit(1000000)
n,m=map(int,input().split())
a={int(input()) for i in range(m)}
dp=[-1]*(n+1)
print(func(n)%1000000007)
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=list(input())
s[k]=s[k].lower()
s="".join(s)
print(s)

Fixed submission:
n,k=map(int,input().split())
s=list(input())
s[k-1]=s[k-1].lower()
s="".join(s)
print(s)

Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=list(input())
s[k]=s[k].lower()
for i in range(len(s)):
  print(s[i],end="")
print("\n")

Fixed submission:
n,k=map(int,input().split())
s=list(input())
s[k-1]=s[k-1].lower()
s="".join(s)
print(s)

Buggy python submission (verdict: Runtime Error):
import numpy as np
n,k=map(int,input().split())
s=list(input())
s[k]=s[k].lower()
for i in range(len(s)):
  print(s[i],end="")
#print()

Fixed submission:
n,k=map(int,input().split())
s=list(input())
s[k-1]=s[k-1].lower()
s="".join(s)
print(s)

Buggy python submission (verdict: Runtime Error):
import numpy as np
n,k=map(int,input().split())
s=list(input())
s[k]=s[k].lower()
for i in range(len(s)):
  print(s[i],end="")
print("")

Fixed submission:
n,k=map(int,input().split())
s=list(input())
s[k-1]=s[k-1].lower()
s="".join(s)
print(s)
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=list(input())
k=int(input())
tmp=s[k]
for i in range(n):
  print(s[i],end="") if s[i]==tmp else print("*",end="")
print("")

Fixed submission:
n=int(input())
s=list(input())
k=int(input())
tmp=s[k-1]
for i in range(n):
  print(s[i],end="") if s[i]==tmp else print("*",end="")
print("")
Buggy python submission (verdict: Runtime Error):
n=int(input())
s_o=input()
s_dot=[len(x) for x in s_o.replace("#"," ").split()]
s_sharp=[len(x) for x in s_o.replace("."," ").split()]
if s_o[0]==".":
  s_dot=s_dot[1:]
if s_o[-1]=="#":
  s_sharp[:-1]
if len(s_dot)==0 or len(s_sharp)==0:
  print(0)
  exit()
sum_sharp=[0]*len(s_sharp)
sum_dot=[0]*len(s_dot)
for i in range(len(sum_sharp)):
  if i==0:
    sum_sharp[i]=s_sharp[i]
  else:
    sum_sharp[i]=sum_sharp[i-1]+s_sharp[i]

for i in reversed(range(len(sum_dot))):
  if i==len(sum_dot)-1:
    sum_dot[i]=s_dot[i]
  else:
    sum_dot[i]=sum_dot[i+1]+s_dot[i]
ans=[1000000]*len(sum_sharp)
for i in range(len(sum_sharp)):
  ans[i]=sum_sharp[i]+sum_dot[-i-1]
print(min(ans))

Fixed submission:
n=int(input())
s_o=input()
s_dot=[len(x) for x in s_o.replace("#"," ").split()]
s_sharp=[len(x) for x in s_o.replace("."," ").split()]
if s_o[0]==".":
  s_dot=s_dot[1:]
if s_o[-1]=="#":
  s_sharp=s_sharp[:-1]
length=len(s_dot)+1
if len(s_dot)==0 or len(s_sharp)==0:
  print(0)
  exit()
sum_sharp=[0]*length
sum_dot=[0]*length
for i in range(length):
  if i==0:
    sum_sharp[i]=0
  else:
    sum_sharp[i]=sum_sharp[i-1]+s_sharp[i-1]

for i in reversed(range(length)):
  if i==length-1:
    sum_dot[i]=0
  else:
    sum_dot[i]=sum_dot[i+1]+s_dot[i]
ans=[1000000]*(length)
for i in range(length):
  ans[i]=sum_sharp[i]+sum_dot[i]
print(min(ans))
Buggy python submission (verdict: Runtime Error):
n,q=map(int,input().split())
s=list(input())
stage=[1]*n
for i in range(q):
  v = input().split()
  for j in range(n):
    if s[j]==v[0]:
      if v[1]=="L":
        if j!=0:
          stage[j-1]+=stage[j]
        stage[j]=0
      else:
        if j!=n-1:
          stage[j+1]+=stage[j]
        stage[j]=0
print(sum(stage))

Fixed submission:
a,b,c=map(int,input().split())
if a==b and b==c:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
n=int(input())
b=list(map(int,input().split()))
s_b=sorted(list(set(b)),reverse=True)
ans=[]
for itr in range(n):
  for j in s_b:
    try:
      if len(b)>=j:
        if b[j-1]==j:
          b.pop(j-1)
          ans.append(j)
          break
    except:
      print("error")
    if j==1:
      print(-1)
      exit()
ans.reverse()
for i in range(n):
  print(ans[i])


Fixed submission:
n=int(input())
b=list(map(int,input().split()))
s_b=sorted(list(set(b)),reverse=True)
if 1 not in s_b:
  print(-1)
  exit()
ans=[]
for itr in range(n):
  for j in s_b:
    if len(b)>=j:
      if b[j-1]==j:
        b.pop(j-1)
        ans.append(j)
        break
    if j==1:
      print(-1)
      exit()
ans.reverse()
for i in range(n):
  print(ans[i])

Buggy python submission (verdict: Runtime Error):
n=int(input())
b=list(map(int,input().split()))
s_b=sorted(list(set(b)),reverse=True)
ans=[]
for itr in range(n):
  for j in s_b:
    if len(b)>=j:
      if b[j-1]==j:
        b.pop(j-1)
        ans.append(j)
        break
    if j==1:
      print(-1)
      exit()
ans.reverse()
for i in range(n):
  print(ans[i])


Fixed submission:
n=int(input())
b=list(map(int,input().split()))
s_b=sorted(list(set(b)),reverse=True)
if 1 not in s_b:
  print(-1)
  exit()
ans=[]
for itr in range(n):
  for j in s_b:
    if len(b)>=j:
      if b[j-1]==j:
        b.pop(j-1)
        ans.append(j)
        break
    if j==1:
      print(-1)
      exit()
ans.reverse()
for i in range(n):
  print(ans[i])

Buggy python submission (verdict: Runtime Error):
n=int(input())
b=list(map(int,input().split()))
s_b=sorted(list(set(b)),reverse=True)
ans=[]
for itr in range(n):
  for j in s_b:
    if len(b)>=j:
      if b[j-1]==j:
        b=b[:j-1]+b[j:]
        ans.append(j)
        break
    if j==1:
      print(-1)
      exit()
ans.reverse()
for i in range(n):
  print(ans[i])


Fixed submission:
n=int(input())
b=list(map(int,input().split()))
s_b=sorted(list(set(b)),reverse=True)
if 1 not in s_b:
  print(-1)
  exit()
ans=[]
for itr in range(n):
  for j in s_b:
    if len(b)>=j:
      if b[j-1]==j:
        b.pop(j-1)
        ans.append(j)
        break
    if j==1:
      print(-1)
      exit()
ans.reverse()
for i in range(n):
  print(ans[i])

Buggy python submission (verdict: Runtime Error):
n=int(input())
b=list(map(int,input().split()))
s_b=sorted(list(set(b)),reverse=True)
ans=[]
for itr in range(n):
  for j in s_b:
    if len(b)>=j:
      if b[j-1]==j:
        b=b[:j-1]+b[j:]
        ans.append(j)
        break
    if j==1:
      print(-1)
      exit()
for i in range(n):
  print(ans[i])


Fixed submission:
n=int(input())
b=list(map(int,input().split()))
s_b=sorted(list(set(b)),reverse=True)
if 1 not in s_b:
  print(-1)
  exit()
ans=[]
for itr in range(n):
  for j in s_b:
    if len(b)>=j:
      if b[j-1]==j:
        b.pop(j-1)
        ans.append(j)
        break
    if j==1:
      print(-1)
      exit()
ans.reverse()
for i in range(n):
  print(ans[i])
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
data=sorted([tuple(map(int,input().split())) for i in range(n)])
ans=0
while True:
  if m == 0:
    print(ans)
    exit()
  elif data[0][1]<=m:
    ans+=data[0][0]*data[0][1]
    m-=data[0][1]
    data=data[1:]
  else:
    ans+=data[0][0]*m
    m=0

Fixed submission:
n,m=map(int,input().split())
dataset=sorted([tuple(map(int,input().split())) for i in range(n)])
ans=0
for data in dataset:
  if m==0:
    print(ans)
    exit()
  tmp=min(data[1],m)
  ans+=tmp*data[0]
  m-=tmp
print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
ans=0

def f(li):
  global ans
  
  #終了条件
  if li==[]:
    del li
    return
  
  #再帰
  min_num=min(li)
  if min(li)>0:
    count+=min(li)
    li=list(map(lambda x: x-min(li), li))
  li=[li[:li.index(0)],li[li.index(0)+1:]]
  f(li[0])
  f(li[1])

f(h)
print(count)

Fixed submission:
S =list(map(int, input().split()))
print(int(S[0]*S[1]/2))
Buggy python submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
ans=0

def f(li):
  global ans
  
  #終了条件
  if li==[]:
    del li
    return
  
  #再帰
  min_num=min(li)
  if min(li)>0:
    count+=min(li)
    li=list(map(lambda x: x-min(li), li))
  li=[li[:li.index(0)],li[li.index(0)+1:]]
  f(li[0])
  f(li[1])

f(h)
print(count)

Fixed submission:
n=int(input())
h=list(map(int,input().split()))
ans=0

def f(li):
  global ans
  
  #終了条件
  if li==[]:
    del li
    return
  
  #再帰
  min_num=min(li)
  if min(li)>0:
    ans+=min(li)
    li=list(map(lambda x: x-min(li), li))
  li=[li[:li.index(0)],li[li.index(0)+1:]]
  f(li[0])
  f(li[1])

f(h)
print(ans)
Buggy python submission (verdict: Runtime Error):
def f(k):
  if k==0:return 0
  if k<0: return 100000
  if dp[k]!=-1:return dp[k]
  f1=f(k-1)+abs(h[k]-h[k-1])
  f2=f(k-2)+abs(h[k]-h[k-2])
  dp[k]=min(f1,f2)
  return dp[k]
n=int(input())
h=list(map(int,input().split()))
dp=[-1]*n
print(f(n-1))


Fixed submission:
import sys
sys.setrecursionlimit(1000000)
def f(k):
  if k==0:return 0
  if k<0: return 100000
  if dp[k]!=-1:return dp[k]
  f1=f(k-1)+abs(h[k]-h[k-1])
  f2=f(k-2)+abs(h[k]-h[k-2])
  dp[k]=min(f1,f2)
  return dp[k]
n=int(input())
h=list(map(int,input().split()))
dp=[-1]*n
print(f(n-1))
Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict,deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp():
    '''
    一つの整数
    '''
    return int(input())
def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))

n, m = inpl()
v = [[] for _ in range(n)]
for i in range(m):
    a, b = inpl()
    v[a - 1].append(b - 1)
'''
v[0]=[1,2]
v[1]=[3]
v[2]=[1,3]
'''

from functools import lru_cache
@lru_cache(maxsize=None)
def dp(x):
    r = 0
    for i in v[x]:
        r = max(r, dp(i) + 1)
    return r

res = max([dp(i) for i in range(n)])
print(res)

Fixed submission:
'''
N頂点M辺の有向グラフGの有向パスのうち最長のものを求めよ。
terms:
    2<=N<=10**5
    1<=M<=10**5
    (x_i,y_i)はすべて相異なる
    Gは有向閉路を含まない

input:
    4 5
    1 2
    1 3
    3 2
    2 4
    3 4
output:
    3
'''


from collections import defaultdict,deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp():
    '''
    一つの整数
    '''
    return int(input())
def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))

n, m = inpl()
v = [[] for _ in range(n)]
for i in range(m):
    a, b = inpl()
    v[a - 1].append(b - 1)
'''
v[0]=[1,2]
v[1]=[3]
v[2]=[1,3]
'''

from functools import lru_cache
@lru_cache(maxsize=None)
def dp(x):
    r = 0
    for i in v[x]:
        r = max(r, dp(i) + 1)
    return r

res = max([dp(i) for i in range(n)])
print(res)
Buggy python submission (verdict: Runtime Error):
n=input()
while True:
  if n%4==0:
    print("YES")
    break
  n-=7
  if n<0:
    print("NO")
    break

Fixed submission:
n=int(input())
while True:
  if n%4==0:
    print("Yes")
    break
  n-=7
  if n<0:
    print("No")
    break

Buggy python submission (verdict: Runtime Error):
n=input()
while True:
  if n%4==0:
    print("YES")
    exit()
  n-=7
  if n<0:
    print("NO")
    exit()

Fixed submission:
n=int(input())
while True:
  if n%4==0:
    print("Yes")
    break
  n-=7
  if n<0:
    print("No")
    break
Buggy python submission (verdict: Runtime Error):
s=list(input())
t=list(input())
for i in range(len(s)):
  if s==t:
    print("Yes")
    exit()
  s=s[1:].append(s[0])
print("No")


Fixed submission:
s=list(input())
t=list(input())
for i in range(len(s)):
  if s==t:
    print("Yes")
    exit()
  s.append(s[0])
  s=s[1:]
print("No")

Buggy python submission (verdict: Runtime Error):
s=input()
t=input()
if s.sort() == t.sort():
  print("Yes")
else:
  print("No")


Fixed submission:
s=list(input())
t=list(input())
for i in range(len(s)):
  if s==t:
    print("Yes")
    exit()
  s.append(s[0])
  s=s[1:]
print("No")
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
print(abs(max(a)-min(a))

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
print(abs(max(a)-min(a)))

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
print(abs(a.max()-a.min())

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
print(abs(max(a)-min(a)))
Buggy python submission (verdict: Runtime Error):
n,m,x=map(int,input().split())
a=list(map(int,input().split()))
print(min(len([i for i in a if i<x]),len([j for j in a if i>x])))

Fixed submission:
n,m,x=map(int,input().split())
a=list(map(int,input().split()))
print(min(len([i for i in a if i<x]),len([j for j in a if j>x])))
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[map(int,input().split())]
a.sort(reverse=True)
print(sum(a[::2]-a[1::2])

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
print(sum(a[::2])-sum(a[1::2]))
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input())
print("Odd") if (a*b)%2==1 else print("Even")

Fixed submission:
a,b=map(int,input().split())
print("Odd") if (a*b)%2==1 else print("Even")
Buggy python submission (verdict: Runtime Error):
h,w=map(int,input().split())
s=[list(input().replace(".","0")) for i in range(h)]
for i in range(h):
  for j in range(w):
    if s[i][j]=="#":
      for k in range(-1,2):
        for l in range(-1,2):
          if 0<=i+k<=h and 0<=j+l<=w and s[i+k][j+l]!="#":
            s[i+k][j+l]=str(int(s[i+k][j+l])+1)
for i in range(h):
  for j in range(w):
    print(s[i][j], end="")
  print()

Fixed submission:
h,w=map(int,input().split())
s=[list(input().replace(".","0")) for i in range(h)]
for i in range(h):
  for j in range(w):
    if s[i][j]=="#":
      for k in range(-1,2):
        for l in range(-1,2):
          if 0<=i+k<h and 0<=j+l<w and s[i+k][j+l]!="#":
              s[i+k][j+l]=str(int(s[i+k][j+l])+1)
for i in range(h):
  for j in range(w):
    print(s[i][j], end="")
  print()
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
t = 0
mod = 10**9+7
for i in range(n):
    t += a[i]*sum(a[i+1:])
print(t%mod)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
t = 0
r = 0
mod = 10**9+7
for i in range(n-1, 0, -1):
    r += a[i]
    t += a[i-1]*r
print(t%mod)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
t = 0
for i in range(len(a)):
    for j in range(i+1, len(a)):
        t += a[i]*a[j]
print(t%(10**9+7))

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
t = 0
r = 0
mod = 10**9+7
for i in range(n-1, 0, -1):
    r += a[i]
    t += a[i-1]*r
print(t%mod)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
t = 0
L = []
for e in a:
    L.append(e%(10**9+7))


for i in range(len(a)):
    for j in range(i, len(a)):
        if i != j:
          t += L[i]*L[j]

print(t%(10**9+7))

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
t = 0
r = 0
mod = 10**9+7
for i in range(n-1, 0, -1):
    r += a[i]
    t += a[i-1]*r
print(t%mod)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
t = 0
for i in range(len(a)):
    for j in range(i, len(a)):
        if i != j:
          t += a[i]*a[j]

ans = t%(10**9+7)
print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
t = 0
r = 0
mod = 10**9+7
for i in range(n-1, 0, -1):
    r += a[i]
    t += a[i-1]*r
print(t%mod)
Buggy python submission (verdict: Runtime Error):
import collections
h, w, m = map(int, input().split())
L_g = []
L_r = []
L = []
for i in range(m):
    a, b = map(int, input().split())
    L_g.append(a)
    L_r.append(b)
    L.append((a, b))
c1 = collections.Counter(L_g)
c2 = collections.Counter(L_r)

L1 = c1.most_common()
L2 = c2.most_common()

s = L1[0][1]
bL1 = []
d = 0
for i in range(len(L1)):
    if L1[i][1] == s:
        bL1.append(L1[i])
        d += 1
        if d == 3:
          break
    else:
        break
s = L2[0][1]
bL2 = []
d = 0
for i in range(len(L2)):
    if L2[i][1] == s:
        bL2.append(L2[i])
        d += 1
        if d == 3:
          break
    else:
        break
bL = []
for i in range(len(bL1)):
    for j in range(len(bL2)):
        bL.append((bL1[i][0], bL2[j][0]))
flag = 0
for e in bL:
    if e not in L:
        bom = e
        flag = 1
        break
if flag == 0:
    bom = bL[0]

t = L1[0][1]+L2[0][1]

if flag == 0:
        t -= 1
print(t)

Fixed submission:
n,x,t = map(int, input().split())
if n%x == 0:
  print((n//x)*t)
else:
  print((n//x + 1)*t)