Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import sys

def Forbidden_List(x,n,p):
  k = [abs(s - x) for s in p]
  for i in range(n):
    if i not in k: 
      return 10 - i
  return 10 - n

if __name__ == '__main__':
    input = sys.stdin.readline
    
    inp1 = input().rstrip().split()
    x,n = int(inp1[0]),int(inp1[1])
    if n == 0:
        print(x)
    else: 
     	inp2 = input().rstrip().split()
       	p = list(map(int,inp2))

        print(Forbidden_List(x,n,p))

Fixed submission:
import sys

def Forbidden_List(x,n,p):
  for i in range(n):
    if x - i not in p: 
        return x - i
    if x + i not in p:
        return x + i
  return x - n

if __name__ == '__main__':
    input = sys.stdin.readline
    
    inp1 = input().rstrip().split()
    x,n = int(inp1[0]),int(inp1[1])
    if n == 0:
        print(x)
    else: 
        inp2 = input().rstrip().split()
        p = list(map(int,inp2))
        print(Forbidden_List(x,n,p))

Buggy python submission (verdict: Runtime Error):
 import sys
  
def Forbidden_List(x,n,p):
  k = [abs(s - x) for s in p]
  for i in range(n):
    if i not in k: 
      return 10 - i
  return 10 - n
 
if __name__ == '__main__':
    input = sys.stdin.readline
    
    inp1 = input().rstrip().split()
    inp2 = input().rstrip().split()
    
    x,n = int(inp1[0]),int(inp1[1])
    if n == 0:
        print(x)
    else:
        p = list(map(int,inp2))
 
        print(Forbidden_List(x,n,p))

Fixed submission:
import sys

def Forbidden_List(x,n,p):
  for i in range(n):
    if x - i not in p: 
        return x - i
    if x + i not in p:
        return x + i
  return x - n

if __name__ == '__main__':
    input = sys.stdin.readline
    
    inp1 = input().rstrip().split()
    x,n = int(inp1[0]),int(inp1[1])
    if n == 0:
        print(x)
    else: 
        inp2 = input().rstrip().split()
        p = list(map(int,inp2))
        print(Forbidden_List(x,n,p))
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import math


def factorize(a):
    ret = set()
    i = 2
    while i * i < a:
        if a % i != 0:
            i += 1
        else:
            while a % i == 0:
                a //= i
                ret.add(i)
            i += 1
    if a != 1:
        ret.add(a)
    return ret

def main():
    A, B = map(int,input().split())
    ABgcd = math.gcd(A, B)
    ABfactor = factorize(ABgcd)
    Ans = len(ABfactor) + 1
    print(Ans)

if __name__ == "__main__":
    main()


Fixed submission:
# -*- coding: utf-8 -*-

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

def factorize(a):
    ret = set()
    i = 2
    while i * i < a:
        if a % i != 0:
            i += 1
        else:
            while a % i == 0:
                a //= i
                ret.add(i)
            i += 1
    if a != 1:
        ret.add(a)
    return ret

def main():
    A, B = map(int,input().split())
    ABgcd = gcd(A, B)
    ABfactor = factorize(ABgcd)
    Ans = len(ABfactor) + 1
    print(Ans)

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

N, Q = map(int,input().split())
Node = [-1] * N
Counter = [0] * N
Result = [0] * N

for i in range(N-1):
    a, b = map(int,input().split())
    Node[b-1] = a-1

for i in range(Q):
    p, x = map(int,input().split())
    Counter[p-1] += x

for i in range(N):
    p = i
    ans = 0
    while p >= 0:
        ans = ans + Counter[p]
        p = Node[p]
        
    Result[i] = ans

print(" ".join(list(map(str,Result))))


Fixed submission:
# -*- coding: utf-8 -*-

N, Q = map(int,input().split())
Node = [-1] * N
Counter = [0] * N
Result = [0] * N

for i in range(N-1):
    a, b = map(int,input().split())
    Node[b-1] = a-1

for i in range(Q):
    p, x = map(int,input().split())
    Counter[p-1] += x

for i in range(N):
    p = i
    ans = 0
    while p >= i:
        ans += Counter[p]
        p = Node[p]
    Result[i] = ans
    if p >= 0:
        Result[i] += Result[p]

print(" ".join(list(map(str,Result))))

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-



N, Q = map(int,input().split())
Node = []
Parsed = []
Counter = [0] * N
for i in range(N):
    Node.append([])
    Parsed.append([])

def parse(i):
    Parsed[i] += Node[i]
    for c in Node[i]:
        Parsed[i] += parse(c)
    #end for
    return Parsed[i]
        
for i in range(N-1):
    a, b = map(int,input().split())
    Node[a-1].append(b-1)
parse(0)
for i in range(N):
    Parsed[i].append(i)


for i in range(Q):
    p, x = map(int,input().split())
    for v in Parsed[p-1]:
        Counter[v] += x

print(" ".join(list(map(str,Counter))))



Fixed submission:
# -*- coding: utf-8 -*-

N, Q = map(int,input().split())
Node = [-1] * N
Counter = [0] * N
Result = [0] * N

for i in range(N-1):
    a, b = map(int,input().split())
    Node[b-1] = a-1

for i in range(Q):
    p, x = map(int,input().split())
    Counter[p-1] += x

for i in range(N):
    p = i
    ans = 0
    while p >= i:
        ans += Counter[p]
        p = Node[p]
    Result[i] = ans
    if p >= 0:
        Result[i] += Result[p]

print(" ".join(list(map(str,Result))))
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import heapq

N, M = map(int, input().split())
Wlist = []
for i in range(N):
    A, B = map(int, input().split())
    Wlist.append([A,B])
Wlist.sort(key=lambda x:x[0])

h = []
Ans = 0
Index = 0
for day in range(1,M+1):
    while Index < N:
        if Wlist[Index][0] <= day:
            heapq.heappush(h, -Wlist[Index][1])
            Index += 1
        else:
            break
    Ans += -heapq.heappop(h)

print(Ans)


Fixed submission:
# -*- coding: utf-8 -*-
import heapq

N, M = map(int, input().split())
Wlist = []
for i in range(N):
    A, B = map(int, input().split())
    Wlist.append([A,B])
Wlist.sort(key=lambda x:x[0])

h = []
Ans = 0
Index = 0
for day in range(1,M+1):
    while Index < N:
        if Wlist[Index][0] <= day:
            heapq.heappush(h, -Wlist[Index][1])
            Index += 1
        else:
            break
    if len(h):
        Ans += -heapq.heappop(h)

print(Ans)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

N, M = map(int, input().split())
Wlist = []
for i in range(N):
    A, B = map(int, input().split())
    Wlist.append([A,B])
Wlist.sort(key=lambda x:x[0])

Ans = 0
for day in range(1,M+1):
    Best = 0
    BestIdx = -1
    for i, W in enumerate(Wlist):
        if W[0] > day:
            break
        if Best < W[1]:
            Best = W[1]
            BestIdx = i
    if BestIdx >= 0:
        Ans += Best
        Wlist[BestIdx][1] = 0
            
print(Ans)


Fixed submission:
# -*- coding: utf-8 -*-
import heapq

N, M = map(int, input().split())
Wlist = []
for i in range(N):
    A, B = map(int, input().split())
    Wlist.append([A,B])
Wlist.sort(key=lambda x:x[0])

h = []
Ans = 0
Index = 0
for day in range(1,M+1):
    while Index < N:
        if Wlist[Index][0] <= day:
            heapq.heappush(h, -Wlist[Index][1])
            Index += 1
        else:
            break
    if len(h):
        Ans += -heapq.heappop(h)

print(Ans)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

S = input()

MOD =[1,0,0,0,0,0,0,0,0,0,0,0,0]
NMOD =[0,0,0,0,0,0,0,0,0,0,0,0,0]

R10 = range(10)
R13 = range(13)

for i,D in enumerate(S):
    C = -1
    if D == '?':
        for N in R10:
            for M in R13:
                NM = (M * 10 + N) % 13
                NMOD[NM] += MOD[M]
            #end for
        #end for
    else:
        C = int(D)
        for M in R13:
            NM = (M * 10 + C) % 13
            NMOD[NM] += MOD[M]
        #end for
    #end if
    for M in R13:
        MOD[M] = NMOD[M]%1000000007
        NMOD[M] = 0
    #end for
#end for

print(MOD[5])




Fixed submission:
# -*- coding: utf-8 -*-


A, B = map(int, input().split())

K = A + B
if K % 2 == 0:
    K = int((A + B) / 2)
    print(K)
else:
    print("IMPOSSIBLE")
Buggy python submission (verdict: Runtime Error):
rint(15 - sum(list(map(int, input().split()))))

Fixed submission:
x = list(map(int, input().split()))
if x[0] == 0: print(1)
if x[1] == 0: print(2)
if x[2] == 0: print(3)
if x[3] == 0: print(4)
if x[4] == 0: print(5)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
for i in range(1,n+1):
    print(a.count(i))

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
ans = [0] * n
for i in a:
    ans[i-1] += 1

for i in range(n):
    print(ans[i])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
for i in range(1,n+1):
    print(a.count(i))

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
ans = [0] * n
for i in a:
    ans[i-1] += 1

for i in range(n):
    print(ans[i])
Buggy python submission (verdict: Time Limit Exceeded):
def gcd(a,b):
    if not b:
        return a
    else:
        return gcd(b, a%b)

n = int(input())

ans = 0

for i in range(1,n+1):
    for j in range(1, n + 1):
        tmp = gcd(i,j)
        for k in range(1, n + 1):
            ans += gcd(tmp,k)

print(ans)

Fixed submission:
def gcd(a,b):
    if not b:
        return a
    else:
        return gcd(b, a%b)

n = int(input())

ans = 0

for i in range(1,n-1):
    for j in range(i+1, n):
        tmp = gcd(i,j)
        for k in range(j+1, n + 1):
            ans += gcd(tmp,k) * 6

for i in range(1,n):
    for j in range(i+1,n+1):
        ans += 6*gcd(i,j)
# print(ans)
ans += (n*(n+1))//2

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(str(input()))

ans = 0
for i in range(1,n-1):
    sr = 0
    sg = 0
    sb = 0
    er = 0
    eg = 0
    eb = 0

    for j in range(i):
        if s[j] != s[i]:
            if s[j] == "R":
                sr += 1
            elif s[j] == "G":
                sg += 1
            else:
                sb += 1
        pass
    for j in range(i+1,n):
        if s[j] != s[i]:
            if s[j] == "R":
                er += 1
            elif s[j] == "G":
                eg += 1
            else:
                eb += 1
    ans += sr*eb + sr*eg + sg*eb + sg*er + sb*er + sb*eg
    for j in range(min(i,n-i-1)):
        if s[i+j+1] != s[i-j-1] and s[i+j+1] != s[i] and s[i] != s[i-j-1]:
            ans -= 1
    # print(i,ans)

print(ans)

Fixed submission:
n = int(input())
s = list(str(input()))

ans = 0
for i in range(1,n-1):
    sr = 0
    sg = 0
    sb = 0
    er = 0
    eg = 0
    eb = 0

    for j in range(i):
        if s[j] != s[i]:
            if s[j] == "R":
                sr += 1
            elif s[j] == "G":
                sg += 1
            else:
                sb += 1
        pass
    for j in range(i+1,n):
        if s[j] != s[i]:
            if s[j] == "R":
                er += 1
            elif s[j] == "G":
                eg += 1
            else:
                eb += 1
    ans += sr*eb + sr*eg + sg*eb + sg*er + sb*er + sb*eg
    for j in range(min(i,n-i-1)):
        if s[i+j+1] != s[i-j-1] and s[i+j+1] != s[i] and s[i] != s[i-j-1]:
            ans -= 1
    # print(i,ans)

print(ans)

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

ans = 0
for i in range(n-3):
    for j in range(i+1,n-1):
        if s[i] != s[j]:
            for k in range(j+1,n):
                if s[i] != s[k] and s[j] != s[k] and j-i != k-j:
                    ans += 1

print(ans)

Fixed submission:
n = int(input())
s = list(str(input()))

ans = 0
for i in range(1,n-1):
    sr = 0
    sg = 0
    sb = 0
    er = 0
    eg = 0
    eb = 0

    for j in range(i):
        if s[j] != s[i]:
            if s[j] == "R":
                sr += 1
            elif s[j] == "G":
                sg += 1
            else:
                sb += 1
        pass
    for j in range(i+1,n):
        if s[j] != s[i]:
            if s[j] == "R":
                er += 1
            elif s[j] == "G":
                eg += 1
            else:
                eb += 1
    ans += sr*eb + sr*eg + sg*eb + sg*er + sb*er + sb*eg
    for j in range(min(i,n-i-1)):
        if s[i+j+1] != s[i-j-1] and s[i+j+1] != s[i] and s[i] != s[i-j-1]:
            ans -= 1
    # print(i,ans)

print(ans)
Buggy python submission (verdict: Runtime Error):
x = int(input())
ans = x//500 * 1000
ans += (x%500)//5*5
print(ans)

Fixed submission:
s = list(str(input()))
if s[2]==s[3] and s[4]==s[5]:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
for i,b in enumerate(a):
    for j in range(i+1,n):
        #print(b,a[j])
        if b == a[j]:
            print('NO')
            exit()
print('YES')


Fixed submission:
n = int(input())
a = list(map(int,input().split()))
if n == len(set(a)):
  print('YES')
else:
  print('NO')

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
for i in a:
    if a.count(i)-1:
        print('NO')
        exit()
print('YES')

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
if n == len(set(a)):
  print('YES')
else:
  print('NO')

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
for i,b in enumerate(a):
    for j in range(i+1,n):
        #print(b,a[j])
        if b == a[j]:
            print('NO')
            exit()
print('YES')

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
if n == len(set(a)):
  print('YES')
else:
  print('NO')
Buggy python submission (verdict: Time Limit Exceeded):
h, n = map(int, input().split())
a, b = [0] * n, [0] * n
for i in range(n):
    a[i], b[i] = map(int, input().split())

dp = [(-(-i // a[0]) * b[0]) for i in range(h + 1)]
for i in range(1, n):
    for j in range(1, h + 1):
        dp[j] = min(dp[j], dp[max(j-a[i],0)] + b[i])

print(dp[-1])

Fixed submission:
h, n = map(int, input().split())
a, b = [0] * n, [0] * n
for i in range(n):
    a[i], b[i] = map(int, input().split())

dp = [(-(-i // a[0]) * b[0]) for i in range(h + 1)]
for i in range(1, n):
    for j in range(1, h + 1):
        dp[j] = min(dp[j], dp[max(j-a[i],0)] + b[i])

print(dp[-1])
Buggy python submission (verdict: Runtime Error):
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

n,m = map(int,input().split())
a = list(map(int,input().split()))
tmplcm = 1
for i in a:
    tmplcm = lcm(tmplcm,i)


m -= tmplcm//2
ans = m // tmplcm +1
print(max(ans,0))

Fixed submission:
from fractions import gcd
def lcm(a):

    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]//2) // gcd(x, a[i]//2)
    return x

def map_all(es):
    return all([e == es[0] for e in es[1:]]) if es else False

n,m = map(int,input().split())
a = list(map(int,input().split()))
tmp = [0] * n
for i in range(n):
    tmpnum = a[i]
    while 1:
        if tmpnum%2:
            break
        else:
            tmpnum/=2
            tmp[i]+=1

if not map_all(tmp):
    print('0')
    exit()
    
tmplcm = lcm(a)


m -= tmplcm//2
ans = m // tmplcm +1

print(max(ans,0))

Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

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

tmp = lcm(*a)
m -= tmp//2
ans = m // tmp +1
print(max(ans,0))

Fixed submission:
from fractions import gcd
def lcm(a):

    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]//2) // gcd(x, a[i]//2)
    return x

def map_all(es):
    return all([e == es[0] for e in es[1:]]) if es else False

n,m = map(int,input().split())
a = list(map(int,input().split()))
tmp = [0] * n
for i in range(n):
    tmpnum = a[i]
    while 1:
        if tmpnum%2:
            break
        else:
            tmpnum/=2
            tmp[i]+=1

if not map_all(tmp):
    print('0')
    exit()
    
tmplcm = lcm(a)


m -= tmplcm//2
ans = m // tmplcm +1

print(max(ans,0))
Buggy python submission (verdict: Runtime Error):
import math
a,b = map(int,input().split())

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(a,b))

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

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

def lcm(x, y):
    return (x * y) // gcd(x, y)

print(lcm(a,b))
Buggy python submission (verdict: Runtime Error):
n = int(input())
if n%2:
    print(0)
else:
    tmp = 5
    ans = 0
    n //= 2
    while tmp < n:
        ans += n//tmp
        tmp *= 5
print(ans)

Fixed submission:
n = int(input())
if n%2:
    print(0)
else:
    tmp = 5
    ans = 0
    n //= 2
    while tmp <= n:
        ans += n//tmp
        tmp *= 5
    print(ans)

Buggy python submission (verdict: Runtime Error):
n = str(input())
tmp = len(n)
bai = 1
if int(n)%2:
    print(0)
else:
    ans = 0
    for i in range(1,tmp):
        if i == 1:
            ans += int(n[-1-i]) * bai
        elif i == 2:
            bai = 12
            ans += int(n[-1 - i]) * bai
        elif i == 3:
            bai = 124
            ans += int(n[-1 - i]) * bai
        elif i < 18:
            bai *= 10
            bai += 9
            ans += int(n[-1 - i]) * bai
        else:
            ans = 124999999999999995
print(ans)

Fixed submission:
n = int(input())
if n%2:
    print(0)
else:
    tmp = 5
    ans = 0
    n //= 2
    while tmp <= n:
        ans += n//tmp
        tmp *= 5
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
ans = 0
for i in range(n-1):
    for j in range(i,n):
        ans += a[i] ^ a[j]
        ans %= 10**9 +7

print(ans)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
for i in range(n):
    a[i] = str(bin(a[i]))

ans = [0] * 65
for i in a:
    for j in reversed(range(len(i))):
        if i[j] == '1':
            ans[-len(i)+j] += 1
        elif i[j] == '0':
            continue
        elif i[j] == 'b':
            break

tmp = 0
for i in range(len(ans)):
    tmp += 2 ** abs(i - 64) * (n - ans[i]) * ans[i]
    #print(i,2 ** abs(i - 64) * (n - ans[i]) * ans[i])
    tmp %= 10**9+7

print(tmp)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = str(input())
ans = 0
for i in range(1000):
    i = str(i).zfill(3)
    cursor = 0
    for j in range(n):
        if s[j] == i[cursor]:
            cursor += 1
            if cursor == 3:
                ans += 1
                break

print(ans)

Fixed submission:
n = int(input())
s = str(input())
ans = 0
for i in range(1000):
    i = str(i).zfill(3)
    cursor = 0
    for j in range(n):
        if s[j] == i[cursor]:
            cursor += 1
            if cursor == 3:
                ans += 1
                break

print(ans)
Buggy python submission (verdict: Runtime Error):
t = list(map(int,(input().split())))
a = list(map(int,(input().split())))
b = list(map(int,(input().split())))
A = 0
B = 0
ans = 0
tmp = [[0,0],[0,0]]
for i in range(2):
    a[i] *= t[i]
    b[i] *= t[i]

if a[0] + a[1] == b[0] + b[1]:
    print('infinity')
    exit(0)
elif a[0] > b[0] and a[1] > b[1]:
    print(0)
    exit(0)
elif a[0] < b[0] and a[1] < b[1]:
    print(0)
    exit(0)


for i in range(2):
    for j in range(2):
        A += a[j]
        B += b[j]
        tmp[i][j] = abs(A-B)
#print(tmp)
if tmp[0][0] - tmp[1][0] < 0:
    if not tmp[0][1] % (tmp[0][1] - tmp[1][1]):
        ans += 1
    tmp[0][1] //= tmp[0][1] - tmp[1][1]
    ans = '11145147'
else:
    if not tmp[0][0] % (tmp[0][0] - tmp[1][0]):
        ans -= 1

    tmp[0][0] //= tmp[0][0] - tmp[1][0]
    ans += tmp[0][0] * 2 +1


print(max(ans,1))

Fixed submission:
t1, t2 = map(int,input().split())
a1, a2 = map(int,input().split())
b1, b2 = map(int,input().split())

a1 = t1*a1
a2 = t2*a2
b1 = t1*b1
b2 = t2*b2

if (a1 + a2) == (b1 + b2):
    print('infinity')
    exit(0)

elif (a1 + a2) > (b1 + b2):
    a1, b1 = b1, a1
    a2, b2 = b2, a2
if b1 > a1:
    print(0)
    exit(0)

tmp00 = a1 - b1
tmp01 = b1 + b2 - a1 - a2

ans = tmp00 // tmp01 * 2 + 1
if tmp00 % tmp01 == 0:
    ans -= 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
tmp = [0]
tmpsc = 1
for i in range(len(s)):
    if s[i] == '<':
        tmp.append(tmp[i] + 1)
        tmpsc = 0
    else:
        tmpsc += 1
        if tmp[i] - 1 < 0:
            tmp.append(0)
            for j in range(tmpsc):
                if tmp[i - j] == tmp[i - j + 1]:
                    tmp[i - j] += 1
                else:
                    break
        else:
            tmp.append(0)
print(sum(tmp))

Fixed submission:
s = input()
arr = [0]
for i in range(len(s)):
  if s[i] == '<':
    arr.append(arr[i]+1)
  else:
    arr.append(0)
#print(len(arr))
for i in reversed(range(len(s))):
  if s[i] == '>':
    arr[i] = max(arr[i],arr[i+1]+1)
print(sum(arr))

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
tmp = [0]
tmpsc = 1
tmpsum = 0
for i in range(len(s)):
    #print(tmp)
    if s[i] == '<':
        tmp.append(tmp[i] + 1)
        tmpsc = 0
    else:
        tmpsc += 1
        if tmp[i] - 1 < 0:
            # print(tmp)
            tmp.append(0)
            for j in range(tmpsc):
                if tmp[i - j] == tmp[i - j + 1]:
                    tmp[i - j] += 1
                    # print(i-j)
        else:
            tmp.append(0)
            #tmpsc += 1
#print(tmp)
print(sum(tmp))

Fixed submission:
s = input()
arr = [0]
for i in range(len(s)):
  if s[i] == '<':
    arr.append(arr[i]+1)
  else:
    arr.append(0)
#print(len(arr))
for i in reversed(range(len(s))):
  if s[i] == '>':
    arr[i] = max(arr[i],arr[i+1]+1)
print(sum(arr))

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
tmp = [0]
tmpsc = 1
tmpsum = 0
for i in range(len(s)):
    #print(tmp)
    if s[i] == '<':
        tmp.append(tmp[i] + 1)
        tmpsc = 0
    else:
        tmpsc += 1
        if tmp[i] - 1 < 0:
            # print(tmp)
            tmp.append(0)
            for j in range(tmpsc):
                if tmp[i - j] == tmp[i - j + 1]:
                    tmp[i - j] += 1
                    # print(i-j)
        else:
            tmp.append(0)
            #tmpsc += 1
#print(tmp)
print(sum(tmp))

Fixed submission:
s = input()
arr = [0]
for i in range(len(s)):
  if s[i] == '<':
    arr.append(arr[i]+1)
  else:
    arr.append(0)
#print(len(arr))
for i in reversed(range(len(s))):
  if s[i] == '>':
    arr[i] = max(arr[i],arr[i+1]+1)
print(sum(arr))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import itertools
import numpy as np

def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i:
        divisors.append(n//i)
  return divisors
def abc(n):
  b = 2
  fct = [0]
  while b * b <= n:
    while n % b == 0:
      n //= b
      fct.append(b)
    b = b + 1
  if n > 1:
    fct.append(n)
  return fct
def getNearestValue(list, num):
  idx = np.abs(np.asarray(list) - num).argmin()
  return list[idx]
for n in range(2,10**12):
  list_ = abc(n)

  list_.sort()
  tmp = np.sqrt(n)
  N = len(list_)

  dp = [[1 for i in range(N+1)] for j in range(N+1)]

  for i in range(N):
    for j in range(1,N):
      if i == j:
          continue
      else:
        if dp[i][j-1] * list_[j] <= tmp:
          dp[i][j] = dp[i][j-1] * list_[j]
        else:
          continue
  tmplist = list(itertools.chain.from_iterable(dp))

  tmp1 = max(tmplist)
  if tmp1 == 0:
    print(n-1)
    sys.exit()
    
    
  tmp2 = make_divisors(n)
  tmp2.sort()
  sq = np.sqrt(n)
  tmpnum = n
  for i in tmp2:
    if i > sq:
      break
    else:
      tmpnum = min(tmpnum-1, n//i + i - 2)
    
  if (tmp1 - 1)+(n//tmp1-1) != tmpnum:
    print(n)

Fixed submission:
a,b = map(int,input().split())
if a >= 10 or b >= 10:
  print(-1)
else:
  print(a*b)
Buggy python submission (verdict: Runtime Error):
n = int(input())
l = list(map(int,input().split()))
l.sort()
#s = input()
ans = 0
for i in range(n-2):
  for j in range(i+1,n-1):
    tmp = l[i] + l[j]
    for k in range(j+1,n):
      #print(i,j,k)
      if tmp > l[k]:
        ans += 1
      else:
        break

print(ans)

Fixed submission:
a,b = map(int,input().split())
print(max(0,a-b*2))