Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n=int(input())
l=[]
for i in range(n):
  l.append(list(map(int,input().split())))
dp=[[0,0,0] for i in range(n)]
dp[0]=l[0]
def dp1(x):
  if dp[x]!=[0,0,0]:
    return dp[x]
  else:
    dp2=dp1(x-1)
    ansa=l[x][0]+max(dp2[1],dp2[2])
    ansb=l[x][1]+max(dp2[0],dp2[2])
    ansc=l[x][2]+max(dp2[1],dp2[1])
    dp[x]=[ansa,ansb,ansc]
    return dp[x]
print(dp1(n-1))

Fixed submission:
import sys
sys.setrecursionlimit(10**8)
n=int(input())
l=[]
for i in range(n):
  l.append(list(map(int,input().split())))
dp=[[0,0,0] for i in range(n)]
dp[0]=l[0]
def dp1(x):
  if dp[x]!=[0,0,0]:
    return dp[x]
  else:
    dp2=dp1(x-1)
    ansa=l[x][0]+max(dp2[1],dp2[2])
    ansb=l[x][1]+max(dp2[0],dp2[2])
    ansc=l[x][2]+max(dp2[1],dp2[0])
    dp[x]=[ansa,ansb,ansc]
    return dp[x]
print(max(dp1(n-1)))
Buggy python submission (verdict: Runtime Error):
n,x=map(int,input().split())
plist=[1]
blist=[1]
for i in range(n):
  plist.append(plist[-1]*2+1)
  blist.append(blist[-1]*2+3)
def patty(n,x):
  if n==0:
    return 0
  else:
    if x==1:
      return 0
    elif 1<x and x<=blist[n-1]+1:
      return patty(n-1,x-1)
    elif x==blist[n-1]+2:
      return plist[n-1]+1
    elif 2+blist[n-1]<x and 2*blist[n-1]+2>=x:
      return plist[n-1]+patty(n-1,x-2-blist[n-1])+1
    else:
      return plist[n]
print(patty(n,x))

Fixed submission:
i=int(input())
if i==25:
 print("Christmas")
elif i==24:
 print("Christmas Eve")
elif i==23:
 print("Christmas Eve Eve")
else:
 print("Christmas Eve Eve Eve")
Buggy python submission (verdict: Runtime Error):
n=int(input())
l=[]
p=0
for I in range(1,n+1):
 l.append(int(input())
l.sort()
for I in l:
 p+=I
print(p+max(l))

Fixed submission:
n=int(input())
l=[]
s=0
for i in range(1,n+1):
 l.append(int(input()))
l.sort()
for i in l:
 s+=i
print(int(s-0.5*max(l)))
Buggy python submission (verdict: Runtime Error):
from collections import deque
n=int(input())
num=0
l=["3","5","7"]
q=deque(["3","5","7"])
count=0
while q:
  a=q.popleft()
  for i in l:
    if int(i+a)<n:
    count+=1
    q.append(i+a)
print(count)

Fixed submission:
from collections import deque
n=int(input())
l=["3","5","7"]
q=deque(["3","5","7"])
l1=["3","5","7"]
count=0
while q:
  a=q.popleft()
  for i in l:
    if int(i+a)<=n:
      q.append(i+a)
      l1.append(i+a)
for i in l1:
  if ("3" in i) and ("5" in i) and ("7" in i):
    count+=1
print(count)

Buggy python submission (verdict: Runtime Error):
n1=int(input())
l1=len(str(n1))
count=0
def count1(n):
  l=len(str(n))-1
  l2=int(str(n)[0])
  if int(str(n)[0])>=8:
    return 3*(3**l+3-3*(2**l))
  elif int(str(n)[0])==7:
    return count(n-7*(10**(l-1)))+2*(3**l+3-3*(2**l))
  elif l2==6:
    return 2*(3**l+3-3*(2**l))
  elif l2==5:
    return count(n-5*(10**(l-1)))+(3**l+3-3*(2**l))
  elif l2==4:
    return (3**l+3-3*(2**l))
  elif l2==3:
    return count(n-3*(10**(l-1)))
  else:
    return 0
    
    
if l1<3:
  print(0)
else:
  if l1>=4:
    for i in range(3,l1):
      c+=3**i+3-3*(2**i)
  print(c+count1(n1))
  

Fixed submission:
from collections import deque
n=int(input())
l=["3","5","7"]
q=deque(["3","5","7"])
l1=["3","5","7"]
count=0
while q:
  a=q.popleft()
  for i in l:
    if int(i+a)<=n:
      q.append(i+a)
      l1.append(i+a)
for i in l1:
  if ("3" in i) and ("5" in i) and ("7" in i):
    count+=1
print(count)
Buggy python submission (verdict: Runtime Error):
n=int(input())
count=1
index=1
while count<n:
  index+=1
  count+=index
if count!=n:
  print("No")
else:
  print("Yes")
  print(index+1)
  l=[]
  now=1
  num=1
  while now<n:
    l.append(now)
    now+=num
    num+=1
  for i in range(index):
    l1=[str(index)]
    l1.append(str(l[i]))
    num=l[i]
    count1=0
    while count1<i:
      num+=1
      count1+=1
      l1.append(str(num))
    for j in range(1+i,index):
      num+=j
      l1.append(str(num))
    print(" ".join(l1))
  l1=[str(index),str(l[0])]
  num=0
  for j in range(2,index+1):
    num+=j
    l1.append(str(l[0]+num))
  print(" ".join(l1))

Fixed submission:
n=int(input())
count=1
index=1
while count<n:
  index+=1
  count+=index
if count!=n:
  print("No")
elif n==1:
  print("Yes")
  print(2)
  print("1 1")
  print("1 1")
else:
  print("Yes")
  print(index+1)
  l=[]
  now=1
  num=1
  while now<n:
    l.append(now)
    now+=num
    num+=1
  for i in range(index):
    l1=[str(index)]
    l1.append(str(l[i]))
    num=l[i]
    count1=0
    while count1<i:
      num+=1
      count1+=1
      l1.append(str(num))
    for j in range(1+i,index):
      num+=j
      l1.append(str(num))
    print(" ".join(l1))
  l1=[str(index),str(l[0])]
  num=0
  for j in range(2,index+1):
    num+=j
    l1.append(str(l[0]+num))
  print(" ".join(l1))
Buggy python submission (verdict: Runtime Error):
def make_divisors(n,m):
    divisors = []
    i=1
    while i*i<m:
      if m % i == 0:
          divisors.append(i)
          if i != m // i and m//i<=m//n:
              divisors.append(m//i)
      i+=1
    return divisors
n,m=map(int,input().split())
print(max(make_divisors(n,m)))


Fixed submission:
i=input()
if i=="2":
  n=int(input())
  m=int(input())
  print(n+m)
else:
  print("Hello World")

Buggy python submission (verdict: Runtime Error):
def make_divisors(n,m):
    divisors = []
    for i in range(1, (m//n)+1):
        if m % i == 0:
            divisors.append(i)
            if i != m // i and m//i<=m//n:
                divisors.append(m//i)
    return divisors
n,m=map(int,input().split())
print(max(make_divisors(n,m)))


Fixed submission:
i=input()
if i=="2":
  n=int(input())
  m=int(input())
  print(n+m)
else:
  print("Hello World")
Buggy python submission (verdict: Runtime Error):
n,t=map(int,input().split())
l=[]
m=[]
for i in range(1,n+1):
  p,q=map(int,input().split())
  if q<=t:
    l[i]=p
    m[i]=q
  else:
    pass
if len(l)==0:
  print("TLE")
else:
  print(min(l))
  


Fixed submission:
n,t=map(int,input().split())
l=[]
for i in range(1,n+1):
  p,q=map(int,input().split())
  if q<=t:
    l.append(p)
  else:
    pass
if len(l)==0:
  print("TLE")
else:
  print(min(l))

Buggy python submission (verdict: Runtime Error):
n,t=map(int,input().split())
l=[]
m=[]
for i in range(1,n+1):
  p,q=map(int,input().split())
  if q<=t:
    l[i]=p
    m[i]=q
  else:
    pass
if l==[]:
  print("TLE")
else:
  print(min(l))
  

Fixed submission:
n,t=map(int,input().split())
l=[]
for i in range(1,n+1):
  p,q=map(int,input().split())
  if q<=t:
    l.append(p)
  else:
    pass
if len(l)==0:
  print("TLE")
else:
  print(min(l))
Buggy python submission (verdict: Runtime Error):
n=int(input())
l=[]
for i in range(n):
  l.append(reversed(list(map(int,input().split()))))
l=sorted(l)
for i in range(101):
  for j in range(101):
    b=True
    h=abs(i-l[-1][2])+abs(j-l[-1][1])+l[-1][0]
    for i in range(n-1):
      if max(h-abs(i-l[-2-i][2])-abs(j-l[-2-i][1]),0)!=l[-2-i][0]:
        b=False
    if b:
      print(i,j,h)
      break
      
    
           

Fixed submission:
n=int(input())
l=[]
l1=[]
for i in range(n):
  l1=list(map(int,input().split()))
  l1=l1[::-1]
  l.append(l1)      
l=sorted(l)
for i in range(101):
  for j in range(101):
    b=True
    h=abs(i-l[-1][2])+abs(j-l[-1][1])+l[-1][0]
    for k in range(n-1):
      if max(h-abs(i-l[-2-k][2])-abs(j-l[-2-k][1]),0)!=l[-2-k][0]:
        b=False
    if b:
      print(i,j,h)
      break
Buggy python submission (verdict: Runtime Error):
k=int(input())
l=[]
p=[]
for i in range(1,10):
  l.append(111*i)
for i in l:
  if i-k>=0:
    p.aapend(i)
print(min(p))  
  
  

Fixed submission:
k=int(input())
l=[]
p=[]
for i in range(1,10):
  l.append(111*i)
for i in l:
  if i-k>=0:
    p.append(i)
print(min(p))
Buggy python submission (verdict: Runtime Error):
i=int(input())
l=[]
c=True
for k in range(1,i+1):
  l.append(list(input())
if len(l)==len(set(l)):
  for k in range(0,i):
    if l[k][-1]!=l[k+1][0]:
       c=False
       break
else:
  c=False
if c==False:
  print("No")
else:
  print("Yes")
           
  


Fixed submission:
a,s=map(int,input().split())
if a*s%2==0:
  print("No")
else:
  print("Yes")
Buggy python submission (verdict: Runtime Error):
n=int(input())
l=[list(input())]
b=True
for i in range(n-1):
  w=list(input())
  if l[-1][-1]==w[0]:
    l.append(w)
  else:
    b=False
    break
if len(set(l))==n and b==True:
  print("Yes")
else:
  print("No")
  

  


Fixed submission:
n=int(input())
b=True
l=[]
w=input()
l.append(w)
for i in range(n-1):
  w=input()
  if w in l or w[0]!=l[-1][-1]:
    b=False
    break
  else:
    l.append(w)
if b:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
n=int(input())
l=[list(input())]
b=True
for i in range(n-1):
  w=list(input())
  if l[-1][-1]==w[0]:
    l.append(w)
  else:
    b=False
    break
if len(set(l))=n and b==True:
  print("Yes")
else:
  print("No")
  

  

Fixed submission:
n=int(input())
b=True
l=[]
w=input()
l.append(w)
for i in range(n-1):
  w=input()
  if w in l or w[0]!=l[-1][-1]:
    b=False
    break
  else:
    l.append(w)
if b:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
i=int(input())
l=[]
c=True
for k in range(1,i+1):
  l.append(list(input())
if len(l)==len(set(l)):
  for k in range(0,i):
    if l[k][-1]!=l[k+1][0]:
       c=False
       break
else:
  c=False
if c==False:
  print("No")
else:
  print("Yes")
           
  


Fixed submission:
n=int(input())
b=True
l=[]
w=input()
l.append(w)
for i in range(n-1):
  w=input()
  if w in l or w[0]!=l[-1][-1]:
    b=False
    break
  else:
    l.append(w)
if b:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
i=int(input())
l=[]
c=True
for k in range(1,i+1):
  l.append(list(input())
if len(l)==set(l):
  for k in range(0,i):
    if l[k][-1]!=l[k+1][0]:
       c=False
       break
else:
  c=False
if c==False:
  print("No")
else:
  print("Yes")
           
  

Fixed submission:
n=int(input())
b=True
l=[]
w=input()
l.append(w)
for i in range(n-1):
  w=input()
  if w in l or w[0]!=l[-1][-1]:
    b=False
    break
  else:
    l.append(w)
if b:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
n,x=map(int,input().split())
l=list(map(int,input().split()))
def gcd(n,m):
  a=max(n,m)
  b=min(n,m)
  while b!=0:
    a,b=b,a%b
  return a
a=abs(l[0]-x)
for i in range(l):
  a=gcd(a,abs(l[i]-x))
print(a)

Fixed submission:
n,x=map(int,input().split())
l=list(map(int,input().split()))
def gcd(n,m):
  a=max(n,m)
  b=min(n,m)
  while b!=0:
    a,b=b,a%b
  return a
a=abs(l[0]-x)
for i in range(n):
  a=gcd(a,abs(l[i]-x))
print(a)
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
l=list(map(int,input().split()))
l1=[]
for i in range(n-m+1):
  if l[i]>=0:
    l1.append(l[i+m]-l[i])
  elif l[i]<=0<=l[i+m]:
    l1.append(l[i+m]-l[i]+min(l[i],l[i+m]))
  else:
    l1.append(l[i+m]-l[i])
print(min(l1))    

Fixed submission:
n,m=map(int,input().split())
l=list(map(int,input().split()))
l1=[]
for i in range(n-m+1):
  if l[i]>=0:
    l1.append(l[i+m-1])
  elif l[i]<=0<=l[i+m-1]:
    l1.append(l[i+m-1]-l[i]+min(abs(l[i]),abs(l[i+m-1])))
  else:
    l1.append(abs(l[i]))
print(min(l1))
Buggy python submission (verdict: Runtime Error):
n=int(input())
l=0
for i in range(1,n+1):
  if i%2==1:    
    p=0
    for k in range(1,i+1):
      if i%k==0:
        p+=1
    if p==8:
      l+=1
print(l)


Fixed submission:
a,b=map(int,input().split())
print(a*b-a-b+1)
Buggy python submission (verdict: Runtime Error):
n=list(input())
m=int(input())
i=0
for t in range(len(n)):
  if n[t]!="1":
    i=t+1
    break
if m<i:
  print(1)
else:
  print(int(n[i]))


Fixed submission:
n=list(input())
m=int(input())
i=0
for t in range(len(n)):
  if n[t]!="1":
    i=t+1
    break
if m<i:
  print(1)
else:
  print(int(n[i-1]))

Buggy python submission (verdict: Runtime Error):
n=list(input())
m=int(input())
i=0
for t in range(len(n)):
  if n[t]=="1":
    pass
  else:
    i=t+1
    break
if m>=i:
  print(int(n[i]))
else:
  print(1)

Fixed submission:
n=list(input())
m=int(input())
i=0
for t in range(len(n)):
  if n[t]!="1":
    i=t+1
    break
if m<i:
  print(1)
else:
  print(int(n[i-1]))

Buggy python submission (verdict: Runtime Error):
n=list(input())
m=int(input())
i=0
for t in range(100):
  if n[t]=="1":
    pass
  else:
    i=t+1
if m=>i:
  print(str(n[i]))
else:
  print(1)


Fixed submission:
n=list(input())
m=int(input())
i=0
for t in range(len(n)):
  if n[t]!="1":
    i=t+1
    break
if m<i:
  print(1)
else:
  print(int(n[i-1]))
Buggy python submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
for i in range(n):
  l[i]=l[i]-i-1
l=sorted(l)
if n%2==0:
  mid=(l[n/2-1]+l[n/2])
else:
  mid=l[n/2]
sum=0
for i in range(n):
  sum+=abs(l[i]-mid)
print(sum)


Fixed submission:
n=int(input())
l=list(map(int,input().split()))
for i in range(n):
  l[i]=l[i]-i-1
l=sorted(l)
if n%2==0:
  mid=(l[n//2-1]+l[n//2])//2
else:
  mid=l[(n-1)//2]
sum=0
for i in range(n):
  sum+=abs(l[i]-mid)
print(sum)
Buggy python submission (verdict: Runtime Error):
n=input()
l=list(map(int,input().split()))
count=0
for i in range(n):
  num=l[i]
  while num%2==0:
    count+=1
    num=num//2
print(count)

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
c=0
for i in l:
  while i%2==0:    
    c+=1
    i=i//2
print(c)
Buggy python submission (verdict: Runtime Error):
n=int(input())
num6=6
num9=9
while num6<=n:
  l.append(num6)
  num6*=6
while num9<=n:
  l.append(num9)
  num9*=9
count=[0,1,2,3,4,5,1,2,3,1,2,3]
for i in range(12,n+1):
  min=100000
  for j in l:
    if i-j<0:
      pass
    else:
      if min>count[i-j]+1:
        min=count[i-j]+1
  count.append(min)
print(count[n])

Fixed submission:
n=int(input())
l6=[]
l9=[]
num6=6
num9=9
while num6<=n:
  l6.append(num6)
  num6*=6
while num9<=n:
  l9.append(num9)
  num9*=9
count=[0,1,2,3,4,5,1,2,3,1,2,3]
for i in range(12,n+1):
  min=100000
  for j in l6:
    if i-j<0:
      pass
    else:
      if min>count[i-j]+1:
        min=count[i-j]+1
  for j in l9:
    if i-j<0:
      pass
    else:
      if min>count[i-j]+1:
        min=count[i-j]+1
  count.append(min)
print(count[n])
Buggy python submission (verdict: Runtime Error):
n,c=map(int,input().split())
d=[]
for i in range(c):
  d.append(list(map(int,input().split())))
col=[]
for i in range(n):
  col.append(list(map(int,input().split())))
lc1=[]
lc2=[]
lc3=[]
for i in range(c):
  ccount1=0
  ccount2=0
  ccount3=0
  for j in range(n):
    for k in range(n):
      if (j+k)%3==0:
        ccount1+=d[col[j][k]][i]
      elif (j+k)%3==1:
        ccount2+=d[col[j][k]][i]
      else:
        ccount3+=d[col[j][k]][i]
  lc1.append(ccount1)
  lc2.append(ccount2)
  lc3.append(ccount3)
min=10**10
for i in range(c):
  for j in range(c):
    for k in range(c):
      if i==j or j==k or i==k:
        pass
      else:
        if min>lc1[i]+lc2[j]+lc3[k]:
          min=lc1[i]+lc2[j]+lc3[k]
print(min)

Fixed submission:
n,c=map(int,input().split())
d=[]
for i in range(c):
  d.append(list(map(int,input().split())))
col=[]
for i in range(n):
  col.append(list(map(int,input().split())))
lc1=[]
lc2=[]
lc3=[]
for i in range(c):
  ccount1=0
  ccount2=0
  ccount3=0
  for j in range(n):
    for k in range(n):
      if (j+k)%3==0:
        ccount1+=d[col[j][k]-1][i]
      elif (j+k)%3==1:
        ccount2+=d[col[j][k]-1][i]
      else:
        ccount3+=d[col[j][k]-1][i]
  lc1.append(ccount1)
  lc2.append(ccount2)
  lc3.append(ccount3)
min=10**10
for i in range(c):
  for j in range(c):
    for k in range(c):
      if i==j or j==k or i==k:
        pass
      else:
        if min>lc1[i]+lc2[j]+lc3[k]:
          min=lc1[i]+lc2[j]+lc3[k]
print(min)

Buggy python submission (verdict: Time Limit Exceeded):
n,c=map(int,input().split())
d=[]
for i in range(c):
  d.append(list(map(int,input().split())))
col=[]
for i in range(n):
  col.append(list(map(int,input().split())))
lc1=[]
lc2=[]
lc3=[]
for i in range(c):
  ccount1=0
  ccount2=0
  ccount3=0
  for j in range(n):
    for k in range(n):
      if (j+k)%3==0:
        ccount1+=d[col[j][k]-1][i]
      elif (j+k)%3==1:
        ccount2+=d[col[j][k]-1][i]
      else:
        ccount3+=d[col[j][k]-1][i]
  lc1.append(ccount1)
  lc2.append(ccount2)
  lc3.append(ccount3)
min=10**10
for i in range(c):
  for j in range(c):
    for k in range(c):
      if i==j or j==k or i==k:
        pass
      else:
        if min>lc1[i]+lc2[j]+lc3[k]:
          min=lc1[i]+lc2[j]+lc3[k]
print(min)

Fixed submission:
n,c=map(int,input().split())
d=[]
for i in range(c):
  d.append(list(map(int,input().split())))
col=[]
for i in range(n):
  col.append(list(map(int,input().split())))
lc1=[]
lc2=[]
lc3=[]
for i in range(c):
  ccount1=0
  ccount2=0
  ccount3=0
  for j in range(n):
    for k in range(n):
      if (j+k)%3==0:
        ccount1+=d[col[j][k]-1][i]
      elif (j+k)%3==1:
        ccount2+=d[col[j][k]-1][i]
      else:
        ccount3+=d[col[j][k]-1][i]
  lc1.append(ccount1)
  lc2.append(ccount2)
  lc3.append(ccount3)
min=10**10
for i in range(c):
  for j in range(c):
    for k in range(c):
      if i==j or j==k or i==k:
        pass
      else:
        if min>lc1[i]+lc2[j]+lc3[k]:
          min=lc1[i]+lc2[j]+lc3[k]
print(min)
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
import bisect
d1=defaultdict(list)
d2=defaultdict(list)
n,m=map(int,input().split())
l=list(map(int,input().split()))
la=[[] for i in range(n+1)]
for i in range(m):
  a,b=map(int,input().split())
  la[a].append(b)
  la[b].append(a)
lb=[0 for i in range(n+1)]
def dfs(x,y):
  if lb[x]!=0:
    return
  else:
    lb[x]=y
    s=la[x]
    if s==[]:
      pass
    else:
      for i in s:
        dfs(i,y)
c=1
for i in range(1,n+1):
  dfs(i,c)
  c+=1
lc=set(lb)
for i in range(1,n+1):
  d1[lb[i]]+=[i]
  d2[lb[i]]+=[l[i-1]]
ans=0
for i in d1:
  d11=d1[i]
  d12=d2[i]
  for j in d12:
    index=bisect.bisect_right(d11,j)
    if d11[index-1]==j:
      ans+=1
print(ans)

Fixed submission:
import sys
from collections import defaultdict
import bisect
sys.setrecursionlimit(1000000)
d1=defaultdict(list)
d2=defaultdict(list)
n,m=map(int,input().split())
l=list(map(int,input().split()))
la=[[] for i in range(n+1)]
for i in range(m):
  a,b=map(int,input().split())
  la[a].append(b)
  la[b].append(a)
lb=[0 for i in range(n+1)]
def dfs(x,y):
  if lb[x]!=0:
    return
  else:
    lb[x]=y
    s=la[x]
    if s==[]:
      pass
    else:
      for i in s:
        dfs(i,y)
c=1
for i in range(1,n+1):
  dfs(i,c)
  c+=1
lc=set(lb)
for i in range(1,n+1):
  d1[lb[i]]+=[i]
  d2[lb[i]]+=[l[i-1]]
ans=0
for i in d1:
  d11=d1[i]
  d12=d2[i]
  for j in d12:
    index=bisect.bisect_right(d11,j)
    if d11[index-1]==j:
      ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
l1=sorted(l)
for i in range(1,n+1):
  if l1.index(l[i])<=n//2:
    print(l1[(n+2)//2])
  else:
    print(l1[n//2])  

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
l1=sorted(l)
for i in range(1,n+1):
  if l[i-1]<=l1[n//2-1]:
    print(l1[n//2])
  else:
    print(l1[(n-2)//2])
Buggy python submission (verdict: Runtime Error):
a,s,d=map(int,input().split())
if s-a<2*d:
  for i in range(a,s+1):
    print(i)
else:
  for i in range(a,a+k+1):
    print(i)
  for i in range(s-k+1,s+1):
    print(i)

Fixed submission:
a,b,k=map(int,input().split())
if a+k-1>=b-k+1:
  for i in range(a,b+1):
    print(i)
else:
  for i in range(k):
    print(a+i)
  for i in range(k):
    print(b-k+1+i)
Buggy python submission (verdict: Runtime Error):
l=list(map(int(input().split())))
l=sorted(l)
a=l[0]
b=l[1]
c=l[2]
count=0
count+=c-b
if (b-a)%2==0:
  count+=(b-a)//2
else:
  count+=(b-a+1)//2+1
print(count)
  
  
          

Fixed submission:
l=list(map(int,input().split()))
l=sorted(l)
a=l[0]
b=l[1]
c=l[2]
count=0
count+=c-b
if (b-a)%2==0:
  count+=(b-a)//2
else:
  count+=(b-a+1)//2+1
print(count)
Buggy python submission (verdict: Runtime Error):
a,s,d=input().split()
f,g,h=input().split()
j,k,l=input().split()
print(a+g+k)

Fixed submission:
a=input()
f=input()
j=input()
print(a[0]+f[1]+j[2])
Buggy python submission (verdict: Runtime Error):
h,w,d=map(int,input().split())
l={}
for i in range(h):
  l1=list(map(int,input().split()))
  for j in l1:
    l[j]=[l1.index(j)+1,i+1]
li=[]
for i in range(1,d+1):
  l11=[]
  c=0
  x=l[i][0]
  y=l[i][1]
  while i<=h*w:
    c+=abs(x-l[i][0])+abs(y-l[i][1])
    l11.append(c)
    x=l[i][0]
    y=l[i][1]
    i+=d
  li.append(l11)
q=int(input())
for i in range(q):
  a,b=map(int,input().split())
  r=a%d
  if r==0:
    print(li[d][b//d-1]-li[d][a//d-1])
  else:
    print(li[r-1][b//d]-li[r-1][a//d])

Fixed submission:
h,w,d=map(int,input().split())
l={}
for i in range(h):
  l1=list(map(int,input().split()))
  for j in l1:
    l[j]=[l1.index(j)+1,i+1]
li=[]
for i in range(1,d+1):
  l11=[]
  c=0
  x=l[i][0]
  y=l[i][1]
  while i<=h*w:
    c+=abs(x-l[i][0])+abs(y-l[i][1])
    l11.append(c)
    x=l[i][0]
    y=l[i][1]
    i+=d
  li.append(l11)
q=int(input())
for i in range(q):
  a,b=map(int,input().split())
  r=a%d
  if r==0:
    print(li[d-1][b//d-1]-li[d-1][a//d-1])
  else:
    print(li[r-1][b//d]-li[r-1][a//d])
Buggy python submission (verdict: Runtime Error):
l1=list(map(int,input().split()))
l2=list(map(int,input().split()))
l3=list(map(int,input().split()))
a1=l1[0]
b2=l1[1]-a1
b3=l1[2]-a1
a2=l2[0]
a3=l3[0]
if a2+b2==l2[1] and a2+b3==l2[2] and a3+b2==l3[1] and a3+b3==l3[2];:
  print("Yes")
else:
  print("No")

Fixed submission:
l1=list(map(int,input().split()))
l2=list(map(int,input().split()))
l3=list(map(int,input().split()))
a1=l1[0]
b2=l1[1]-a1
b3=l1[2]-a1
a2=l2[0]
a3=l3[0]
if a2+b2==l2[1] and a2+b3==l2[2] and a3+b2==l3[1] and a3+b3==l3[2]:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
a=int(input())
s=int(input())
d=int(input())
print(a-s-(a-s)//b*b)

Fixed submission:
a=int(input())
s=int(input())
d=int(input())
print(a-s-(a-s)//d*d)
Buggy python submission (verdict: Runtime Error):
n=int(input())
l=[]
for i in range(n):
  l.append(list(map(int,input().split())))
l1=[0,0,0]
b=True
for i in l:
  if abs(l[i][1]-l1[1])+abs(l1[2]-l[i][2])>l[i][0]-l1[0]:
    b=False
    break
  elif (abs(l[i][1]-l1[1])+abs(l1[2]-l[i][2]))%2!=(l[i][0]-l1[0])%2:
    b=False
    break
  else:
    l1=l[i]
if b:
  print("Yes")
else:
  print("No")

Fixed submission:
n=int(input())
l=[]
for i in range(n):
  l.append(list(map(int,input().split())))
l1=[0,0,0]
b=True
for i in range(n):
  if abs(l[i][1]-l1[1])+abs(l1[2]-l[i][2])>l[i][0]-l1[0]:
    b=False
    break
  elif (abs(l[i][1]-l1[1])+abs(l1[2]-l[i][2]))%2!=(l[i][0]-l1[0])%2:
    b=False
    break
  else:
    l1=l[i]
if b:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
q=int(input())
l=[0]
c=0
def prime(n):
  if n==2:
    return True
  elif n==1:
    return False
  else:
    return pow(2,n-1,n)==1
for i in range(1,100001):
  if prime(n)==True and prime((n+1)//2)=True:
    c+=1
  l.append(c)
for i in range(q):
  a,b=map(int,input().split())
  print(l[b]-l[a-1])
  
  

Fixed submission:
def prime(n):
  if n==1:
    return False
  elif n==2:
    return True
  else:
    for i in range(2,int((n)**(1/2))+1):
      if n%i==0:
        return False
    return True
list=[True]*100001
for i in range(1,100001):
  if not prime(i):
    list[i]=False
list1=[0]
count=0
for i in range(1,100001):
  if i%2==1:
    if list[i] and list[(i+1)//2]:
      count+=1
  list1.append(count)
n=int(input())
for i in range(n):
  a,b=map(int,input().split())
  print(list1[b]-list1[a-1])
Buggy python submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
c=0
for i in range(1,n+1):
  w=str(i)
  d
  for j in range(len(w)):
    d+=int(w[j])
  if a<=d<=b:
    c+=1
print(c)
  

Fixed submission:
n,a,b=map(int,input().split())
c=0
for i in range(1,n+1):
  w=str(i)
  d=0
  for j in range(len(w)):
    d+=int(w[j])
  if a<=d<=b:
    c+=i
print(c)