Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())

xlist,ylist,xylist=[],[],[]
for i in range(N):
  x,y=map(int,input().split())
  xlist.append(x)
  ylist.append(y)
  xylist.append((x,y))

xy_prod_list=[]
for x in xlist:
  for y in ylist:
    xy_prod_list.append((x,y))
xy_prod_list.sort()
#print(xy_prod_list)    

answer=float("inf")
for i in range(len(xy_prod_list)):
  x1,y1=xy_prod_list[i]
  for j in range(i+1,len(xy_prod_list)):
    x2,y2=xy_prod_list[j]    
    
    num_inbox=0
    for x,y in xylist:
      if min(x1,x2)<=x<=max(x1,x2) and min(y1,y2)<=y<=max(y1,y2):
        num_inbox+=1
    
    if num_inbox>=K:
      answer=min(answer,abs(x2-x1)*abs(y2-y1))
    
print(answer)

Fixed submission:
N,K=map(int,input().split())

xlist,ylist,xylist=[],[],[]
xyset=set()
xydic={}
yxdic={}
for i in range(N):
  x,y=map(int,input().split())
  xlist.append(x)
  ylist.append(y)
  xylist.append((x,y))
  xyset.add((x,y))
  xydic[x]=y
  yxdic[y]=x

xy_prod_list=[]
for x in xlist:
  for y in ylist:
    xy_prod_list.append((x,y))
xy_prod_list.sort()
#print(xy_prod_list)    

num_ld_dic={}
for xx,yy in xy_prod_list:
  num_ld=0
  for x,y in xylist:
    if x<=xx and y<=yy:
      num_ld+=1
  num_ld_dic[(xx,yy)]=num_ld
#print(num_ld_dic)

answer=float("inf")
for i in range(len(xy_prod_list)):
  x1,y1=xy_prod_list[i]
  for j in range(len(xy_prod_list)):
    x2,y2=xy_prod_list[j]
    if x1>=x2 or y1>=y2:
      continue
    
    area=(x2-x1)*(y2-y1)
    if area>answer:
      continue
      
    num_point=num_ld_dic[(x2,y2)]-num_ld_dic[(x1,y2)]-num_ld_dic[(x2,y1)]+num_ld_dic[(x1,y1)]
    if (x1,y1) in xyset:  
      num_point+=1
    else:
      xx=yxdic[y1]
      if x1<=xx<=x2:
        num_point+=1
      yy=xydic[x1]
      if y1<=yy<=y2:
        num_point+=1
      
    if num_point>=K:
      #print((x1,y1),(x2,y2),num_point)
      answer=min(answer,area)
    
print(answer)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
N=int(input())

def warshall_floyd(d):
  #d[i][j]: iからjへの最短距離
  for k in range(N):
    for i in range(N):
      for j in range(N):
        if i<j and i!=k and k!=j and d[i][j]==d[i][k]+d[k][j]:
          #print((i,k),(k,j))
          shortcut_set.add((i,j))
        d[i][j]=min(d[i][j],d[i][k]+d[k][j])
  return d

mat=[]
for i in range(N):
  mat.append([int(x) for x in input().split()])
#print(mat)

dist=[[float("inf")]*N for i in range(N)]
graph=[[] for _ in range(N)]
for i in range(N):
  for j in range(N):
    if i==j:
      dist[i][i]=0
    else:
      graph[i].append((j,mat[i][j]))
      dist[i][j]=mat[i][j]
#print(graph)
#print(dist)

shortcut_set=set()
dist=warshall_floyd(dist)
#print(dist)

for i in range(N):
  for j in range(N):
    if dist[i][j]!=mat[i][j]:
      print(-1)
      sys.exit(0)
      
answer=0
for i in range(N):
  for j in range(i+1,N):
    if not (i,j) in shortcut_set:
      answer+=dist[i][j]
      
print(answer)

Fixed submission:
import sys
N=int(input())

def warshall_floyd(d):
  #d[i][j]: iからjへの最短距離
  for k in range(N):
    for i in range(N):
      for j in range(N):
        if i<j and i!=k and k!=j and d[i][j]==d[i][k]+d[k][j]:
          #print((i,k),(k,j))
          shortcut_set.add((i,j))
        d[i][j]=min(d[i][j],d[i][k]+d[k][j])
  return d

mat=[]
for i in range(N):
  mat.append([int(x) for x in input().split()])
#print(mat)

dist=[[float("inf")]*N for i in range(N)]
graph=[[] for _ in range(N)]
for i in range(N):
  for j in range(N):
    if i==j:
      dist[i][i]=0
    else:
      graph[i].append((j,mat[i][j]))
      dist[i][j]=mat[i][j]
#print(graph)
#print(dist)

shortcut_set=set()
dist=warshall_floyd(dist)
#print(dist)

for i in range(N):
  for j in range(N):
    if dist[i][j]!=mat[i][j]:
      print(-1)
      sys.exit(0)
      
answer=0
for i in range(N):
  for j in range(i+1,N):
    if not (i,j) in shortcut_set:
      answer+=dist[i][j]
      
print(answer)
Buggy python submission (verdict: Runtime Error):
N=int(input())
alist=[0]+list(map(int,input().split()))

answer=0
if alist[N]=N:
  alist[N-1],alist[N]=alist[N],alist[N-1]
  answer+=1

for i in range(1,N+1):
  if alist[i]==i:
    alist[i],alist[i+1]=alist[i+1],alist[i]
    answer+=1
    
print(answer)

Fixed submission:
N=int(input())
alist=[0]+list(map(int,input().split()))

answer=0
if alist[N]==N:
  alist[N-1],alist[N]=alist[N],alist[N-1]
  answer+=1

for i in range(1,N+1):
  if alist[i]==i:
    alist[i],alist[i+1]=alist[i+1],alist[i]
    answer+=1
    
print(answer)

Buggy python submission (verdict: Runtime Error):
N=int(input())
alist=[0]+list(map(int,input().split()))

if alist[N]=N:
  alist[N-1],alist[N]=alist[N],alist[N-1]
  answer+=1

answer=0
for i in range(1,N+1):
  if alist[i]==i:
    alist[i],alist[i+1]=alist[i+1],alist[i]
    answer+=1
    
print(answer)

Fixed submission:
N=int(input())
alist=[0]+list(map(int,input().split()))

answer=0
if alist[N]==N:
  alist[N-1],alist[N]=alist[N],alist[N-1]
  answer+=1

for i in range(1,N+1):
  if alist[i]==i:
    alist[i],alist[i+1]=alist[i+1],alist[i]
    answer+=1
    
print(answer)

Buggy python submission (verdict: Runtime Error):
N=int(input())
alist=[0]+list(map(int,input().split()))

answer=0
for i in range(1,N+1):
  if alist[i]==i:
    alist[i],alist[i+1]=alist[i+1],alist[i]
    answer+=1
    
print(answer)

Fixed submission:
N=int(input())
alist=[0]+list(map(int,input().split()))

answer=0
if alist[N]==N:
  alist[N-1],alist[N]=alist[N],alist[N-1]
  answer+=1

for i in range(1,N+1):
  if alist[i]==i:
    alist[i],alist[i+1]=alist[i+1],alist[i]
    answer+=1
    
print(answer)
Buggy python submission (verdict: Time Limit Exceeded):
N,A,B=map(int,input().split())

hlist=[]
for i in range(N):
  hlist.append(int(input()))
mh=max(hlist)
#print(mh,hlist)

def isOK(m):
  if m==0:
    return False
  
  hlist2=list(hlist)
  for i in range(N):
    hlist2[i]-=m*B
  #print(m,hlist2)
  if max(hlist2)<=0:
    return True
  
  cnt=0
  for i in range(N):
    if hlist2[i]>0:
      cnt+=-(-hlist2[i]//(A-B))
  return cnt<=m

l,r=1,mh//B+1
while l<=r:
  mid=(l+r)//2
  #print(l,mid,r)
  if not isOK(mid-1) and isOK(mid):
    print(mid)
    break
  elif isOK(mid-1):
    r=mid-1
  else:
    l=mid+1

Fixed submission:
import sys
input=sys.stdin.readline
N,A,B=map(int,input().split())

hlist=[]
for i in range(N):
  hlist.append(int(input()))
mh=max(hlist)
#print(mh,hlist)

def isOK(m):
  if m==0:
    return False
  
  hlist2=list(hlist)
  for i in range(N):
    hlist2[i]-=m*B
  #print(m,hlist2)
  if max(hlist2)<=0:
    return True
  
  cnt=0
  for i in range(N):
    if hlist2[i]>0:
      cnt+=-(-hlist2[i]//(A-B))
  return cnt<=m

l,r=1,mh//B+1
while l<=r:
  mid=(l+r)//2
  #print(l,mid,r)
  if not isOK(mid-1) and isOK(mid):
    print(mid)
    break
  elif isOK(mid-1):
    r=mid-1
  else:
    l=mid+1
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
alist=list(map(int,input().split()))

answer=-float("inf")
for i in range(N,2*N+1):
  alist1=alist[:i]
  alist2=alist[i:]
  #print(alist1,alist2)
  
  alist1.sort(reverse=True)
  alist2.sort()
  maxn_a1=sum(alist1[:N])
  minn_a2=sum(alist2[:N])
  #print(maxn_a1,minn_a2)
  answer=max(answer,maxn_a1-minn_a2)

print(answer)

Fixed submission:
import heapq
N=int(input())
alist=list(map(int,input().split()))

sum1=0
hq1=[]
for i in range(N):
  sum1+=alist[i]
  heapq.heappush(hq1,alist[i])
sum1_list=[sum1]
for i in range(N,2*N):
  heapq.heappush(hq1,alist[i])
  min_s1=heapq.heappop(hq1)  
  sum1+=alist[i]-min_s1
  sum1_list.append(sum1)
#print(sum1_list)  
  
alist_rev=alist[::-1]  
sum2=0
hq2=[]
for i in range(N):
  sum2+=alist_rev[i]
  heapq.heappush(hq2,-alist_rev[i])
sum2_list=[sum2]
for i in range(N,2*N):
  heapq.heappush(hq2,-alist_rev[i])
  max_s2=-heapq.heappop(hq2)
  sum2+=alist_rev[i]-max_s2
  sum2_list.append(sum2)
sum2_list.reverse()
#print(sum2_list)  

answer=-float("inf")
for i in range(N+1):
  answer=max(answer,sum1_list[i]-sum2_list[i])

print(answer)

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

#dp[3N][N]
dp=[[0 for _ in range(N+1)] for _ in range(3*N+1)]
for i in range(1,3*N+1):
  for j in range(1,N+1):
    if i<j:
      break
    dp[i][j]=max(dp[i-1][j],alist[i-1]+dp[i-1][j-1])
#print(dp)

alist_rev=alist[::-1]
dp_rev=[[float("inf") for _ in range(N+1)] for _ in range(3*N+1)]
dp_rev[0][0]=0
for i in range(1,3*N+1):
  dp_rev[i][0]=0
  for j in range(1,N+1):
    if i<j:
      break
    dp_rev[i][j]=min(dp_rev[i-1][j],alist_rev[i-1]+dp_rev[i-1][j-1])
#print(dp_rev)

slist=[]
for i in range(3*N+1):
  slist.append(dp[i][N])
  
slist_rev=[]
for i in range(3*N+1):
  slist_rev.append(dp_rev[-i-1][N])
  
#print(slist)
#print(slist_rev)

answer=-float("inf")
for i in range(N,2*N+1):
  score=slist[i]-slist_rev[i]
  answer=max(score,answer)
  
print(answer)

Fixed submission:
import heapq
N=int(input())
alist=list(map(int,input().split()))

sum1=0
hq1=[]
for i in range(N):
  sum1+=alist[i]
  heapq.heappush(hq1,alist[i])
sum1_list=[sum1]
for i in range(N,2*N):
  heapq.heappush(hq1,alist[i])
  min_s1=heapq.heappop(hq1)  
  sum1+=alist[i]-min_s1
  sum1_list.append(sum1)
#print(sum1_list)  
  
alist_rev=alist[::-1]  
sum2=0
hq2=[]
for i in range(N):
  sum2+=alist_rev[i]
  heapq.heappush(hq2,-alist_rev[i])
sum2_list=[sum2]
for i in range(N,2*N):
  heapq.heappush(hq2,-alist_rev[i])
  max_s2=-heapq.heappop(hq2)
  sum2+=alist_rev[i]-max_s2
  sum2_list.append(sum2)
sum2_list.reverse()
#print(sum2_list)  

answer=-float("inf")
for i in range(N+1):
  answer=max(answer,sum1_list[i]-sum2_list[i])

print(answer)
Buggy python submission (verdict: Runtime Error):
import sys
N=int(input())
slist=[x=="o" for x in input()]
#print(slist)

answer_list=[0]*(N+1)

if N==3:
  if slist.count(True)==3:
    print("SSS")
  elif slist.count(False)==3:
    print("WWW")
  else:
    print(-1)
  sys.exit(0)

ok=False
for p1,p2 in [(1,1),(1,-1),(-1,1),(-1,-1)]:
  answer_list[1]=p1
  answer_list[2]=p2
  if slist[1]:
    answer_list[3]=answer_list[1]
  else:
    answer_list[3]=-answer_list[1]
  for i in range(3,N+1):
    l=i-1
    r=i%N+1
    si=slist[i-1]

    if answer_list[i]==1:
      if si:
        if answer_list[l]==1:
          answer_list[r]=1
        else:
          answer_list[r]=-1
      else:
        if answer_list[l]==1:
          answer_list[r]=-1
        else:
          answer_list[r]=1
    elif answer_list[i]==-1:
      if si:
        if answer_list[l]==1:
          answer_list[r]=-1
        else:
          answer_list[r]=1
      else:
        if answer_list[l]==-1:
          answer_list[r]=1
        else:
          answer_list[r]=-1
    
  contra=False
  if slist[0]:
    if answer_list[1]==1 and answer_list[2]!=answer_list[N]:
      contra=True
    if answer_list[1]==-1 and answer_list[2]==answer_list[N]:
      contra=True
  elif not slist[0]:
    if anser_list[1]==1 and answer_list[2]==answer_list[N]:
      contra=True
    if anser_list[1]==-1 and answer_list[2]!=answer_list[N]:
      contra=True

  if not contra:
    ok=True
    break
      
if ok:
  #print(answer_list[1:])
  sw_list=[]
  for i in range(1,N+1):
    if answer_list[i]==1:
      sw_list.append("S")
    else:
      sw_list.append("W")
  print("".join(sw_list))  
else:
  print(-1)

Fixed submission:
N=int(input())
slist=[x=="o" for x in input()]
#print(slist)

answer_list=[0]*N

ok=False
for p1,p2 in [(1,1),(1,-1),(-1,1),(-1,-1)]:
  answer_list[0]=p1
  answer_list[1]=p2
  
  for i in range(2,N):
    if answer_list[i-1]==1:
      if slist[i-1]:
        answer_list[i]=answer_list[i-2]
      else:
        answer_list[i]=-answer_list[i-2]
    else:
      if slist[i-1]:
        answer_list[i]=-answer_list[i-2]
      else:
        answer_list[i]=answer_list[i-2]
        
  contra=False
  for i in range(N):
    l=(i-1)%N
    r=(i+1)%N
    if answer_list[i]==1:
      if slist[i]:
        if answer_list[l]!=answer_list[r]:
          contra=True
      else:
        if answer_list[l]==answer_list[r]:
          contra=True
    else:
      if slist[i]:
        if answer_list[l]==answer_list[r]:          
          contra=True
      else:
        if answer_list[l]!=answer_list[r]:
          contra=True

  if not contra:
    ok=True
    break
    
if ok:
  sw_list=[]
  for ans in answer_list:
    if ans==1:
      sw_list.append("S")
    else:
      sw_list.append("W")
  print("".join(sw_list))
else:
  print(-1)
Buggy python submission (verdict: Runtime Error):
import sys
n=int(input())
s=int(input())

if n==s:
  print(n+1)
  sys.exit(0)

def f(b,n):
  ret=0
  while n:
    ret+=n%b
    n//=b
  return ret

for b in range(2,int(n**0.5)+1):
  ss=f(b,n)
  if ss==s:
    print(b)
    sys.exit(0)

#n=pb+q
for p in range(1,int(n**0.5)+1):
  q=s-p
  b=(n-q)//p
  if q<0 or (n-q)%p!=0:
    continue
    
  ss=f(b,n)
  if ss==s:
    print(b)
    sys.exit(0)
    
print(-1)

Fixed submission:
import sys
n=int(input())
s=int(input())

if n==s:
  print(n+1)
  sys.exit(0)

def f(b,n):
  ret=0
  while n:
    ret+=n%b
    n//=b
  return ret

for b in range(2,int(n**0.5)+1):
#for b in range(2,n+2):
  ss=f(b,n)
  if ss==s:
    print(b)
    sys.exit(0)

#n=pb+q
for p in range(int((n-1)**0.5),0,-1):
  q=s-p
  b=(n-q)//p
  if q<0 or b<=q or b<2 or (n-q)%p!=0:
    continue
    
  #print(b,p,q)
  ss=f(b,n)
  if ss==s:
    print(b)
    sys.exit(0)
    
print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
n=int(input())
s=int(input())

def f(b,n):
  ret=0
  while n:
    ret+=n%b
    n//=b
  return ret

for b in range(2,n+2):
  ss=f(b,n)
  if ss==s:
    print(b)
    break
else:
  print(-1)

Fixed submission:
import sys
n=int(input())
s=int(input())

if n==s:
  print(n+1)
  sys.exit(0)

def f(b,n):
  ret=0
  while n:
    ret+=n%b
    n//=b
  return ret

for b in range(2,int(n**0.5)+1):
#for b in range(2,n+2):
  ss=f(b,n)
  if ss==s:
    print(b)
    sys.exit(0)

#n=pb+q
for p in range(int((n-1)**0.5),0,-1):
  q=s-p
  b=(n-q)//p
  if q<0 or b<=q or b<2 or (n-q)%p!=0:
    continue
    
  #print(b,p,q)
  ss=f(b,n)
  if ss==s:
    print(b)
    sys.exit(0)
    
print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import defaultdict
s=list(input())

for i in range(len(s)):
  subs=s[i:]
  dic=defaultdict(int)
  for k in range(len(subs)):
    dic[subs[k]]+=1
    if k>=1 and dic[subs[k]]>(k+1)//2:
      print(i+1,i+k+1)
      sys.exit(0)
else:
  print(-1,-1)

Fixed submission:
import sys
s=list(input())

for i in range(1,len(s)):
  if s[i-1]==s[i]:
    print(i,i+1)
    sys.exit(0)
  
for i in range(2,len(s)):
  if s[i-2]==s[i]:
    print(i-1,i+1)
    sys.exit(0)
    
print(-1,-1)
Buggy python submission (verdict: Time Limit Exceeded):
ans = 0
n = int(input())+1
for i in range(1,n):
    for j in range(i,n,i):
        ans += j
print(ans)

Fixed submission:
ans = 0
n = int(input())
for i in range(1,n+1):
    j = n//i
    ans += i*j*(j+1)//2
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def gcd(a,b):
	return gcd(b,a%b) if b else a
n = int(input())
a = list(map(int,input().split()))
lcm = 1
for v in a:
	lcm *= v//gcd(v,lcm)
ans = 0
for v in a:
	ans += lcm // v
print(ans%1000000007)

Fixed submission:
def gcd(a,b):
	return gcd(b,a%b) if b else a
n = int(input())
a = list(map(int,input().split()))
lcm = 1
for v in a:
	lcm *= v//gcd(v,lcm)
ans = 0
for v in a:
	ans += lcm // v
print(ans%1000000007)

Buggy python submission (verdict: Runtime Error):
import math
n = int(input())
a = list(map(int,input().split()))
lcm = 1
for v in a:
	lcm *= v//math.gcd(v,lcm)
ans = 0
for v in a:
	ans += lcm // v
print(ans%1000000007)

Fixed submission:
def gcd(a,b):
	return gcd(b,a%b) if b else a
n = int(input())
a = list(map(int,input().split()))
lcm = 1
for v in a:
	lcm *= v//gcd(v,lcm)
ans = 0
for v in a:
	ans += lcm // v
print(ans%1000000007)

Buggy python submission (verdict: Runtime Error):
import math
n = int(input())
a = list(map(int,input().split()))
lcm = 1
for v in a:
	lcm *= v//math.gcd(v,lcm)
ans = 0
for v in a:
	ans += lcm // v
print(ans%1000000007)

Fixed submission:
def gcd(a,b):
	return gcd(b,a%b) if b else a
n = int(input())
a = list(map(int,input().split()))
lcm = 1
for v in a:
	lcm *= v//gcd(v,lcm)
ans = 0
for v in a:
	ans += lcm // v
print(ans%1000000007)
Buggy python submission (verdict: Runtime Error):
import math as m
n,a=int(input()),list(map(int,input().split()))
b,c=[],[]
for i in range(n):
	b.append(m.gcd(b[i-1],a[i-1]) if i else 0)
	c.append(m.gcd(c[i-1],a[n-i]) if i else 0)
print(max([m.gcd(b[i],c[n-i-1]) for i in range(n)]))

Fixed submission:
def gcd(x,y):
	return gcd(y,x%y) if y else x
n,a,b,c=int(input()),list(map(int,input().split())),[],[]
for i in range(n):
	b.append(gcd(b[i-1],a[i-1]) if i else 0)
	c.append(gcd(c[i-1],a[n-i]) if i else 0)
print(max([gcd(b[i],c[n-i-1]) for i in range(n)]))
Buggy python submission (verdict: Runtime Error):
print("No War" if (lambda a:max(a[0][2],max(a[1]))<min(a[0][3],min(a[2])))([int(j) for j in input().split()] for i in range(3)]) else "War")

Fixed submission:
print("No War" if (lambda a:max(a[2],max(list(map(int,input().split()))))<min(a[3],min(list(map(int,input().split())))))(list(map(int,input().split()))) else "War")
Buggy python submission (verdict: Runtime Error):
n=int(input())
w=[input() for i in range(n)]
flag=True
for s in w:
    if w.count(s) > 1:
        flag = False
for i in range(1,n)
    if w[i][0] != w[i-1][len(w[i-1])-1]:
        flag = False
print("Yes" if flag else "No")


Fixed submission:
n=int(input())
w=[input() for i in range(n)]
flag=True
for s in w:
    if w.count(s) > 1:
        flag = False
for i in range(1,n):
    if w[i][0] != w[i-1][-1]:
        flag = False
print("Yes" if flag else "No")

Buggy python submission (verdict: Runtime Error):
n=int(input())
w=[input() for i in range(n)]
flag=True
for s in w:
    if w.count(s) > 1:
        flag = False
for i in range(1,n)
    if list(w[i])[0] != reversed(list(w[i-1]))[0]:
        flag = False
print("Yes" if flag else "No")

Fixed submission:
n=int(input())
w=[input() for i in range(n)]
flag=True
for s in w:
    if w.count(s) > 1:
        flag = False
for i in range(1,n):
    if w[i][0] != w[i-1][-1]:
        flag = False
print("Yes" if flag else "No")
Buggy python submission (verdict: Runtime Error):
print(int(input())-int(input())+1)

Fixed submission:
print((lambda a:a[0]-a[1]+1)(list(map(int,input().split()))))
Buggy python submission (verdict: Runtime Error):
N,M,Q = map(int,input().split())
t,ans = [[0 for j in range(N+1)] for i in range(N+1)],[[-1 for j in range(N+1)] for i in range(N+1)]
def solve(x, y):
	global ans,N,t
	if x > N or y == 0:
		return 0
	elif ans[x][y] != -1:
		return ans[x][y]
	else:
		ans[x][y] = solve(x,y-1) + solve(x+1,y) - solve(x+1,y-1) + t[x][y]
		return ans[x][y]
for i in range(M):
	l,r = map(int,input().split())
	t[l][r] += 1
for i in range(Q):
	p,q = map(int,input().split())
	print(solve(p,q))



Fixed submission:
n,m,q=map(int,input().split())
d=[[0 for j in range(n)] for i in range(n)]
for i in range(m):
	l,r=map(lambda x:int(x)-1,input().split())
	d[l][r]+=1
for l in range(n):
	for r in range(1,n):
		d[l][r]+=d[l][r-1]
for l in range(n-1,0,-1):
	for r in range(n):
		d[l-1][r]+=d[l][r]
for i in range(q):
	l,r=map(lambda x:int(x)-1,input().split())
	print(d[l][r])
Buggy python submission (verdict: Runtime Error):
print((int(input())%int(input())+99)//100)

Fixed submission:
n,k=map(int,input().split())
print(1 if n%k else 0)

Buggy python submission (verdict: Runtime Error):
print((int(input())%int(input())+99)/100)

Fixed submission:
n,k=map(int,input().split())
print(1 if n%k else 0)
Buggy python submission (verdict: Runtime Error):
print((lambda a,b:sum(b)-a)(input(),list(map(int,input().split()))))

Fixed submission:
print((lambda a,b:sum(b)-int(a))(input(),list(map(int,input().split()))))
Buggy python submission (verdict: Runtime Error):
n,m,d=map(float,input().split())
print((m-1.0)*(n-d)*((d>0.0)?2.0:1.0)/(n*n));

Fixed submission:
n,m,d=map(float,input().split())
print((m-1)*(n-d)*([1,2][d>0])/n**2);

Buggy python submission (verdict: Runtime Error):
n,m,d=map(float,input().split())
print((m-1.0)*(n-d)*((d)?2.0:1.0)/(n*n));

Fixed submission:
n,m,d=map(float,input().split())
print((m-1)*(n-d)*([1,2][d>0])/n**2);

Buggy python submission (verdict: Runtime Error):
n,m,d=map(float,input().split())
print((m-1)*(n-d)*((d)?2:1)/(n*n));

Fixed submission:
n,m,d=map(float,input().split())
print((m-1)*(n-d)*([1,2][d>0])/n**2);
Buggy python submission (verdict: Runtime Error):
n=input()
print(["Yes","No"][int(n)%sum(list(map(int,list(n))))])

Fixed submission:
n=input()
print(["Yes","No"][int(n)%sum(list(map(int,list(n))))>0])
Buggy python submission (verdict: Runtime Error):
n = int(input())
def f(x):
    x%10+f(x//10) if x else 0
print(min([f(i)+f(n-i) for i in range(0,n+1)]))

Fixed submission:
def f(x):
    return x%10+f(x//10) if x else 0
n = int(input())
print(min([f(i)+f(n-i) for i in range(1,n)]))
Buggy python submission (verdict: Runtime Error):
def isPrime(x):
	for i in range(2,min(x,236)):
		if x%i == 0:
			return False
	return True
n,a,p = int(input()),[],2
while n > 0:
	if isPrime(p):
		a.append(str(p))
		n -= 1
	p += 5
print(" ".join(a))


Fixed submission:
a,b = map(int,input().split())
print(a-1 if a > b else a)
Buggy python submission (verdict: Runtime Error):
a,b,c,k=map(int,input().split()),int(input())
print(max(a**k+b+c,a+b**k+c,a+b+c**k))

Fixed submission:
a,k = list(map(int,input().split())),int(input())
print(sum(a)+max(a)*2**k-max(a))
Buggy python submission (verdict: Runtime Error):
n,x,m = map(int,input().split()),[int(input()) for i in range(n)]
print(n+(x-sum(m))//min(m))

Fixed submission:
n,x = map(int,input().split())
m = [int(input()) for i in range(n)]
print(n+(x-sum(m))//min(m))
Buggy python submission (verdict: Time Limit Exceeded):
a,b,k = map(int,input().split())
for i in range(a,b+1):
	if (i-a)<k or (b-i)<k:
		print(i)


Fixed submission:
a,b,k = map(int,input().split())
if (b-a)<2*k:
	for i in range(a,b+1):
		if (i-a)<k or (b-i)<k:
			print(i)
else:
	for i in range(0,k):
		print(a+i)
	for i in range(k-1,-1,-1):
		print(b-i)
Buggy python submission (verdict: Runtime Error):
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<ll, P> E;
#define MOD (1000000007ll)
#define l_ength size
#define PI 3.14159265358979

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	b += MOD;
	a += b;
	a %= MOD;
}

int main(void){
	int n,m,i,j,ans=0,tmp;
	string s[123],t[123];
	cin >> n;
	for(i=0; i<n; ++i){
		cin >> s[i];
	}
	cin >> m;
	for(j=0; j<m; ++j){
		cin >> t[j];
	}
	for(i=0; i<n; ++i){
		tmp = 0;
		for(j=0; j<n; ++j){
			if(s[i] == s[j]){
				++tmp;
			}
		}
		for(j=0; j<m; ++j){
			if(s[i] == t[j]){
				--tmp;
			}
		}
		ans = max(ans,tmp);
	}
	cout << ans << endl;
	return 0;
}


Fixed submission:
n,s = int(input()),[]
for i in range(n):
	s.append(input())
m,t = int(input()),[]
for i in range(m):
	t.append(input())
ans = []
for i in range(n):
	ans.append(0)
	for j in range(n):
		if s[i] == s[j]:
			ans[i] += 1
	for j in range(m):
		if s[i] == t[j]:
			ans[i] -= 1
ans.append(0)
print(max(ans))
Buggy python submission (verdict: Runtime Error):
a=input()
op=list("+-")
flag = False
for i in range(op):
    for j in range(op):
        for k in range(op):
            s = a[0]+i+a[1]+j+a[2]+k+a[3]
            flag = True
            if eval(s) == 7:
                break
        if flag:
            break
    if flag:
        break
print(s+"=7")

Fixed submission:
a=input()
op=list("+-")
flag = False
for i in op:
    for j in op:
        for k in op:
            s = a[0]+i+a[1]+j+a[2]+k+a[3]
            if eval(s) == 7:
                flag = True
                break
        if flag:
            break
    if flag:
        break
print(s+"=7")