Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import math
n,x=map(int,input().split())
xlist=list(map(int,input().split()))
xlist.sort(key=lambda xx:abs(xx-x))
for i in range(n):
    xlist[i]-=x
    xlist[i]=abs(xlist[i])
m=xlist[-1]
while xlist!=[0]*n:
    for i in range(n):
        
        xlist[i]%=m
        if xlist[i]>0:
            m=math.gcd(m,xlist[i])
print(m)

Fixed submission:
def gcd(x,y):
    while x%y:
        x%=y
        x,y=(y,x)
    return y
n,x=map(int,input().split())
xlist=list(map(int,input().split()))
xlist.sort(key=lambda xx:abs(xx-x))
for i in range(n):
    xlist[i]-=x
    xlist[i]=abs(xlist[i])
m=xlist[-1]
while xlist!=[0]*n:
    for i in range(n):
        
        xlist[i]%=m
        if xlist[i]>0:
            m=gcd(m,xlist[i])
print(m)

Buggy python submission (verdict: Runtime Error):
import math
n,x=map(int,input().split())
xlist=list(map(int,input().split()))
xlist.sort(key=lambda xx:abs(xx-x))
for i in range(n):
    xlist[i]-=x
    xlist[i]=abs(xlist[i])
m=xlist[-1]
while xlist!=[0]*n:
    for i in range(n):
        
        xlist[i]%=m
        if xlist[i]>0:
            m=math.gcd(m,xlist[i])
print(m)

Fixed submission:
def gcd(x,y):
    while x%y:
        x%=y
        x,y=(y,x)
    return y
n,x=map(int,input().split())
xlist=list(map(int,input().split()))
xlist.sort(key=lambda xx:abs(xx-x))
for i in range(n):
    xlist[i]-=x
    xlist[i]=abs(xlist[i])
m=xlist[-1]
while xlist!=[0]*n:
    for i in range(n):
        
        xlist[i]%=m
        if xlist[i]>0:
            m=gcd(m,xlist[i])
print(m)

Buggy python submission (verdict: Runtime Error):
n,x=map(int,input().split())
xlist=list(map(int,input().split()))
xlist.sort(key=lambda xx:abs(xx-x))
m=abs(xlist[0]-x)
for i in range(n):
    xlist[i]-=x
    xlist[i]=abs[xlist[i]]
while xlist==[0]*n:
   for i in range(n):
        xlist[i]%=m
        if xlist[i]>0:
            m=min((m,xlist[i]))
print(m)

Fixed submission:
def gcd(x,y):
    while x%y:
        x%=y
        x,y=(y,x)
    return y
n,x=map(int,input().split())
xlist=list(map(int,input().split()))
xlist.sort(key=lambda xx:abs(xx-x))
for i in range(n):
    xlist[i]-=x
    xlist[i]=abs(xlist[i])
m=xlist[-1]
while xlist!=[0]*n:
    for i in range(n):
        
        xlist[i]%=m
        if xlist[i]>0:
            m=gcd(m,xlist[i])
print(m)
Buggy python submission (verdict: Runtime Error):
import bisect
N,K=map(int,input().split())
x=list(map(int,input().split()))
min=1000000000

a=bisect.bisect_left(x,0)
flist=[]
for i in range(a-K,a):
    if i+K-1>N-1 or i<0:
        pass
    else:
        flist.append(i)








for i in flist:
    if x[i+K+1]<0:
        if min>-x[i]:
            min=-x[i]
    elif x[i]>=0:
        if min>x[i+K-1]:
            min=x[i+K-1]
    elif x[i]+x[i+K-1]>=0:
        if min>x[i+K-1]-x[i]*2:
            min=x[i+K-1]-x[i]*2
    else:
        if min>x[i+K-1]*2-x[i]:
            min=x[i+K-1]*2-x[i]
print(min)

Fixed submission:
N,K=map(int,input().split())
x=list(map(int,input().split()))
tmin=1000000000
for i in range(N-K+1):
    a=x[i+K-1]
    b=x[i]
    res=a-b+min([abs(a),abs(b)])
    if tmin>res:
        tmin=res
print(tmin)

Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
x=list(map(int,input().split()))
min=1000000000
for i in range(N-K+1):
    if x[i+K+1]<0:
        if min>-x[i]:
            min=-x[i]
    elif x[i]>=0:
        if min>x[i+K-1]:
            min=x[i+K-1]
    elif x[i]+x[i+K-1]>=0:
        if min>x[i+K-1]-x[i]*2:
            min=x[i+K-1]-x[i]*2
    else:
        if min>x[i+K-1]*2-x[i]:
            min=x[i+K-1]*2-x[i]
print(min)

Fixed submission:
N,K=map(int,input().split())
x=list(map(int,input().split()))
tmin=1000000000
for i in range(N-K+1):
    a=x[i+K-1]
    b=x[i]
    res=a-b+min([abs(a),abs(b)])
    if tmin>res:
        tmin=res
print(tmin)
Buggy python submission (verdict: Runtime Error):
n=map(int,input().split())
if n<=105:
    print(0)
elif n<=135:
    print(1)
elif n<=189:
    print(2)
else:
    print(3)
    

Fixed submission:
n=int(input())
if n<105:
    print(0)
elif n<135:
    print(1)
elif n<165:
    print(2)
elif n<189:
    print(3)
elif n<195:
    print(4)
else:
    print(5)

Buggy python submission (verdict: Runtime Error):
n=map(int,input().split())
if n<=105:
    print(0)
elif n<=135:
    print(1)
elif n<=189:
    print(2)

Fixed submission:
n=int(input())
if n<105:
    print(0)
elif n<135:
    print(1)
elif n<165:
    print(2)
elif n<189:
    print(3)
elif n<195:
    print(4)
else:
    print(5)
Buggy python submission (verdict: Runtime Error):
n=int(input())
if n==0:
    result=0
result=''
while True:
    if n==0:
        break
    if n%2==0:
        n=n/(-2)
        result='0'+result
    else:
        n=(n-1)/(-2)
        result='1'+result
print(int(result))


Fixed submission:
n=int(input())
result=''
if n==0:
    result='0'
while True:
    if n==0:
        break
    if n%2==0:
        n=n/(-2)
        result='0'+result
    else:
        n=(n-1)/(-2)
        result='1'+result
print(int(result))

Buggy python submission (verdict: Runtime Error):
n=int(input())
result=''
while True:
    if n==0:
        break
    if n%2==0:
        n=n/(-2)
        result='0'+result
    else:
        n=(n-1)/(-2)
        result='1'+result
print(int(result))

Fixed submission:
n=int(input())
result=''
if n==0:
    result='0'
while True:
    if n==0:
        break
    if n%2==0:
        n=n/(-2)
        result='0'+result
    else:
        n=(n-1)/(-2)
        result='1'+result
print(int(result))
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
a=list(map(int,input().split()))
a[0]=a[0]%m
for i in range(n-1):
    a[i+1]=(a[i]+a[i+1])%m
result=0
for i in range(n):
    if a[i]==0:
        result+=1
    for j in range(i+1,n):
        if a[i]==a[j]:
            result+=1
print(result)

Fixed submission:
n,m=map(int,input().split())
a=list(map(int,input().split()))
a[0]=a[0]%m
for i in range(n-1):
    a[i+1]=(a[i]+a[i+1])%m
result=0
for i in range(n):
    if a[i]==0:
        result+=1

a.sort()
num=a[0]
b=0
for i in range(n):
    if a[i]==num:
        b+=1
    else:
        result+=b*(b-1)/2
        b=1
        num=a[i]
print(int(result+b*(b-1)/2))
Buggy python submission (verdict: Runtime Error):
n=int(input())
x=list(map(int,input().split()))
N=int(n/2)
y=sorted(x)
a=y[N-1]
b=y[N]
for j in range(n):
    if x[j]<a:
        print(b)
    elif x[j]==a:
        print(y[N+1])
    else:
        print(a)

Fixed submission:
n=int(input())
x=list(map(int,input().split()))
N=int(n/2)
y=sorted(x)
a=y[N-1]
b=y[N]
for j in range(n):
    if x[j]<=a:
        print(b)
    else:
        print(a)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
x=list(map(int,input().split()))
N=int(n/2)
for i in range(n):
    y=[]
    for j in range(n):
        if j!=i:
            y.append(x[j])
    y.sort()
    print(y[N-1])

Fixed submission:
n=int(input())
x=list(map(int,input().split()))
N=int(n/2)
y=sorted(x)
a=y[N-1]
b=y[N]
for j in range(n):
    if x[j]<=a:
        print(b)
    else:
        print(a)
Buggy python submission (verdict: Runtime Error):
from collections import deque

h,w=[int(i) for i in input().split() ]

graph=[[None for i in range(w+2)] for j in range(h+2)]
wnum=0
for i in range(w+2):
    graph[0][i]=['#',None]
    graph[h+1][i]=['#',None]
for j in range(h+2):
    graph[j][0]=['#',None]
    graph[j][w+1]=['#',None]
for i in range(h):
    a=input()
    for j in range(w):
        if a[j]=='.':
            wnum+=1
        graph[i+1][j+1]=[a[j],None]

q=deque([])
q.append((1,1))
graph[1][1][1]=0
d_min=None
while len(q)!=0:
    x,y=q.popleft()
    for cx,cy in ((x-1,y),(x+1,y),(x,y-1),(x,y+1)):
        if graph[cx][cy][0]=='.':
            if graph[cx][cy][1]==None:
                graph[cx][cy][1]=graph[x][y][1]+1
                if (cx,cy)==(h,w):
                    d_min=graph[cx][cy][1]
                    break
                q.append((cx,cy))
print(wnum-d_min-1)

Fixed submission:
from collections import deque

h,w=[int(i) for i in input().split() ]

graph=[[None for i in range(w+2)] for j in range(h+2)]
wnum=0
for i in range(w+2):
    graph[0][i]=['#',None]
    graph[h+1][i]=['#',None]
for j in range(h+2):
    graph[j][0]=['#',None]
    graph[j][w+1]=['#',None]
for i in range(h):
    a=input()
    for j in range(w):
        if a[j]=='.':
            wnum+=1
        graph[i+1][j+1]=[a[j],None]

q=deque([])
q.append((1,1))
graph[1][1][1]=0
d_min=None
while len(q)!=0:
    x,y=q.popleft()
    for cx,cy in ((x-1,y),(x+1,y),(x,y-1),(x,y+1)):
        if graph[cx][cy][0]=='.':
            if graph[cx][cy][1]==None:
                graph[cx][cy][1]=graph[x][y][1]+1
                if (cx,cy)==(h,w):
                    d_min=graph[cx][cy][1]
                    break
                q.append((cx,cy))
if d_min!=None:
   print(wnum-d_min-1)
else:
   print(-1)
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
l=[]
for i in range(m):
    l.append(list(map(int,input().split())))
l.sort()
xi=0
i=0
x=[None for i in range(10**5)]
while i<m:
    x[l[0][0]]=0
    if l[i][0]==xi:
        if x[l[i][1]]==None:
            x[l[i][1]]=l[i][2]+x[l[i][0]]
            i+=1
        else:
            print('No')
            break
    else:
        xi+=1
if i<m:
    pass
else:
    print('Yes')

Fixed submission:
x=int(input())
a=int(input())
b=int(input())
print((x-a)%b)

Buggy python submission (verdict: Runtime Error):
x=input()
a=input()
b=input()
print((x-a)%b)

Fixed submission:
x=int(input())
a=int(input())
b=int(input())
print((x-a)%b)
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
l=[]
for i in range(m):
    l.append(list(map(int,input().split())))
l.sort()
xi=0
i=0
x=[None for i in range(10**5)]
while i<m:
    x[l[0][0]]=0
    if l[i][0]==xi:
        if x[l[i][1]]==None:
            x[l[i][1]]=l[i][2]+x[l[i][0]]
            i+=1
        else:
            print('No')
            break
    else:
        xi+=1
if i<m:
    pass
else:
    print('Yes')

Fixed submission:
n,m=map(int,input().split())
graph=[[] for i in range(n+1) ]
dist=[None for i in range(n+1)]
dist[0]=0
result=[True]

for i in range(m):
    l,r,d=(int(i) for i in input().split())
    graph[l].append((r,-d))
    graph[r].append((l,d))
def haba(i):
    if dist[i]== None:
        stack=[]
        dist[i]=0
        stack.append(i)
        while len(stack)!=0 :
            l=stack.pop()
            for r,d in graph[l]:
                b=dist[l]+d
                if dist[r]==None :
                    dist[r]=b
                    stack.append(r)
                elif dist[r]!=b:
                     result[0]=False
                     return
        return 
    else:
        return 

for i in range(n+1):
    haba(i)
if result[0]:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
def a(t,x,y):
    n=abs(x)+abs(y)
    if (t-n)%2==0 and t-n>=0 :
        return 1
    else :
        return 0
N=int(input())
result=1
tn,xn,yn=0,0,0
for i in range(N):
    t,x,y=map(int,input().split())
    tn=t-tn
    xn=x-xn
    yn=y-yn
    result*=a(tn,xn,yn)
    #print (result)
if result==1:
    print ('Yes')
else:
    print ('No')

Fixed submission:
a,b=map(int,input().split())
if a*b%2 :
    print('Odd')
else:
    print('Even')

Buggy python submission (verdict: Runtime Error):
def a(t,x,y):
    n=abs(x)+abs(y)
    if (t-n)%2==0 and t-n>=0 :
        return 1
    else :
        return 0
N=int(input())
result=1
tn,xn,yn=0,0,0
for i in range(N):
    t,x,y=map(int,input().split())
    tn=t-tn
    xn=x-xn
    yn=y-yn
    result*=a(tn,xn,yn)
    print (result)
if result==1:
    print ('Yes')
else:
    print ('No')

Fixed submission:
a,b=map(int,input().split())
if a*b%2 :
    print('Odd')
else:
    print('Even')
Buggy python submission (verdict: Runtime Error):
N=int(input())
def ok(h,n,w,N):
    if 4*h*n*w==N*(n*w+n*h+h*w):
        return 1
    else:
        return 0

def kiyaku(a,b):
    if b%a==0:
        return 1
    else:
        return 0

def solve(N):

    for i in range(N//4+1,3*N//4+1):
        for j in range(3*N//4+1,3501):
            if kiyaku(4*i*j-N*(i+j),N*i*j) and 4*i*j-N*(i+j)>0:
                return (i,j,N*i*j//(4*i*j-N*(i+j)))

    return (-1,-1,-1)
h,n,w=solve(N)
print(h,n,w)

Fixed submission:
N=int(input())
def ok(h,n,w,N):
    if 4*h*n*w==N*(n*w+n*h+h*w):
        return 1
    else:
        return 0

def kiyaku(a,b):
    if b%a==0:
        return 1
    else:
        return 0

def solve(N):

    for i in range(N//4+1,3*N//4+1):
        for j in range(3*N//4+1,3501):
            if 4*i*j-N*(i+j)>0 and kiyaku(4*i*j-N*(i+j),N*i*j):
                return (i,j,N*i*j//(4*i*j-N*(i+j)))
h,n,w=solve(N)
print(h,n,w)
Buggy python submission (verdict: Runtime Error):
n,k=map(int, input().split())
h=list(map(int,input().split()))
H=sorted(h,reverse=True)
for i in range(k):
	H[i]=0
print(sum(H))

Fixed submission:
n,k=map(int, input().split())
h=list(map(int,input().split()))
H=sorted(h,reverse=True)
if n>=k:
	for i in range(k):
		H[i]=0
	print(sum(H))
else: 
	print(0)

Buggy python submission (verdict: Runtime Error):
n,k=map(int, input().split())
h=list(map(int,input().split()))
H=sorted(h)
for i in range(k):
 H[n-k+1]=0
print(sum(H))

Fixed submission:
n,k=map(int, input().split())
h=list(map(int,input().split()))
H=sorted(h,reverse=True)
if n>=k:
	for i in range(k):
		H[i]=0
	print(sum(H))
else: 
	print(0)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
height=list(input())
count=0
for i in range (a):
    if height[i]>=b:
       count+=count
print(count)

Fixed submission:
a,b=map(int,input().split())
height=list(map(int,input().split()))
count=0
for i in range (a):
    if int(height[i])>=b:
       count+=1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
import bisect
import numpy as np
n, q = map(int, input().split())
s = input()
ac = 'AC'
args = []
for i in range(len(s) - 1):
    if s[i:i+2] == 'AC':
        args.append(i)
args = np.array(args)
for j in range(q):
    l, r = map(int, input().split())
    i_l = bisect.bisect_left(args, l-1)
    i_r = bisect.bisect_right(args, r-2)
    print(len(args[i_l:i_r]))

Fixed submission:
import bisect
n, q = map(int, input().split())
s = input()
ac = 'AC'
args = []
for i in range(len(s) - 1):
    if s[i:i+2] == 'AC':
        args.append(i)
for j in range(q):
    l, r = map(int, input().split())
    i_l = bisect.bisect_left(args, l-1)
    i_r = bisect.bisect_right(args, r-2)
    print(i_r - i_l)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
p = []
y = []
d = {}
for n_ in range(n):
    d[n_ + 1] = []
for i in range(m):
    p_, y_ = map(int, input().split())
    p.append(p_)
    y.append(y_)
    d[p_].append(y_)
for i in d.keys():
    d[i] = sorted(d[i])
for i in range(m):
    print('{:06d}{:06d}'.format(p[i], d[p[i]].index(y[i]) + 1))


Fixed submission:
import numpy as np
from bisect import bisect_right
# from time import time
# start = time()
n, m = map(int, input().split())
p = []
y = []
d = {i + 1: [] for i in range(n)}
# n, m = 10**5, 10**5
# p = [10**5]*m
# y = [i + 1 for i in range(m)]
for i in range(m):
    p_, y_ = map(int, input().split())
    # p_, y_ = p[i], y[i]
    p.append(p_)
    y.append(y_)
    d[p_].append(y_)
for i in d.keys():
    d[i] = sorted(d[i])
for i in range(m):
    # print('{:06d}{:06d}'.format(p[i], d[p[i]].index(y[i]) + 1))
    print('{:06d}{:06d}'.format(p[i], bisect_right(d[p[i]], y[i])))
#
# print(time() - start)

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
p = []
y = []
d = {}
for i in range(m):
    p_, y_ = map(int, input().split())
    p.append(p_)
    y.append(y_)
    if p_ not in d.keys():
        d[p_] = [y_]
    else:
        d[p_].append(y_)
for i in d.keys():
    d[i] = sorted(d[i])
for i in range(m):
    print('{:06d}{:06d}'.format(p[i], d[p[i]].index(y[i]) + 1))


Fixed submission:
import numpy as np
from bisect import bisect_right
# from time import time
# start = time()
n, m = map(int, input().split())
p = []
y = []
d = {i + 1: [] for i in range(n)}
# n, m = 10**5, 10**5
# p = [10**5]*m
# y = [i + 1 for i in range(m)]
for i in range(m):
    p_, y_ = map(int, input().split())
    # p_, y_ = p[i], y[i]
    p.append(p_)
    y.append(y_)
    d[p_].append(y_)
for i in d.keys():
    d[i] = sorted(d[i])
for i in range(m):
    # print('{:06d}{:06d}'.format(p[i], d[p[i]].index(y[i]) + 1))
    print('{:06d}{:06d}'.format(p[i], bisect_right(d[p[i]], y[i])))
#
# print(time() - start)
Buggy python submission (verdict: Runtime Error):
from math import gcd
from functools import reduce


def _gcd(*n):
    return reduce(gcd, n)


N, X = map(int, input().split())
x = list(map(int, input().split()))
x = sorted(x + [X])
diff = [x[i+1] - x[i] for i in range(N)]
print(_gcd(*diff))


Fixed submission:
from functools import reduce


def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)


def _gcd(*n):
    return reduce(gcd, n)


N, X = map(int, input().split())
x = list(map(int, input().split()))
x = sorted(x + [X])
diff = [x[i+1] - x[i] for i in range(N)]
print(_gcd(*diff))
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
K = int(input())
sub = []
for i in range(len(s)):
    for j in range(i, len(s)):
        sub.append(s[i:j+1])

sub = sorted(set(sub))
print(sub[K-1])


Fixed submission:
s = input()
K = int(input())
sub = []
for i in range(len(s)):
    for j in range(i, min(i+K, len(s))):
        sub.append(s[i:j+1])

sub = sorted(set(sub))
print(sub[K-1])
Buggy python submission (verdict: Time Limit Exceeded):
def is_ub(string):
    return max([string.count(i) for i in set(string)]) > len(string)/2

s = input()
for i in range(len(s)-1):
    for j in range(i+1, len(s)):
        if is_ub(s[i:j+1]):
            print(i+1, j+1)
            exit()
print(-1, -1)

Fixed submission:
s = input()
if len(s) == 2:
    if s[0] == s[1]:
        print(1, 2)
    else:
        print(-1, -1)
else:
    for i in range(len(s)-2):
        if len(set(s[i:i+3])) < 3:
            print(i+1, i+3)
            exit()
    print(-1, -1)
Buggy python submission (verdict: Runtime Error):
n,k = map(int,(input().split(" ")))

import math
a = (int(math.ceil(math.log(n)/math.log(k) )))
if a==0:
  print(1)
else
  print(a)

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

import math
a = (int(math.ceil(math.log(n)/math.log(k) )))
if a==0:
  print(1)
else:
  print(a)

Buggy python submission (verdict: Runtime Error):
n,k = int(input().split(" "))
import math
print(int(math.ceil(math.log(n)/math.log(k) )))

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

import math
a = (int(math.ceil(math.log(n)/math.log(k) )))
if a==0:
  print(1)
else:
  print(a)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,c,d = map(int,input().split(" "))
ans = 0
for i in range(a,b+1):
  if i%c!=0 and i%d!=0:
    ans+=1
    
print(ans)    

Fixed submission:
a,b,c,d = map(int,input().split(" "))
ans = 0
from fractions import gcd
def lcm(x, y):
  return (x * y) // gcd(x, y)
a -= 1
f = lcm(c,d)
ans = (b - a) - ((b//c - a//c) + (b//d - a//d) - (b//f - a//f))

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
ans=""
while n!=0:
  if n%2==0:
    ans = "0"+ans
  else
    n-=1
    ans = "1"+ans
  n//=-2  

if n==0:
  print("0")
else
  print(ans)

Fixed submission:
n = int(input())
ans=""
while n!=0:
  if n%2==0:
    ans = "0"+ans
  else:
    n-=1
    ans = "1"+ans
  n//=-2  

if ans=="":
  print("0")
else:
  print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
ls=[a,b,c,d,e]
ls_1=[]
for i in range(len(ls)):
    ls_1.append(int(str(ls[i])[-1]))
ls_1=np.array(ls_1)
ls_1=10-ls_1
ls_1_10=ls_1[ls_1 < 10]#１０を除いたロス
a=np.argmax(ls_1_10)#最大の１の位を探す
ls_non=np.delete(ls_1_10, a, 0)
#ls_non_10=ls_non[ls_non < 10]
ls=np.array(ls)
ans=np.sum(ls) + np.sum(ls_non)
print(ans)

Fixed submission:
#１のくらいのみ見れはいい？
import numpy as np
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
ls=[a,b,c,d,e]
ls_1=[]
for i in range(len(ls)):
    ls_1.append(int(str(ls[i])[-1]))
ls_1=np.array(ls_1)
ls_1_10=10-ls_1
ls_1_10[ls_1_10==10]=0
#ls_1_10=ls_1[ls_1 < 10]#１０を除いたロス
a=np.argmax(ls_1_10)#最大の１の位を探す
ls_non=np.delete(ls_1_10, a, 0)
#ls_non_10=ls_non[ls_non < 10]
ls=np.array(ls)
ans=np.sum(ls) + np.sum(ls_non)
print(ans)

Buggy python submission (verdict: Runtime Error):
import numpy as np
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
ls=[a,b,c,d,e]
ls_1=[]
for i in range(len(ls)):
    ls_1.append(int(str(ls[i])[-1]))
ls_1=np.array(ls_1)
ls_1=10-ls_1
ls_1_10=ls_1[ls_1 < 10]#１０を除いたロス
a=np.argmax(ls_1_10)#最大の１の位を探す
ls_non=np.delete(ls_1_10, a, 0)
#ls_non_10=ls_non[ls_non < 10]
ls=np.array(ls)
ans=np.sum(ls) + np.sum(ls_non)
print(ans)

Fixed submission:
#１のくらいのみ見れはいい？
import numpy as np
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
ls=[a,b,c,d,e]
ls_1=[]
for i in range(len(ls)):
    ls_1.append(int(str(ls[i])[-1]))
ls_1=np.array(ls_1)
ls_1_10=10-ls_1
ls_1_10[ls_1_10==10]=0
#ls_1_10=ls_1[ls_1 < 10]#１０を除いたロス
a=np.argmax(ls_1_10)#最大の１の位を探す
ls_non=np.delete(ls_1_10, a, 0)
#ls_non_10=ls_non[ls_non < 10]
ls=np.array(ls)
ans=np.sum(ls) + np.sum(ls_non)
print(ans)
Buggy python submission (verdict: Runtime Error):
ls=list(input())
ans=0
ans_ls=[]
for i in range(len(ls)):
    if ls[i ]=='A' or ls[i] == 'C' or ls[i] == 'G' or ls[i] == 'T':
        ans=ans+1
    else:
        ans1=ans
        ans_ls.append(ans1)
        ans=0

print(max(ans_ls))

Fixed submission:
import copy
ls=list(input())
ans=0
#ans1=0
ans_ls=[]
#print(ls)
for i in range(len(ls)):
    if ls[i]=='A' or ls[i] == 'C' or ls[i] == 'G' or ls[i] == 'T':
        ans=ans+1
        #print(ans)
    else:
        #print(ans)
        ans1=ans
        #print(ans1)
        ans_ls.append(ans1)
        ans=0
ans_ls.append(ans)
#print(ans_ls)
print(max(ans_ls))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

print(sum([i for i in range(n)]))

Fixed submission:
n = int(input())

print(n * (n - 1) // 2)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = [sorted(input()) for _ in range(n)]

ans, u = 0, set()
for i in range(n-1):
    c = set()
    if i not in u:
        for j in range(i+1, n):
            if s[i] == s[j]:
                c.add(i)
                c.add(j)
                u.add(i)
                u.add(j)
        ans += (len(c) * (len(c) - 1)) // 2
print(ans)

Fixed submission:
n = int(input())
s = ["".join(sorted(input())) for _ in range(n)]

ans, d = 0, {}
for i in range(n):
    if s[i] in d.keys():
        ans += d[s[i]]
        d[s[i]] = d[s[i]] + 1
    else:
        d[s[i]] = 1
print(ans)

Buggy python submission (verdict: Runtime Error):
def hoge(n):
    if n == 1:
        return 1
    else:
        return n * hoge(n-1)

n = int(input())
s = [sorted(input()) for i in range(n)]

count = 0
c = 0
t = []
for i in range(n - 1):
    if i not in t:
        for j in range(n - i - 2):
            if s[i] == s[j]:
                c += 1
                t.append(j)
        count += hoge(c + 1) // 2
        c = 0
    
print(count)

Fixed submission:
n = int(input())
s = ["".join(sorted(input())) for _ in range(n)]

ans, d = 0, {}
for i in range(n):
    if s[i] in d.keys():
        ans += d[s[i]]
        d[s[i]] = d[s[i]] + 1
    else:
        d[s[i]] = 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split(" "))
cards = [0] * n

for i in range(m):
    l, r = map(int, input().split(" "))
    for j in range(l-1, r):
        cards[j] += 1

ans = 0
for card in cards:
    if card == m:
        ans += 1
print(ans)

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

s, e = 1, n
for i in range(m):
    l, r = map(int, input().split(" "))
    if s < l: s = l
    if e > r: e = r

print(e-s+1 if s <= e else 0)
Buggy python submission (verdict: Runtime Error):
H, N = map(int, input().split())
A = list(map(int, input().split()))

A.sort(reverse=True)
if H - A[0] - A[1] <= 0:
    print("Yes")
else:
    print("No")

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

if sum(A) >= H:
    print("Yes")
else:
    print("No")