Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ListL = [int(i) for i in input().split()]

ListL.sort()

ans = 0
for i in range(n-2):
	a = ListL[i]
	for j in range(i+1, n-1):
		b = ListL[j]
		maxC = a + b - 1
		minC = abs(a-b) + 1
		for k in range(j+1, n):
			c = ListL[k]
			if(c < minC):
				continue
			elif(c > maxC):
				break
			else:
				ans += 1

print(ans)

Fixed submission:
import bisect

n = int(input())
ListL = [int(i) for i in input().split()]

ListL.sort()
ans = 0

for i in reversed(range(2, n)):
	a = ListL[i]
	for j in reversed(range(1, i)):
		b = ListL[j]
		index = bisect.bisect_right(ListL, a-b)
		#print(a, b)
		if (index >= j):
			break
		else:
			ans += j - index

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def check(a, b, c):
	if(c<a+b and a<b+c and b<c+a):
		return True
	else:
		return False


n = int(input())
ListL = [int(i) for i in input().split()]

ListL.sort()

ans = 0
for i in range(n-2):
	a = ListL[i]
	for j in range(i+1, n-1):
		b = ListL[j]
		for k in range(j+1, n):
			c = ListL[k]
			if(check(a, b, c)):
				ans += 1
			else:
				break

print(ans)

Fixed submission:
import bisect

n = int(input())
ListL = [int(i) for i in input().split()]

ListL.sort()
ans = 0

for i in reversed(range(2, n)):
	a = ListL[i]
	for j in reversed(range(1, i)):
		b = ListL[j]
		index = bisect.bisect_right(ListL, a-b)
		#print(a, b)
		if (index >= j):
			break
		else:
			ans += j - index

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def check(a, b, c):
	if(c<a+b and a<b+c and b<c+a):
		return True
	else:
		return False

n = int(input())
ListL = [int(i) for i in input().split()]

ans = 0
for i in range(n-2):
	a = ListL[i]
	for j in range(i+1, n-1):
		b = ListL[j]
		for k in range(j+1, n):
			c = ListL[k]
			if(check(a, b, c)):
				ans += 1

print(ans)

Fixed submission:
import bisect

n = int(input())
ListL = [int(i) for i in input().split()]

ListL.sort()
ans = 0

for i in reversed(range(2, n)):
	a = ListL[i]
	for j in reversed(range(1, i)):
		b = ListL[j]
		index = bisect.bisect_right(ListL, a-b)
		#print(a, b)
		if (index >= j):
			break
		else:
			ans += j - index

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

yes = 0
no = n // 2 + 1
while abs(yes - no) > 1:
	center = (yes + no) // 2
	for i in range(n - 2 * center + 1):
		tempS = s[i:i+center]
		if (tempS in s[i+center:]):
			yes = center
			#print(tempS)
			break
	if (yes != center):
		no = center
print(yes)

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

ans = 0
lenS = 1
for i in range(n):
	tempS = s[i:i+lenS]
	while (tempS in s[i+lenS:]):
		lenS += 1
		tempS = s[i:i+lenS]
		ans += 1

print(ans)

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

lenS = len(s)
#print(lenS)
ans = 0
tempAns = 0
for i in reversed(range(1,lenS//2+1)):
	for j in range(0,n-i+1):
		tempS1 = s[j:j+i]
		#print(tempS)
		tempS2 = s[j+i:]
		if (tempS1 in tempS2):
			ans = i
			break
			#print(s[j+i+k-1:j+2*i+k-1], i, j, k)
	if (ans > 0):
		break
print(ans)


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

ans = 0
lenS = 1
for i in range(n):
	tempS = s[i:i+lenS]
	while (tempS in s[i+lenS:]):
		lenS += 1
		tempS = s[i:i+lenS]
		ans += 1

print(ans)

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

lenS = len(s)
#print(lenS)
ans = 0
tempAns = 0
for i in reversed(range(1,lenS//2+1)):
	for j in range(0,n-i+1):
		tempS = s[j:j+i]
		#print(tempS)
		for k in range(1,n-i-j+1):
			if (tempS == s[j+i+k-1:j+2*i+k-1]):
				ans = i
				break
			#print(s[j+i+k-1:j+2*i+k-1], i, j, k)
		if (ans > 0):
			break
	if (ans > 0):
		break
print(ans)


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

ans = 0
lenS = 1
for i in range(n):
	tempS = s[i:i+lenS]
	while (tempS in s[i+lenS:]):
		lenS += 1
		tempS = s[i:i+lenS]
		ans += 1

print(ans)

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

lenS = len(s)
#print(lenS)
ans = 0
tempAns = 0
for i in range(1,lenS//2+1):
	for j in range(0,n-i+1):
		tempS = s[j:j+i]
		#print(tempS)
		for k in range(1,n-i-j+1):
			if (tempS == s[j+i+k-1:j+2*i+k-1]):
				ans = i
				break
			#print(s[j+i+k-1:j+2*i+k-1], i, j, k)
		if (ans == i):
			break
print(ans)


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

ans = 0
lenS = 1
for i in range(n):
	tempS = s[i:i+lenS]
	while (tempS in s[i+lenS:]):
		lenS += 1
		tempS = s[i:i+lenS]
		ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
string_list = split(input())
D = int(string_list[0])
T = int(string_list[1])
S = int(string_list[2])
kyori = T * S
if D<=kyori:
  print('Yes')
else:
  print('No')

Fixed submission:
string_list = input().split(' ')
D = int(string_list[0])
T = int(string_list[1])
S = int(string_list[2])
kyori = T * S
if D<=kyori:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
a = input()
num = a.split(' ')
N = num[0]
K = num[1]
j = N % K

if j == 0:
	print(0)
else:
	print(1)


Fixed submission:
a = input()
num = a.split(' ')
N = int(num[0])
K = int(num[1])
j = N % K
if j == 0:
	print(0)
else:
	print(1)
Buggy python submission (verdict: Runtime Error):
rate = int(input())

if rate >= 0 && rate <= 1199:
	print('ABC')
elif rate >= 1200 && rate <= 2799:
	print('ARC')
else:
	print('AGC')


Fixed submission:
rate = int(input())

if rate >= 0 and rate <= 1199:
	print('ABC')
elif rate >= 1200 and rate <= 2799:
	print('ARC')
else:
	print('AGC')
Buggy python submission (verdict: Runtime Error):
a = [int(input()) for i in range(5)]
(a[0]+a[1])*a[2]/2

Fixed submission:
a = [int(input()) for i in range(3)]
print(int((a[0]+a[1])*a[2]/2))
Buggy python submission (verdict: Runtime Error):
D=int(input('D='))
T=int(input('T='))
S=int(input('S='))

if (D/S)<=T:
    print('Yes')
else:
    print('No')

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

if (D/S)<=T:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
import sys
import math
input = sys.stdin.readline

MOD = 10 ** 9 + 7


def main():
    N, K = map(int, input().split())
    ans = 0.0

    for i in range(1, N+1):
        c = 0
        if i < K:
            c = math.ceil(math.log2(K) - math.log2(i))
        # print(i, c, (1.0 / (2 ** c)), 1.0/N)
        ans += (1.0 / (2 ** c)) * 1.0/N

    print("{0:.20f}".format(ans))


if __name__ == '__main__':
    main()


Fixed submission:
import sys
input = sys.stdin.readline


def main():
    N = int(input())
    if N == 1 or N == 2:
        print(0)
        return

    print((N-1)//2)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
from fractions import gcd
import os
import math
import sys
from math import factorial
input = sys.stdin.readline


if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 998244353

g1 = [1, 1]  # 元テーブル
g2 = [1, 1]  # 逆元テーブル
inverse = [0, 1]  # 逆元テーブル計算用テーブル


def cmb(n, r, mod):
    return factorial(n) / factorial(r) / factorial(n - r)
    # if (r < 0 or r > n):
    #     return 0
    # r = min(r, n-r)
    # return g1[n] * g2[r] * g2[n-r] % mod


def main():
    N = int(input())
    d = list(map(int, input().split()))
    D = []

    for (k, v) in enumerate(d):
        D.append((v, k+1))

    distance = [0] * (max(d) + 1)

    for d in D:
        distance[d[0]] += 1

    ans = 1
    for i in range(0, len(distance)):
        if i == 0:
            ans = 1
            # print(ans)
        else:
            n = distance[i-1]
            r = distance[i]
            c = cmb(n+r-1, r-1, MOD)
            # print('n', n, 'r', r, 'c', c)
            ans *= n ** r
            ans = ans % MOD
            # print(ans)

    print(ans)
    # print(*distance)
    # n = 2
    # r = 3
    # print(cmb(n+r-1, r-1, MOD))


if __name__ == '__main__':
    main()


Fixed submission:
INF = float("inf")
IINF = 10 ** 18
MOD = 998244353


def main():
    N = int(input())
    d = list(map(int, input().split()))

    distance = [0] * (N + 1)

    for _d in d:
        distance[_d] += 1

    if d[0] != 0 or distance[0] != 1:
        print(0)
        return

    ans = 1
    for i in range(1, (N + 1)):
        n = distance[i-1]
        r = distance[i]
        ans = ans * n ** r
        ans = ans % MOD
        # print(ans)

    print(ans % MOD)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import heapq
# import collection
# import bisect
# import numpy

N, M = list(map(int, input().split()))
A = list(map(int, input().split()))

# N = 10**5
# A = [10 for i in range(10**5)]
# M = 10**5

# A = sorted(A)

heapq.heapify(A)

while M > 0:
    i = heapq.nlargest(1, enumerate(A), key=lambda x: x[1])
    A[i[0][0]] = A[i[0][0]] // 2
    M -= 1

print(sum(A))


Fixed submission:
import heapq
# import collection
# import bisect
# import numpy

N, M = list(map(int, input().split()))
# A = list(map(int, input().split()))

# N = 10**5
# A = [10 for i in range(10**5)]
# M = 10**5

# A = sorted(A)
A = []
for i in input().split():
    heapq.heappush(A, -int(i))

while M > 0:
    heapq.heappush(A, -((-heapq.heappop(A))//2))
    M -= 1

print(-sum(A))

Buggy python submission (verdict: Runtime Error):
# import heapq
# import collection
# import bisect
import numpy


def binary_search(arry, target):
    result = None
    left = 0
    right = len(arry) - 1

    while left <= right:
        mid = (left + right) // 2
        if arry[mid] == target:
            result = mid
            break
        elif arry[mid] > target:
            right = mid - 1
        else:
            left = mid + 1

    # print(left, right)
    if result is None:
        return left
    else:
        return result


N, M = list(map(int, input().split()))
A = list(map(int, input().split()))

A = sorted(A)

# A = [i for i in range(10**5)]
# M = 10**5

while M > 0:
    index = binary_search(A, A[N-1] // 2)
    for i in range(index+1):
        if M <= 0:
            break
        A[N-1-i] = A[N-1-i] // 2
        M -= 1

print(numpy.sum(A))


Fixed submission:
import heapq
# import collection
# import bisect
# import numpy

N, M = list(map(int, input().split()))
# A = list(map(int, input().split()))

# N = 10**5
# A = [10 for i in range(10**5)]
# M = 10**5

# A = sorted(A)
A = []
for i in input().split():
    heapq.heappush(A, -int(i))

while M > 0:
    heapq.heappush(A, -((-heapq.heappop(A))//2))
    M -= 1

print(-sum(A))
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

N = int(input())
ans = range(1, N)
print(sum(ans))


Fixed submission:
N = int(input())

print((N * (N - 1)) // 2)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools

N = int(input())
O = range(1, N+1)
MODS = range(1, N+1)
ans = 0

for i in range(N):
    M = O[i] % MODS[(i+1) % N]
    ans += M

print(ans)


Fixed submission:
N = int(input())

print((N * (N - 1)) // 2)
Buggy python submission (verdict: Runtime Error):

import sys

input = sys.stdin.readline

# input = sys.stdin.readline
sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7


def main():
    a = int(input())
    s = int(input())

    if a >= 3200:
        print(s)
    else:
        print('red')


if __name__ == '__main__':
    main()


Fixed submission:

import sys

input = sys.stdin.readline

# input = sys.stdin.readline
sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7


def main():
    a = int(input())
    s = input()

    if a >= 3200:
        print(s)
    else:
        print('red')


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):

# import sys
# input = sys.stdin.readline
import bisect


def ch_to_int(c):
    return ord(c) - 96


def main():
    s = input()
    t = input()
    pos = 0
    count = 0
    ch = [[] for i in range(26)]

    for i in range(len(s)):
        ch[ch_to_int(s[i])].append(i)

    for i in range(len(t)):
        c = ch_to_int(t[i])
        li = ch[c]

        if len(li) == 0:
            pos = -2
            count = 0
            break

        next_index = bisect.bisect_right(li, pos)
        if next_index >= len(li):
            next_pos = li[0]
            count += 1
            pos = next_pos
        else:
            pos = li[next_index]

    print((pos + 1) + count * len(s))


if __name__ == '__main__':
    main()


Fixed submission:

# import sys
# input = sys.stdin.readline
import bisect


def ch_to_int(c):
    return ord(c) - 96


def main():
    s = input()
    t = input()
    pos = 0
    count = 0
    ch = [[] for i in range(27)]

    for i in range(len(s)):
        ch[ch_to_int(s[i])].append(i)

    for i in range(len(t)):
        c = ch_to_int(t[i])
        li = ch[c]

        if len(li) == 0:
            pos = -1
            count = 0
            break

        next_index = bisect.bisect_left(li, pos)
        # print(next_index, pos, li)
        if next_index >= len(li):
            next_pos = li[0]
            count += 1
            pos = next_pos + 1
        else:
            if pos == li[next_index]:
                pos += 1
            else:
                pos = li[next_index] + 1
        # print(li, next_index, pos, count)

    print(pos + count * len(s))


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):

# import sys
# input = sys.stdin.readline
from collections import Counter


def main():
    s = input()
    t = input()
    ts = Counter(s)
    i = 0
    pos = 0

    while i < len(t):
        cur = pos % len(s)
        # print(len(t), i, cur, t[i], s[cur])

        if t[i] not in ts:
            pos = -1
            break

        if t[i] == s[cur]:
            i += 1
        # else:
        #     pos = -1
        #     break
        pos += 1

    print(pos)


if __name__ == '__main__':
    main()


Fixed submission:

# import sys
# input = sys.stdin.readline
import bisect


def ch_to_int(c):
    return ord(c) - 96


def main():
    s = input()
    t = input()
    pos = 0
    count = 0
    ch = [[] for i in range(27)]

    for i in range(len(s)):
        ch[ch_to_int(s[i])].append(i)

    for i in range(len(t)):
        c = ch_to_int(t[i])
        li = ch[c]

        if len(li) == 0:
            pos = -1
            count = 0
            break

        next_index = bisect.bisect_left(li, pos)
        # print(next_index, pos, li)
        if next_index >= len(li):
            next_pos = li[0]
            count += 1
            pos = next_pos + 1
        else:
            if pos == li[next_index]:
                pos += 1
            else:
                pos = li[next_index] + 1
        # print(li, next_index, pos, count)

    print(pos + count * len(s))


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import math
from itertools import accumulate
from collections import Counter
import itertools


N = int(input())

strings = []
for i in range(N):
    strings.append(input())


def is_anagrams(t1, t2):
    c1 = Counter(t1)
    c2 = Counter(t2)
    if sorted(c1.values()) == sorted(c2.values()) and sorted(c1.keys()) == sorted(c2.keys()):
        return 1
    else:
        return 0



count = 0
for t1, t2 in list(itertools.combinations(strings, 2)):
    count += is_anagrams(t1, t2)
print(count)

Fixed submission:
import math
from itertools import accumulate
from collections import Counter
import itertools
import functools


N = int(input())

strings = []
for i in range(N):
    strings.append(input())


strings = [''.join(sorted(i)) for i in strings]
c = Counter(strings)
count = 0
for i in c.values():
    if i > 1:
        count += (i * (i - 1)) / 2
print(int(count))
Buggy python submission (verdict: Runtime Error):
A, P = map(int, input().split())

print((A * 3 + p) // 2)

Fixed submission:
A, P = map(int, input().split())
 
print((A * 3 + P) // 2)
Buggy python submission (verdict: Runtime Error):
import sys
import math
input = sys.stdin.readline

MOD = 10 ** 9 + 7


def main():
    N, K = map(int, input().split())
    ans = 0.0

    for i in range(1, N+1):
        c = 0
        if i < K:
            c = math.ceil(math.log2(K) - math.log2(i))
        # print(i, c, (1.0 / (2 ** c)), 1.0/N)
        ans += (1.0 / (2 ** c)) * 1.0/N

    print("{0:.20f}".format(ans))


if __name__ == '__main__':
    main()


Fixed submission:
import sys
import math
input = sys.stdin.readline

MOD = 10 ** 9 + 7


def main():
    N, K = map(int, input().split())
    ans = 0.0

    for i in range(1, N+1):
        c = 0
        if i < K:
            c = math.ceil(math.log2(K) - math.log2(i))
        # print(i, c, (1.0 / (2 ** c)), 1.0/N)
        ans += (1.0 / (2 ** c)) * 1.0/N

    print("{0:.20f}".format(ans))


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
import sys
import math
input = sys.stdin.readline

MOD = 10 ** 9 + 7


def main():
    N, K = map(int, input().split())
    ans = 0.0

    for i in range(1, N+1):
        c = 0
        if i < K:
            c = math.ceil(math.log2(K) - math.log2(i))
        # print(i, c, (1.0 / (2 ** c)), 1.0/N)
        ans += (1.0 / (2 ** c)) * 1.0/N

    print(ans)


if __name__ == '__main__':
    main()


Fixed submission:
import sys
import math
input = sys.stdin.readline

MOD = 10 ** 9 + 7


def main():
    N, K = map(int, input().split())
    ans = 0.0

    for i in range(1, N+1):
        c = 0
        if i < K:
            c = math.ceil(math.log2(K) - math.log2(i))
        # print(i, c, (1.0 / (2 ** c)), 1.0/N)
        ans += (1.0 / (2 ** c)) * 1.0/N

    print("{0:.20f}".format(ans))


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
import sys
import math
input = sys.stdin.readline

MOD = 10 ** 9 + 7


def main():
    N, K = map(int, input().split())
    ans = 0.0

    for i in range(1, N+1):
        c = 0
        if i < K:
            c = math.ceil(math.log2(K) - math.log2(i))
        # print(i, c, (1.0 / (2 ** c)), 1.0/N)
        ans += (1.0 / (2 ** c)) * 1.0/N

    print(ans)


if __name__ == '__main__':
    main()


Fixed submission:
import sys
import math
input = sys.stdin.readline

MOD = 10 ** 9 + 7


def main():
    N, K = map(int, input().split())
    ans = 0.0

    for i in range(1, N+1):
        c = 0
        if i < K:
            c = math.ceil(math.log2(K) - math.log2(i))
        # print(i, c, (1.0 / (2 ** c)), 1.0/N)
        ans += (1.0 / (2 ** c)) * 1.0/N

    print("{0:.20f}".format(ans))


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):

import sys
from collections import deque

# input = sys.stdin.readline
sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7


def main():
    BLACK = '#'
    WHITE = '.'
    H, W = map(int, input().split())
    graph = [None] * H
    # w_score = [[0 for i in range(W)] for i in range(H)]
    # h_score = [[0 for i in range(W)] for i in range(H)]
    options = [(-1, 0), (0, 1), (1, 0), (0, -1)]
    visited = [[False for i in range(W)] for i in range(H)]
    initial = []

    for i in range(H):
        graph[i] = list(input())

        for j in range(W):
            if graph[i][j] == BLACK:
                initial.append((i, j))
                visited[i][j] = True

    q = deque()
    q.append(initial)
    ans = 0
    while len(q) != 0:
        n = q.popleft()
        # print(ans, n)

        items = set()
        for p in n:
            for d in options:
                i = p[0] + d[0]
                j = p[1] + d[1]

                if i >= 0 and i < W and j >= 0 and j < H and not visited[i][j] and graph[i][j] == WHITE:
                    visited[i][j] = True
                    graph[i][j] = BLACK
                    items.add((i, j))
                # else:
                #     print(i, j)

        if len(items) > 0:
            ans += 1
            q.append(items)

    print(ans)


if __name__ == '__main__':
    main()


Fixed submission:

import sys
from collections import deque

# input = sys.stdin.readline
sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7


def main():
    BLACK = '#'
    WHITE = '.'
    H, W = map(int, input().split())
    graph = [None] * H
    # w_score = [[0 for i in range(W)] for i in range(H)]
    # h_score = [[0 for i in range(W)] for i in range(H)]
    options = [(-1, 0), (0, 1), (1, 0), (0, -1)]
    visited = [[False for i in range(W)] for i in range(H)]
    initial = []

    for i in range(H):
        graph[i] = list(input())

        for j in range(W):
            if graph[i][j] == BLACK:
                initial.append((i, j))
                visited[i][j] = True

    # print(visited)
    # print(graph)

    q = deque()
    q.append(initial)
    ans = 0
    while len(q) != 0:
        n = q.popleft()
        # print(ans, n)

        items = set()
        for p in n:
            for d in options:
                i = p[0] + d[0]
                j = p[1] + d[1]

                if i >= 0 and i < H and j >= 0 and j < W and not visited[i][j] and graph[i][j] == WHITE:
                    visited[i][j] = True
                    graph[i][j] = BLACK
                    items.add((i, j))
                # else:
                #     print(i, j)

        if len(items) > 0:
            ans += 1
            q.append(items)

    print(ans)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
n, q = map(int, input().split())
s = input()
a = [list(map(int, input().split())) for i in range(q)]

cum=[0]*n
for i in range(1, n):
    cum[i] = cum[i - 1]
    if s[i-1:i+1] == 'AC':
        cum[i]+=1
    print(cum)

for i in range(q):
    print(cum[a[i][1]-1]-cum[a[i][0]-1])

Fixed submission:
dic = {
    'A': 'T',
    'T': 'A',
    'C': 'G',
    'G': 'C'
}

n=input()
print(dic[n])
Buggy python submission (verdict: Runtime Error):
n=input()
dic = {'A': True, 'C': True, 'G': True, 'T': True}
lens = []

for i in range(0, len(n)):
    length = 0
    s = n[i]

    if s not in dic:
        lens.append(length)
        continue

    length += 1
    for j in range(i+1, len(n)):
        t = n[j]
        if t not in dic:
            lens.append(length)
            continue

        length += 1

print(max(lens))

Fixed submission:
n=input()
dic = {'A': True, 'C': True, 'G': True, 'T': True}
lens = []

for i in range(0, len(n)):
    length = 0
    s = n[i]

    if s not in dic:
        lens.append(length)
        continue

    length += 1
    for j in range(i+1, len(n)):
        t = n[j]
        if t not in dic:
            break

        length += 1

    lens.append(length)
print(max(lens))