Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import sys
def input(): return sys.stdin.readline().split()
def main():
    _ = input()
    A = (map(int, input().split()))
    print("second") if all(( a%2==0 for a in A)) else print("first")
if __name__ == "__main__":
    main()


Fixed submission:
import numpy as np

def main():
    stdin = np.fromstring(open(0).read(), dtype=np.int32, sep=' ')
    N = stdin[0]
    A = stdin[1:]
    A = np.mod(A, 2)
    print("first") if np.count_nonzero(A) else print("second")
if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
import numpy as np
import sys
buf = sys.stdin.buffer

def main():
    N = int(buf.readline())
    A = np.frombuffer(buf.read(), dtype="int64")
    A = np.mod(A, 2)
    print("first") if np.count_nonzero(A) else print("second")
if __name__ == "__main__":
    main()

Fixed submission:
import numpy as np

def main():
    stdin = np.fromstring(open(0).read(), dtype=np.int32, sep=' ')
    N = stdin[0]
    A = stdin[1:]
    A = np.mod(A, 2)
    print("first") if np.count_nonzero(A) else print("second")
if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
import numpy as np
import sys
buf = sys.stdin.buffer

def main():
    N = int(buf.readline())
    A = np.frombuffer(buf.read(), dtype="int64")
    A = np.mod(A, 2)
    print("first") if np.count_nonzero(A) else print("second")
if __name__ == "__main__":
    main()

Fixed submission:
def main():

    burgur = [0] * 51
    burgur[0] = 1
    pate = [0] * 51
    pate[0] = 1
    for i in range(50):
        burgur[i+1] = burgur[i] * 2 + 3
        pate[i+1] = pate[i] * 2 + 1
    
    N, X = map(int, input().split())

    X -= 1
    ans = 0
    for i in reversed(range(1, N+1)):
        if X == burgur[i] - 1:
            ans += pate[i]
            break
        elif X >= burgur[i-1] + 1:
            ans += pate[i-1] + 1
            X -= (burgur[i-1] + 2)
        else: 
            X -= 1
    if X == 0:
        ans += 1
    print(ans)
    

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
from collections import Counter
import numpy as np
H, W = map(int, input().split())
a = []
r_idx = []
c_idx = []
#a.shape = (H, W)
for i in range(H):
    line = list(input())
    if Counter(line).most_common()[0][1] != W:
        r_idx.append(i)
    a.append(line)
a = np.array(a).T
#a.shape = (W, H)
b = []
for i in range(W):
    if Counter(a[i]).most_common()[0][1] == H:
        continue
    b.append(a[i])

b = np.array(b).T
c = []
for idx in r_idx:
    c.append(b[idx])

for i in range(len(c)):
    print("".join(c[i]))


Fixed submission:
import bisect
N, K = map(int, input().split())
x = list(map(int, input().split()))
t = 2 * (x[-1] - x[0])
i = bisect.bisect_right(x, 0)
for j in range(0, N):
    if N <= j + K -1 :
        break
    if (j - (i - 0.1)) * (j + K- 1 - (i - 0.1)) >= 0:
        t = min(t, max(abs(x[j]), abs(x[j+K-1])))
    else:
        t = min(t, abs(2 * x[j]) + x[j+K-1])
        t = min(t, abs(x[j]) + 2 * x[j+K-1])
print(t)
Buggy python submission (verdict: Runtime Error):
s = input()
K = int(input())
l = []
for i in range(5):
    for j in range(len(s)):
        if j + i + 1 >=  len(s):
            break
        l.append(s[j:j + i + 1])
l = sorted(set(l))
print(l[K-1])

Fixed submission:
s = input()
K = int(input())
l = []
for i in range(5):
    for j in range(len(s)):
        if j + i >=  len(s):
            break
        l.append(s[j:j + i + 1])
l = sorted(set(l))
print(l[K-1])
Buggy python submission (verdict: Runtime Error):
N = int(input())
red = [list(map(int, input().split())) for i in range (N)]
blue = [list(map(int, input().split())) for i in range (N)]
blue.sort(key=lambda x:x[0])
red.sort(key=lambda x:x[1], reverse=True)
pairs = 0
flag = [True for i in range(N)]
for i in range(N):
    for j in range(N):
        if blue[i][0] > red[j][0] and blue[i][1] > red[j][1] and flag[j]:
            pairs += 1
            flag[j] = False
            break
print(pairs)

Fixed submission:
c = [list(map(int, input().split())) for i in range(3)]
a = [0 for i in range(3)]
b = [0 for i in range(3)]
a[0] = 0
a[1] = c[1][1] - c[0][1]
a[2] = c[2][2] - c[0][2]
b[0] = c[0][0]
b[1] = c[0][1]
b[2] = c[0][2]
flag = True
for i in range(3):
    for j in range(3):
        if c[i][j] != a[i] + b[j]:
            flag = False
print("Yes") if flag else print("No")
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort()
    B = list(map(int, input().split()))
    B.sort()
    sum_a = sum(A)
    sum_b = sum(B)
    k = sum_b - sum_a

    now = 0
    while now < N and A[now] == B[now]:
        now += 1

    while k > 0 and now < N:
        while now < N and  A[now] == B[now]:
            now += 1
        
        if now < N:
            A[now] += 2
            B[now] += 1
            k -= 1
            if A[now] == B[now]:
                now += 1
    
    if now == N:
        print("Yes")
    else:
        print("No")
        
if __name__ == "__main__":
    main()

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

    need = 0
    stock = 0
    for a, b in zip(A, B):
        if a > b: need += (a-b)
        if b > a: stock += (b-a)//2

    if stock >= need:
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
N, Y =  map(int, input().split())
flag = False
x, y, z = -1, -1, -1
for i in range(Y // 10000 + 1):
    for j in range(Y // 5000 + 1):
        otoshidama = Y
        otoshidama -= 10000 * i + 5000 * j
        if otoshidama >= 0 and otoshidama // 1000 + i + j == N:
            x, y, z = i , j, otoshidama // 1000
            flag = True
            break
    if flag:
        break
print(x, y, z)

Fixed submission:
N, Y =  map(int, input().split())
x, y, z = -1, -1, -1
for i in range(N + 1):
    for j in range(N + 1):
        k = N - i - j
        if k >= 0 and 10000 * i + 5000 * j + 1000 * k == Y:
            x, y, z = i, j, k
print(x, y, z)
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10000)

N = int(input())
F = [list(map(int, input().split())) for i in range(N)]
P = [list(map(int, input().split())) for i in range(N)]
INF = 10 ** 9

def dfs(s):
    if len(s) == 10:
        value = -INF
        if "1" in s:
            value = 0
            c= [0 for i in range(10)]
            for i in range(5):
                for j in range(2):
                    for k in range(N):
                        if int(s[2*i+j]) * F[k][2*i+j]:
                            c[k] += 1
            for i in range(N):
                value += P[i][c[i]]
        return value
    else:
        return max(dfs(s+"0"), dfs(s+"1"))

print(dfs(""))

Fixed submission:
import sys
sys.setrecursionlimit(10000)

N = int(input())
F = [list(map(int, input().split())) for i in range(N)]
P = [list(map(int, input().split())) for i in range(N)]
INF = 10 ** 9

def dfs(s):
    if len(s) == 10:
        value = -INF
        if "1" in s:
            value = 0
            c = [0 for i in range(N)]
            for i in range(5):
                for j in range(2):
                    for k in range(N):
                        if int(s[2*i+j]) * F[k][2*i+j]:
                            c[k] += 1
            for i in range(N):
                value += P[i][c[i]]
        return value
    else:
        return max(dfs(s+"0"), dfs(s+"1"))

print(dfs(""))

Buggy python submission (verdict: Runtime Error):
N = int(input())
F = [list(map(int, input().split())) for i in range(N)]
P = [list(map(int, input().split())) for i in range(N)]
INF = 10 ** 9

def dfs(s):
    if len(s) == 10:
        value = -INF
        if "1" in s:
            value = 0
            c= [0 for i in range(10)]
            for i in range(5):
                for j in range(2):
                    for k in range(N):
                        if int(s[2*i+j]) * F[k][2*i+j]:
                            c[k] += 1
            for i in range(N):
                value += P[i][c[i]]
        return value
    else:
        return max(dfs(s+"0"), dfs(s+"1"))

print(dfs(""))

Fixed submission:
import sys
sys.setrecursionlimit(10000)

N = int(input())
F = [list(map(int, input().split())) for i in range(N)]
P = [list(map(int, input().split())) for i in range(N)]
INF = 10 ** 9

def dfs(s):
    if len(s) == 10:
        value = -INF
        if "1" in s:
            value = 0
            c = [0 for i in range(N)]
            for i in range(5):
                for j in range(2):
                    for k in range(N):
                        if int(s[2*i+j]) * F[k][2*i+j]:
                            c[k] += 1
            for i in range(N):
                value += P[i][c[i]]
        return value
    else:
        return max(dfs(s+"0"), dfs(s+"1"))

print(dfs(""))
Buggy python submission (verdict: Time Limit Exceeded):
import bisect
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A.sort()
B.sort()
C.sort()

count = 0
for i in range(N):
    b_idx = bisect.bisect_right(B, A[i])
    for j in range(b_idx, N):
        c_idx = bisect.bisect_right(C, B[j])
        count += N - c_idx

print(count)

Fixed submission:
import bisect
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A.sort()
B.sort()
C.sort()
BtoC = [0 for i in range(N+1)]
for i in range(N-1, -1, -1):
    c_idx = bisect.bisect_right(C, B[i])
    BtoC[i] = BtoC[i+1] + (N - c_idx)
count = 0
for i in range(N):
    b_idx = bisect.bisect_right(B, A[i])
    count += BtoC[b_idx]


print(count)
Buggy python submission (verdict: Runtime Error):
def main():
    S = list(input())
    T = list(input())

    for i in range(max(0, len(S)-len(T)+1)):
        ans = ""
        for j in range(i):
            if S[j] == "?":
                ans += "a"
            else:
                ans += S[j]

        for j in range(i, len(S)):
            if S[j] == T[j-i]:
                ans += S[j]
            elif S[j] == "?":
                ans += T[j-i]
            else:
                break

        if len(ans) == len(S):
            print(ans)
            exit()

    print("UNRESTORABLE")

if __name__ == "__main__":
    main()

Fixed submission:
S = input()
T = input()

def f():
    l = []
    for i in range(len(S)):
        if i + len(T) > len(S):
            break
        flag = True
        for j in range(len(T)):
            if S[i + j] not in [T[j], "?"] :
                flag = False
                break
        if flag:
            s = S
            s = s[:i] + T + s[i+len(T):]
            s = s.replace("?", "a")
            l.append(s)
    l.sort()
    if len(l):
        return l[0]
    else:
        return "UNRESTORABLE"

print(f())

Buggy python submission (verdict: Runtime Error):
def main():
    S = list(input())
    T = list(input())

    for i in range(len(S)-len(T)+1):
        ans = ""
        for j in range(i):
            if S[j] == "?":
                ans += "a"
            else:
                ans += S[j]

        for j in range(i, len(S)):
            if S[j] == T[j-i]:
                ans += S[j]
            elif S[j] == "?":
                ans += T[j-i]
            else:
                break

        if len(ans) == len(S):
            print(ans)
            exit()
            
    print("UNRESTORABLE")

if __name__ == "__main__":
    main()

Fixed submission:
S = input()
T = input()

def f():
    l = []
    for i in range(len(S)):
        if i + len(T) > len(S):
            break
        flag = True
        for j in range(len(T)):
            if S[i + j] not in [T[j], "?"] :
                flag = False
                break
        if flag:
            s = S
            s = s[:i] + T + s[i+len(T):]
            s = s.replace("?", "a")
            l.append(s)
    l.sort()
    if len(l):
        return l[0]
    else:
        return "UNRESTORABLE"

print(f())
Buggy python submission (verdict: Runtime Error):
def main():
    s = input()
    N = len(s)

    nox = []
    idxs = []
    ans = 0
    for i, c in enumerate(s):
        if c != "x":
            nox.append(c)
            idxs.append(i)
    
    if nox != nox[::-1]:
        print(-1)
        exit()
    

    if len(nox)%2 == 0:
        left = len(nox)//2 - 1
        right = len(nox)//2
        
        left_idx = idxs[left]
        right_idx = idxs[right]
        
    else:
        center = len(nox)//2
        left_idx = idxs[center]
        right_idx = idxs[center]

    old_left = -1
    old_right = -1
    while not (old_left == left_idx and old_right == right_idx):
        old_left = left_idx
        old_right = right_idx

        if s[left_idx] == s[right_idx]:
            if left_idx > 0:
                left_idx -= 1
            if right_idx < N-1:
                right_idx += 1
        elif s[left_idx] == "x":
            ans += 1
            if left_idx > 0:
                left_idx -= 1
        elif s[right_idx] == "x":
            ans += 1
            if right_idx < N-1:
                right_idx += 1

    print(ans)

if __name__ == "__main__":
    main()


Fixed submission:
def main():
    s = input()
    N = len(s)

    nox = []
    idxs = []
    ans = 0
    for i, c in enumerate(s):
        if c != "x":
            nox.append(c)
            idxs.append(i)
    
    if nox != nox[::-1]:
        print(-1)
        exit()
    
    if len(nox) == 0:
        print(0)
        exit()

    if len(nox)%2 == 0:
        left = len(nox)//2 - 1
        right = len(nox)//2
        
        left_idx = idxs[left]
        right_idx = idxs[right]

    else:
        center = len(nox)//2
        left_idx = idxs[center]
        right_idx = idxs[center]

    while not(left_idx == 0 and right_idx == N-1):
        if s[left_idx] == s[right_idx]:
            if left_idx > 0 and right_idx < N - 1:
                left_idx -= 1
                right_idx += 1
            else:
                if left_idx <= idxs[0] and right_idx >= idxs[-1] and (left_idx > 0 or right_idx < N - 1):
                    ans += 1
                if left_idx > 0:
                    left_idx -= 1
                if right_idx < N-1:
                    right_idx += 1

        elif s[left_idx] == "x":
            ans += 1
            if left_idx > 0:
                left_idx -= 1
        elif s[right_idx] == "x":
            ans += 1
            if right_idx < N-1:
                right_idx += 1
    print(ans)

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    N = int(input())

    for h in range(1, 3501):
        for n in range(h+N-1, 3501):
            if N*h*n % (4*h*n - N*h - N*n)==0:
                w = N*h*n // (4*h*n - N*h - N*n)
                print(h, n, w)
                exit()

if __name__ == "__main__":
    main()

Fixed submission:
def main():
    N = int(input())

    for h in range(1, 3501):
        for n in range(N-h+1, 3501):
            if (4*h*n - N*h - N*n)>0 and N*h*n % (4*h*n - N*h - N*n)==0:
                w = N*h*n // (4*h*n - N*h - N*n)
                print(h, n, w)
                exit()

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
import math
A,B,C,D,E,F = map(int, input().split())
water = A
suger = 0
for a in range(31):
    for b in range(31):
        subwater = A * a + B * b
        if subwater == 0:
                continue
        for c in range(151):
            subsuger = C * c
            if subsuger <= subwater * E:
                subsuger += D * min(F - subwater * 100 - subsuger, ((subwater * E - subsuger) // D))
                if subsuger <= subwater * E and subwater * 100 + subsuger <= F and subsuger / (subwater * 100 + subsuger) > suger / (water * 100 + suger):
                    water = subwater
                    suger = subsuger
print("{} {}".format(water * 100 + suger, suger))
print(0//D)

Fixed submission:
import math
A,B,C,D,E,F = map(int, input().split())
water = A
suger = 0
for a in range(31):
    for b in range(31):
        subwater = A * a + B * b
        if subwater == 0:
                continue
        for c in range(1501):
            subsuger = C * c
            if subsuger <= subwater * E:
                if F - subwater * 100 - subsuger > 0:
                    subsuger += D * min((F - subwater * 100 - subsuger) // D, (subwater * E - subsuger) // D)
                if subsuger <= subwater * E and subwater * 100 + subsuger <= F and subsuger / (subwater * 100 + subsuger) > suger / (water * 100 + suger):
                    water = subwater
                    suger = subsuger
print("{} {}".format(water * 100 + suger, suger))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int, input().split()))
b = [a.count(i) for i in range(10 ** 5 + 1)]
ans = 0
for i in range(1, 10 ** 5):
    ans = max(ans, b[i-1] + b[i] + b[i+1])
print(ans)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
b = [0 for i in range(10 ** 5 + 1)]
d = {}

for key in a:
    if key in d:
        d[key] += 1
    else:
        d[key] = 1

ans = 0
for i in range(10 ** 5 + 1):
    if i in d:
        b[i] = d[i]

for i in range(1, 10 ** 5):
    ans = max(ans, b[i-1] + b[i] + b[i+1])
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(1000000)

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

def dfs(seq):
    if len(seq) == N:
        score = 0
        for i in range(N):
            if seq[i] == "1":
                score += s[i]
        if score % 10 == 0:
            return 0
        else:
            return score

    else:
        return max(dfs(seq + "0"), dfs(seq + "1"))

print(dfs(""))

Fixed submission:
import sys
sys.setrecursionlimit(1000000)

N = int(input())
s = [int(input()) for i in range(N)]
wa = sum(s)
s.sort()
if wa % 10 != 0:
    print(wa)
else:
    for i in range(N):
        if s[i] % 10 != 0:
            print(wa - s[i])
            break
    else:
        print(0)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
temp = N * 2 + M
print(temp　//　4)

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

count = min(M // 2, N)
if M - 2 * N >= 0:
    M -= 2 * N
    count += M // 4

print(count)
Buggy python submission (verdict: Runtime Error):
k = int(input())

ans = -1
memo = 7 % k

for i in range(k):
    if a == 0:
        ans = i+1
        break
    a = (10*k+7) % k
print(ans)


Fixed submission:
k = int(input())

ans = -1
memo = 7 % k
a = 7 % k
for i in range(k):
    if a == 0:
        ans = i+1
        break
    a = (10*a+7) % k
print(ans)

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

ans = -1
memo = 7 % k

for i in range(k):
    if a == 0:
        ans = a+1
        break
    a = (10*k+7) % k
print(ans)


Fixed submission:
k = int(input())

ans = -1
memo = 7 % k
a = 7 % k
for i in range(k):
    if a == 0:
        ans = i+1
        break
    a = (10*a+7) % k
print(ans)

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

ans = []
memo = 0
for i in range(k):
    memo = 10*memo + 7
    if memo % k == 0:
        ans.append(i)
print(-1 if not len(ans) else ans[0] + 1)


Fixed submission:
k = int(input())

ans = -1
memo = 7 % k
a = 7 % k
for i in range(k):
    if a == 0:
        ans = i+1
        break
    a = (10*a+7) % k
print(ans)

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

li = []

for i in range(k):
    li.append(int('7'*(i+1)) % k)
count = -1
for i in range(k):
    if(li[k-i-1] == 0):
        count = k-i

print(count)


Fixed submission:
k = int(input())

ans = -1
memo = 7 % k
a = 7 % k
for i in range(k):
    if a == 0:
        ans = i+1
        break
    a = (10*a+7) % k
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())

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

count = 1
li = []

for i in range(k):
    count *= a[i]

li.append(count)

for i in range(n - k):
    count = int(count*a[k+i]/a[i])
    li.append(count)

for i in range(len(li) - 1):
    if(li[i] < li[i+1]):
        print("Yes")
    else:
        print("No")


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

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


for i in range(n - k):
    if(a[i] < a[k+i]):
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
 
print(a[n+1])

Fixed submission:
n = int(input())
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
 
print(a[n-1])

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(a[n])

Fixed submission:
n = int(input())
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
 
print(a[n-1])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
li=list(map(int,input().split()))
count = 0
for i in range(n-1):
  for j in range(n-i-1):
    if (li[n-i-1]>li[n-i-2-j]):
      count+=1
      break
print(n-count)


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

mymin = a[0]
count = 0

for i in range(len(a)):
  if min(mymin, a[i]) == a[i]:
    mymin = a[i]
    count += 1
    
print(count)

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

li=list(map(int,input().split()))
count = 0

for i in range(n-1):
  if min(li)==li[-1]:
    count+=1
  li.pop()

print(count+1)



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

mymin = a[0]
count = 0

for i in range(len(a)):
  if min(mymin, a[i]) == a[i]:
    mymin = a[i]
    count += 1
    
print(count)

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

li=list(map(int,input().split()))
count = 0

for i in range(n-1): #iは0からn-1
  for j in range(n-i-1):
    if (li[n-i-1]>li[n-i-2-j]):
      #print("break "+str(li[n-i-1]))
      count+=1
      break
  
print(n-count)


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

mymin = a[0]
count = 0

for i in range(len(a)):
  if min(mymin, a[i]) == a[i]:
    mymin = a[i]
    count += 1
    
print(count)
Buggy python submission (verdict: Runtime Error):
#0<3>2>1>0<1<2>0<1<2<3<4<5>2>1>0<1
import math
s = input()
bigger=0
smaller=0
count = 0
for i in range(len(s)-1):
    if (s[i]==">" and s[i+1]=="<"):
        count += (max(bigger,smaller))*((max(bigger,smaller))+1)/2
        count += (min(bigger,smaller)-1)*((min(bigger,smaller)-1)+1)/2 if (min(bigger,smaller)-1)!=0 else 0
        bigger = 0
        smaller = 0
    elif (s[i]=="<" and s[i+1]=="<"):
        bigger += 1
    elif (s[i]=="<" and s[i+1]==">"):
        bigger += 1
        smaller += 1
    elif (s[i]==">" and s[i+1]==">"):
        smaller += 1
count += (max(bigger,smaller))*((max(bigger,smaller))+1)/2
count += math.factorial(min(bigger,smaller)-1) if smaller!=0 else True

print(int(count))


Fixed submission:
#0<3>2>1>0<1<2>0<1<2<3<4<5>2>1>0<1
import math
s = input()
bigger=0
smaller=0
count = 0
bigger=1 if s[0]=="<" else 0 
smaller=1 if s[0]==">" else 0 


for i in range(len(s)-1):
    if (s[i]==">" and s[i+1]=="<"):
        count += (max(bigger,smaller))*((max(bigger,smaller))+1)/2
        count += (min(bigger,smaller)-1)*(min(bigger,smaller))/2 if (min(bigger,smaller)-1)!=0 else 0
        bigger = 1
        smaller = 0
    elif (s[i]=="<" and s[i+1]=="<"):
        bigger += 1
    elif (s[i]=="<" and s[i+1]==">"):
        smaller += 1
    elif (s[i]==">" and s[i+1]==">"):
        smaller += 1
count += (max(bigger,smaller))*((max(bigger,smaller))+1)/2
count += (min(bigger,smaller)-1)*(min(bigger,smaller))/2 if (min(bigger,smaller)-1)!=0 else 0

print(int(count))