Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
s = input()

a = [0] * len(s)
b = [0] * len(s)
c = [0] * len(s)
q = 0

if s[0] == "A":
    a[0] = 1
elif s[0] == "?":
    a[0] = 1
    q = 1

for i in range(1, len(s)):
    if s[i] == "A":
        a[i] = a[i - 1] + 3**q
        b[i] = b[i - 1]
        c[i] = c[i - 1]
    elif s[i] == "B":
        a[i] = a[i - 1]
        b[i] = b[i - 1] + a[i - 1]
        c[i] = c[i - 1]
    elif s[i] == "C":
        a[i] = a[i - 1]
        b[i] = b[i - 1]
        c[i] = c[i - 1] + b[i - 1]
    else:
        a[i] = 3 * a[i - 1] + 3**q
        b[i] = 3 * b[i - 1] + a[i - 1]
        c[i] = 3 * c[i - 1] + b[i - 1]
        q += 1
        
print(c[len(s) - 1] % (10**9 + 7))

Fixed submission:
s = input()

a = [0] * len(s)
b = [0] * len(s)
c = [0] * len(s)
q = 0
m = 10**9 + 7

if s[0] == "A":
    a[0] = 1
elif s[0] == "?":
    a[0] = 1
    q = 1

for i in range(1, len(s)):
    if s[i] == "A":
        a[i] = (a[i - 1] + pow(3, q, m)) % m
        b[i] = b[i - 1] % m
        c[i] = c[i - 1] % m
    elif s[i] == "B":
        a[i] = a[i - 1] % m
        b[i] = (b[i - 1] + a[i - 1]) % m
        c[i] = c[i - 1] % m
    elif s[i] == "C":
        a[i] = a[i - 1] % m
        b[i] = b[i - 1] % m
        c[i] = (c[i - 1] + b[i - 1]) % m
    else:
        a[i] = (3 * a[i - 1] + pow(3, q, m)) % m
        b[i] = (3 * b[i - 1] + a[i - 1]) % m
        c[i] = (3 * c[i - 1] + b[i - 1]) % m
        q += 1
        
print(c[len(s) - 1] % m)

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

a = [0] * len(s)
b = [0] * len(s)
c = [0] * len(s)
q = 0

if s[0] == "A":
    a[0] = 1
elif s[0] == "?":
    a[0] = 1
    q = 1

for i in range(1, len(s)):
    if s[i] == "A":
        a[i] = a[i - 1] + 3**q
        b[i] = b[i - 1]
        c[i] = c[i - 1]
    elif s[i] == "B":
        a[i] = a[i - 1]
        b[i] = b[i - 1] + a[i - 1]
        c[i] = c[i - 1]
    elif s[i] == "C":
        a[i] = a[i - 1]
        b[i] = b[i - 1]
        c[i] = c[i - 1] + b[i - 1]
    else:
        a[i] = 3 * a[i - 1] + 3**q
        b[i] = 3 * b[i - 1] + a[i - 1]
        c[i] = 3 * c[i - 1] + b[i - 1]
        q += 1
        
print(c[len(s) - 1] % (10**9 + 7))

Fixed submission:
s = input()

a = [0] * len(s)
b = [0] * len(s)
c = [0] * len(s)
q = 0
m = 10**9 + 7

if s[0] == "A":
    a[0] = 1
elif s[0] == "?":
    a[0] = 1
    q = 1

for i in range(1, len(s)):
    if s[i] == "A":
        a[i] = (a[i - 1] + pow(3, q, m)) % m
        b[i] = b[i - 1] % m
        c[i] = c[i - 1] % m
    elif s[i] == "B":
        a[i] = a[i - 1] % m
        b[i] = (b[i - 1] + a[i - 1]) % m
        c[i] = c[i - 1] % m
    elif s[i] == "C":
        a[i] = a[i - 1] % m
        b[i] = b[i - 1] % m
        c[i] = (c[i - 1] + b[i - 1]) % m
    else:
        a[i] = (3 * a[i - 1] + pow(3, q, m)) % m
        b[i] = (3 * b[i - 1] + a[i - 1]) % m
        c[i] = (3 * c[i - 1] + b[i - 1]) % m
        q += 1
        
print(c[len(s) - 1] % m)
Buggy python submission (verdict: Time Limit Exceeded):
n, c = [int(i) for i in input().split(" ")]
d = [0 for i in range(0, c + 1)]
a = [0 for i in range(0, n + 1)]

for i in range(1, c + 1):
    d[i] = [0] + [int(i) for i in input().split(" ")]

for i in range(1, n + 1):
    a[i] = [0] + [int(i) for i in input().split(" ")]
    
m = [[] for i in range(0, 3)]

for i in range(1, n + 1):
    for j in range(1, n + 1):
        m[(i + j) % 3].append(a[i][j])

d_min = 1000*500*500

def s(p):
    ca = [True] * (c + 1)
    c_min = 0
    global d_min
    d_min_t_sum = 0
    for mod in p:
        d_min_t = 1000*500*500
        for ci in range(1, c + 1):
            if ca[ci]:
                d_sum = sum([d[mi][ci] for mi in m[mod]])
                #print(d_sum)
                if d_sum < d_min_t:
                    d_min_t = d_sum
                    c_min = ci
        ca[c_min] = False
        d_min_t_sum += d_min_t
    if d_min_t_sum < d_min:
        d_min = d_min_t_sum
        
s([0, 1, 2])
s([0, 2, 1])
s([1, 0, 2])
s([1, 2, 0])
s([2, 1, 0])
s([2, 0, 1])

print(d_min)

Fixed submission:
n, c = [int(i) for i in input().split(" ")]
d = [0 for i in range(0, c + 1)]
a = [0 for i in range(0, n + 1)]

for i in range(1, c + 1):
    d[i] = [0] + [int(i) for i in input().split(" ")]

for i in range(1, n + 1):
    a[i] = [0] + [int(i) for i in input().split(" ")]
    
m = [[] for i in range(0, 3)]

for i in range(1, n + 1):
    for j in range(1, n + 1):
        m[(i + j) % 3].append(a[i][j])

d_min = 1000*500*500

def s(p):
    ca = [True] * (c + 1)
    c_min = 0
    global d_min
    d_min_t_sum = 0
    for mod in p:
        d_min_t = 1000*500*500
        for ci in range(1, c + 1):
            if ca[ci]:
                d_sum = sum([d[mi][ci] for mi in m[mod]])
                #print(d_sum)
                if d_sum < d_min_t:
                    d_min_t = d_sum
                    c_min = ci
        ca[c_min] = False
        d_min_t_sum += d_min_t
    if d_min_t_sum < d_min:
        d_min = d_min_t_sum
        
s([0, 1, 2])
s([0, 2, 1])
s([1, 0, 2])
s([1, 2, 0])
s([2, 1, 0])
s([2, 0, 1])

print(d_min)
Buggy python submission (verdict: Runtime Error):
def charToInt(c):
    return ord(c) - ord("a")

def stringToFlags(s):
    t = [False for i in range(26)]
    for i in range(len(s)):
        t[charToInt(s[i])] = True
    return t

def B(n, s):
    max = 0
    for i in range(1, n):
        print(s[0:i], s[i:n])
        xflags = stringToFlags(s[0:i])
        yflags = stringToFlags(s[i:n])
        
        count = 0
        for i in range(26):
            if xflags[i] and yflags[i]:
                count += 1
                if count > max:
                    max = count
    return max

n = int(input())
s = input()
return B(n, s)

Fixed submission:
def charToInt(c):
    return ord(c) - ord("a")
 
def stringToFlags(s):
    t = [False for i in range(26)]
    for i in range(len(s)):
        t[charToInt(s[i])] = True
    return t
 
def B(n, s):
    max = 0
    for i in range(1, n):
        xflags = stringToFlags(s[0:i])
        yflags = stringToFlags(s[i:n])
        
        count = 0
        for i in range(26):
            if xflags[i] and yflags[i]:
                count += 1
                if count > max:
                    max = count
    return max
 
n = int(input())
s = input()
print(B(n, s))
Buggy python submission (verdict: Time Limit Exceeded):
def xor(a, b):
    ab = "{0:020b}".format(a)
    bb = "{0:020b}".format(b)
    r = ""
    for i in range(20):
        if ab[i] == bb[i]:
            r += "0"
        else:
            r += "1"
    return int(r, 2)


def D(n, a):
    n = len(a)
    count = 0
    
    l = 0
    r = 0
    
    x = 0
    sum = 0
    for l in range(n):
        while r < n:
            if xor(x, a[r]) == sum + a[r]:
                sum += a[r]
                x = sum
                r += 1
            else:
                break
        
        #print(l, r - 1, x, sum)
        count += r - l
        x = xor(x, a[l])
        sum -= a[l]
        
    return count

n = int(input())
a = list(map(int, input().split()))
print(D(n, a))

Fixed submission:
def D(n, a):
    n = len(a)
    count = 0
    
    l = 0
    r = 0
    
    sum = 0
    for l in range(n):
        while r < n:
            if sum & a[r] == 0:
                sum += a[r]
                x = sum
                r += 1
            else:
                break
        count += r - l
        sum -= a[l]
        
    return count

n = int(input())
a = list(map(int, input().split()))
print(D(n, a))

Buggy python submission (verdict: Time Limit Exceeded):
def xor(a, b):
    ab = "{0:020b}".format(a)
    bb = "{0:020b}".format(b)
    r = ""
    for i in range(20):
        if ab[i] == bb[i]:
            r += "0"
        else:
            r += "1"
    return int(r, 2)


def D(n, a):
    count = 0
    
    for l in range(n):
        x = a[l]
        sum = a[l]
        if x == sum:
            count += 1
        
        for r in range(l + 1, n):
            x = xor(x, a[r])
            sum += a[r]
            if x == sum:
                count += 1
    return count

n = int(input())
a = list(map(int, input().split()))
print(D(n, a))

Fixed submission:
def D(n, a):
    n = len(a)
    count = 0
    
    l = 0
    r = 0
    
    sum = 0
    for l in range(n):
        while r < n:
            if sum & a[r] == 0:
                sum += a[r]
                x = sum
                r += 1
            else:
                break
        count += r - l
        sum -= a[l]
        
    return count

n = int(input())
a = list(map(int, input().split()))
print(D(n, a))
Buggy python submission (verdict: Runtime Error):
def comb(n, r):
    return f(n) / (f(n - r) * f(r)) 
 
def f(n):
    if n == 0:
        return 1
    else:
        return n * f(n - 1)
 
n = input()
a = map(int, raw_input().split())
 
a.sort()
a.reverse()
max = 0
ai = 0
aj = 0
for i in range(0, len(a)):
    for j in range(i + 1, len(a)):
        c = comb(a[i], a[j])
        if c > max:
            max = c
            ai = a[i]
            aj = a[j]
print(str(ai) + " " + str(aj))

Fixed submission:
n = int(input())
a = [int(i) for i in input().split(" ")]
m = max(a)
abs_min = m
abs_i = 0

for i in range(0, n):
    ab = abs((m + 1)//2 - a[i])
    if a[i] != m and abs_min > ab:
        abs_min = ab
        abs_i = i
        
print(m, a[abs_i])

Buggy python submission (verdict: Runtime Error):
def comb(n, r):
    return f(n) / (f(n - r) * f(r)) 
 
def f(n):
    if n == 1:
        return 1
    else:
        return n * f(n - 1)

n = input()
a = map(int, raw_input().split())
 
a.sort()
a.reverse()
max = 0
ai = 0
aj = 0
for i in range(0, len(a)):
    for j in range(i + 1, len(a)):
        c = comb(a[i], a[j])
        if c > max:
            max = c
            ai = a[i]
            aj = a[j]
print(str(ai) + " " + str(aj))

Fixed submission:
n = int(input())
a = [int(i) for i in input().split(" ")]
m = max(a)
abs_min = m
abs_i = 0

for i in range(0, n):
    ab = abs((m + 1)//2 - a[i])
    if a[i] != m and abs_min > ab:
        abs_min = ab
        abs_i = i
        
print(m, a[abs_i])

Buggy python submission (verdict: Runtime Error):
def comb(n, r):
    return f(n) / (f(n - r) * f(r)) 
 
def f(n):
    if n == 1:
        return 1
    else:
        return n * f(n - 1)

n = input()
a = map(int, raw_input().split())
 
a.sort()
a.reverse()
max = 0
ai = 0
aj = 0
for i in range(0, len(a)):
    for j in range(i + 1, len(a)):
        c = comb(a[i], a[j])
        if c > max:
            max = c
            ai = a[i]
            aj = a[j]
print(str(ai) + " " + str(aj))

Fixed submission:
n = int(input())
a = [int(i) for i in input().split(" ")]
m = max(a)
abs_min = m
abs_i = 0

for i in range(0, n):
    ab = abs((m + 1)//2 - a[i])
    if a[i] != m and abs_min > ab:
        abs_min = ab
        abs_i = i
        
print(m, a[abs_i])

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

    a.sort()
    a.reverse()
    max = 0
    ai = 0
    aj = 0
    for i in range(0, len(a)):
        for j in range(i + 1, len(a)):
            c = comb(a[i], a[j])
            if c > max:
                max = c
                ai = a[i]
                aj = a[j]
    print(str(ai) + " " + str(aj))
    
def comb(n, r):
    return f(n) / (f(n - r) * f(r)) 

def f(n):
    if n == 1:
        return 1
    else:
        return n * f(n - 1)

Fixed submission:
n = int(input())
a = [int(i) for i in input().split(" ")]
m = max(a)
abs_min = m
abs_i = 0

for i in range(0, n):
    ab = abs((m + 1)//2 - a[i])
    if a[i] != m and abs_min > ab:
        abs_min = ab
        abs_i = i
        
print(m, a[abs_i])
Buggy python submission (verdict: Runtime Error):
import math

q = int(input())
a = [0] * q
b = [0] * q

for i in range(0, q):
    a[i], b[i] = [int(i) for i in input().split(" ")]

for i in range(0, q):
    mi = min(a[i], b[i])
    mx = max(a[i], b[i])
    p = mi * mx - 1
    s = p**(1/2)
    c = 2 * math.floor(s - 1)
    if mi <= math.floor(s - 1):
        c -= 1
    if math.floor(p / math.floor(s)) > math.floor(s):
        if math.floor(s) == mi:
            c += 1
        else:
            c += 2
    elif math.floor(p / math.floor(s)) == math.floor(s) and math.floor(s) != mi:
        c += 1
    print(c)

Fixed submission:
import math

q = int(input())
a = [0] * q
b = [0] * q

for i in range(0, q):
    a[i], b[i] = [int(i) for i in input().split(" ")]
    
def sqrt_int(n):
    s = math.floor(n**(1/2)) - 1
    while s * s <= n:
        s += 1
    return s - 1

for i in range(0, q):
    mi = min(a[i], b[i])
    mx = max(a[i], b[i])
    p = mi * mx - 1
    s = math.floor(p**(1/2))
    c = 2 * (s - 1)
    if s == 0:
        print(0)
        continue
    if mi <= s - 1:
        c -= 1
    r = p // s
    if r > s:
        if s == mi:
            c += 1
        else:
            c += 2
    elif r == s and s != mi:
        c += 1
    print(c)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(i) for i in input().split(" ")]
b = [int(i) for i in input().split(" ")]

def sL(v, x, l, r):
    if l == r:
        return l
    else:
        h = (l + r) // 2
        if x > v[h]:
            return sL(v, x, h + 1, r)
        else:
            return sL(v, x, l, h)

p = 1
x = 0
for k in range(0, 29):
    b_m = [i % (p * 2) for i in b]
    b_m = sorted(b_m)
    s = 0
    for ai in a:
        u = ai % (p * 2)
        s += sL(b_m, p * 2 - u, 0, n) - sL(b_m, p - u, 0, n) + sL(b_m, p * 4 - u, 0, n) - sL(b_m, 3 * p - u, 0, n)
    if s % 2 == 1:
        x += p
    p *= 2

print(x)

Fixed submission:
n = int(input())
a = [int(i) for i in input().split(" ")]
b = [int(i) for i in input().split(" ")]

#n = 200000
#a = [1] * n
#b = [1] * n
#b_m = [0] * n

p = 1
x = 0
for k in range(0, 29):
    b_m = sorted([i % (p * 2) for i in b])
    a_m = sorted([i % (p * 2) for i in a], reverse=True)
    s = 0
    l1 = 0
    r1 = 0
    l2 = 0
    r2 = 0
    for a_mi in a_m:
        while l1 < n and a_mi + b_m[l1] < p:
            l1 += 1
        while r1 < n and a_mi + b_m[r1] < 2 * p:
            r1 += 1
        while l2 < n and a_mi + b_m[l2] < 3 * p:
            l2 += 1
        while r2 < n and a_mi + b_m[r2] < 4 * p:
            r2 += 1
        s += r2 - l2 + r1 - l1
    if s % 2 == 1:
        x += p
    p *= 2

print(x)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(i) for i in input().split(" ")]
b = [int(i) for i in input().split(" ")]

def sL(v, x, l, r):
    if l == r:
        return l
    else:
        h = (l + r) // 2
        if x > v[h]:
            return sL(v, x, h + 1, r)
        else:
            return sL(v, x, l, h)

p = 1
x = 0
for k in range(0, 29):
    b_m = [i % (p * 2) for i in b]
    b_m = sorted(b_m)
    s = 0
    for ai in a:
        u = ai % (p * 2)
        s += sL(b_m, p * 2 - u, 0, n) - sL(b_m, p - u, 0, n) + sL(b_m, p * 4 - u, 0, n) - sL(b_m, 3 * p - u, 0, n)
    if s % 2 == 1:
        x += p
    p *= 2

print(x)

Fixed submission:
n = int(input())
a = [int(i) for i in input().split(" ")]
b = [int(i) for i in input().split(" ")]

#n = 200000
#a = [1] * n
#b = [1] * n
#b_m = [0] * n

p = 1
x = 0
for k in range(0, 29):
    b_m = sorted([i % (p * 2) for i in b])
    a_m = sorted([i % (p * 2) for i in a], reverse=True)
    s = 0
    l1 = 0
    r1 = 0
    l2 = 0
    r2 = 0
    for a_mi in a_m:
        while l1 < n and a_mi + b_m[l1] < p:
            l1 += 1
        while r1 < n and a_mi + b_m[r1] < 2 * p:
            r1 += 1
        while l2 < n and a_mi + b_m[l2] < 3 * p:
            l2 += 1
        while r2 < n and a_mi + b_m[r2] < 4 * p:
            r2 += 1
        s += r2 - l2 + r1 - l1
    if s % 2 == 1:
        x += p
    p *= 2

print(x)
Buggy python submission (verdict: Runtime Error):
n, k = [int(i) for i in input().split(" ")]
dm = [[0 for j in range(0, 2 * k)] for i in range(0, 2 * k)]
s = [[0 for j in range(0, 2 * k + 1)] for  i in range(0, 2 * k + 1)]

for i in range(0, n):
    x, y, c = input().split(" ")
    x = int(x) % (2 * k)
    if c == "W":
        y = int(y) % (2 * k)
    else:
        y = int(y + k) % (2 * k)
    dm[x][y] += 1

for i in range(1, 2 * k + 1):
    for j in range(1, 2 * k + 1):
        s[i][j] = s[i][j - 1] + s[i - 1][j] - s[i - 1][j - 1] + dm[i - 1][j - 1]

def srect(i, j, r, l):
    global s
    return s[r][l] - s[r][j] - s[i][l] + s[i][j]

m = 0
for i in range(0, k):
    for j in range(0, k):
        aw = srect(i, j, i + k, j + k) + srect(i + k, j + k, 2 * k, 2 * k)
        raw = s[2 * k][2 * k] - aw
        if m < max(aw, raw):
            m = max(aw, raw)
print(m)

#for i in s:
#    print(i)

Fixed submission:
n, k = [int(i) for i in input().split(" ")]
dm = [[0 for j in range(0, 2 * k)] for i in range(0, 2 * k)]
s = [[0 for j in range(0, 2 * k + 1)] for  i in range(0, 2 * k + 1)]

for i in range(0, n):
    x, y, c = input().split(" ")
    x = int(x) % (2 * k)
    if c == "W":
        y = int(y) % (2 * k)
    else:
        y = (int(y) + k) % (2 * k)
    dm[x][y] += 1

for i in range(1, 2 * k + 1):
    for j in range(1, 2 * k + 1):
        s[i][j] = s[i][j - 1] + s[i - 1][j] - s[i - 1][j - 1] + dm[i - 1][j - 1]

def srect(i, j, r, l):
    global s
    return s[r][l] - s[r][j] - s[i][l] + s[i][j]

m = 0
for i in range(0, k):
    for j in range(0, k):
        aw = srect(0, j, i, j + k) + srect(i, 0, i + k, j) + srect(i, j + k, i + k, 2 * k) + srect(i + k, j, 2 * k, j + k)
        raw = n - aw
        if m < max(aw, raw):
            m = max(aw, raw)
print(m)
Buggy python submission (verdict: Runtime Error):
import sys

argv = sys.argv
a = []

P = int(argv[0])
Q = int(argv[1])
R = int(argv[2])

a.append(P)
a.append(Q)
a.append(R)
max = 0
for i in a:
    if max < i:
        max = i

print(sum(a)-max)

Fixed submission:
import sys

a = []


P, Q, R=map(int, input().split())
a.append(P)
a.append(Q)
a.append(R)
max = 0
for i in a:
    if max < i:
        max = i

print(sum(a)-max)

Buggy python submission (verdict: Runtime Error):
import sys

argv = sys.argv
a = []

P = int(argv[1])
Q = int(argv[2])
R = int(argv[3])

a.append(P)
a.append(Q)
a.append(R)
max = 0
for i in a:
    if max < i:
        max = i

print(sum(a)-max)

Fixed submission:
import sys

a = []


P, Q, R=map(int, input().split())
a.append(P)
a.append(Q)
a.append(R)
max = 0
for i in a:
    if max < i:
        max = i

print(sum(a)-max)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
L_max, R_min = 0, 100000
for i in range(M):
  L, R = map(int,input().split())
  if L_max < L:
    L_max = L
  if R_min > R:
    R_min = R
if R_min - L_max < 0:
  print(0)
else:
  print(R_min - L_max + 1)

Fixed submission:
A, B = map(int, input().split())
if A > 12:
  print(B)
elif 5 < A <= 12:
  print(int(B/2))
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
import math

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
A = a % 10
B = b % 10
C = c % 10
D = d % 10
E = e % 10
L = list[A,B,C,D,E]
min_ = L.index(min(L)
A = math.ceil(a)
B = math.ceil(b)
C = math.ceil(c)
D = math.ceil(d)
E = math.ceil(e)
m = A+B+C+D+E
if min_ == 0:
  m = m - A + a
elif min_ == 1:
  m = m - B + b
elif min_ == 2:
  m = m - C + c
elif min_ == 3:
  m = m - D + d
elif min_ == 4:
  m = m - E + e
print(m)

               

Fixed submission:
import math
 
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
A = a % 10
B = b % 10
C = c % 10
D = d % 10
E = e % 10
L = [A,B,C,D,E]
L = [10 if i == 0 else i for i in L]
min_ = L.index(min(L))
A = math.ceil(a*0.1)*10
B = math.ceil(b*0.1)*10
C = math.ceil(c*0.1)*10
D = math.ceil(d*0.1)*10
E = math.ceil(e*0.1)*10
m = A+B+C+D+E
if min_ == 0:
  m = m - A + a
elif min_ == 1:
  m = m - B + b
elif min_ == 2:
  m = m - C + c
elif min_ == 3:
  m = m - D + d
elif min_ == 4:
  m = m - E + e
print(m)
Buggy python submission (verdict: Runtime Error):
import math

n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

L = [n,0,0,0,0]
num = 0
while True:
  if L[0] > a:
    L[0] -= a
    a_ = a
  else:
    a_ = L[0]
    L[0] = 0
  if L[1] > b:
    L[1] -= b
    b_ = b
  else:
    b_ = L[1]
    L[1] = 0
  if L[2] > c:
    L[2] -= c
    c_ = c
  else:
    c_ = L[2]
    L[2] = 0
  if L[3] > d:
    L[3] -= d
    d_ = d
  else:
    d_ = L[3]
    L[3] = 0
  if L[4] > e:
    L[e] -= e
    e_ = e
  else:
    e_ = L[4]
    L[4] = 0
  L[1] += a_
  L[2] += b_
  L[3] += c_
  L[4] += d_
  num += 1
  if sum(L) == 0:
    break
print(num)

Fixed submission:
import math

n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

min_ = min([a,b,c,d,e])
num = math.ceil(n/min_) + 4
print(num)
Buggy python submission (verdict: Runtime Error):
A = input()
if A == 'A'
  print('T')
elif A == 'T'
  print('A')
elif A == 'C'
  print('G')
elif A == 'G'
  print('C')

Fixed submission:
A = input()
if A == 'A':
  print('T')
elif A == 'T':
  print('A')
elif A == 'C':
  print('G')
elif A == 'G':
  print('C')
Buggy python submission (verdict: Runtime Error):
if R<1200:
    print("ABC")
elif R<2800:
    print("ARC")
else:
    print("AGC")


Fixed submission:
R=int(input())
if R<1200:
    print("ABC")
elif R<2800:
    print("ARC")
else:
    print("AGC")
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
a=list(map(int,input().split()))

product=1
for i in range(len(a)):
    product*=a[i]


mods=[]
for i in range(product):
    mods.append(sum([i%a_l for a_l in a]))

ans=max(mods)
print(ans)


Fixed submission:
N=int(input())
a=list(map(int,input().split()))
ans=sum(a)-N
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
K, S = map(int, input().split())
count = 0
for x in range(0, K + 1):
	if (x > S):
		break
	for y in range(0, K + 1):
		if (x + y > S):
			break
		for z in range(0, K + 1):
			if (x + y + z == S):
				count = count + 1
			elif (x + y + z > S):
				break
print(count)


Fixed submission:
K, S = map(int, input().split())
count = 0
for x in range(0, K+1):
	if (x > S):
		break
	for y in range(0, min(S-x+1, K+1)):
		if (S-x-y >= 0 and S-x-y <= K):
			count = count + 1

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
K, S = map(int, input().split())
count = 0
for x in range(0, K + 1):
	for y in range(0, K + 1):
		for z in range(0, K + 1):
			if ((x + y + z) == S):
				count = count + 1
print(count)


Fixed submission:
K, S = map(int, input().split())
count = 0
for x in range(0, K+1):
	if (x > S):
		break
	for y in range(0, min(S-x+1, K+1)):
		if (S-x-y >= 0 and S-x-y <= K):
			count = count + 1

print(count)