Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n, MOD = int(input()), 10 ** 9 + 7

memo = [{} for _ in range(n+1)]
def ok(last4):
    for i in range(4):
        t = list(last4)
        if i >= 1:
            t[i], t[i-1] = t[i-1], t[i]
        if "".join(t).count("AGC") != 0:
            return False
    return True

def dfs(cur, last3):
    if last3 in memo[cur]:
        return memo[cur][last3]
    if cur == N:
        return 1
    ret = 0
    for c in "AGCT":
        if ok(last3 + c):
            ret = (ret + dfs(cur+1, last3[1:] + c)) % MOD
    memo[cur][last3] = ret
    return ret

print(dfs(0,"TTT"))

Fixed submission:
n, MOD = int(input()), 10 ** 9 + 7

memo = [{} for _ in range(n+1)]
def ok(last4):
    for i in range(4):
        t = list(last4)
        if i >= 1:
            t[i], t[i-1] = t[i-1], t[i]
        if "".join(t).count("AGC") != 0:
            return False
    return True

def dfs(cur, last3):
    if last3 in memo[cur]:
        return memo[cur][last3]
    if cur == n:
        return 1
    ret = 0
    for c in "AGCT":
        if ok(last3 + c):
            ret = (ret + dfs(cur+1, last3[1:] + c)) % MOD
    memo[cur][last3] = ret
    return ret

print(dfs(0,"TTT"))

Buggy python submission (verdict: Runtime Error):
n, MOD = int(input()), 10 ** 9 + 7

memo = [{} for _ in range(n+1)]
def ok(last4):
    for i in range(4):
        t = list(last4)
        if i >= 1:
            t[i], t[i-1] = t[i-1], t[i]
        if "".join(t).count("AGC") != 0:
            return False
    return True

def dfs(cur, last3):
    if last3 in memo[cur]:
        return memo[cur][last3]
    if cur == N:
        return 1
    ret = 0
    for c in "AGCT":
        if ok(last3) + c:
            ret = (ret + dfs(cur+1, last3[1:] + c)) % MOD
    memo[cur][last3] = ret
    return ret

print(dfs(0,"TTT"))

Fixed submission:
n, MOD = int(input()), 10 ** 9 + 7

memo = [{} for _ in range(n+1)]
def ok(last4):
    for i in range(4):
        t = list(last4)
        if i >= 1:
            t[i], t[i-1] = t[i-1], t[i]
        if "".join(t).count("AGC") != 0:
            return False
    return True

def dfs(cur, last3):
    if last3 in memo[cur]:
        return memo[cur][last3]
    if cur == n:
        return 1
    ret = 0
    for c in "AGCT":
        if ok(last3 + c):
            ret = (ret + dfs(cur+1, last3[1:] + c)) % MOD
    memo[cur][last3] = ret
    return ret

print(dfs(0,"TTT"))
Buggy python submission (verdict: Runtime Error):
import fraction

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

x = math.gcd(a[0],a[1])

if n != 2:
    for i in range(2,n):
        x = math.gcd(x,a[i])
        
print(x)

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

if b % a == 0:
    print(b+a)
else:
    print(b-a)
Buggy python submission (verdict: Runtime Error):
INF = 10 ** 10

def num(k):#各数字に使用するマッチ棒の本数を返す関数
    if k == 1:
        return 2
    elif k == 7:
        return 3
    elif k == 4:
        return 4
    elif k == 2 or k == 3 or k == 5:
        return 5
    elif k == 6 or k == 9:
        return 6
    elif k == 8:
        return 7

n, m = map(int,input().split())
l = list(map(int,input().split()))
l.sort(reverse = True)
         
dp = [(-1) * INF] * (n+1)

dp[0] = 0

for i in range(2,n+1):
    can = []
    for x in l:
        if i-num(x)>=0:
            can.append(dp[i-num(x)]+1)
    if can == []:
        dp[i] = (-1) * INF
    else:
        dp[i] = max(can)
        
#print(dp)

anslist = [0] * dp[n]

left = n

for j in range(dp[n],0,-1):#jは桁数
    if j == 1:
        for x in l:
            if num(x) == left:
                anslist[j-1] = x
                break
    else:
        for x in l:
            if dp[left-num(x)] == j - 1:
                anslist[j-1] = x#j桁目は10^(j-1)の位
                left = left-num(x)
                break
            
    #print([j,x,left])
#print(anslist)
            
            
ans = 0

for j in range(0,dp[n]):
    ans = ans + anslist[j] * (10 ** j)

print(ans)
         
    

Fixed submission:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

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

x = gcd(a[0],a[1])

if n != 2:
    for i in range(2,n):
        x = gcd(x,a[i])
        
print(x)

Buggy python submission (verdict: Runtime Error):
#ABC118_C

import fraction

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

x = fraction.gcd(a[0],a[1])

if n != 2:
    for i in range(2,n):
        x = fraction.gcd(x,a[i])
        
print(x)

Fixed submission:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

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

x = gcd(a[0],a[1])

if n != 2:
    for i in range(2,n):
        x = gcd(x,a[i])
        
print(x)

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

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

x = math.gcd(a[0],a[1])

if n != 2:
    for i in range(2,n):
        x = math.gcd(x,a[i])
        
print(x)

Fixed submission:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

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

x = gcd(a[0],a[1])

if n != 2:
    for i in range(2,n):
        x = gcd(x,a[i])
        
print(x)

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

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

x = math.gcd(a[0],a[1])

if n != 2:
    for i in range(2,n):
        x = math.gcd(x,a[i])
        
print(x)

Fixed submission:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

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

x = gcd(a[0],a[1])

if n != 2:
    for i in range(2,n):
        x = gcd(x,a[i])
        
print(x)
Buggy python submission (verdict: Runtime Error):
MOD = 10 ** 9 +7
h, w, k = map(int,input().split())

if w == 1:
    print(1)
else:
    acr = []
    for p in range(2**(w-1)):
        det = 0
        pp = p
        exist = [0] * (w-1)
        for i in range(w-1):
            exist[i] = pp % 2
            pp = pp // 2
        for ii in range(w-2):
            if exist[ii] == 1 and exist[ii+1] == 1:
                det = 1
        if det == 0:
            acr.append(exist)

    cur = [0] * w
    cur[0] = 1
    n = [0] * w

    for x in range(len(acr)):
        n[0] = cur[1] * acr[x][0] + cur[0] * (1-acr[x][0])
        for j in range(1,w-1):
            n[j] = cur[j-1] * acr[x][j-1] + cur[j+1] * acr[x][j] + cur[j] * (1-acr[x][j-1])(1-acr[x][j])
        n[w-1] = cur[w-2] * acr[x][w-2] + cur[w-1] * (1-acr[x][w-1])
        cur = n[:]
    print(cur[k-1])

Fixed submission:
MOD = 10 ** 9 +7
h, w, k = map(int,input().split())

if w == 1:
    print(1)
else:
    acr = []
    for p in range(2**(w-1)):
        det = 0
        pp = p
        exist = [0] * (w-1)
        for i in range(w-1):
            exist[i] = pp % 2
            pp = pp // 2
        for ii in range(w-2):
            if exist[ii] == 1 and exist[ii+1] == 1:
                det = 1
        if det == 0:
            acr.append(exist[:])
    #print(acr)

    cur = [0] * w
    cur[0] = 1
    

    for t in range(h):
        n = [0] * w
        for x in range(len(acr)):
            n[0] = (n[0] + cur[1] * acr[x][0] + cur[0] * (1-acr[x][0]))%MOD
            for j in range(1,w-1):
                n[j] = (n[j] + cur[j-1] * acr[x][j-1] + cur[j+1] * acr[x][j] + cur[j] * (1-acr[x][j-1])*(1-acr[x][j]))%MOD
            n[w-1] = (n[w-1] + cur[w-2] * acr[x][w-2] + cur[w-1] * (1-acr[x][w-2])) % MOD
        
        cur = n[:]
        
    print(cur[k-1])
Buggy python submission (verdict: Runtime Error):
N, M = map(int,input().split())
a = [0] + list(map(int,input().split()))

total = 0
info = [0] * M
info[0] = 1

for i in range(1,N+1):
    total = (total + a[i]) % M
    info[total] += 1

#print(info)

ans = 0

for j in range(M):
    ans += (info[j] * (info[j] - 1)) // 2
    #print(ans)

print(ans)


Fixed submission:
N, M = map(int,input().split())
a = [0] + list(map(int,input().split()))

total = 0
info = {}
info[0] = 1

for i in range(1,N+1):
    total = (total + a[i]) % M
    if total in info:
        info[total] += 1
    else:
        info[total] = 1

#print(info)

ans = 0

for j in info:
    ans += (info[j] * (info[j] - 1)) // 2
    #print(ans)

print(ans)

Buggy python submission (verdict: Runtime Error):
N, M = map(int,input().split())
a = [0] + list(map(int,input().split()))

total = 0
info = [0] * M
info[0] = 1

for i in range(1,N+1):
    total = (total + a[i]) % M
    info[total] += 1

#print(info)

ans = 0

for j in range(M):
    ans += (info[j] * (info[j] - 1)) // 2
    #print(ans)

print(ans)


Fixed submission:
N, M = map(int,input().split())
a = [0] + list(map(int,input().split()))

total = 0
info = {}
info[0] = 1

for i in range(1,N+1):
    total = (total + a[i]) % M
    if total in info:
        info[total] += 1
    else:
        info[total] = 1

#print(info)

ans = 0

for j in info:
    ans += (info[j] * (info[j] - 1)) // 2
    #print(ans)

print(ans)
Buggy python submission (verdict: Runtime Error):
H,W,D = map(int,input().split())

A = [[0]*W for i in range(H)]
data = [0]*(H*W+1)

for i in range(H):
    A[i] = list(map(int,input().split()))

for i in range(H):
    for j in range(W):
        data[A[i][j]] = [i,j]

Q = int(input())

L = [0] * Q
R = [0] * Q

for i in range(Q):
    L[i],R[i] = map(int,input().split())

X = [0]*300

for i in range(D):
    x = H*W-D-i
    count = 0
    while x > 0:
        count += abs(data[x][0]-data[x+D][0])+abs(data[x][1]-data[x+D][1])
        X[x] += count
        x -= D

for i in range(Q):
    print(X[L[i]]-X[R[i]])

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

A = [[0]*W for i in range(H)]
data = [0]*(H*W+1)

for i in range(H):
    A[i] = list(map(int,input().split()))

for i in range(H):
    for j in range(W):
        data[A[i][j]] = [i,j]

Q = int(input())

L = [0] * Q
R = [0] * Q

for i in range(Q):
    L[i],R[i] = map(int,input().split())

X = [0]*(H*W+1)

for i in range(D):
    x = H*W-D-i
    count = 0
    while x > 0:
        count += abs(data[x][0]-data[x+D][0])+abs(data[x][1]-data[x+D][1])
        X[x] += count
        x -= D

for i in range(Q):
    print(X[L[i]]-X[R[i]])

Buggy python submission (verdict: Time Limit Exceeded):
H,W,D = map(int,input().split())

A = [[0]*W for i in range(H)]
data = [0]*(H*W+1)

for i in range(H):
    A[i] = list(map(int,input().split()))

for i in range(H):
    for j in range(W):
        data[A[i][j]] = [i,j]

Q = int(input())

L = [0] * Q
R = [0] * Q

for i in range(Q):
    L[i],R[i] = map(int,input().split())


for i in range(Q):
    ans = 0
    x = L[i]
    while x != R[i]:
        ans += abs(data[x+D][0]-data[x][0])
        ans += abs(data[x+D][1]-data[x][1])
        x += D
    print(ans)

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

A = [[0]*W for i in range(H)]
data = [0]*(H*W+1)

for i in range(H):
    A[i] = list(map(int,input().split()))

for i in range(H):
    for j in range(W):
        data[A[i][j]] = [i,j]

Q = int(input())

L = [0] * Q
R = [0] * Q

for i in range(Q):
    L[i],R[i] = map(int,input().split())

X = [0]*(H*W+1)

for i in range(D):
    x = H*W-D-i
    count = 0
    while x > 0:
        count += abs(data[x][0]-data[x+D][0])+abs(data[x][1]-data[x+D][1])
        X[x] += count
        x -= D

for i in range(Q):
    print(X[L[i]]-X[R[i]])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

A = [[0]*N for i in range(N)]

for i in range(N):
    A[i] = list(map(int,input().split()))
B = [[A[i][j] for j in range(i+1,N)] for i in range(N-1)]
#print(A)
#print(B)

det = 0

for i in range(N-1):
    for j in range(i+1,N):
        for k in range(N):
            if A[i][j] > A[i][k] + A[k][j]:
                det = -1
                break
            elif i != k and j != k and A[i][j] == A[i][k] + A[k][j]:
                B[i][j-(i+1)] = 0
                #print(i,j,k,B)
        
        if det == -1:
            break

    if det == -1:
        break

if det == 0:
    ans = 0
    for i in range(N-1):
        for j in range(i+1,N):
            ans += B[i][j-(i+1)]
else:
    ans = -1

print(ans)


Fixed submission:
N = int(input())

A = [[0]*N for i in range(N)]

for i in range(N):
    A[i] = list(map(int,input().split()))
B = [[A[i][j] for j in range(i+1,N)] for i in range(N-1)]
#print(A)
#print(B)

det = 0

for i in range(N-1):
    for j in range(i+1,N):
        for k in range(N):
            if A[i][j] > A[i][k] + A[k][j]:
                det = -1
                break
            elif i != k and j != k and A[i][j] == A[i][k] + A[k][j]:
                B[i][j-(i+1)] = 0
                #print(i,j,k,B)
        
        if det == -1:
            break

    if det == -1:
        break

if det == 0:
    ans = 0
    for i in range(N-1):
        for j in range(i+1,N):
            ans += B[i][j-(i+1)]
else:
    ans = -1

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = [0] * n
for i in range(0,n):
    s[i] = int(input())

#print(s)

l0 = []
l1 = []
for i in range(0,n):
    if s[i] % 10 == 0:
        l1.append(s[i])
    else:
        l0.append(s[i])

#print(l)

w = sum(s)

if w % 10 != 0:
    ans = w

elif l[0] == []:
    ans = 0

else:

    l0.sort
    
    #print(l)
    
    ans = w - l0[0]

print(ans)

Fixed submission:
n = int(input())
s = [0] * n
for i in range(0,n):
    s[i] = int(input())

#print(s)

l0 = []
l1 = []
for i in range(0,n):
    if s[i] % 10 == 0:
        l1.append(s[i])
    else:
        l0.append(s[i])

#print(l)

w = sum(s)

if w % 10 != 0:
    ans = w

elif l0 == []:
    ans = 0

else:

    l0.sort()
    
    #print(l)
    
    ans = w - l0[0]

print(ans)
Buggy python submission (verdict: Runtime Error):
def roof(x):
    if x == int(x):
        return x
    else:
        return int(x)+1

def ans(n,a,b,h):
    
    m = max(h)

    M = roof(m / b)
    
    x = M
    y = 0
    
    if x == 1:
        return x
    
    while x - y > 1:
        half = int((x+y)/2)
        s_half = 0
        for i in range(0,n):
            s_half = s_half +roof((h[i] - b * half) / (a - b))
        if s_half <= half:
            x = half
        else:
            y = half
        #print(x,y)
    
    return x
    
n, a, b = map(int,input().split())

h = [0] * n

for i in range(0,n):
    h[i] = int(input())

print(int(ans(n,a,b,h))

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

h = []

for i in range(N):
    h.append(int(input()))

def det(num):
    count = 0
    for i in range(N):
        H = h[i]-B*num
        count += max(0,H//(A-B) + min(1,H%(A-B)))
    if count <= num:
        return True
    else:
        return False

x = 1###False
y = max(h)###True

while y - x > 1:
    if det((x+y)//2):
        y = (x+y)//2
    else:
        x = (x+y)//2
    #print(x,y)

print(y)
Buggy python submission (verdict: Runtime Error):
h, w = map(int,input().split())

if w % 3 == 0 or h % 3 == 0:
    print(0)

else:
    s = h * w
    l = []
    for i in range(0,2):
        if w == 2 and i == 0:
            break
        a = (int(w/3) + i) * h
        b = (w - (int(w/3) + i)) * int(h/2)
        c = s - a - b
        l.append(max([a,b,c])-min([a,b,c]))
    for j in range(0,2):
        if h == 2 and j == 0:
            break
        a = (int(h/3) + j) * w
        b = (h - (int(h/3) + j)) * int(w/2)
        c = s - a - b
        l.append(max([a,b,c])-min([a,b,c]))
    print(min(l))

Fixed submission:
h, w = map(int,input().split())

if w % 3 == 0 or h % 3 == 0:
    print(0)

else:
    s = h * w
    l = [h,w]
    for i in range(0,2):
        if w == 2 and i == 0:
            continue
        a = (int(w/3) + i) * h
        b = (w - (int(w/3) + i)) * int(h/2)
        c = s - a - b
        #print([a,b,c])
        l.append(max([a,b,c])-min([a,b,c]))
    for j in range(0,2):
        if h == 2 and j == 0:
            continue
        a = (int(h/3) + j) * w
        b = (h - (int(h/3) + j)) * int(w/2)
        c = s - a - b
        #print([a,b,c])
        l.append(max([a,b,c])-min([a,b,c]))
    print(min(l))
Buggy python submission (verdict: Time Limit Exceeded):
import heapq

n = int(input())

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

func = lambda p: p * (-1)

b = list(map(func,a[:]))

#print(a)
#print(b)

l = [0] * (3*n)

first = a[0:n]
second = b[2*n:3*n]

x = [0] * (3*n)
y = [0] * (3*n)

x[n-1] = sum(first)
y[2*n-1] = sum(second)

heapq.heapify(first)
heapq.heapify(second)

for i in range(n,2*n):
    heapq.heappushpop(first, a[i])
    x[i] = sum(first)

for i in range(n,2*n):
    heapq.heappushpop(second, b[-i-1])
    y[-i-2] = sum(second)
    
for i in range(n-1,2*n):
    l[i] = x[i] + y[i]
    
#print(x)
#print(y)
#print(l)

print(max(l[n-1:2*n]))

Fixed submission:
import heapq

n = int(input())

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

func = lambda p: p * (-1)

b = list(map(func,a[:]))

#print(a)
#print(b)

l = [0] * (3*n)

first = a[0:n]
second = b[2*n:3*n]

x = [0] * (3*n)
y = [0] * (3*n)

x[n-1] = sum(first)
y[2*n-1] = sum(second)

heapq.heapify(first)
heapq.heapify(second)

for i in range(n,2*n):
    heapq.heappush(first, a[i])
    s = first[0]
    heapq.heappop(first)
    x[i] = x[i-1] + a[i] - s

for i in range(n,2*n):
    heapq.heappush(second, b[-i-1])
    t = second[0]
    heapq.heappop(second)
    y[-i-2] = y[-i-1] + b[-i-1] - t
    
for i in range(n-1,2*n):
    l[i] = x[i] + y[i]
    
#print(x)
#print(y)
#print(l)

print(max(l[n-1:2*n]))

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

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

l = [0] * (3*n)

first = a[0:n]
second = a[2*n:3*n]

x = [0] * (3*n)
y = [0] * (3*n)

x[n-1] = sum(first)
y[2*n-1] = sum(second)

for i in range(n,2*n):
    first.append(a[i])
    first.remove(min(first))
    x[i] = sum(first)

for i in range(n,2*n):
    second.append(a[-i-1])
    second.remove(max(second))
    y[-i-2] = sum(second)
    
for i in range(n-1,2*n):
    l[i] = x[i] - y[i]
    
#print(x)
#print(y)
#print(l)

print(max(l[n-1:2*n]))

Fixed submission:
import heapq

n = int(input())

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

func = lambda p: p * (-1)

b = list(map(func,a[:]))

#print(a)
#print(b)

l = [0] * (3*n)

first = a[0:n]
second = b[2*n:3*n]

x = [0] * (3*n)
y = [0] * (3*n)

x[n-1] = sum(first)
y[2*n-1] = sum(second)

heapq.heapify(first)
heapq.heapify(second)

for i in range(n,2*n):
    heapq.heappush(first, a[i])
    s = first[0]
    heapq.heappop(first)
    x[i] = x[i-1] + a[i] - s

for i in range(n,2*n):
    heapq.heappush(second, b[-i-1])
    t = second[0]
    heapq.heappop(second)
    y[-i-2] = y[-i-1] + b[-i-1] - t
    
for i in range(n-1,2*n):
    l[i] = x[i] + y[i]
    
#print(x)
#print(y)
#print(l)

print(max(l[n-1:2*n]))
Buggy python submission (verdict: Runtime Error):
s=list(input())
if 'R' in s:
  if s.count('R')==3:
    print(3)
  if s[0]==s[1]=='R' and s[2]==s[1]=='R':
    print(2)
  else:
    print(1)]
else:
  print(0)

Fixed submission:
s=list(input())
if 'R' in s:
  if s.count('R')==3:
    print(3)
  elif s[0]==s[1]=='R' or s[2]==s[1]=='R':
    print(2)
  else:
    print(1)
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
l,r,d=map(int,input().split())
for x in range(l,r+1):
  if x%d==0:
    c=c+1
print(c)

Fixed submission:
l,r,d=map(int,input().split())
c=0
for x in range(l,r+1):
  if x%d==0:
    c=c+1
print(c)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split("")))
dp=[0 for x in range(n+1)]
dp[1]=0
dp[2]=abs(a[1]-a[0])
for x in range(3,n+1):
  dp[x]=min(dp[x-1]+abs(a[x]-a[x-1]),dp[x-2]+abs(a[x]-a[x-2]))
print(dp[n])


Fixed submission:
#!/usr/bin/env python
import os
import sys
from io import BytesIO, IOBase
#from bisect import bisect_left as bl                #c++ lowerbound bl(array,element)
#from bisect import bisect_right as br               #c++ upperbound br(array,element)
 
 
def main():
    n=int(input())
    a=list(map(int,input().split(" ")))
    dp=[0 for x in range(n+1)]
    dp[0]=0
    dp[1]=abs(a[1]-a[0])
    for x in range(2,n):
        dp[x]=min(dp[x-1]+abs(a[x]-a[x-1]),dp[x-2]+abs(a[x]-a[x-2]))
    print(dp[n-1])




#-----------------------------BOSS-------------------------------------!
# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    a=int(input())
    for w in range(1,a+1):
        if w<5:
            print(0)
        else:
            total=0
            for i in range(1,w):
                for j in range(1,w):
                    for k in range(1,w):
                        if (i**2)+(j**2)+(k**2)+i*k+i*j+k*j==w:
                            total+=1
            print(total)

if __name__ == '__main__':
    main()

Fixed submission:
a,b,c=map(int,input().split())
total=0
for i in range(a,b+1):
    if i%c==0:
        total+=1
print(total)

Buggy python submission (verdict: Runtime Error):
a=int(input())
for w in range(1,a+1):
    if w<5:
        print(0)
    else:
        total=0
        for i in range(1,w):
            for j in range(1,w):
                for k in range(1,w):
                    if (i**2)+(j**2)+(k**2)+i*k+i*j+k*j==w:
                        total+=1
        print(total)

Fixed submission:
a,b,c=map(int,input().split())
total=0
for i in range(a,b+1):
    if i%c==0:
        total+=1
print(total)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
b=len(a)
result=1
i=0
j=0
while True:
    if a[i]!=result:
        del a[i]
    else:
        result+=1
        i+=1
    j+=1
    if j>=b:
        break
if a==[]:
    print(-1)
else:
    print(b-len(a))

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=len(a)
result=1
i=0
j=0
while True:
    if a[i]==result:
        result+=1
    i+=1
    if i>=b:
        break
if result==1:
    print(-1)
else:
    print(b-result+1)
Buggy python submission (verdict: Runtime Error):
s=input()
a=[0]*len(s)
for i in range(len(s)+1):
    if s[i]=="<":
        a[i+1]=a[i]+1
for i in range(len(s)-1,-1,-1):
    if s[i]==">":
        a[i]=max(a[i],a[i+1]+1)
print(sum(a))

Fixed submission:
s=input()
a=[0]*(len(s)+1)
for i in range(len(s)):
    if s[i]=="<":
        a[i+1]=a[i]+1
for i in range(len(s)-1,-1,-1):
    if s[i]==">":
        a[i]=max(a[i],a[i+1]+1)
print(sum(a))

Buggy python submission (verdict: Runtime Error):
s=input()
print(s.count("<"))
print(s.count(">"))
print(len(s))
a=[0]*len(s)
for i in range(len(s)+1):
    if s[i]=="<":
        a[i+1]=a[i]+1
for i in range(len(s)-1,-1,-1):
    if s[i]==">":
        a[i]=max(a[i],a[i+1]+1)
print(sum(a))

Fixed submission:
s=input()
a=[0]*(len(s)+1)
for i in range(len(s)):
    if s[i]=="<":
        a[i+1]=a[i]+1
for i in range(len(s)-1,-1,-1):
    if s[i]==">":
        a[i]=max(a[i],a[i+1]+1)
print(sum(a))