Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
a3 = list(map(int, input().split()))
n = int(input())
c = "check"
for i in range(n):
    v = int(input())
    ind = 0
    if v in a1 :
        ind = a1.index(v)
        a1[ind] = c
    if v in a2 :
        ind = a2.index(v)
        a2[ind] = c
    if v in a3 :
        ind = a3.index(v)
        a3[ind] = c

if ((a1[0] == c and a2[0] == c and a3[0] == c) or  
    (a1[1] == c and a2[1] == c and a3[1] == c) or 
    (a1[2] == c and a2[2] == c and a3[2] == c) or 
    (a1[0] == c and a2[1] == c and a3[2] == c) or
    (a1[2] == c and a2[1] == c and a3[3] == c) or
    a1.count(c) == 3 or
    a2.count(c) == 3 or
    a3.count(c) == 3):
    print("Yes")
else:
    print("No")

Fixed submission:
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
a3 = list(map(int, input().split()))
n = int(input())
c = "check"
for i in range(n):
    v = int(input())
    ind = 0
    if v in a1 :
        ind = a1.index(v)
        a1[ind] = c
    if v in a2 :
        ind = a2.index(v)
        a2[ind] = c
    if v in a3 :
        ind = a3.index(v)
        a3[ind] = c

if ((a1[0] == c and a2[0] == c and a3[0] == c) or  
    (a1[1] == c and a2[1] == c and a3[1] == c) or 
    (a1[2] == c and a2[2] == c and a3[2] == c) or 
    (a1[0] == c and a2[1] == c and a3[2] == c) or
    (a1[2] == c and a2[1] == c and a3[0] == c) or
    a1.count(c) == 3 or
    a2.count(c) == 3 or
    a3.count(c) == 3):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
import collections
n = int(input())
cnt_lis = []
for i in range(n):
    s = input()
    cnt_lis.append(s)

lis = collections.Counter(cnt_lis)
ans = []
tmp = 0
for i in range(len(lis)):
    if tmp <= lis.most_common()[i][1]:
        ans.append(lis.most_common()[i][0])
        tmp = lis.most_common()[i][1]
    else:
        continue
ans.sort()
for i in ans:
    print(i)

Fixed submission:
n = int(input())
dic = {}
for i in range(n):
    s = input()
    if s in dic.keys():
        dic[s] += 1
    else:
        dic[s] = 1

max_val = max(dic.values())
k = [key for key in dic if dic[key] == max_val]
for i in sorted(k):
    print(i)
Buggy python submission (verdict: Runtime Error):
c = input()
dic = ['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']
ind = dic.index(c)
print(dic[ind+1])

Fixed submission:
c = input()
dic = ['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']
ind = dic.index(c)
print(dic[ind+1])
Buggy python submission (verdict: Runtime Error):
import math
a, b = map(int, input().split())
ans = (a * b) // math.gcd(a, b)
print(ans)


Fixed submission:
import fractions
a, b = map(int, input().split())
ans = (a * b) //fractions.gcd(a, b)
print(ans)
Buggy python submission (verdict: Runtime Error):
n,k = map(int, input().split())
a = list(map(int, input(),split()))
ans = 0
for i in range(len(a)):
    if a[i] >= k:
        ans += 1
print(ans)

Fixed submission:
n,k = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
for i in range(len(a)):
    if a[i] >= k:
        ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
n,k = map(int, input().split())
a = list(map(int, input(),split()))
ans = 0
for i in range(len(a):
    if a[i] >= k:
        ans += 1
print(ans)

Fixed submission:
n,k = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
for i in range(len(a)):
    if a[i] >= k:
        ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
n,k = map(int, input().split())
a = list(map(int, input(),split()))
ans = 0
for i in range(len(a):
    if a[i] >= k:
        ans += 1
print(ans)

Fixed submission:
n,k = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
for i in range(len(a)):
    if a[i] >= k:
        ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

d = list(map(int,input().split()))
ans = 0
k_m = max(d)

for i in range(1, k_m+1):
    abc = []
    arc = []
    arc = [j for j in d if j >= i]  
    abc = [k for k in d if k < i]
    if len(arc) == len(abc):
        ans += 1
print(ans)

Fixed submission:
n = int(input())

d = sorted(list(map(int,input().split())))

print(d[n//2] - d[n//2-1])

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

d = list(map(int,input().split()))
ans = 0
k_m = max(d)

for i in range(1, k_m+1):
    abc = []
    arc = []
    arc = [j for j in d if j >= i]  
    abc = [k for k in d if k < i]
    if len(arc) == len(abc):
        ans += 1
print(ans)

Fixed submission:
n = int(input())

d = sorted(list(map(int,input().split())))

print(d[n//2] - d[n//2-1])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
d = list(map(int,input().split()))
ans = 0
k_m = max(d)

for i in range(1, k_m+1):
    abc = 0
    arc = 0
    for j in d:
        if j >= i:
            arc += 1
        elif j < i:
            abc += 1
    if arc == abc:
        ans += 1
print(ans)

Fixed submission:
n = int(input())

d = sorted(list(map(int,input().split())))

print(d[n//2] - d[n//2-1])

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

d = list(map(int,input().split()))

ans = 0

k_m = max(d)

for i in range(1, k_m+1):
    abc = 0
    arc = 0
    for j in d:
        if j >= i:
            arc += 1
        elif j < i:
            abc += 1

    if arc == abc:
        ans += 1

print(ans)

Fixed submission:
n = int(input())

d = sorted(list(map(int,input().split())))

print(d[n//2] - d[n//2-1])
Buggy python submission (verdict: Runtime Error):
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))
gap = float("")
for i in range(n):
    print(gap)
    if abs(t - h[i] * 0.006 - a) < gap:
        ans = i + 1
        gap = abs(t - h[i] * 0.006 - a)
print(ans)

Fixed submission:
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))
gap = float("inf")
for i in range(n):
    if abs(t - h[i] * 0.006 - a) < gap:
        ans = i + 1
        gap = abs(t - h[i] * 0.006 - a)
print(ans)
Buggy python submission (verdict: Runtime Error):
x = int(input())
ans = 0
lis = []
for i in range(1, x + 1):
    for j in range(2, x+1):
        ans = i ** j
        if ans <= x:
            lis.append(ans)
print(lis[-1])

Fixed submission:
x = int(input())
ans = 1
for i in range(1, 32):
    for j in range(2, 10):
        p = pow(i, j)
        if p > x:
            break
        if p > ans:
            ans = p
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
lis = list(range(a, b+1))
ans = []
for i in range(k):
    if a + i <= b:
        ans.append(a + i)
    if b - i >= a:
        ans.append(b - i)

for i in sorted(set(ans)):
    print(i)


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

for i in range(a, min(b +1, a+k)):
    print(i)
for i in range(max(a+k, b-k+1), b+1):
    print(i)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 0
for i in range(1, n+1):
    if (i **.5).is_integer():
        ans = i
print(ans)
    

Fixed submission:
import math
n = int(input())
ans = int(math.sqrt(n))
print(ans**2)
Buggy python submission (verdict: Runtime Error):
a = int(input)
b = int(input)
if a < b:
    print("LESS")
elif a > b:
    print("GREATER")
else:
    print("EQUAL")

Fixed submission:
a = int(input())
b = int(input())
if a < b:
    print("LESS")
elif a > b:
    print("GREATER")
else:
    print("EQUAL")
Buggy python submission (verdict: Runtime Error):
happy,newyear,enjoy

Fixed submission:
a = input()

b = a.replace(",", " ")

print(b)
Buggy python submission (verdict: Time Limit Exceeded):
a, b, x = map(int, input().split())
ans = 0
for i in range(a, b+1):
    if i % x == 0:
        ans += 1
print(ans)


Fixed submission:
a, b, x = map(int, input().split())
if a != 0:
    print(b//x - (a-1)//x)
else:
    print(b//x + 1)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
book = {}
array = [int(i) for i in input().split()]

for i in array:
    book[i] = book.get(i, 0) + 1

for i in range(n):
    s = 0
    for k, v in book.items():
        if k == array[i]:
            v -= 1
        s += (v * (v - 1)) // 2 if v > 0 else 0
    print(s)


Fixed submission:
n = int(input())
book = {}
array = [int(i) for i in input().split()]

for i in array:
    book[i] = book.get(i, 0) + 1

sum_val = 0
delta = {}
for k, v in book.items():
    t = (v * (v - 1)) // 2 if v > 0 else 0
    sum_val += t
    u = v - 1
    delta[k] = t - (u * (u - 1)) // 2 if u > 0 else 0

for i in range(n):
    print(sum_val - delta[array[i]])
Buggy python submission (verdict: Runtime Error):
def main():
    n, m = [int(i) for i in input().split()]
    # digits = [(int(i) for i in input().split()) for _ in range(m)]
    digits = [-1] * 3
    for i in range(m):
        s, c = [int(i) for i in input().split()]
        if not digits[s-1] in (-1, c):
            print(-1)
            return

        digits[s-1] = c

    top = True
    for i in range(n):
        d = digits[i]
        if top:
            if d == 0:
                if i+1 < n:
                    print(-1)
                    return
            if d == -1:
                digits[i] = 0
                continue
            else:
                top = False
        else:
            if d == -1:
                digits[i] = 0

    print(int("".join([str(i) for i in digits])))

main()


Fixed submission:
def main():
    n, m = [int(i) for i in input().split()]
    # digits = [(int(i) for i in input().split()) for _ in range(m)]
    digits = [-1] * n
    for i in range(m):
        s, c = [int(i) for i in input().split()]
        if not digits[s-1] in (-1, c):
            print(-1)
            return

        digits[s-1] = c

    top = True
    for i in range(n):
        d = digits[i]
        if top:
            if d == 0:
                if i+1 < n:
                    print(-1)
                    return
                top = False
            if d == -1:
                digits[i] = 0
            else:
                top = False
        else:
            if d == -1:
                digits[i] = 0

    t = str(int("".join([str(i) for i in digits])))
    if len(t) == n:
        print(t)
    else:
        s = [str(i) for i in digits]
        s[0] = "1" if n > 1 else "0"
        print("".join(s))

main()
Buggy python submission (verdict: Runtime Error):
def common_divisor(a, b):
    # a <= b
    res = []
    for i in range(2, int(a**0.5)+1):
        if a % i == 0 and b % i == 0:
            res.append(i)
            t = a // i
            if i != t and b % t == 0:
                res.append(t)
    return sorted(res)

def primes_num(arr):
    res = 0
    TESU = int(arr[-1]**0.5)+1
    for i in arr:
        flg = True
        rt_i = i**0.5
        for j in range(2, TESU):
            if rt_i < j:
                break
            elif i % j == 0:
                flg = False
                break
        if flg: res += 1
    return res

A, B = sorted([int(i) for i in input().split()])
# A <= B

cds = common_divisor(A, B)
print(primes_num(cds)+1)


Fixed submission:
A, B = sorted([int(i) for i in input().split()])

res = 1
for i in range(2, int(B**0.5)+1):
    if B % i == 0:
        if A % i == 0:
            for j in range(2, int(i**0.5)+1):
                if i % j == 0:
                    break
            else:
                res += 1
        t = B // i
        if t != i and A % t == 0:
            for j in range(2, int(t**0.5)+1):
                if t % j == 0:
                    break
            else:
                res += 1

print(res if res > 1 else (1 if (A == B == 1) or A != B else 2))
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = []
for _ in range(N):
    s = [0]*26
    for i in map(lambda: ord(c)-97, input()):
        s[i] += 1

res = 0
for i in range(N):
    for j in range(i+1, N):
        if S[i] == S[j]:
            res += 1

print(res)

Fixed submission:
N = int(input())
d = dict()

for _ in range(N):
    s = "".join(sorted(input()))
    if s in d:
        d[s] += 1
    else:
        d[s] = 0

print(int(sum(map(lambda x: (x+1)*x/2, d.values()))))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = ["".join(sorted(input())) for _ in range(N)]

res = 0
for i in range(N):
    for j in range(i+1, N):
        if S[i] == S[j]:
            res += 1

print(res)


Fixed submission:
N = int(input())
d = dict()

for _ in range(N):
    s = "".join(sorted(input()))
    if s in d:
        d[s] += 1
    else:
        d[s] = 0

print(int(sum(map(lambda x: (x+1)*x/2, d.values()))))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
As = [int(i) for i in input().split()]

T = ( sum(map(lambda t: (-1)**(t[0]%2+1) * t[1], enumerate(As[:-1])) ) + As[-1] ) / 2

for i in range(N-1):
    U = sum(map(lambda t: (-1)**(t[0]%2) * t[1], enumerate(As[i:-1])) )
    U += (-1)**(i%2) * T
    print(int(U)*2, end=" ")

print(int(T)*2)

Fixed submission:
N = int(input())
As = [int(i) for i in input().split()]

x_0 = sum(As) - 2 * sum(As[1::2])
print(int(x_0), end=" ")
x = x_0

for i in range(N-2):
    x = 2*As[i] - x
    print(int(x), end=" ")

x = 2*As[N-2] - x
print(int(x))

Buggy python submission (verdict: Runtime Error):
import numpy as np

N = int(input())
As = [int(i) for i in input().split()]

mat = np.array([np.zeros(N) for _ in range(N)])

for i in range(N-1):
    mat[i][i], mat[i][i+1] = 1, 1

mat[N-1][0], mat[N-1][N-1] = 1, 1

for i in range(N):
    C = mat[i][i]
    As[i] /= C
    for j in range(N):
        mat[i][j] /= C
    for k in range(N):
        if k == i: continue
        D = mat[k][i]
        for j in range(N):
            mat[k][j] -= mat[i][j] * D
        As[k] -= As[i] * D

print(*[int(i)*2 for i in As])

Fixed submission:
N = int(input())
As = [int(i) for i in input().split()]

x_0 = sum(As) - 2 * sum(As[1::2])
print(int(x_0), end=" ")
x = x_0

for i in range(N-2):
    x = 2*As[i] - x
    print(int(x), end=" ")

x = 2*As[N-2] - x
print(int(x))
Buggy python submission (verdict: Runtime Error):
from math import gcd

A, B, C, D = [int(i) for i in input().split()]

def lcm(a, b):
    return a // gcd(a, b) * b

S1 = A - ( A//C + A//D - A//lcm(C, D) ) - (1 if A%C and A%D else 0)
S2 = B - ( B//C + B//D - B//lcm(C, D) )

print(S2 - S1)

Fixed submission:
A, B, C, D = [int(i) for i in input().split()]

def lcm(a, b):
    ori_a, ori_b = a, b
    if a > b: a, b = b, a
    while True:
        a, b = b%a, a
        if a == 0:
            g = b
            break
        elif a == 1:
            g = 1
            break

    return ori_a // g * ori_b

S1 = A - ( A//C + A//D - A//lcm(C, D) ) - (1 if A%C and A%D else 0)
S2 = B - ( B//C + B//D - B//lcm(C, D) )

print(S2 - S1)
Buggy python submission (verdict: Runtime Error):
def processValue(array:list):
	global minimumValue
	value = 0
	for i in array:
		value += fruits[i]
	
	if minimumValue == -1 or value < minimumValue:
		minimumValue = value

def combi(n,k,i,array):
	if i == k:
		processValue(array)
		return
	for j in range(array[i-1],n):
		if j in array[0:i]:
			continue
		array[i] = j
		combi(n,k,i+1,array)

fruits = []
minimumValue = -1
n,k = map(int,input().split())
fruits = [int(f) for f in input().split()]
combi(n,k,0,[0 for _ in range(k)])
print(minimumValue)


Fixed submission:
def addAndDeleteMin():
	global ans
	global p
	minv = min(p)
	ans += minv
	p.remove(minv)

n,k = map(int,input().split())
p = [int(x) for x in input().split()]
ans = 0
for i in range(k):
	addAndDeleteMin()
print(ans)

Buggy python submission (verdict: Runtime Error):
fruits = []
minimumValue = -1

def processValue(array:list):
	global minimumValue
	value = 0
	for i in array:
		value += fruits[i]
	
	if minimumValue == -1 or value < minimumValue:
		minimumValue = value

def combi(n,k,i,array):
	if i == k:
		processValue(array)
		return
	for j in range(array[i-1],n):
		if j in array[0:i]:
			continue
		array[i] = j
		combi(n,k,i+1,array)

n,k = map(int,input().split())
fruits = [int(f) for f in input().split()]
combi(n,k,0,[0 for _ in range(k)])
print(minimumValue)


Fixed submission:
def addAndDeleteMin():
	global ans
	global p
	minv = min(p)
	ans += minv
	p.remove(minv)

n,k = map(int,input().split())
p = [int(x) for x in input().split()]
ans = 0
for i in range(k):
	addAndDeleteMin()
print(ans)

Buggy python submission (verdict: Runtime Error):
fruits = []
minimumValue = -1

def processValue(array:list):
	global minimumValue
	value = 0
	for i in array:
		value += fruits[i]
	
	if minimumValue == -1 or value < minimumValue:
		minimumValue = value

def combi(n,k,i,array):
	if i == k:
		processValue(array)
		return
	for j in range(array[i-1],n):
		if j in array[0:i]:
			continue
		array[i] = j
		combi(n,k,i+1,array)

def main():
	global fruits
	global minimumValue
	n,k = map(int,input().split())
	fruits = [int(f) for f in input().split()]
	combi(n,k,0,[0 for _ in range(k)])
	print(minimumValue)

main()

Fixed submission:
def addAndDeleteMin():
	global ans
	global p
	minv = min(p)
	ans += minv
	p.remove(minv)

n,k = map(int,input().split())
p = [int(x) for x in input().split()]
ans = 0
for i in range(k):
	addAndDeleteMin()
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
x = int(input())
ans = 2
while(True):
    if x*ans == 360:
        print(ans)
        sys.exit()
    ans +=1

Fixed submission:
import sys
x = int(input())
ans = 2
while(True):
    if x*ans % 360 == 0:
        print(ans)
        sys.exit()
    ans +=1
Buggy python submission (verdict: Runtime Error):
n = int(intput())
res = n // 2
if n % 2 == 1:
  res += 1
print(res)


Fixed submission:
n = int(input())
res = n // 2
if n % 2 == 1:
  res += 1
print(res)

Buggy python submission (verdict: Runtime Error):
n = int(intput())
res = n // 2
if n % 2 == 1:
  res += 1
print(res)

Fixed submission:
n = int(input())
res = n // 2
if n % 2 == 1:
  res += 1
print(res)

Buggy python submission (verdict: Runtime Error):
n = int(intput())
res = n // 2
if n % 2 == 1:
  res += 1
print(res)


Fixed submission:
n = int(input())
res = n // 2
if n % 2 == 1:
  res += 1
print(res)

Buggy python submission (verdict: Runtime Error):
n = int(intput())
res = n // 2
if n % 2 == 1:
  res += 1
print(res)


Fixed submission:
n = int(input())
res = n // 2
if n % 2 == 1:
  res += 1
print(res)

Buggy python submission (verdict: Runtime Error):
n = int(intput())
res = n // 2
if res % 2 == 1:
  res += 1
print(res)

Fixed submission:
n = int(input())
res = n // 2
if n % 2 == 1:
  res += 1
print(res)

Buggy python submission (verdict: Runtime Error):
n = int(intput())

res = n // 2
if res % 2 == 1:
  res += 1
  
print(res)

Fixed submission:
n = int(input())
res = n // 2
if n % 2 == 1:
  res += 1
print(res)

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

res = n //2 

if n%2 == 1:
  res += 1
  
return res

Fixed submission:
n = int(input())
res = n // 2
if n % 2 == 1:
  res += 1
print(res)

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

res = n//2
if res % 2 == 1:
  res += 1

return res

Fixed submission:
n = int(input())
res = n // 2
if n % 2 == 1:
  res += 1
print(res)
Buggy python submission (verdict: Time Limit Exceeded):
import sys

n,k = map(int,input().split())
ans = 0;
h = [int(x) for x in input().split()]
for i in range(k):
    if len(h) == 0:
        break;
    m = max(h)
    h.remove(m)


if len(h) > 0:
    ans += sum(h)

print(ans)


Fixed submission:
import sys

n,k = map(int,input().split())
ans = 0;
h = [int(x) for x in input().split()]
h.sort(reverse = True)
h = h[k:]

if len(h) > 0:
    ans += sum(h)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
min = n
for i in range(1,n+1):
    if n % i == 0:
        if min > i + n/i-2:
            min = i + n/i -2
        elif min <= i + n/i-2:
            break
print(int(min))

Fixed submission:
import math
n = int(input())
min = n - 1
#√n を算出
split = n / math.sqrt(n)


for i in range(int(split),0,-1):
    if n % i == 0:
        min = i + n/i -2
        break

print(int(min))

Buggy python submission (verdict: Runtime Error):
n = int(input())
min = n
for i in range(1,n+1):
  if n % i == 0:
      if min < x + n/i
      
print(min)

Fixed submission:
import math
n = int(input())
min = n - 1
#√n を算出
split = n / math.sqrt(n)


for i in range(int(split),0,-1):
    if n % i == 0:
        min = i + n/i -2
        break

print(int(min))

Buggy python submission (verdict: Runtime Error):
n = int(input())
min = -1
for i in range(1,n+1):
  if min == -1:
    if n % i == 0:
      if min < x + n/i
      
print(min)

Fixed submission:
import math
n = int(input())
min = n - 1
#√n を算出
split = n / math.sqrt(n)


for i in range(int(split),0,-1):
    if n % i == 0:
        min = i + n/i -2
        break

print(int(min))
Buggy python submission (verdict: Runtime Error):
import math
N,D = map(int,input().split())

people = math.ceil(N // (2D+1))
print(people)

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

people = N / (2*D+1)
if people % 1.0 != 0:#割り切れないのであれば？？
    people+=1
print(int(people))
Buggy python submission (verdict: Runtime Error):
a=input()
b=input()
c=input()
d=input()
e=input()
k=input()
array=[a,b,c,d,e]
flag=True

for i in range(5):
  for j in range(5):
    if array[i]-array[j] >= k:
      flag=False
      print(":(")
      break
  if not flag:
    break
      
if flag:
  print("Yay!")

Fixed submission:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
array=[a,b,c,d,e]
flag=True
 
for i in range(5):
  for j in range(5):
    if array[i]-array[j] > k:
      flag=False
      print(":(")
      break
  if not flag:
    break
      
if flag:
  print("Yay!")
Buggy python submission (verdict: Runtime Error):
def f(x):
    length=0
    array=[]
    for b in x:
        if b==True:
            length+=1
        else:
            array.append(length)
            length=0

    return array

s=input()
sb = ['A','C','G','T']
boola=list()
length=0

for x in s:
    boola.append(x in sb)

print(max(f(boola)))
    

Fixed submission:
def f(x):
    length=0
    array=[]
    for b in x:
        if b==True:
            length+=1
        else:
            array.append(length)
            length=0

    array.append(length)
    return array

s=input()
sb = ['A','C','G','T']
boola=list()
length=0

for x in s:
    boola.append(x in sb)

print(max(f(boola)))
Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
shop=dict()
for x in range(N):
    shop[x]=[int(x) for x in input().split()]

min=1
count=0
used_money=0;
while True:
    for x in range(len(shop)):
        if shop[x][0] == min and shop[x][1]!=0:
            for n in range(shop[x][1]):
                if(count<M):
                    shop[x][1]-=1
                    count+=1
                    used_money+=shop[x][0]
                else:
                    break
    if count==M:
        break       
    min+=1
    
print(used_money)

Fixed submission:
N,M = map(int,input().split())
shop=[[int(x) for x in input().split()] for j in range(N)]

shop_s=sorted(shop)
count=0
used_money=0

for s in shop_s:
    for i in range(s[1]):
        if(M!=count and s[1]!=0):#買った数がMに達していない && 在庫が０ではない
            s[1]-=1
            count+=1
            used_money += s[0]
        else:
            break
    if  count == M:
        break
print(used_money)
Buggy python submission (verdict: Runtime Error):
A,B,K = map(int,input().split())
if(B>A):
  A,B=B,A
divisor = [x for x in range(B,0,-1) if (A%x==0 and B%x==0)]
print(divisor[K+1])

Fixed submission:
A,B,K = map(int,input().split())
d=[]
if(A>B):
    M=A
    m=B
else:
    M=B
    m=A

for x in range(m,0,-1):
    if(m%x ==0 and M%x ==0):
       d.append(x) 

print(d[K-1])