Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import heapq
a,b,c,k = map(int,input().split())
li = [1]*a + [0]*b + [-1]*c
print(sum(heapq.nlargest(k,li)))

Fixed submission:
a,b,c,k = map(int,input().split())
if a >= k:
    print(f"{k}")
else:
    if a + b >= k:
        print(f"{a}")
    else:
        print(f"{a*1 + b*0 + (k-a-b)*(-1)}")
Buggy python submission (verdict: Runtime Error):
n, m, x = map(int,input().split())

a = [[0 for i in range(m)] for _ in range(n)]
c = [0] * n
for sankousyo in range(n):
    c_and_a = list(map(int,input().split()))
    c[sankousyo] = c_and_a[0]
    a[sankousyo] = c_and_a[1:]
    
cost = [0] * (2**n)
INF = 10**12
res_cost = INF
for i in range(2**n):
    understandings = [0] * m
    cost_sum = 0
    for j in range(n):
        if (i >> j) & 1:

            cost_sum += c[j]
            
            for k in range(m):
                understandings[k] = understandings[k] + a[j][k]

    res = True
    for j in range(n):
        if understandings[j] < x:
            res = False 

    if res:
        if res_cost > cost_sum:
            res_cost = cost_sum

if res_cost == INF:
    print(-1)
else:
    print(f"お会計は{res_cost}円です")


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

a = [[0 for i in range(m)] for _ in range(n)]
c = [0] * n
for sankousyo in range(n):
    c_and_a = list(map(int,input().split()))
    c[sankousyo] = c_and_a[0]
    a[sankousyo] = c_and_a[1:]
    
cost = [0] * (2**n)
INF = 10**12
res_cost = INF
for i in range(2**n):
    understandings = [0] * m
    cost_sum = 0
    for j in range(n):
        if (i >> j) & 1:

            cost_sum += c[j]
            
            for k in range(m):
                understandings[k] = understandings[k] + a[j][k]

    res = True
    for j in range(m):
        if understandings[j] < x:
            res = False 

    if res:
        if res_cost > cost_sum:
            res_cost = cost_sum

if res_cost == INF:
    print(-1)
else:
    print(res_cost)
Buggy python submission (verdict: Runtime Error):
S = input()
assert S == ("ABC" or "ARC"), "Sは、ABCまたはARCです"
if S == "ABC":
    print("ARC")
else:
    print("ABC")

Fixed submission:
S = input()
assert S == "ABC" or "ARC", "Sは、ABCまたはARCです"
if S == "ABC":
    print("ARC")
else:
    print("ABC")
Buggy python submission (verdict: Time Limit Exceeded):
a,b,n=(map(int,input().split()))

ans=0

for i in range(n+1):
  c=int(a*i/b)-a*int(i/b)
  if c>ans:
    ans=c
    
print(ans)

Fixed submission:
A, B, N = map(int, input().split())
 
def solve(i):
  return A * i // B - A * (i // B)
 
print(solve(min(B-1, N)))
Buggy python submission (verdict: Time Limit Exceeded):
S=input()[::-1]
l=[0]*2019
a=1
d=0

for s in S:
  d=d+int(s)*a
  l[d%2019]+=1
  a*=10
  
ans=l[0]
for i in l:
  if i>=2:
    ans+=i*(i-1)//2
    
print(ans)

Fixed submission:
S=input()[::-1]
l=[0]*2019
a=1
d=0

for s in S:
  d=d+int(s)*a
  l[d%2019]+=1
  a*=10
  a%=2019
  
ans=l[0]
for i in l:
  if i>=2:
    ans+=i*(i-1)//2
    
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s=(input())
n=len(s)

print(sum([int(s[i:j+1])%2019==0 for i in range(n) for j in range(i+3,n)]))

Fixed submission:
S=input()[::-1]
l=[0]*2019
a=1
d=0

for s in S:
  d=d+int(s)*a
  l[d%2019]+=1
  a*=10
  a%=2019
  
ans=l[0]
for i in l:
  if i>=2:
    ans+=i*(i-1)//2
    
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s=(input())
n=len(s)

ans=0

s_ans=[int(s[i:j+1]) for i in range(n) for j in range(i+3,n)]

print(sum(map(lambda x:x%2019==0,s_ans)))

Fixed submission:
S=input()[::-1]
l=[0]*2019
a=1
d=0

for s in S:
  d=d+int(s)*a
  l[d%2019]+=1
  a*=10
  a%=2019
  
ans=l[0]
for i in l:
  if i>=2:
    ans+=i*(i-1)//2
    
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s=list(input())
n=len(s)

ans=0

for i in range(n):
  for j in range(i+3,n):
    s_ans=s[i:j+1]
    s_ans=int("".join(s_ans))
    if s_ans%2019==0:
      ans+=1
      
print(ans)

Fixed submission:
S=input()[::-1]
l=[0]*2019
a=1
d=0

for s in S:
  d=d+int(s)*a
  l[d%2019]+=1
  a*=10
  a%=2019
  
ans=l[0]
for i in l:
  if i>=2:
    ans+=i*(i-1)//2
    
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import math

k=int(input())

ans=0

for l in range(1,k+1):
  for m in range(1,k+1):
    for n in range(1,k+1):
      a=math.gcd(l,m)
      if a==1:
        ans+=1
      else:
        ans+=math.gcd(a,n)
        
print(ans)

Fixed submission:
import math

k=int(input())

ans=0

for l in range(1,k+1):
  for m in range(1,k+1):
    tmp=math.gcd(l,m)
    for n in range(1,k+1):
      gcd=math.gcd(tmp,n)
      ans+=gcd
      
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
l=input()

a=l.count("R")
b=l.count("G")
c=l.count("B")

ans=0
d=0
e=0
f=0

for _ in range(a):
  x=l.find("R",d)
  d=x+1
  for _ in range(b):
    y=l.find("G",e)
    e=y+1
    if e==l.rfind("G")+1:
      e=0
    for _ in range(c):
      z=l.find("B",f)
      f=z+1
      if f==l.rfind("B")+1:
        f=0
      if (abs(x-y)==abs(y-z)) or (abs(x-z)==abs(z-y)) or (abs(y-x)==abs(x-z)):
        ans+=1
    
print(a*b*c-ans)

Fixed submission:
n = int(input())
s = list(input())

ans = s.count('R') * s.count('G') * s.count('B')

for i in range(n):
    for j in range(i + 1, n):
        k = 2 * j - i

        if k >= n:
            continue

        if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
            ans -= 1

print(ans)
Buggy python submission (verdict: Runtime Error):
n,m=(map(int,input().split()))
l=list(map(int,input().split()))

l=sorted(l,reverse=True)

l_sum=sum(l)
ans="Yes"

for i in range(m):
  if l[m]<(l_sum/4/m):
    ans="No"
    break
    
print(ans)

Fixed submission:
n,m=(map(int,input().split()))
l=list(map(int,input().split()))

l=sorted(l,reverse=True)

l_sum=sum(l)
ans="Yes"

if l[m-1]<(l_sum/4/m):
  ans="No"
    
print(ans)

Buggy python submission (verdict: Runtime Error):
n,m=(map(int,input().split()))
l=list(map(int,input().split()))

l=sorted(l,reverse=True)

l_sum=sum(l)
ans="Yes"

for i in range(m):
  if l[m]<(l_sum*1/4/m):
    ans="No"
    break
    
print(ans)

Fixed submission:
n,m=(map(int,input().split()))
l=list(map(int,input().split()))

l=sorted(l,reverse=True)

l_sum=sum(l)
ans="Yes"

if l[m-1]<(l_sum/4/m):
  ans="No"
    
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
x=np.where(c-(a-b)>0,c-(a-b),0)

print(x)

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

x=0
if c-(a-b)>0:
  x=c-(a-b)

print(x)

Buggy python submission (verdict: Runtime Error):
a,b,c=int(input())
x=np.where(c-(a-b)>0,c-(a-b),0)

print(x)

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

x=0
if c-(a-b)>0:
  x=c-(a-b)

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

if n<100:
  print(min(n,9))
elif n<10000:
  print(min(n-90),909)
else:
  print(min(n-9090),90909)

Fixed submission:
n=int(input())

if n<100:
  print(min(n,9))
elif n<10000:
  print(min(n-90,909))
else:
  print(min(n-9090,90909))

Buggy python submission (verdict: Runtime Error):
n=int(input())
n1=len(str(n))

x=0
if n1=1:
  x=n
elif n1=2:
  x=9
elif n1=3:
  x=9+(n-99)
elif n1=4:
  x=9+90
elif n1=5:
  x=9+900+(n-999)
elif n1=6:
  x=9+900+90000
  
print(x)

Fixed submission:
n=int(input())

if n<100:
  print(min(n,9))
elif n<10000:
  print(min(n-90,909))
else:
  print(min(n-9090,90909))

Buggy python submission (verdict: Runtime Error):
n=int(input())
n1=len([i for i in str(n)])

x=0
if n1=1:
  x=n
elif n1=2:
  x=9
elif n1=3:
  x=9+(n-99)
elif n1=4:
  x=9+90
elif n1=5:
  x=9+900+(n-999)
elif n1=6:
  x=9+900+90000
  
print(x)

Fixed submission:
n=int(input())

if n<100:
  print(min(n,9))
elif n<10000:
  print(min(n-90,909))
else:
  print(min(n-9090,90909))

Buggy python submission (verdict: Runtime Error):
n=int(input())
n1=[int(i) for i in str(n)]
n2=len(n1)

x=0
if n1=1:
  x=n
elif n1=2:
  x=9
elif n1=3:
  x=9+(n-99)
elif n1=4:
  x=9+900
elif n1=5:
  x=9+900+(n-999)
  
print(x)

Fixed submission:
n=int(input())

if n<100:
  print(min(n,9))
elif n<10000:
  print(min(n-90,909))
else:
  print(min(n-9090,90909))
Buggy python submission (verdict: Runtime Error):
import math
n,d=map(int,input().split())
print(math.ceil(n/(2*d+1))

Fixed submission:
import math

n,d=map(int,input().split())
print(math.ceil(n/(2*d+1)))

Buggy python submission (verdict: Runtime Error):
n,d=map(int,input().split())
print(math.ceil(n/(2*d+1))

Fixed submission:
import math

n,d=map(int,input().split())
print(math.ceil(n/(2*d+1)))
Buggy python submission (verdict: Runtime Error):
n=int(input())

list=[]
for _ in range(n-1):
  list.append(int(input()))

for i in range(n-1):
  print(max(list.pop(i+1)))

Fixed submission:
N=int(input())

l=list(int(input()) for i in range(N))

sort_l=sorted(l,reverse=True)

for i in range(N):
  if l[i]==sort_l[0]:
    print(sort_l[1])
  else:
    print(sort_l[0])
Buggy python submission (verdict: Runtime Error):
n,a,b=int(input().split())

print(min(n*a,b))

Fixed submission:
n,a,b=map(int,input().split())
print(min(n*a,b))
Buggy python submission (verdict: Runtime Error):
n,d=map(int,input().split())

l=[]
for _ in range(n):
  l1=[map(int,input().split())]
  l.append(l1)

import math

ans=[]
for a in range(n):
  for b in range(n):
    x=0
    for c in range(d):
      D=(l[a][c]-l[b][c])**2
      x+=D
    y=math.sqrt(x)
    ans.append(y.is_integer())
      
ans=(ans.count(True)-n)//2
print(ans)

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

l=[]
for _ in range(n):
  l1=list(map(int,input().split()))
  l.append(l1)

import math

ans=[]
for a in range(n):
  for b in range(n):
    x=0
    for c in range(d):
      D=(l[a][c]-l[b][c])**2
      x+=D
    y=math.sqrt(x)
    ans.append(y.is_integer())
      
ans=(ans.count(True)-n)//2
print(ans)

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

l=[]
for _ in range(n):
  l1=[map(int,input().split())]
  l.append(l1)

import math

ans=[]
for a in range(n):
  for b in range(n):
    x=0
    for c in range(d):
      D=(l[a][c]-l[b][c])**2
      x+=D
    y=math.sqrt(x)
    ans.append(isinstance(y,int))
      
ans=(ans.count(True)-n)//2
print(ans)

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

l=[]
for _ in range(n):
  l1=list(map(int,input().split()))
  l.append(l1)

import math

ans=[]
for a in range(n):
  for b in range(n):
    x=0
    for c in range(d):
      D=(l[a][c]-l[b][c])**2
      x+=D
    y=math.sqrt(x)
    ans.append(y.is_integer())
      
ans=(ans.count(True)-n)//2
print(ans)

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

l=[]
for _ in range(n):
  l1=[map(int,input().split())]
  l.append(l1)

import math

ans=[]
for a in range(n):
  for b in range(n):
    a=0
    for c in range(d):
      D=(l[a][c]-l[b][c])**2
      a+=D
    ans.append(isinstance(math.sqrt(a),int))
      
ans=(ans.count(True)-n)//2
print(ans)

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

l=[]
for _ in range(n):
  l1=list(map(int,input().split()))
  l.append(l1)

import math

ans=[]
for a in range(n):
  for b in range(n):
    x=0
    for c in range(d):
      D=(l[a][c]-l[b][c])**2
      x+=D
    y=math.sqrt(x)
    ans.append(y.is_integer())
      
ans=(ans.count(True)-n)//2
print(ans)

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

l=[]
for _ in range(n):
  l1=[map(int,input().split())]
  l.append(l1)

import math

ans=[]
for a in range(n):
  for b in range(n):
    a=0
    for c in range(d):
      D=(l[a][c]-l[b][c])**2
      a+=D
    ans.append(isinstance(math.sqrt(a),int))
      
ans=sum(ans)-n
print(ans)

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

l=[]
for _ in range(n):
  l1=list(map(int,input().split()))
  l.append(l1)

import math

ans=[]
for a in range(n):
  for b in range(n):
    x=0
    for c in range(d):
      D=(l[a][c]-l[b][c])**2
      x+=D
    y=math.sqrt(x)
    ans.append(y.is_integer())
      
ans=(ans.count(True)-n)//2
print(ans)
Buggy python submission (verdict: Runtime Error):
l=[i for i in input()]

ans='No'

con=len(unique(l))
if (con==2) and (l.count(l[0])==2):
  ans='Yes'

print(ans)

Fixed submission:
l=[i for i in input()]

ans='No'

con=len(set(l))
if (con==2) and (l.count(l[0])==2):
  ans='Yes'

print(ans)
Buggy python submission (verdict: Runtime Error):
n,a=map(int,input().split())

apples=[a+i for i in ragen(n)]
eat=min(apples,key=lambda x:abs(x))
res=sum(apples)-eat

print(res)

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

l=[a+i-1 for i in range(1,n+1)]

import numpy as np
b=min(np.abs(l))

if b==0:
  l.remove(0)
elif b in l:
  l.remove(b)
elif -b in l:
  l.remove(-b)
  
print(sum(l))

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

l=[a+i-1 for i in range(1,n+1)]

import numpy as np
b=min(np.abs(l))

if b==0:
  l.remove(0)
else:
  l.remove([b,-b],1)
  
print(sum(l))

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

l=[a+i-1 for i in range(1,n+1)]

import numpy as np
b=min(np.abs(l))

if b==0:
  l.remove(0)
elif b in l:
  l.remove(b)
elif -b in l:
  l.remove(-b)
  
print(sum(l))

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

l=[a+i-1 for i in range(1,n+1)]

import numpy as np
b=min(np.abs(l))

if b==0:
  l.remove(0)
else:
  l.remove([b,-b])
  
print(sum(l))

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

l=[a+i-1 for i in range(1,n+1)]

import numpy as np
b=min(np.abs(l))

if b==0:
  l.remove(0)
elif b in l:
  l.remove(b)
elif -b in l:
  l.remove(-b)
  
print(sum(l))

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

l=[a+i-1 for i in range(1,n+1)]
b=min(abs(l))

if b==0:
  l.remove(0)
else:
  l.remove([b,-b])
  
print(sum(l))

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

l=[a+i-1 for i in range(1,n+1)]

import numpy as np
b=min(np.abs(l))

if b==0:
  l.remove(0)
elif b in l:
  l.remove(b)
elif -b in l:
  l.remove(-b)
  
print(sum(l))
Buggy python submission (verdict: Runtime Error):
x,a=map(int,input().split)

if x<a:
  print(0)
else:
  print(10)

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

if x<a:
  print(0)
else:
  print(10)

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

if x<a:
  print(0)
else:
  print(10)

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

if x<a:
  print(0)
else:
  print(10)

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

if x<a:
  print('0')
else:
  print('10')

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

if x<a:
  print(0)
else:
  print(10)
Buggy python submission (verdict: Runtime Error):
n,x=map(int,input().split())
l=[int(input()) for _ in range(n)]

ans=0
a=0
for i in range(n):
  if a<=x:
    a+=l[0]
    ans+=1
        
print(ans)

Fixed submission:
n,x=map(int,input().split())
l=list(map(int,input().split()))

ans=1
a=0
for i in range(n):
  a+=l[i]
  if a>x:
    break
  else:
    ans+=1
    
print(ans)

Buggy python submission (verdict: Runtime Error):
n,x=map(int,input().split())
l=[int(input()) for _ in range(n)]

ans=0
a=0
for i in range(n):
  if i==0:
    ans+=1
    continue
  else:
    if a<=x:
      ans+=1
      a+=l[i-1]
    else:
      break

print(ans)

Fixed submission:
n,x=map(int,input().split())
l=list(map(int,input().split()))

ans=1
a=0
for i in range(n):
  a+=l[i]
  if a>x:
    break
  else:
    ans+=1
    
print(ans)
Buggy python submission (verdict: Runtime Error):
p,q,r=map(int,input().split())

l=list(p,q,r)
l=sorted(l)

print(l[0]+l[1])

Fixed submission:
p,q,r=map(int,input().split())

print(p+q+r-max(p,q,r))
Buggy python submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))

ans=[]
left=0
right=0

for i in range(n):
  left=sum(l[:i+1])
  right=sum(l[i+1:])
  ans+=abs(left-right)
  
print(min(ans))

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

ans=[]
left=0
right=0

for i in range(n):
  left=sum(l[:i+1])
  right=sum(l[i+1:])
  ans.append(abs(left-right))
  
print(min(ans))

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

ans=[]
for i in range(n):
  left=sum(l[:i+1])
  right=sum(l[i+1:])
  ans+=abs(left-right)
  
print(min(ans))

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

ans=[]
left=0
right=0

for i in range(n):
  left=sum(l[:i+1])
  right=sum(l[i+1:])
  ans.append(abs(left-right))
  
print(min(ans))

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

sum_l=sum(l)

sum=0
a=0
for i in range(n):
  sum+=l[i]
  if sum>sum_l/2:
    a=i-1
    break
    
ans=abs(sum(l[:a])-sum(l[a:]))
print(ans)

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

ans=[]
left=0
right=0

for i in range(n):
  left=sum(l[:i+1])
  right=sum(l[i+1:])
  ans.append(abs(left-right))
  
print(min(ans))
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())

l=[]
for _ in range(m):
  a,b=map(int,input().split())
  l1=list(range(a,b+1))
  l.append(l1)
  
con=0
for x in range(1,n+1):
  ans=[x in i for i in l]
  con+=all(ans)
  
print(con)

Fixed submission:
n,m=map(int,input().split())
lm=0
rm=10**9
 
for i in range(m):
    l,r=map(int,input().split())
    lm=max(lm,l)
    rm=min(rm,r)
 
print(max(0,rm-lm+1))
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=[i for i in str(input())]

l[k]=l[k].lower()

print(''.join(l))

Fixed submission:
n,k=map(int,input().split())
l=[i for i in str(input())]

l[k-1]=l[k-1].lower()

print(''.join(l))
Buggy python submission (verdict: Runtime Error):
l=[i for i in str(input())]
A=int(''.join(l[:2]))
B=int(''.join(l[2:]))

if A==00 or A>=13:
  if B==00 or B>=13:
    print('NA')
  else:
    print('YYMM')
elif A>=01 and A<=12:
  if B==00 or B>=13:
    print('MMYY')
  else:
    print('AMBIGUOUS')
  

Fixed submission:
l=[i for i in str(input())]
A=int(''.join(l[:2]))
B=int(''.join(l[2:]))

if A==0 or A>=13:
  if B==0 or B>=13:
    print('NA')
  else:
    print('YYMM')
elif A>=1 and A<=12:
  if B==0 or B>=13:
    print('MMYY')
  else:
    print('AMBIGUOUS')
Buggy python submission (verdict: Runtime Error):
a,b,t=map(int,input().split())
 
ans=[]
while a<=t+0.5:
  ans.appen(b)
  a+=a
  
print(sum(ans))

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

print(t//a*b)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[int(input()) for _ range(n)]
b=[int(input()) for _ range(n)]

ans=0
for i in range(n):
  if a[i]>b[i]:
    ans+=a[i]

print(ans)

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

ans=0
for i in range(n):
  if a[i]>b[i]:
    ans+=a[i]-b[i]

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

if a=b:
  print(2*a)
  
else:
  print(2*max(a,b)-1)

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

if a==b:
  print(2*a)
  
else:
  print(2*max(a,b)-1)

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

ans=0

if a=b:
  ans+=2*a
  print(ans)
else:
  ans+=2*max(a,b)-1
  print(ans)

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

if a==b:
  print(2*a)
  
else:
  print(2*max(a,b)-1)

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

ans=0

if a=b:
  ans+=2*a
  print(ans)
else:
  ans+=2*max(a,b)-1
  print(ans)

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

if a==b:
  print(2*a)
  
else:
  print(2*max(a,b)-1)

Buggy python submission (verdict: Runtime Error):
a,b=int(input())

ans=0

if a=b:
  ans+=2*a
  print(ans)
else:
  ans+=2*max(a,b)-1
  print(ans)

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

if a==b:
  print(2*a)
  
else:
  print(2*max(a,b)-1)
Buggy python submission (verdict: Runtime Error):
n=int(input())
l=[int(input().split()) for _ in range(n)]

ans=1
a=l[0]
for i in range(n-1):
  if a<=l[i+1]:
    ans+=1
    a=max(a,l[i])

print(ans)

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

ans=1
a=l[0]
for i in range(n-1):
  if a<=l[i+1]:
    ans+=1
    a=l[i+1]

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,k=(map(int,input().split()))

list=[]
for _ in range(n):
  a,b=(map(int,input().split()))
  list+=[a]*b
  
print(sorted(list)[k-1])

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

ans_list=[0]*(10**5+1)
#print(len(ans_list))

for _ in range(n):
  a,b=(map(int,input().split()))
  ans_list[a]+=b

#print(ans_list)
s=0
ans=0

for n,i in enumerate(ans_list):
  s+=i
  ans=n
  if s>=k:
    print(ans)
    break
Buggy python submission (verdict: Runtime Error):
import math

n=int(input())
n_sqrt=int(math.sqrt(n))

ans=[]

for i in range(1,n_sqrt):
  if n%i==0:
    x=int(max(math.log10(i)+1,math.log10(n//i)+1))
    ans.append(x)

print(min(ans))

Fixed submission:
import math

n=int(input())
n_sqrt=int(math.sqrt(n))

ans=[]

for i in range(1,n_sqrt+1):
  if n%i==0:
    x=int(max(math.log10(i)+1,math.log10(n//i)+1))
    ans.append(x)

print(min(ans))
Buggy python submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
for i in range(100):
    c-=b
    if c<=0:
        print("Yes")
        break
    else:
        a-=d
        if a<=0:
            print("No")
            break

Fixed submission:
s,w=map(int,input().split())
if s>w :
    print("safe")
else:
    print("unsafe")
Buggy python submission (verdict: Time Limit Exceeded):
K=int(input())
import numpy
sum=0
for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            sum+=numpy.gcd(numpy.gcd(i,j),k)
print(sum)

Fixed submission:
K=int(input())
from math import gcd
sum=0
for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            sum+=gcd(gcd(i,j),k)
print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
K=int(input())
import math
sum=0
for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            sum+=math.gcd(math.gcd(i,j),k)
print(sum)

Fixed submission:
K=int(input())
from math import gcd
sum=0
for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            sum+=gcd(gcd(i,j),k)
print(sum)
Buggy python submission (verdict: Runtime Error):
if S=="Sunny":
    S="cloudy"
elif S=="cloudy":
    S="Rainy"
elif S=="Rainy":
    S="Sunny"

Fixed submission:
S=input()
if S=="Sunny":
    S="Cloudy"
elif S=="Cloudy":
    S="Rainy"
elif S=="Rainy":
    S="Sunny"
print(S)
Buggy python submission (verdict: Runtime Error):
S=input()
e=S[0::2]
o=S[1::2]
for i in range(len(e)):
    if s[i]=="L":
        print("No")
        break
else:
  for j in range(len(o)):
    if o[j]=="R":
        print("No")
        break 
  else:
    print("Yes")   

Fixed submission:
S=input()
e=S[0::2]
o=S[1::2]
for i in range(len(e)):
    if e[i]=="L":
        print("No")
        break
else:
    for j in range(len(o)):
        if o[j]=="R":
            print("No")
            break 
    else:
        print("Yes")
Buggy python submission (verdict: Runtime Error):
N=input()
print(N**3)

Fixed submission:
N=input()
print(int(N)**3)
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()

Slen = len(S)
Tx = T[0:Slen]

if S == Tx:print("Yes")
else: print("No")


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

sum1 = 0
sum2 = 0
sum3 = 0

if k < a: sum = k
if k >= a and k < a+b: sum = a
if k >= a+b: sum = a-(k-a-b)

print(sum)

Buggy python submission (verdict: Runtime Error):
S = input()
T = input()

Slen = len(S)
Tx = T[0:Slen]

if S == Tx:print("Yes")
else: print("No")


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

sum1 = 0
sum2 = 0
sum3 = 0

if k < a: sum = k
if k >= a and k < a+b: sum = a
if k >= a+b: sum = a-(k-a-b)

print(sum)

Buggy python submission (verdict: Runtime Error):
S = input()
T = input()

Slen = len(S)
Tx = T[0:Slen]

if S == Tx:print("Yes")
else: print("No")


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

sum1 = 0
sum2 = 0
sum3 = 0

if k < a: sum = k
if k >= a and k < a+b: sum = a
if k >= a+b: sum = a-(k-a-b)

print(sum)