Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
q=int(input())
for i in range(q):
  a,b=map(int,input().split())
  h=0
  for j in range(a,b+1):
    for v in range(2,j):
      if j%v==0:
        for k in range(2,(j+1)/2):
          if j%k==0:
            h+=1
          else:
            pass
      else:
        pass
      
  print(h)
        
    

Fixed submission:
Q = int(input())
lr_list = [list(map(int, input().split())) for _ in range(Q)]

max_val = max([lr[1] for lr in lr_list])

# エラトステネスの篩
num_list = list(range(max_val + 1))
for num in num_list[2:max_val // 2 + 1]:
    if num > 0:
        for i in range(num*2, max_val+1, num):
            num_list[i] = -1

prime_num_set = set([num for num in num_list if num>0][1:])

# 累積和
sum_list = [0, 0, 0]
for i in range(3, max_val+1):
    if i in prime_num_set and (i+1)//2 in prime_num_set:
        sum_list.append(sum_list[-1]+1)
    else:
        sum_list.append(sum_list[-1])

for l, r in lr_list:
    print(sum_list[r] - sum_list[l-1])
Buggy python submission (verdict: Runtime Error):
h=int(input())
g=0
for i in range(3):
  if h[i]==1:
    g+=1
print(g)

Fixed submission:
h=input()
g=0
for i in range(3):
  if h[i]=="1":
    g+=1
print(g)

Buggy python submission (verdict: Runtime Error):
h=int(input())
g=0
for i in range(3):
  if h[i]==1:
    i+=1
print(g)

Fixed submission:
h=input()
g=0
for i in range(3):
  if h[i]=="1":
    g+=1
print(g)
Buggy python submission (verdict: Runtime Error):
n=int(input())
k=100000000000000000000000000000000000000000
for i in range(n):
  j=0
  a=int(input())
  while a%2==0:
    a=a/2
    j+=1
  k=min(j,k)
  
print(k)


Fixed submission:
n=int(input())
k=10000000000000000000000000000000000000000
a=list(map(int,input().split()))
for i in range(n):
  j=0
  while a[i]%2==0:
    a[i]=a[i]/2
    j+=1
  k=min(j,k)
  
print(k)

Buggy python submission (verdict: Runtime Error):
n=int(input())
k=100000000000000000000000000000000000000000
for i in range(n):
  j=0
  a=int(input())
  while a%2==0:
    a=a/2
    j+=1
  min(j,k)
  
print(k)

Fixed submission:
n=int(input())
k=10000000000000000000000000000000000000000
a=list(map(int,input().split()))
for i in range(n):
  j=0
  while a[i]%2==0:
    a[i]=a[i]/2
    j+=1
  k=min(j,k)
  
print(k)
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
a=list(map(int,input().split()))
s=set(a)
h=[]
ans=0
for i in s:
  l=a.count(i)
  h.append(l)
if len(s)-k>0:
  for i in range(len(s)-k):
    ans+=min(h)
    h.remove(min(h))
  print(ans)
else:
  print(0)

Fixed submission:
from collections import Counter
n, k = map(int, input().split())
a = list(map(int, input().split()))
a = sorted(Counter(a).values(), reverse=True)
print(sum(a[k:]))
Buggy python submission (verdict: Runtime Error):
n=int(input())
l=[0]*n+1
l[0]=2
l[1]=1

for i in range(2,n+2):
  l[i]=l[i-1]+l[i-2]
print(l[n+1])

Fixed submission:
n=int(input())
l=[0]*(n+1)
l[0]=2
l[1]=1

for i in range(2,n+1):
  l[i]=l[i-1]+l[i-2]
print(l[n])
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=[]
ans=0
for i in range(n):
  a=input()
  if a in s:
    s.remove(a)
    ans-=1
  else:
    s.append(a)
    ans+=1
print(ans)

Fixed submission:
from collections import Counter
N = int(input())
A = Counter([int(input()) for _ in range(N)])
ans = 0
for val in A.values():
    if val % 2 == 1:
        ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
P = list(map(int,input().split()))
ans = 0
for i in range(N - 1):
  if P[i] == i+1:
    P[i],P[i+1] = P[i+1],P[i]
    ans += 1
if P[-1] == N:
  ans += 1
print(ans)


Fixed submission:
x,t=map(int,input().split())
if x-t>0:
  print(x-t)
else:
  print(0)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
k=0
ans=0
while k<n:
  if a[k]==k and a[k+1]==k:
    k+=2
    ans+=1
  elif a[k]==k and a[k+1]!=k:
    k+=1
    ans+=1
  else:
    pass
print(ans)
    
    

Fixed submission:
N = int(input())
P = list(map(int,input().split()))
ans = 0
for i in range(N - 1):
  if P[i] == i+1:
    P[i],P[i+1] = P[i+1],P[i]
    ans += 1
if P[-1] == N:
  ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
x=input()
s=[a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z]
for i in s:
  if x.count(i)==0:
    print(i)
    exit()

Fixed submission:
x=input()
s=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
for i in s:
  if x.count(i)==0:
    print(i)
    exit()
print("None")
Buggy python submission (verdict: Runtime Error):
n=input()
print(n[0]+(len(n)-2)+n[-1])

Fixed submission:
n=input()
print(n[0]+str(len(n)-2)+n[-1])
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
j=0
k=0
l=0
for i in a:
  if i%4==0:
    l+=1
  elif i%2==0:
    k+=1
  else:
    j+=1
if l<=j :
  print("Yes")
else:
  print("No")


Fixed submission:
H, W = map(int, input().split())
N = int(input())
a = list(map(int, input().split()))

b = []
for i in range(N):
    b.extend([i + 1] * a[i])

for i in range(H):
    row = b[i * W:(i + 1) * W]
    if i % 2 == 1:
        row.reverse()
    print(' '.join([str(c) for c in row]))
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
s=[]
for i in range(m):
  d=list(map(int,input().split()))
  s.append(d)
for j in range(m-1):
  for k in range(j+1,m):
    if (s[j][0]==1 and s[j][1]==s[k][0] and s[k][1]==n) or (s[k][0]==1 and s[k][1]==s[j][0] and s[j][1]==n):
      print("POSSIBLE")
      exit()
print("IMPOSSIBLE")


Fixed submission:
n,m=map(int,input().split())
s=[[] for i in range(n)]
for i in range(m):
  a,b=map(int,input().split())
  s[a-1].append(b)
for j in s[0]:
  if n in s[j-1]:
    print("POSSIBLE")
    exit()
print("IMPOSSIBLE")

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
s=[]
for i in range(m):
  d=list(map(int,input().split()))
  s.append(d)
for j in range(n-1):
  for k in range(j,n):
    if (s[j][0]==1 and s[j][1]==s[k][0] and s[k][1]==n) or (s[k][0]==1 and s[k][1]==s[j][0] and s[j][1]==n):
      print("POSSIBLE")
      exit()
print("IMPOSSIBLE")

Fixed submission:
n,m=map(int,input().split())
s=[[] for i in range(n)]
for i in range(m):
  a,b=map(int,input().split())
  s[a-1].append(b)
for j in s[0]:
  if n in s[j-1]:
    print("POSSIBLE")
    exit()
print("IMPOSSIBLE")
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
a.reverse()
print(sum(0,k+1))

Fixed submission:
n,k=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
a.reverse()
print(sum(a[0:k]))
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=[]
k=s[0]
ans=0
for i in range(n):
  a=int(input())
  s.append(a)
for j in range(n+1):
  if s[k]==2:
    ans+=1
    print(ans)
    exit()
  else:
    ans+=1
    k=s[s[k]]
print(-1)  

Fixed submission:
n=int(input())
s=[]
ans=0
for i in range(n):
  a=int(input())
  s.append(a)
k=s[0]
for j in range(n+1):
  if k==2:
    ans+=1
    print(ans)
    exit()
  else:
    ans+=1
    k=s[k-1]
print(-1)
Buggy python submission (verdict: Runtime Error):
import math
n,m=map(int,input().split())
if n=m+1 or m=n+1:
  print((math.factorial(n)*math.factorial(m))%(10**9+7))
elif n=m:
  print(((math.factorial(n)*math.factorial(m))*2)%(10**9+7))
else:
  print(0)
  

Fixed submission:
import math
n,m=map(int,input().split())
if n==m+1 or m==n+1:
  print((math.factorial(n)*math.factorial(m))%(10**9+7))
elif n==m:
  print(((math.factorial(n)*math.factorial(m))*2)%(10**9+7))
else:
  print(0)
Buggy python submission (verdict: Time Limit Exceeded):
n,a,b=map(int,input().split())
s=[]
ans=0
for i in range(n):
  h=int(input())
  s.append(h)
while max(s)>0:
  ans+=1
  s.sort()
  s[-1]-=a-b
  for i in range(n):
    s[i]-=b
print(ans)

Fixed submission:
_,a,b,*H=map(int,open(0).read().split())
l,r=0,10**9
while r-l>1:
	m=(l+r)//2
	if-sum(min(0,(h-m*b)//(b-a))for h in H)>m:l=m
	else:r=m
print(r)
Buggy python submission (verdict: Runtime Error):
h,w=map(int,input().split())
print("#"*(w+2))
for i in range(h):
  d=input()
  d.insert("#",0)
  d.append("#")
  print(d)
print("#"*(w+2))

Fixed submission:
from collections import deque
h,w=map(int,input().split())
print("#"*(w+2))
for i in range(h):
  d=input()
  print("#"+d+"#")
print("#"*(w+2))
Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
a = []
M = 0
for i in range(N):
  a.append(list(map(int,input().split())))
a.sort()
print(a)
for i in range(N):
    K = K-a[i][1]
    if K <= 0:
        print(a[i][0])
        break

Fixed submission:
a,b,c=map(int,input().split())
if a<=c<=b:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
l=[]
g=0
for i in range(m):
  a,b=map(int,input().split())
  a.append(l)
  b.append(l)
  
for j in range(1,n+1):
  g+=l.count(j)
  
print(g)

Fixed submission:
n,m=map(int,input().split())
l=[]
for i in range(m):
  a,b=map(int,input().split())
  l.append(a)
  l.append(b)
  
for j in range(1,n+1):
  print(l.count(j))

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
l=[]
g=0
for i in range(n):
  a,b=map(int,input().split())
  a.append(l)
  b.append(l)
  
for j in range(1,n+1):
  g+=l.count(j)
  
print(g)
  

Fixed submission:
n,m=map(int,input().split())
l=[]
for i in range(m):
  a,b=map(int,input().split())
  l.append(a)
  l.append(b)
  
for j in range(1,n+1):
  print(l.count(j))
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
p=[]
for i in range(n):
  a,b=map(int,input().split())
  p+=[a]*b
p.sort() 




print(p[k-1])

Fixed submission:
N,K = map(int,input().split())
a = []
M = 0
for i in range(N):
  a.append(list(map(int,input().split())))
a.sort()
for i in range(N):
    K = K-a[i][1]
    if K <= 0:
        print(a[i][0])
        break

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
p=[]
for i in range(n):
  a,b=map(int,input().split())
  for j in range(b):
    p.append(a)
p.sort() 
 

print(p[k-1])

Fixed submission:
N,K = map(int,input().split())
a = []
M = 0
for i in range(N):
  a.append(list(map(int,input().split())))
a.sort()
for i in range(N):
    K = K-a[i][1]
    if K <= 0:
        print(a[i][0])
        break
Buggy python submission (verdict: Runtime Error):
n,t=map(int,input().split())
a=list(map(int,input().split()))
j=t
for i in range(1,n+1):
  if a[i]>t:
    j+=t
  else:
    j+=a[i]
    
print(j)

Fixed submission:
n,t=map(int,input().split())
a=list(map(int,input().split()))
j=t
for i in range(1,n):
  if a[i]-a[i-1]>t:
    j+=t
  else:
    j+=a[i]-a[i-1]
    
print(j)
Buggy python submission (verdict: Runtime Error):
x, y =map(int,input().split())
 
print("Alice") if abs(x - y) >= 2 else print("Brown")

Fixed submission:
a,b,c=input().split()
g=[a[0].upper(),b[0].upper(),c[0].upper()]
print("".join(g))
Buggy python submission (verdict: Runtime Error):
a=input()
b=input()
n=[]
for i in range(len(a)):
  n.append(a[i])
  if i<=len(b):
    n.append(b[i])
print("".join(n))

Fixed submission:
a=input()
b=input()
n=[]
for i in range(len(a)):
  n.append(a[i])
  if i<=len(b)-1:
    n.append(b[i])
print("".join(n))

Buggy python submission (verdict: Runtime Error):
a=input()
b=input()
n=[]
for i in range(len(a)):
  n.append(a[i])
  n.append(b[i])
print("".join(n))

Fixed submission:
a=input()
b=input()
n=[]
for i in range(len(a)):
  n.append(a[i])
  if i<=len(b)-1:
    n.append(b[i])
print("".join(n))
Buggy python submission (verdict: Runtime Error):
a.b=map(int,input().split())
print((a+b)%24)

Fixed submission:
a,b=map(int,input().split())
print((a+b)%24)

Buggy python submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
v=list(map(int,input().split()))
v.sort()
v.reverse()
ave=0
for i in range(a):
  ave+=v[i]
  
print(ave/a)

l=0
for j in range(a,b):
  if v[a-1]==v[j]:
    l+=1
    
p=v.count(v[a-1])

from math import factorial
a=factorial(p) / factorial(p-l) / factorial(l)
print(a)
  

Fixed submission:
a,b=map(int,input().split())
print((a+b)%24)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
ans=10**10
for i in range(1,n+1):
  if n%i==0:
    a=max(len(str(i)),len(str(n//i)))
    if a<ans:
      ans=a
print(ans)

Fixed submission:
import math
n=int(input())
ans=10**10
for i in range(1,round(math.sqrt(n+1))+5):
  if n%i==0:
    a=max(len(str(i)),len(str(n//i)))
    if a<ans:
      ans=a
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
n,a,b=map(int,input().split())
x=list(map(int,input().split()))
x.sort()
x.reverse()

j=a+1
moto=0
h=0
d=x[a-1]
asd=0
l=x.count(d)
for i in range(a):
  moto+=x[i]
  if x[i]==x[a-1]:
    h+=1
print(moto/a)
if x[0]==x[a-1]:
  for i in range(a,b+1):
    asd+=math.factorial(l)//(math.factorial(l-i)*math.factorial(i))
  print(asd)
else:
  print(math.factorial(l)//(math.factorial(l-h)*math.factorial(h)))   

Fixed submission:
import math
n,a,b=map(int,input().split())
x=list(map(int,input().split()))
x.sort()
x.reverse()

j=a+1
moto=0
h=0
d=x[a-1]
asd=0
l=x.count(d)
for i in range(a):
  moto+=x[i]
  if x[i]==x[a-1]:
    h+=1
print(moto/a)
if moto/a==x[a-1]:
  for i in range(a,b+1):
    if l-i>=0:
      asd+=math.factorial(l)//(math.factorial(l-i)*math.factorial(i))
  print(asd)
else:
  print(math.factorial(l)//(math.factorial(l-h)*math.factorial(h)))

Buggy python submission (verdict: Runtime Error):
import math
n,a,b=map(int,input().split())
x=list(map(int,input().split()))
x.sort()
x.reverse()

j=a+1
moto=0
h=0
d=x[a-1]
asd=0
l=x.count(d)
for i in range(a):
  moto+=x[i]
  if x[i]==x[a-1]:
    h+=1
print(moto/a)
if moto/a==x[a-1]:
  for i in range(a,b+1):
    asd+=math.factorial(l)//(math.factorial(l-i)*math.factorial(i))
  print(asd)
else:
  print(math.factorial(l)//(math.factorial(l-h)*math.factorial(h)))   

Fixed submission:
import math
n,a,b=map(int,input().split())
x=list(map(int,input().split()))
x.sort()
x.reverse()

j=a+1
moto=0
h=0
d=x[a-1]
asd=0
l=x.count(d)
for i in range(a):
  moto+=x[i]
  if x[i]==x[a-1]:
    h+=1
print(moto/a)
if moto/a==x[a-1]:
  for i in range(a,b+1):
    if l-i>=0:
      asd+=math.factorial(l)//(math.factorial(l-i)*math.factorial(i))
  print(asd)
else:
  print(math.factorial(l)//(math.factorial(l-h)*math.factorial(h)))
Buggy python submission (verdict: Runtime Error):
a,b=input().split()
if a=="H":
  print(b):
else:
  if b=="H":
    print("D")
  else:
    print("H")

Fixed submission:
a,b=input().split()
if a=="H":
  print(b)
else:
  if b=="H":
    print("D")
  else:
    print("H")
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())

i=1

for j in range(1,n+1):
  i*=j
  
print(i%(10**9+7))

Fixed submission:
n=int(input())

i=1

for j in range(1,n+1):
  i*=j
  i%=10**9+7
  
print(i)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

# input
s = input()

# solve
for i in range(len(s)):
    if s[i] == 'A':
        a = i
        break

for i in reversed(range(len(s))):
    if s[i] == 'Z':
        z = i
        break

# output
print(z - a + 1)


Fixed submission:
x=int(input())
if 1200>x:
  print("ABC")
  
else:
  print("ARC")

Buggy python submission (verdict: Runtime Error):

 s = str(input())
 

 for i in range(len(s)):
    if s[i] == 'A':
        a = i
        break
 
 for i in reversed(range(len(s))):
    if s[i] == 'Z':
        z = i
        break
 

 print(z - a + 1)

Fixed submission:
x=int(input())
if 1200>x:
  print("ABC")
  
else:
  print("ARC")
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

# input
s = input()

# solve
for f in range(len(s)):
    if s[i] == 'A':
        a = i
        break

for f in reversed(range(len(s))):
    if s[i] == 'Z':
        z = i
        break

# output
print(z - a + 1)


Fixed submission:
# -*- coding: utf-8 -*-

# input
s = input()

# solve
for i in range(len(s)):
    if s[i] == 'A':
        a = i
        break

for i in reversed(range(len(s))):
    if s[i] == 'Z':
        z = i
        break

# output
print(z - a + 1)

Buggy python submission (verdict: Runtime Error):
 s = str(input())
 

 for i in range(len(s)):
    if s[i] == 'A':
        a = i
        break
 
 for i in reversed(range(len(s))):
    if s[i] == 'Z':
        z = i
        break
 

 print(z - a + 1)

Fixed submission:
# -*- coding: utf-8 -*-

# input
s = input()

# solve
for i in range(len(s)):
    if s[i] == 'A':
        a = i
        break

for i in reversed(range(len(s))):
    if s[i] == 'Z':
        z = i
        break

# output
print(z - a + 1)
Buggy python submission (verdict: Time Limit Exceeded):
x=int(input())
k=True
i=0
while x>0:
  if k==True:
    x-=6
    i+=1
    k=not True
  else:
    x-=5
    i+=1
    k=True
    
print(i)


Fixed submission:
n=int(input())
ans=n//11
if n%11>6:
  print(ans*2+2)
elif n%11==0:
  print(ans*2)
else:
  print(ans*2+1)
Buggy python submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
x=list(map(int,input().split()))
ans=0
for i in range(n):
  if (x[i+1]-x[i])*a>=b:
    ans+=b
  else:
    ans+=(x[i+1]-x[i])*a
print(ans)

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

Fixed submission:
a,c,b=input().split()
if c=="+":
  print(int(a)+int(b))
else:
  print(int(a)-int(b))
Buggy python submission (verdict: Runtime Error):
s= input()
u= s[::-1]
 
k=["resare","esare","remaerd","maerd"]
 
l=u.replace("resare","")
d=l.replace("esare","")
h=d.replace("remaerd","")
w=h.replace("maerd","")
  
print(w)    
if w="":
  print("Yes")
  
else:
  print("No")

Fixed submission:
l=input()
if l=="a" or l=="e" or l=="i" or l=="o" or l=="u":
  print("vowel")
else:
  print("consonant")
Buggy python submission (verdict: Runtime Error):
s = input()
u=s[::-1]

k=[maerd,remaerd,esare,resare]

for i in k:
  if u.find(k):
    s.strip(k)
    
if u==[]:
  print("Yes")
  
else:
  print("No")


Fixed submission:
s= input()
u= s[::-1]
 
k=["resare","esare","remaerd","maerd"]
 
l=u.replace("resare","")
d=l.replace("esare","")
h=d.replace("remaerd","")
w=h.replace("maerd","")
  
    
if w:
  print("NO")
  
else:
  print("YES")
Buggy python submission (verdict: Runtime Error):
a,b,x = map(int,input().split())

num= range(a,b)

d =0

for c in num:
  if c%x == 0:
    d+=1
  else:
    continue

print(d)

Fixed submission:
n=input().split()
print(n[0][0]+n[1][0]+n[2][0])
Buggy python submission (verdict: Time Limit Exceeded):
a,b,x = map(int,input().split())
 
d =0
 
for c in range(a,b+1):
  if c%x == 0:
    d+=1
print(d)

Fixed submission:
a,b,x = map(int,input().split())
 
print(b//x-(a-1)//x)

Buggy python submission (verdict: Time Limit Exceeded):
a,b,x = map(int,input().split())

num= range(a,b+1)

d =0

for c in num:
  if c%x == 0:
    d+=1
  else:
    pass

print(d)

Fixed submission:
a,b,x = map(int,input().split())
 
print(b//x-(a-1)//x)
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input())

if a==b+c or b==a+c or c==a+b:
  print("Yes")
  
else:
  print("No")

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

if a==b+c or b==a+c or c==a+b:
  print("Yes")
  
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n,t=map(int,input().split())
a=list(map(int,input().split()))
max=0
ans=1
for i in range(len(a)-1):
  for j in range(i+1,len(a)):
    if (a[j]-a[i])>max:
      max=a[j]-a[i]
      ans=1
    elif (a[j]-a[i])==max:
      ans+=1
    else:
      pass
print(ans)
  

Fixed submission:
n,t=map(int,input().split())
a=list(map(int,input().split()))
max=0
min=1000000000000000000000000000000000000
ans=1
for i in range(len(a)-1):
  if a[i]<min:
    min=a[i]
  elif min==a[i] or max==a[i]-min:
    ans+=1
  elif max<a[i]-min:
    ans=1
    max=a[i]-min
if a[len(a)-1]-min==max:
  ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input())

s=k*(k-1)**(n-1)

print(s)

Fixed submission:
n,k=map(int,input().split())

s=k*(k-1)**(n-1)

print(s)
Buggy python submission (verdict: Runtime Error):
n=int(input())

t=[0]*n
a=[0]*n

for i in range(n):
    t,a=map(int,input().split()) 
  
  
  
for i in range(n-1):
  while (t[i]>t[i+1]) or (a[i]>a[i+1]):
    for k in range(1,100000000000000000000000000000000):
      t[i+1]*=k
      a[i+1]*=k
      
print(a[n]+t[n])

Fixed submission:
N = int(input())
x, y = 1, 1
for i in range(N):
    a, b = map(int, input().split())
    n = max((x-1 + a) // a, (y - 1 +b) // b)
    x = n * a
    y = n * b
print(x + y)
Buggy python submission (verdict: Runtime Error):
a,b,h=map(int,input().split())

print((a+b)*h/2)

Fixed submission:
a=int(input())
b=int(input())
h=int(input())

print(round((a+b)*h/2))

Buggy python submission (verdict: Runtime Error):
a,b,h=map(int,input().split())

print((a+B)*h/2)

Fixed submission:
a=int(input())
b=int(input())
h=int(input())

print(round((a+b)*h/2))
Buggy python submission (verdict: Runtime Error):
sa=input()
sb=input()
sc=input()
print(sa[0])
while True:
  k="a"
  if k=="a":
    if sa==[]:
      print("A")
      exit()
    else:
      k=sa[0]
      sa=sa[1:]
  if k=="b":
    if sb==[]:
      print("B")
      exit()
    else:
      k=sb[0]
      sb=sb[1:]
  if k=="c":
    if sc==[]:
      print("C")
      exit()
    else:
      k=sc[0]
      sc=sc[1:]

Fixed submission:

SA = input()
SB = input()
SC = input()
turn = "a"
while min(len(SA), len(SB), len(SC)) >= 0:
    if turn == "a":
        if len(SA) == 0:
            print("A")
            break
        else:
            turn = SA[0]
            SA = SA[1:]
    elif turn == "b":
        if len(SB) == 0:
            print("B")
            break
        else:
            turn = SB[0]
            SB = SB[1:]
    else:
        if len(SC) == 0:
            print("C")
            break
        else:
            turn = SC[0]
            SC = SC[1:]
Buggy python submission (verdict: Runtime Error):
n,k,x,y=map(int,input().split())

if n>k:
  print(k*x+(n-k)*y)

else:
  print(n*x)
      

Fixed submission:
n = int(input())
k = int(input())
x= int(input())
y= int(input())

if n>k:
  print(k*x+(n-k)*y)

else:
  print(n*x)

Buggy python submission (verdict: Runtime Error):
n,k,x,y=map(int,input().split())

if n>k:
  print(k*x+(n-k)*y)

else:
  print(k*x)
      

Fixed submission:
n = int(input())
k = int(input())
x= int(input())
y= int(input())

if n>k:
  print(k*x+(n-k)*y)

else:
  print(n*x)

Buggy python submission (verdict: Runtime Error):
n,k,x,y=map(int,input().split())

if n>=k:
  print(k*x+(n-k)*y)

else:
  print(k*x)
      

Fixed submission:
n = int(input())
k = int(input())
x= int(input())
y= int(input())

if n>k:
  print(k*x+(n-k)*y)

else:
  print(n*x)

Buggy python submission (verdict: Runtime Error):
n,k,x,y=map(int,input().split())

if n>=k:
  print(round(k*x+(n-k)*y))

else:
  print(round(k*x))
      

Fixed submission:
n = int(input())
k = int(input())
x= int(input())
y= int(input())

if n>k:
  print(k*x+(n-k)*y)

else:
  print(n*x)

Buggy python submission (verdict: Runtime Error):
n,k,x,y=map(int,input().split())

if n>k:
  print(round(k*x+(n-k)*y))

else:
  print(round(k*x))
      

Fixed submission:
n = int(input())
k = int(input())
x= int(input())
y= int(input())

if n>k:
  print(k*x+(n-k)*y)

else:
  print(n*x)

Buggy python submission (verdict: Runtime Error):
n,k,x,y=map(int,input().split())

if n>k:
  print(round(k*x+(n-k)*y)
        
else:
        print(round(k*x)
        

Fixed submission:
n = int(input())
k = int(input())
x= int(input())
y= int(input())

if n>k:
  print(k*x+(n-k)*y)

else:
  print(n*x)
Buggy python submission (verdict: Runtime Error):
n =int,input()

print(n*(n+1)/2)

Fixed submission:
n = int(input())

print(round(n*(n+1)/2))
Buggy python submission (verdict: Time Limit Exceeded):
import collections
n=input()
s=[]
for i in range(len(n)-1):
  s.append(n[i])
  for j in range(i+1,len(n)):
    s.append(n[j])
    
    t=collections.Counter(s)
    
    d=t.most_common()[0][1]  
    
    if (j-i+1)/d<2:
      print(i+1,j+1)
      exit()
  s=[] 
print("-1 -1")

Fixed submission:
n=input()
for i in range(len(n)-1):
  if n[i]==n[i+1]:
    print(i+1,i+2)
    exit()
for i in range(len(n)-2):
  if n[i]==n[i+2]:
    print(i+1,i+3)
    exit()
print(-1,-1)