Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02983 (python)

Fixed submission:
l,r=map(int,input().split())
a=[]
b=[]
if r-l>=2018:
  print(0)
else:
  for i in range(0,r-l+1):
    a.append((l+i)%2019)
  
  for j in range(0,r-l):
    for k in range(j+1,r-l+1):
      b.append((a[j]*a[k])%2019)
      
  print(min(b))

Buggy submission (verdict: Runtime Error):
l,r=map(int,input(),split())
a=[]
if r-l>=2018:
  print(0)
else:
  for i in range(0,r-l+1):
    a.append((l+i)%2019)
  
  a=sorted(a)
  print(a[0]*a[1])
Problem p02993 (python)

Fixed submission:
s=input()
ans=0
for i in range(0,3):
  if s[i]==s[i+1]:
    ans+=1
  else:
    ans+=0

if ans==0:
  print("Good")
else:
  print("Bad")

Buggy submission (verdict: Runtime Error):
s=input()
ans=0
for i in range(0,3):
  if s[i]=s[i+1]:
    ans+=1
  else:
    ans+=0

if ans==0:
  print("Good")
else:
  print("Bad")

Buggy submission (verdict: Runtime Error):
s=input()
ans=0
for i in range(0,len(s)-1):
  if s[i]=s[i+1]:
    ans+=1
  else:
    ans+=0

if ans==0:
  print("Good")
else:
  print("Bad")
Problem p02995 (python)

Fixed submission:
a,b,c,d=map(int,input().split())
def gcd(x,y):
  if x%y==0:
    return y
  else:
    return gcd(y,x%y)
    
r=int((c*d)/gcd(c,d)) 
s=(b//c)-((a-1)//c)
t=(b//d)-((a-1)//d)
u=(b//r)-((a-1)//r)

print(int(b-a+1-s-t+u))

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
def gcd(x,y):
  if x%y==0:
    return y
  else:
    return gcd(x%y,y)
    
r=(c*d)/gcd(c,d)    
s=(b//c)-((a-1)//c)
t=(b//d)-((a-1)//d)
u=(b//r)-((a-1)//r)

print(int(b-a+1-s-t+u))

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
def gcd(x,y):
  if x%y==0:
    return y
  else:
    return gcd(x%y,y)
    
r=gcd(c,d)    
s=(b//c)-((a-1)//c)
t=(b//d)-((a-1)//d)
u=(b//r)-((a-1)//r)

print(b-a+1-s-t+u)

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
def gcd(x,y):
  if x%y==0:
    print(y)
  else:
    gcd(x%y,y)
    
r=gcd(c,d)    
s=(b//c)-((a-1)//c)
t=(b//d)-((a-1)//d)
u=(b//r)-((a-1)//r)

print(b-a+1-s-t+u)
Problem p03029 (python)

Fixed submission:
a,p=map(int,input().split())
x=3*a+p
print(x//2)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
s=[list(map(int,input().split()))[1:] for i in range(m)]
p=list(map(int,input().split()))
cnt=0

for i in range(2**n):
    pattern=format(i,"b").zfill(n)
    point=0
    
    for j in range(m):
        swi=0
        for k in s[j]:
            if pattern[k-1]=="1":
              swi +=1
        if swi%2==p[j]:
          point +=1
    if point==m:
      cnt +=1
      
print(cnt)

Buggy submission (verdict: Runtime Error):
n=int(input())
s,p=list(map(int,input().split()))
li=[]
for i in range(0,n):
  li.append((i+1,s[i],p[i]))

new_li=sorted(li,key=lambda x:x[1])
new2_li=sorted(new_li,key=lambda x:x[2])

for j in range(0,n):
  print(new2_li[j][0])

Buggy submission (verdict: Runtime Error):
a,p=map(int(input().split()))
x=3*a+p
print(x//2)

Buggy submission (verdict: Runtime Error):
a,p=int(input().split())
x=3*a+p
if x%2==0:
  print(x/2)
else:
  print((x-1)/2)
Problem p03030 (python)

Fixed submission:
n=int(input())

li=[]

for i in range(0,n):
  s,p=input().split()
  p=int(p)
  li.append((i+1,s,p))


new_li=sorted(li,key=lambda x:x[2] , reverse=True)
new2_li=sorted(new_li,key=lambda x:x[1])


for j in range(0,n):
  print(new2_li[j][0])

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

for i in range(0,n):
  li.append((i+1,s[i],p[i]))


new_li=sorted(li,key=lambda x:x[2] , reverse=True)
new2_li=sorted(new_li,key=lambda x:x[1])


for j in range(0,n):
  print(new2_li[j][0])

Buggy submission (verdict: Runtime Error):
n=int(input())
s,p=input().split()
p=int(p)
li=[]

for i in range(0,n):
  li.append((i+1,s,p))


new_li=sorted(li,key=lambda x:(x[1],-x[2]))


for j in range(len(new2_li)):
  print(new_li[j][0])

Buggy submission (verdict: Runtime Error):
n=int(input())
s,p=input().split()
p=int(p)
li=[]

for i in range(0,n):
  li.append((i+1,s[i],p[i]))

new_li=sorted(li,key=lambda x:x[1])

new2_li=sorted(new_li,key=lambda x:x[2] , reverse=True)

for j in range(0,n):
  print(new2_li[j][0])

Buggy submission (verdict: Runtime Error):
n=int(input())
s,p=list(input().split())

li=[]
for i in range(0,n):
  li.append((i+1,s[i],p[i]))

new_li=sorted(li,key=lambda x:x[1])

new2_li=sorted(new_li,key=lambda x:x[2] , reverse=True)

for j in range(0,n):
  print(new2_li[j][0])

Buggy submission (verdict: Runtime Error):
n=int(input())
s=str(input().split())
p=int(input().split())
li=[]
for i in range(0,n):
  li.append((i+1,s[i],p[i]))

new_li=sorted(li,key=lambda x:x[1])

new2_li=sorted(new_li,key=lambda x:x[2] , reverse=True)

for j in range(0,n):
  print(new2_li[j][0])

Buggy submission (verdict: Runtime Error):
n=int(input())
s,p=int(input().split())
li=[]
for i in range(0,n):
  li.append((i+1,s[i],p[i]))

new_li=sorted(li,key=lambda x:x[1])

new2_li=sorted(new_li,key=lambda x:x[2] reverse=True)

for j in range(0,n):
  print(new2_li[j][0])

Buggy submission (verdict: Runtime Error):
n=int(input())
s,p=list(map(int,input().split()))
li=[]
for i in range(0,n):
  li.append((i+1,s[i],p[i]))

new_li=sorted(li,key=lambda x:x[1])
new2_li=sorted(new_li,key=lambda x:x[2])

for j in range(0,n):
  print(new2_li[j][0])

Buggy submission (verdict: Runtime Error):
n=int(input())
s,p=list(map(int,input().split()))
li=[]
for i in range(0,n):
  li.append(i+1,s[i],p[i])

new_li=sorted(li,key=lambda x:x[1])
new2_li=sorted(new_li,key=lambda x:x[2])

for j in range(0,n):
  print(new2_li[j][0])
Problem p03031 (python)

Fixed submission:
n,m=map(int,input().split())
s=[list(map(int,input().split()))[1:] for i in range(m)]
p=list(map(int,input().split()))
cnt=0

for i in range(2**n):
    pattern=format(i,"b").zfill(n)
    point=0
    
    for j in range(m):
        swi=0
        for k in s[j]:
            if pattern[k-1]=="1":
              swi +=1
        if swi%2==p[j]:
          point +=1
    if point==m:
      cnt +=1
      
print(cnt)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
s=[list(map(int,input().split()))[1:] for i in range(m)]
p=list(map(int,input().split()))
cnt=0

for i in range(2**n):
    pattern=format(i,"b").zfill(n)
    point=0
    
    for j in range(m):
        swi=0
        for k in s[j]:
            if pattern[k-1]=="1":
              swi +=1
        if swi%2==P[j]:
          point +=1
    if point==m:
      cnt +=1
      
print(cnt)
Problem p03037 (python)

Fixed submission:
n,m=map(int,input().split())
lm,mr=0,n
for i in range(m):
  l,r=map(int,input().split())
  lm=max(lm,l)
  mr=min(mr,r)
  x=mr-lm+1

if x>=0:
  print(x)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
lm,mr=0,n
for i in range(m):
  l,r=map(int(input()).split())
  lm=max(lm,l)
  mr=min(mr,r)
  x=mr-lm+1

if x>=0:
  print(x)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
lm,mr=0,n
for i in range(m):
  l,r=map(int(input()))
  lm=max(lm,l)
  mr=min(mr,r)
  x=mr-lm+1

if x>=0:
  print(x)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
l=[list(map(int,input().split()))[0] for i in range(m)]
r=[list(map(int,input().split()))[1] for i in range(m)]
lm=max(l)
mr=min(r)
x=mr-lm+1

if x>=0:
  print(x)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
l,r=[list(map(int,input().split())) for i in range(m)]

lm=max(l)
mr=min(r)
x=mr-lm+1

if x>=:
  print(x)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
l=[list(map(int,input().split()))[0] for i in range(m)]
r=[list(map(int,input().split()))[1] for i in range(m)]
lm=max(l)
mr=min(r)
x=mr-lm+1

if x>=:
  print(x)
else:
  print(0)
Problem p03043 (python)

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

for i in range(1,n+1):
  x=0
  while i*(2**x)<k:
    x+=1
  a.append(x)
    
ans=0
for j in range(0,n):
  ans+=(1/n)*(2**(-a[j]))
  
print(ans)

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

for i in range(1,n+1):
  x=0
  while i*(2**x)<k:
    x+=1
    a.append(x+1)
    
ans=0
for j in range(0,n):
  ans+=(1/n)*(2**(-a[j]))
  
print(ans)

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

for i in range(1,n+1):
  x=0
  while i*(2**x)<=k:
    x+=1
    a.append(x+1)
    
ans=0
for j in range(0,n):
  ans+=(1/n)*(2**(-a[j]))
  
print(ans)
Problem p03059 (python)

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

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

l=[]
l.append(0)
l.append(0)
r=[]
r.append(a[n-1])
r.append(a[n-1])
g=[]

def gcd(x,y):
  if x%y==0:
    return y
  else:
    return gcd(y,x%y)


for i in range(1,n):
  l.append(gcd(l[i],a[i-1]))
  r.append(gcd(r[i],a[n-1-i]))
  
r[0]=l[n]

for j in range(0,n):
  g.append(gcd(l[j+1],r[n-j-1]))

print(max(g))
Problem p03060 (python)

Fixed submission:
n=int(input())
v=list(map(int,input().split()))
c=list(map(int,input().split()))
ans=0
for i in range(0,n):
  if v[i]-c[i]>0:
    ans+=v[i]-c[i]
  
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
v=list(map(int,input().split()))
c=list(map(int,input().split()))
a[0]*n
for i in range(0,n):
  a[i]=v[i]-c[i]
  
ans=0  
for j in range(0,n):
  if a[j]>0:
    ans+=a[j]
    
print(ans)
Problem p03061 (python)

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

l=[]
l.append(0)
l.append(0)
r=[]
r.append(a[n-1])
r.append(a[n-1])
g=[]

def gcd(x,y):
  if x%y==0:
    return y
  else:
    return gcd(y,x%y)


for i in range(1,n):
  l.append(gcd(l[i],a[i-1]))
  r.append(gcd(r[i],a[n-1-i]))
  
r[0]=l[n]

for j in range(0,n):
  g.append(gcd(l[j+1],r[n-j-1]))

print(max(g))

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

l=[]
l.append(0)
l.append(0)
r=[]
r.append(a[n-1])
r.append(a[n-1])
g=[]

def gcd(x,y):
  if x%y==0:
    return y
  else:
    return gcd(y,x%y)


for i in range(1,n):
  l.append(gcd(l[i],a[i-1]))
  r.append(gcd(r[i],a[n-1-i]))
  
r[0]=0

for j in range(0,n):
  g.append(gcd(l[j+1],r[n-j-1]))

print(max(g))

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

l=[]
l.append(0)
l.append(0)
r=[]
r.append(0)
r.append(a[n-1])
g=[]

def gcd(x,y):
  if x%y==0:
    return y
  else:
    return gcd(y,x%y)


for i in range(1,n):
  l.append(gcd(l[i],a[i-1]))
  r.append(gcd(r[i],a[n-1-i]))
  
  
for j in range(0,n):
  g.append(gcd(l[j+1],r[n-j-1]))

print(max(g))

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

l=[]
l.append(0)
l.append(0)
r=[]
r.append(0)
r.append(a[n-1])
g=[]

def gcd(x,y):
  if x%y==0:
    return y
  else:
    return gcd(y,x%y)


for i in range(1,n):
  l.append(gcd(l[i],a[i-1]))
  r.append(gcd(r[i],a[n-1-i]))
  
  
for j in range(0,n):
  g.append(gcd(l[j+1],r[n-j-1]))

print(max(g))

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

l=[]
l.append(a[0])
r=[]
r.append(a[n-1])
g=[]

def gcd(x,y):
  if x%y==0:
    return y
  else:
    return gcd(y,x%y)


for i in range(1,n):
  l.append(gcd(l[i-1],a[i]))
  r.append(gcd(r[i-1],b[n-1-i]))
  
  
for j in range(0,n-2):
  g.append(gcd(l[i],r[n-3-i]))
  
g.append(l[n-1])  
g.append(r[n-1])

print(max(g))

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

l=[]
l.append(a[0])
r=[]
r.append(a[n-1])
g=[]

def gcd(x,y):
  if x%y==0:
    return y
  else:
    return gcd(y,x%y)
  
for i in range(1,n-1):
  l.append(gcd(l[i-1],b[i]))
  r.append(gcd(r[i-1],b[n-1-i]))
  
for j in range(0,n):
  g.append(gcd(l[i],r[n-2-i]))
  
print(max(g))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=[0]*n
x=0
def gcd(x,y):
  if x%y==0:
    print(y)
  else:
    return gcd(y,x%y)
  
for i in range(0,n-1):
  for j in range(i+1,n):
    x=gcd(a[i],a[j])
    b.append(x)
    
print(max(b))
Problem p03086 (python)

Fixed submission:
s=list(str(input()))
li=["A","C","G","T"]
ans=0
x=[0]
for i in range(0,len(s)):
  if s[i] in li:
    ans+=1
    x.append(ans)
  else:
    ans=0
        
print(max(x))

Buggy submission (verdict: Runtime Error):
s=list(str(input()))
li=["A","C","G","T"]
ans=0
x=[]
for i in range(0,len(s)):
  if s[i] in li:
    ans+=1
    x.append(ans)
  else:
    ans=0
        
print(max(x))
Problem p03087 (python)

Fixed submission:
n,q=map(int,input().split())
s=list(str(input()))
l=[]
r=[]
ans=0
x=[0]
for i in range(q):
  l1,r1=map(int,input().split())
  l.append(l1)
  r.append(r1)

for j in range(0,n-1):
  if s[j]=="A" and s[j+1]=="C":
    ans+=1
    x.append(ans)
  else:
    x.append(ans)

for k in range(0,q):
  print(x[r[k]-1]-x[l[k]-1])

Buggy submission (verdict: Runtime Error):
n,q=map(int,input().split())
s=list(str(input()))
l=[]
r=[]
ans=0
x=[0]
for i in range(q):
  l1,r1=map(int,input().split())
  l.append(l1)
  r.append(r1)

for j in range(0,n):
  if s[j]=="A" and s[j+1]=="C":
    ans+=1
    x.append(ans)
  else:
    x.append(ans)

for k in range(0,q):
  print(x[r[k]-1]-x[l[k]-1])

Buggy submission (verdict: Runtime Error):
n,q=map(int,input().split())
s=list(str(input()))
l=[]
r=[]
ans=0
x=[0]
for i in range(q):
  l1,r1=map(int,input().split())
  l.append(l1)
  r.append(r1)

for j in range(0,n):
  if s[j]=="A" and s[j+1]=="C":
    ans+=1
    x.append(ans)
  else:
    x.append(ans)
x.append(x[-1])  

for k in range(0,q):
  print(x[r[k]-1]-x[l[k]-1])

Buggy submission (verdict: Runtime Error):
n,q=map(int,input().split())
s=list(str(input()))
l=[]
r=[]
ans=0
x=[]
for i in range(q):
  l1,r1=map(int,input().split())
  l.append(l1)
  r.append(r1)

for j in range(0,n):
  if s[j]=="A" and s[j+1]=="C":
    ans+=1
    x.append(ans)
  
for k in range(0,q):
  print(x[r[k]-1]-x[l[k]-1])

Buggy submission (verdict: Runtime Error):
n,q=map(int,input().split())
s=list(str(input()))
l=[]
r=[]
ans=0
x=[]
for i in range(q):
  l1,r1=map(int,input().split())
  l.append(l1)
  r.append(r1)

for j in range(0,n):
  if s[j]=="A" and s[j+1]=="C":
      ans+=1
      x.append(ans)
  
for k in range(0,q):
  print(x[r[k]-1]-x[l[k]-1])

Buggy submission (verdict: Runtime Error):
n,q=map(int,input().split())
s=list(str(input()))
l=[]
r=[]
ans=0
x=[]
for i in range(q):
  l1,r1=map(int,input().split())
  l.append(l1)
  r.append(r1)

for j in range(0,q):
  for k in range(l[j],r[j]):
    if s[k]=="A" and s[k+1]=="C":
      ans+=1
    else:
      ans+=0
  x.append(ans)
  ans=0
  
for m in range(0,q):
  print(x[m])

Buggy submission (verdict: Runtime Error):
n,q=map(int,input().split())
s=list(str(input()))
l=[]
r=[]
ans=0
x=[]
for i in range(q):
  x1,y1=[int(i) for i in input().split()]
  x.append(x1)
  y.append(y1)
  
for j in range(0,q):
  for k in range(l[j],r[j]):
    if s[k]=="A" and s[k+1]=="C":
      ans+=1
    else:
      ans+=0
  x.append(ans)
  ans=0
  
for m in range(0,q):
  print(x[m])

Buggy submission (verdict: Runtime Error):
n,q=map(int(input()).split())
s=list(str(input()))
l=[]
r=[]
ans=0
x=[]
for i in range(q):
  x1,y1=[int(i) for i in input().split()]
  x.append(x1)
  y.append(y1)
  
for j in range(0,q):
  for k in range(l[j],r[j]):
    if s[k]=="A" and s[k+1]=="C":
      ans+=1
    else:
      ans+=0
  x.append(ans)
  ans=0
  
for m in range(0,q):
  print(x[m])
Problem p03106 (python)

Fixed submission:
def gcd(x,y):
  if x%y==0:
    return y
  else:
    return gcd(y,x%y)

a,b,k=map(int,input().split())
z=gcd(a,b)
ans=[]
for i in range(1,z+1):
  if z%i==0:
    ans.append(i)
    
print(ans[-k])

Buggy submission (verdict: Runtime Error):
def gcd(x,y):
  if x%y==0:
    return y
  else:
    return gcd(y,x%y)

a,b,k=map(int,input().split())
z=gcd(a,b)
ans=[]
for i in range(1,z):
  if z%i==0:
    ans.append(i)
    
print(ans[-k])
Problem p03109 (python)

Fixed submission:
s=input()
if int(s[5:7])>4:
  print("TBD")
else:
  print("Heisei")

Buggy submission (verdict: Runtime Error):
s=int(input())
if int(s[5:7])>4:
  print("TBD")
else:
  print("Heisei")
Problem p03110 (python)

Fixed submission:
n=int(input())
x=list(input().split() for _ in range(n))
ans=0
for i in range(n):
  if str(x[i][1])=="JPY":
    ans+=float(x[i][0])
  else:
    ans+=float(x[i][0])*380000
    
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
x=list(str,input().split() for _ in range(n))
ans=0
for i in range(n):
  if x[i][1]=="JPY":
    ans+=int(x[i][0])
  else:
    ans+=float(x[i][0])*380000
    
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
x=list(str,input().split() for _ in range(n))
ans=0
for i in range(n):
  if x[i][1]=="JPY":
    ans+=int(x[i][0])
  else:
    ans+=int(x[i][0])*380000
    
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
x=list(input().split() for _ in range(n))
ans=0
for i in range(n):
  if str(x[i][1])=="JPY":
    ans+=int(x[i][0])
  else:
    ans+=int(x[i][0])*380000
    
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
x=list(input().split(), for i in range(n))
ans=0
for j in range(n):
  if x[j][1]=="JPY":
    ans+=x[j][0]
  else:
    ans+=x[j][0]*380000
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
x=[]
u=[]
for i in range(n):
  x.append(int(input()))
  u.append(str(input()))
ans=0
for j in range(n):
  if u[j]=="JPY":
    ans+=x[j]
  else:
    ans+=x[j]*380000
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
x=[]
u=[]
for i in range(n):
  x.append(int(input()))
  u.append(str(input()))
ans=0
for j in range(n):
  if u[j]=="JPY":
    ans+=x[j]
  else:
    ans+=u[j]*380000
print(ans)
Problem p03125 (python)

Fixed submission:
a,b=map(int,input().split())
if b%a==0:
  print(a+b)
else:
  print(b-a)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
ans=[0]*m
for i in range(n):
  x=[int(a),for a in input().split()]
  for j in range(1,x[0]+1):
    ans[x[j]-1]+=1
  
print(ans.count(n))
Problem p03126 (python)

Fixed submission:
n,m=map(int,input().split())
ans=[0]*m
for i in range(n):
  x=list(map(int,input().split()))
  for j in range(1,x[0]+1):
    ans[x[j]-1]+=1
  
print(ans.count(n))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
ans=[0]*m
for i in range(n):
  x=[int(a),for a in input().split()]
  for j in range(1,x[0]+1):
    ans[x[j]-1]+=1
  
print(ans.count(n))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
ans=[0]*m
for i in range(n):
  x=[int,input().split()]
  for j in range(1,x[0]+1):
    ans[x[j]-1]+=1
  
print(ans.count(n))
Problem p03136 (python)

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
cnt=0
l.sort()
for i in range(0,n-1):
  cnt+=l[i]
if cnt>l[n-1]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
cnt=0
l.sort()
for i in range(0,n-1):
  cnt+=l[i]
if cnt>l[n]:
  print("Yes")
else:
  print("No")
Problem p03231 (python)

Fixed submission:
n,m=map(int,input().split())
s=str(input())
t=str(input())
def gcd(x, y):
    if x % y == 0:
        return(y)
    else:
        return gcd(y,x%y)
def lcm(a,b):
    return a*b//gcd(a,b)
a=n//gcd(n,m)
b=m//gcd(n,m)
for i in range(gcd(n,m)):
    if s[a*i]!=t[b*i]:
        print("-1")
        exit()
print(lcm(n,m))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
s=str(input())
t=str(input())
from math import gcd
def lcm(a,b):
    return a*b//gcd(a,b)
if n%m!=0:
    if s[0]==t[0]:
        print(lcm(n,m))
    else:
        print("-1")
else:
    x=n//m
    for i in range(m):
        if s[0+x*i]!=t[i]:
            print("-1")
            exit()
    print(lcm(n,m))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
s=str(input())
t=str(input())
from math import gcd
def lcm(a,b):
    return a*b//gcd(a,b)
if n%m!=0:
    if s[0]==t[0]:
        print(lcm(n,m))
    else:
        print("-1")
else:
    x=n//m
    for i in range(m):
        if s[0+x*i]!=t[i]:
            print("-1")
            exit()
    print(lcm(n,m))
Problem p03238 (python)

Fixed submission:
n=int(input())
if n==1:
  print("Hello World")
else:
  a=int(input())
  b=int(input())
  print(a+b)

Buggy submission (verdict: Runtime Error):
n=int(input())
li=[]
cnt=[]
for i in range(n):
    x,y,h=map(int,input().split())
    li.append([x,y,h])
for j in range(0,101):
    for k in range(0,101):
        for l in range(n):
            if li[l][2]!=0:
                cnt.append(li[l][2]+abs(li[l][0]-j)+abs(li[l][1]-k))
            elif l!=0 and li[l][2]==0:
                if cnt[0]-abs(li[l][0]-j)-abs(li[l][1]-k)>0:
                    cnt.append(0)               
        if len(set(cnt))==1 and max(cnt[0]-abs(li[0][0]-j)-abs(li[0][1]-k),0)==li[0][2]:
            ans=[j,k,cnt[0]]
            break
        else:
            cnt=[]

print(ans[0],ans[1],ans[2])

Buggy submission (verdict: Runtime Error):
n=int(input())
if n==1:
  print("Hello World")
else:
  a,b=map(int,input().split())
  print(a+b)

Buggy submission (verdict: Runtime Error):
n=int(input())
if n==1:
  print("Hello World")
else:
  a,b=int(input().split())
  print(a+b)
Problem p03239 (python)

Fixed submission:
n,T=map(int,input().split())
ans=[]
for i in range(n):
    c,t=map(int,input().split())
    if t<=T:
        ans.append(c)
if len(ans)==0:
  print("TLE")
else:
  print(min(ans))

Buggy submission (verdict: Runtime Error):
n,T=map(int,input().split())
ans=[]
for i in range(n):
    c,t=map(int,input().split())
    if t<=T:
        ans.append(c)
print(min(ans))
Problem p03240 (python)

Fixed submission:
n=int(input())
li=[]
cnt=[]
for i in range(n):
    x,y,h=map(int,input().split())
    li.append([x,y,h])
li=sorted(li,key=lambda x:x[2],reverse=True)    
for j in range(0,101):
    for k in range(0,101):
        for l in range(n):
            if li[l][2]!=0:
                cnt.append(li[l][2]+abs(li[l][0]-j)+abs(li[l][1]-k))
            elif l!=0 and li[l][2]==0:
                if len(cnt)!=0 and cnt[0]-abs(li[l][0]-j)-abs(li[l][1]-k)>0:
                    cnt.append(0)               
        if len(set(cnt))==1 and cnt[0]-abs(li[0][0]-j)-abs(li[0][1]-k)==li[0][2]:
            ans=[j,k,cnt[0]]
            break
        else:
            cnt=[]

print(ans[0],ans[1],ans[2])

Buggy submission (verdict: Runtime Error):
n=int(input())
li=[]
cnt=[]
for i in range(n):
    x,y,h=map(int,input().split())
    li.append([x,y,h])
for j in range(0,101):
    for k in range(0,101):
        for l in range(n):
            if li[l][2]!=0:
                cnt.append(li[l][2]+abs(li[l][0]-j)+abs(li[l][1]-k))
            elif l!=0 and li[l][2]==0:
                if cnt[0]-abs(li[l][0]-j)-abs(li[l][1]-k)>0:
                    cnt.append(0)               
        if len(set(cnt))==1 and max(cnt[0]-abs(li[0][0]-j)-abs(li[0][1]-k),0)==li[0][2]:
            ans=[j,k,cnt[0]]
            break
        else:
            cnt=[]

print(ans[0],ans[1],ans[2])

Buggy submission (verdict: Runtime Error):
n=int(input())
li=[]
cnt=[]
for i in range(n):
    x,y,h=map(int,input().split())
    li.append([x,y,h])
for j in range(0,101):
    for k in range(0,101):
        for l in range(n):
            if li[l][2]!=0:
                cnt.append(li[l][2]+abs(li[l][0]-j)+abs(li[l][1]-k))
            elif l!=0 and li[l][2]==0:
                if cnt[0]-abs(li[l][0]-j)-abs(li[l][1]-k)>0:
                    cnt.append(0)               
        if len(set(cnt))==1 and cnt[0]-abs(li[0][0]-j)-abs(li[0][1]-k)==li[0][2]:
            ans=[j,k,cnt[0]]
            break
        else:
            cnt=[]

print(ans[0],ans[1],ans[2])

Buggy submission (verdict: Runtime Error):
n=int(input())
li=[]
for i in range(n):
    x,y,h=map(int,input().split())
    li.append([x,y,h])
for j in range(0,101):
    for k in range(0,101):
        H=li[0][2]+abs(li[0][0]-j)+abs(li[0][1]-k)
        for l in range(1,n):
            if H!=li[l][2]+abs(li[l][0]-j)+abs(li[l][1]-k):
                break
            elif H==li[l][2]+abs(li[l][0]-j)+abs(li[l][1]-k) and l==n-1:
                ans=[j,k,H]

print(ans[0],ans[1],ans[2])