Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N, T = list(map(int, input().split()))
ans=10000

for i in range(N):
  c, tt==list(map(int, input().split()))
  if tt <= T:
    ans=min(c,ans)

if ans==10000:
  print('TLE')
else:
  print(ans)

Fixed submission:
N, T = list(map(int, input().split()))
ans=10000

for i in range(N):
  c, tt=list(map(int, input().split()))
  if tt <= T:
    ans=min(c,ans)

if ans==10000:
  print('TLE')
else:
  print(ans)

Buggy python submission (verdict: Runtime Error):
N, T = map(int,input())
tmp=10000
ans=0

for i in range(N):
  c, tt==map(int,input())
  if tt <= T:
    tmp=min(c,tmp)
    if c==ans:
      ans=i

if ans==0:
  print('TLE')
else:
  print(ans)

Fixed submission:
N, T = list(map(int, input().split()))
ans=10000

for i in range(N):
  c, tt=list(map(int, input().split()))
  if tt <= T:
    ans=min(c,ans)

if ans==10000:
  print('TLE')
else:
  print(ans)

Buggy python submission (verdict: Runtime Error):
N, T = map(int,input())
ans=10000

for i in range(N):
  c, tt==map(int,input())
  if tt <= T:
    ans=min(c,ans)

if ans==10000:
  print('TLE')
else:
  print(ans)

Fixed submission:
N, T = list(map(int, input().split()))
ans=10000

for i in range(N):
  c, tt=list(map(int, input().split()))
  if tt <= T:
    ans=min(c,ans)

if ans==10000:
  print('TLE')
else:
  print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = list(map(int, input().split()))
tmp=0

if N==1:
  print(M)
  tmp=1
else:
  for i in range(M-N):
    k = i + N
    if M % k == 0:
      print(int(M/k))
      tmp=1
      break

if tmp==0:
  print(1)

Fixed submission:
N, M = list(map(int, input().split()))
tmp=0

if N==1:
  print(M)
  tmp=1
else:
  for i in range(int(M**0.8)+1):
    k = i + N
    if M % k == 0:
      print(int(M/k))
      tmp=1
      break

if tmp==0:
  print(1)

Buggy python submission (verdict: Runtime Error):
N, M = list(map(int, input().split()))
tmp=0

if N==1:
  print(M)
  else:
    for i in range(M-N):
      k = i + N
      if M % k == 0:
        print(int(M/k))
        tmp=1
        break

if tmp==0:
  print(1)

Fixed submission:
N, M = list(map(int, input().split()))
tmp=0

if N==1:
  print(M)
  tmp=1
else:
  for i in range(int(M**0.8)+1):
    k = i + N
    if M % k == 0:
      print(int(M/k))
      tmp=1
      break

if tmp==0:
  print(1)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = list(map(int, input().split()))
tmp=0

for i in range(M-N):
  k = i + N
  if M % k == 0:
    print(int(M/k))
    tmp=1
    break

if tmp==0:
  print(1)

Fixed submission:
N, M = list(map(int, input().split()))
tmp=0

if N==1:
  print(M)
  tmp=1
else:
  for i in range(int(M**0.8)+1):
    k = i + N
    if M % k == 0:
      print(int(M/k))
      tmp=1
      break

if tmp==0:
  print(1)

Buggy python submission (verdict: Runtime Error):
N, M = list(map(int, input().split()))
tmp=0

for i in range(M-N):
  k = i + N
  if M % k == 0:
    print(int(M/k))
    tmp=1
    break

if tmp==1:
else:
  print(1)

Fixed submission:
N, M = list(map(int, input().split()))
tmp=0

if N==1:
  print(M)
  tmp=1
else:
  for i in range(int(M**0.8)+1):
    k = i + N
    if M % k == 0:
      print(int(M/k))
      tmp=1
      break

if tmp==0:
  print(1)

Buggy python submission (verdict: Runtime Error):
N, M = list(map(int, input().split()))

for i in range(M-N):
  k = i + N
  if M % k == 0:
    print(int(M/k))
    tmp=1
    break

if tmp==1:
  else:
    print(1)

Fixed submission:
N, M = list(map(int, input().split()))
tmp=0

if N==1:
  print(M)
  tmp=1
else:
  for i in range(int(M**0.8)+1):
    k = i + N
    if M % k == 0:
      print(int(M/k))
      tmp=1
      break

if tmp==0:
  print(1)

Buggy python submission (verdict: Runtime Error):
N, M = list(map(int, input().split()))

for i in range(M-N):
  k = i + N
  if M % k == 0:
    print(int(M/k))
    tmp=1
    break

if tmp==1:
else:
  print(1)

Fixed submission:
N, M = list(map(int, input().split()))
tmp=0

if N==1:
  print(M)
  tmp=1
else:
  for i in range(int(M**0.8)+1):
    k = i + N
    if M % k == 0:
      print(int(M/k))
      tmp=1
      break

if tmp==0:
  print(1)

Buggy python submission (verdict: Runtime Error):
N, M = list(map(int, input().split()))

for i in range(M/N+1):
  k = i + N
  if M % k == 0:
    print(int(M/k))
    break

print(1)

Fixed submission:
N, M = list(map(int, input().split()))
tmp=0

if N==1:
  print(M)
  tmp=1
else:
  for i in range(int(M**0.8)+1):
    k = i + N
    if M % k == 0:
      print(int(M/k))
      tmp=1
      break

if tmp==0:
  print(1)
Buggy python submission (verdict: Runtime Error):
a=[int(i) for i in input().split()]
a.sort()[::-1]
x,y,z=a
print(x*10+y+z)

Fixed submission:
z,y,x=sorted([int(i) for i in input().split()])
print(x*10+y+z)
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
def div(x,y):
    if x%y!=0:
        return 0
    else:
        return 1+div(int(x/y),y)

p=[]

def fact(s):
    if len(p)!=0:
        k=p[-1]
    else:
        k=2
    for i in range(2,max(int(s**0.5) +2,2)):
        a=div(s,i)
        if a==0:
            0
        else:
            p.append(a)
            s=int(s/i**a)
            
fact(m)
#print(p)
mo=10**9+7
from scipy.special import comb
ans=1
if len(p)==0:
    ans=1
else:
    for i in p:
        ans=ans*comb(i+n-1, i, exact=True) % mo
        #print(ans,comb(i+n-1, i, exact=True))
print(ans)

Fixed submission:
n,m = map(int,input().split())
def div(x,y):
    if x%y!=0:
        return 0
    else:
        return 1+div(int(x/y),y)

p=[]
q=[]

def fact(s):
    if len(p)!=0:
        k=p[-1]
    else:
        k=2
    for i in range(2,max(int(s**0.5) +2,2)):
        a=div(s,i)
        if a==0:
            0
        else:
            p.append(a)
            q.append(i)
            s=int(s/i**a)
    if s!=1:
        p.append(1)
            
fact(m)
def comb(nn,rr):
    rr=min(rr,nn-rr)
    rt=1
    for i in range(rr):
        #rt=rt*(nn-i)/(rr-i)
        rt*=(nn-i)
    for i in range(rr):
        rt//=(rr-i)
    return int(rt)
#print(p,q,m)
mo=10**9 +7
ans=1
if len(p)==0:
    ans=1
else:
    for i in p:
        ans*=comb(i+n-1, i) % mo
print(ans % mo)
Buggy python submission (verdict: Runtime Error):
n,x=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
ans=0
for i in range(n):
  if x>=a[i]:
    ans+=1
    x-=a[i]
if x=sum(a): ans=n-1
print(ans)


Fixed submission:
def MI():
    return map(int,input().split())
def I():
    return int(input())
def LI():
    return [int(i) for i in input().split()]
    
n,x=MI()
a=LI()
a.sort()
y=x
ans,s=0,0
for i in range(n):
    s+=a[i]
    if s>x:
        break
    else:
        if i<n-1:
            ans+=1
        elif x-s==0:
            ans+=1
            
print(ans)

Buggy python submission (verdict: Runtime Error):
n,x=map(int,input().split())
a=list(map(int,input().spit()))
a.sort()
ans=0
for i in range(n):
  if x>=a[i]:
    ans+=1
    x-=a[i]
print(ans)

Fixed submission:
def MI():
    return map(int,input().split())
def I():
    return int(input())
def LI():
    return [int(i) for i in input().split()]
    
n,x=MI()
a=LI()
a.sort()
y=x
ans,s=0,0
for i in range(n):
    s+=a[i]
    if s>x:
        break
    else:
        if i<n-1:
            ans+=1
        elif x-s==0:
            ans+=1
            
print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(iput())
a=input()
st=set(a)
ans='Yes'
for i in range(n-1):
    s=input()
    if a[-1]!=s[0]:
        ans='No'
    st.add(s)
    a=s
if len(st)<n:
    ans='No'
print(ans)

Fixed submission:
n=int(input())
a=input()
st=set()
st.add(a)
ans='Yes'
for i in range(n-1):
    s=input()
    st.add(s)
    if a[-1]!=s[0]:
        ans='No'
    a=s
if len(st)<n:
    ans='No'
print(ans)
Buggy python submission (verdict: Runtime Error):
n, k=map(int, input().split())
x=list(map(int, input().split()))

R=[0]
L=[0]
for i in range(n):
    if x[i]>=0:
        R.append(x[i])
    else:
        L.append(-x[i])

R=sorted(R)
L=sorted(L)


lenR=len(R)
lenL=len(L)

if lenR>k:
    ans=R[k]
    for i in range(k):
        ans=min(ans,R[k-i]+2*L[i], 2*R[k-i]+L[i])
        #print('i,ans,R[k-i]+2*L[i], 2*R[k-i]+L[i]=',i,ans,R[k-i]+2*L[i], 2*R[k-i]+L[i])
else:
    ans=R[lenR-1]+L[k-lenR-1]
    for i in range(lenR):
        if k-i<lenL:
            ans=min(ans,R[i]+2*L[k-i], 2*R[i]+L[k-i])

print(ans)


Fixed submission:
n,k=map(int,input().split())
a=list(map(int,input().split()))
k-=1
ans=1<<99
for i in range(n-k):
    ans=min(ans,abs(a[i])+a[k+i]-a[i],abs(a[k+i])+a[k+i]-a[i])
print(ans)
Buggy python submission (verdict: Runtime Error):
s=input()
k=int(input())
fl=0
t=0
for i in range(len(s)):
  if s[i]=='1' and fl=0:
    t+=1
  else:
    if fl==0:
      ans=s[i]
      fl=1
if t<=k:
  ans='1'
print(ans)

Fixed submission:
s=input()
k=int(input())
fl=0
t=0
ans='1'
for i in range(len(s)):
  if s[i]=='1' and fl==0:
    t+=1
  else:
    if fl==0:
      ans=s[i]
      fl=1
if t>=k:
  ans='1'
print(ans)
Buggy python submission (verdict: Runtime Error):
a

Fixed submission:
from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
import math
import time
import random
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
ts=time.time()
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
show_flg=False
#show_flg=True

ans=0
n,m=MI()
ed=[-1]*n
bg=[[] for _ in range(n)]
A=[0]*n
B=[0]*n
r=[]
for i in range(m):
    a,b=LI_()
    r+=[(a,b)]
    bg[a].append(b)
    ed[a]=b
    A[a]+=1
    B[b]+=1

show(r,A,B)
q=[]
for i in range(n):
    show(i,'q=',q,ans,end=' | ')
    if B[i]>0:
        ans+=1
        for j in q:
            B[j]-=1
        q=[]
    if A[i]>0:
        q+=bg[i]
    show(i,'q=',q,'ans=',ans,'A,B=',A,B)    
print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[int(input()) + i for i in range(n)]
a.sort()
b=a[n//2]
ans=0
for i in range(n):
  ans+=abs(a[i]-b)
print(ans)

Fixed submission:
# coding: utf-8
# Your code here!
n=int(input())
b=input().split()
a=[0]*n
for i in range(n):
    a[i]=int(b[i])-i
a.sort()
c=a[n//2]
ans=0
for i in range(n):
  ans+=abs(a[i]-c)
print(ans)
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
print(int((n-1)/(k-1))

Fixed submission:
n,k=map(int,input().split())
print((n+k-3)//(k-1))
Buggy python submission (verdict: Runtime Error):
n, m=map(int, input().split())
p=[0]+list(map(int, input().split()))

par=[i for i in range(n+1)]
cnt=0
def root(i):
    if par[i]==i:
        return i
    else:
        par[i]=root(par[i])
        return par[i]

for i in range(m):
    x, y=map(int, input().split())
    if root(x)==root(y):
        
    else:
        par[y]=root(x)

ans=0
for i in range(n):
    n=1+i
    if root(n)==root(p[n]):
        ans=ans+1
print(ans)
'''
print(par[1:])

root_ls=[0]+[root(i+1) for i in range(n)]
print(par[1:])
print(root_ls[1:])
'''

Fixed submission:
n, m=map(int, input().split())
p=[0]+list(map(int, input().split()))

par=[i for i in range(n+1)]
cnt=0
def root(i):
    if par[i]==i:
        return i
    else:
        par[i]=root(par[i])
        return par[i]


for i in range(m):
    x, y=map(int, input().split())
    if root(x)==root(y):
        0
        #print(par[1:])
    else:
        par[root(y)]=root(x)
        #print(par[1:])

ans=0
for i in range(n):
    n=1+i
    if root(n)==root(p[n]):
        ans=ans+1
print(ans)
'''
print(par[1:])

root_ls=[0]+[root(i+1) for i in range(n)]
print(par[1:])
print(root_ls[1:])
'''

Buggy python submission (verdict: Runtime Error):
n, m=map(int, input().split())
p=[]+list(map(int, input().split()))

cat=[0]*(n+1)
cnt=0

for i in range(m):
    x, y=map(int, input().split())
    if cat[x]==0 and cat[y]==0:
        # new set
        cnt=cnt+1
        cat[x]=cnt
        cat[y]=cnt
    else:
        cat[x], cat[y]=cat[x]+cat[y], cat[x]+cat[y]

        
        dp.append(set())
        dp[cat[x]].add(x)
        dp[cat[x]].add(y)
        print('i,cat[x],cat[y],cat,dp=',i,cat[x],cat[y],cat,dp)
        

dp=[set()]*cnt
p_set=[set()]*cnt

for i in range(n+1):
    if cat[i]==0:
    else:
        dp[cat[i]].add[i]
        p_set[cat[i]].add[p[i]]

ans=0
for i in range(cnt+1):
    ans=ans+len(dp[i]&p_set[i])

print(ans)


Fixed submission:
n, m=map(int, input().split())
p=[0]+list(map(int, input().split()))

par=[i for i in range(n+1)]
cnt=0
def root(i):
    if par[i]==i:
        return i
    else:
        par[i]=root(par[i])
        return par[i]


for i in range(m):
    x, y=map(int, input().split())
    if root(x)==root(y):
        0
        #print(par[1:])
    else:
        par[root(y)]=root(x)
        #print(par[1:])

ans=0
for i in range(n):
    n=1+i
    if root(n)==root(p[n]):
        ans=ans+1
print(ans)
'''
print(par[1:])

root_ls=[0]+[root(i+1) for i in range(n)]
print(par[1:])
print(root_ls[1:])
'''
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!

n,m,x=map(int,input().split())
a=[int(i) for i in input().split()]
a.sort()
b=[1 for s in a if s<x]
c=sum(a)-b
print(min(b,c))

Fixed submission:
n,m,x=map(int,input().split())
a=[int(i) for i in input().split()]
a.sort()
b=len([1 for s in a if s<x])
c=len(a)-b
print(min(b,c))
Buggy python submission (verdict: Runtime Error):
*a=map(int,open(0))
m=max(a)
t=m*3-sum(a)
if t%2==1:t+=3
print(t//2)

Fixed submission:
a,b,c=map(int,input().split())
a,b,c=sorted([a,b,c])

#parity=set(list(map(lambda x: x % 2,[a,b,c])))
parity=list(map(lambda x: x % 2,[a,b,c]))

if len(set(parity))==1:
    print(int((3*max(a,b,c)-a-b-c)/2))
else:
    if (b-a)%2==0:
        ex=1
    else:
        ex=2
    print(int((max(a,b,c)-a)/2)+int((max(a,b,c)-b)/2)+int((max(a,b,c)-c)/2) + ex)

Buggy python submission (verdict: Runtime Error):
*a=map(int,open(0))
m=max(a)
t=m*3-sum(a)
if t%2==1:t+=3
print(t//2)

Fixed submission:
a,b,c=map(int,input().split())
a,b,c=sorted([a,b,c])

#parity=set(list(map(lambda x: x % 2,[a,b,c])))
parity=list(map(lambda x: x % 2,[a,b,c]))

if len(set(parity))==1:
    print(int((3*max(a,b,c)-a-b-c)/2))
else:
    if (b-a)%2==0:
        ex=1
    else:
        ex=2
    print(int((max(a,b,c)-a)/2)+int((max(a,b,c)-b)/2)+int((max(a,b,c)-c)/2) + ex)

Buggy python submission (verdict: Runtime Error):
*a=map(int,open(0))
m=max(a)
t=m*3-sum(a)
if t%2==1:t+=3
print(t//2)

Fixed submission:
a,b,c=map(int,input().split())
a,b,c=sorted([a,b,c])

#parity=set(list(map(lambda x: x % 2,[a,b,c])))
parity=list(map(lambda x: x % 2,[a,b,c]))

if len(set(parity))==1:
    print(int((3*max(a,b,c)-a-b-c)/2))
else:
    if (b-a)%2==0:
        ex=1
    else:
        ex=2
    print(int((max(a,b,c)-a)/2)+int((max(a,b,c)-b)/2)+int((max(a,b,c)-c)/2) + ex)
Buggy python submission (verdict: Runtime Error):
def sol(n):
    #n=input()
    if len(set(n[1:]))<=1 and (n[-1]=='9' or len(n)==1):
      m=0
    else:
      m=1
    print(int(n[0])+9*len(n)-9-m)

n=input()
sol(str(i))

Fixed submission:
def sol(n):
    #n=input()
    if len(set(n[1:]))<=1 and (n[-1]=='9' or len(n)==1):
      m=0
    else:
      m=1
    print(int(n[0])+9*len(n)-9-m)

n=input()
sol(str(n))
Buggy python submission (verdict: Runtime Error):
n,a=map(int,input().split())
print('YNeos'[n%500>a::2])

Fixed submission:
n,a=map(int,open(0).read().split())
print('YNeos'[n%500>a::2])
Buggy python submission (verdict: Runtime Error):
n,*t=map(int,open(0).read().split())
print(sum([i*(-1)**i for i in t])

Fixed submission:
n,*x=map(int,open(0).read().split());a=0;t=1;x.sort()
while x:a+=t*x.pop();t*=-1
print(a)
Buggy python submission (verdict: Runtime Error):
import numpy as np
import numpy.linalg as LA
a=[int(i) for i in input().split()]
a=[a,[int(i) for i in input().split()]]
a.append([int(i) for i in input().split()])
a = np.array(a)
if LA.det(a)==0:
  print('Yes')
else:
  print('No')


Fixed submission:
d,e,f=[int(i) for i in input().split()]
x,y,z=[int(i) for i in input().split()]
s,t,u=[int(i) for i in input().split()]
b=x-d
c=s-d
if b+e==y and b+f==z and c+e==t and c+f==u:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
import numpy as np
import numpy.linalg as LA
a=[int(i) for i input().split()]
a=[a,[int(i) for i input().split()]]
a.appedn([int(i) for i input().split()])
a = np.array(a)
if LA.det(a)==0:
  print('Yes')
else:
  print('No')

Fixed submission:
d,e,f=[int(i) for i in input().split()]
x,y,z=[int(i) for i in input().split()]
s,t,u=[int(i) for i in input().split()]
b=x-d
c=s-d
if b+e==y and b+f==z and c+e==t and c+f==u:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
print(x if x%y==0 else -1)

Fixed submission:
x,y=map(int,input().split())
print(x if x%y!=0 else -1)
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=int(input())
x=int(input())
cnt=0

for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if 500*i + 100*j + 50*k==x:
        cnt+=1
print(cnt)


Fixed submission:
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
import math
import time
import random
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def StoI():
    return [ord(i)-97 for i in input()]
def ItoS(nn):
    return chr(nn+97)
def GI(V,E,Directed=False,index=0):
    org_inp=[]
    g=[[] for i in range(n)]
    for i in range(E):
        inp=LI()
        org_inp.append(inp)
        if index==0:
            inp[0]-=1
            inp[1]-=1
        if len(inp)==2:
            a,b=inp
            g[a].append(b)
            if not Directed:
                g[b].append(a)
        elif len(inp)==3:
            a,b,c=inp
            aa=(inp[0],inp[2])
            bb=(inp[1],inp[2])
            g[a].append(bb)
            if not Directed:
                g[b].append(aa)
    return g,org_inp
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
u_alp=string.ascii_uppercase
ts=time.time()
sys.setrecursionlimit(10**5)
input=lambda: sys.stdin.readline().rstrip()

show_flg=False
show_flg=True

n,m=LI()
c=[]
x=[inf]*n
ans=True
g=[[] for _ in range(n)]
for i in range(m):
    l,r,d=LI_()
    d+=1
    g[l].append((r,d))
    g[r].append((l,-d))
    c.append((l,r,d))

v=[inf]*n
vs=[-1]*n

def bfs(st):
    if v[st]!=inf:
        return True
    q=[st]
    v[st]=0
    vs[st]=0
    while q:
        
        c=q.pop()
        for nb,d in g[c]:
            if vs[nb]==0:
                continue
            else:
                q.append(nb)
                vs[nb]=0
                if v[nb]==inf:
                    v[nb]=v[c]+d
                elif v[nb]!=v[c]+d:
                    show(c+1,nb+1,v)
                    return False
    return True

for i in range(n):
    if bfs(i):
        continue
    else:
        print('No')
        exit()

for i in range(m):
    l,r,d=c[i]
    if v[l]+d!=v[r]:
        print('No')
        exit()
        
print('Yes')
Buggy python submission (verdict: Runtime Error):
print(input().replace('017','018')

Fixed submission:
print(input().replace('017','018'))
Buggy python submission (verdict: Time Limit Exceeded):
n=10**5+2
#n=100
p=[0]*n
ac=[0]*n
def prime_list(x):
    for i in range(2,x+1):
        flg=True
        for j in range(2,int(i**0.5)+1):
            if i%j==0:
                flg=False
        if flg==True:
            p[i]=1

def elato(x):
    pr=list(range(2,x+1))
    for i in pr:
        for j in pr:
            if j!=i and j%i==0:
                pr.remove(j)
    return pr
            
for i in elato(n):
    p[i]=1
#print(p)
pre=0
for i in range(n):
    if p[i]==1 and p[int((i+1)/2)]==1 and i%2==1:
        k=1
    else:
        k=0
    pre+=k
    ac[i]=pre

q=int(input())
for i in range(q):
    l,r=map(int,input().split())
    print(ac[r]-ac[l-1])

Fixed submission:
n=10**5+2
#n=100
p=[0]*n
ac=[0]*n
def prime_list(x):
    for i in range(2,x+1):
        flg=True
        for j in range(2,int(i**0.5)+1):
            if i%j==0:
                flg=False
        if flg==True:
            p[i]=1

prime_list(n)
#print(p)
pre=0
for i in range(n):
    if p[i]==1 and p[int((i+1)/2)]==1 and i%2==1:
        k=1
    else:
        k=0
    pre+=k
    ac[i]=pre

q=int(input())
for i in range(q):
    l,r=map(int,input().split())
    print(ac[r]-ac[l-1])
Buggy python submission (verdict: Runtime Error):
a

Fixed submission:
a,b,c,d=map(int,input().split())
if a+b==c+d:
  print('Balanced')
elif a+b>c+d:
  print('Left')
else:
  print('Right')
Buggy python submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
ans=0
for i in range(1,n+1):
  k=str(i)
  keta=0
  for j in range(len(k)):
    keta+=k[j]
  if k>=a and k<=b:
    ans+=i
print(ans)

Fixed submission:
n,a,b=map(int,input().split())
ans=0
for i in range(1,n+1):
  k=str(i)
  keta=0
  for j in range(len(k)):
    keta+=int(k[j])
  if keta>=a and keta<=b:
    ans+=i
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
if (a+b )%2==1:
  print(int((a+b+1)/2)
else:
  print(int((a+b)/2)

Fixed submission:
a,b=map(int,input().split())
if (a+b )%2==1:
  print(int((a+b+1)/2))
else:
  print(int((a+b)/2))

Buggy python submission (verdict: Runtime Error):
a

Fixed submission:
a,b=map(int,input().split())
if (a+b )%2==1:
  print(int((a+b+1)/2))
else:
  print(int((a+b)/2))
Buggy python submission (verdict: Runtime Error):
n=input()
dc=dict()
for j in input().split():
    i=int(j)
    if i in dc:
        dc[i]+=1
    else:
        dc[i]=1
ans=0
for i in dc:
    if dc[i]>i:
        ans+=dc[i]-i,0
    elif dc[i]<i:
        ans+=dc[i]
print(ans)
    


Fixed submission:
n=input()
dc=dict()
for j in input().split():
    i=int(j)
    if i in dc:
        dc[i]+=1
    else:
        dc[i]=1
ans=0
for i in dc:
    if dc[i]>i:
        ans+=dc[i]-i
    elif dc[i]<i:
        ans+=dc[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
s=input()
s+='T'
x,y=map(int,input().split())
n=len(s)
f=0
d=0
xx=[]
yy=[]
for i in range(n):
    if s[i]=='F':
        f+=1
    else: #=='T'
        if f==0:
            0
        else:
            if d==0:
                xx.append(f)
                f=0
            else:
                yy.append(f)
                f=0
        d=1-d

if len(x)>0:
    x[0]=t
    x.remove(x[0])
    xx.append(abs(x-t))
else:
    xx.append(abs(x))
yy.append(abs(y))

#rint(xx,yy)
def judg(a):
    tot=sum(a)
    if tot%2==1:
        return False
    else:
        dp=[0]*(tot+1)
        for i in a:
            dp[i]=1
            for j in range(tot+1):
                if dp[j]==1 and j+i<=tot:
                    dp[j+i]=1
        if dp[int(tot/2)]==1:
            return True
        else:
            return False
if judg(xx) and judg(yy):
    ans='Yes'
else:
    ans='No'
print(ans)
    


Fixed submission:
s=input()
s+='T'
x,y=map(int,input().split())
n=len(s)
f=0
d=0
xx=[]
yy=[]
for i in range(n):
    if s[i]=='F':
        f+=1
    else: #=='T'
        if f==0:
            0
        else:
            if d==0:
                xx.append(f)
                f=0
            else:
                yy.append(f)
                f=0
        d=1-d
#print(xx,yy)
def judg(a,b):
    if len(a)==0 and b==0:
        return True
    else:
        dp=set()
        pdp=set()
        for i in a:
            pdp=dp
            if len(pdp)==0:
                pdp.add(i)
                pdp.add(-i)
            else:
                dp=set()
                for j in pdp:
                    dp.add(j-i)
                    dp.add(j+i)
                    #print(dp)
        if b in dp:
            return True
        else:
            return False
    
if s[0]!='T' and len(xx)>0:
    t=xx[0]
    xx.remove(xx[0])
else:
    t=0



if judg(xx,x-t) and judg(yy,y):
    ans='Yes'
else:
    ans='No'
print(ans)