Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(100000)
n, k = map(int,input().split())
stones = list(map(int, input().split()))
stones.reverse()

bottum_up = [0 for i in range(n)]
bottum_up[0] = 0
bottum_up[1] = abs(stones[0] - stones[1])

for i in range(2,len(stones)):
    min_score = abs(stones[i] - stones[i-1]) + bottum_up[i-1]
    for j in range(2, min(i+1,k+1)):
        min_score = min(min_score, abs(stones[i] - stones[i-j]) + bottum_up[i-j])
    bottum_up[i] = min_score

print(bottum_up[-1])

Fixed submission:
import sys
sys.setrecursionlimit(100000)
n, k = map(int,input().split())
stones = list(map(int, input().split()))
stones.reverse()

bottum_up = [0 for i in range(n)]
bottum_up[0] = 0
bottum_up[1] = abs(stones[0] - stones[1])

for i in range(2,len(stones)):
    min_score = abs(stones[i] - stones[i-1]) + bottum_up[i-1]
    for j in range(2, min(i+1,k+1)):
        min_score = min(min_score, abs(stones[i] - stones[i-j]) + bottum_up[i-j])
    bottum_up[i] = min_score

print(bottum_up[-1])
Buggy python submission (verdict: Runtime Error):
A, B = list(map(int, input().split())

if A>=13:
            m = B
elif A>=6:
            m =B/2
else:
            m =0
            
print(m)
       
            

Fixed submission:
a, b = list(map(int, input().split()))
 
if  a>=13:
            m = int(b)
elif a>=6:
            m =int(b/2)
else:
            m =0
            
print(m)
Buggy python submission (verdict: Runtime Error):
n =input()
ans =0
for i in range(n):
	a, b =map(int, input().split())
  	ans +=b-a
print(ans)

Fixed submission:
n =int(input())
ans =0
for i in range(n):
    a, b =map(int, input().split())
    ans +=b-a+1
    
print(ans)

Buggy python submission (verdict: Runtime Error):
n =input()
ans =0
for i in range(n)
	a, b =map(int, input().split())
  	ans +=b-a
print(ans)
	

Fixed submission:
n =int(input())
ans =0
for i in range(n):
    a, b =map(int, input().split())
    ans +=b-a+1
    
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b = list(map, int(input().split()))
if a+b >=10:
  print ('error')
else:
  print(a+b)

Fixed submission:
a, b =map(int, input().split())
if a+b>=10:
  print('error')
else:
  print(a+b)
Buggy python submission (verdict: Runtime Error):
a, b = int(input())
print('GREATER') if a>b else print('LESS') if b>a else print('EQUAL')

Fixed submission:
a=int(input())
b =int(input())

print('GREATER') if a>b else print ('LESS') if b>a else print('EQUAL')
Buggy python submission (verdict: Runtime Error):
n= int(input())
print(int((n*(n+1))/2))
print(1+n)*n/2

Fixed submission:
n= int(input())
print(int((n*(n+1))/2))
Buggy python submission (verdict: Runtime Error):
a = [int(i) for i in input().split()]

if (sum(a) >= 22):
	print('bust' )
else:
  printa('win')


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

if (sum(a) >= 22):
	print('bust' )
else:
	print('win')
Buggy python submission (verdict: Runtime Error):
n = input()
A=[]
for i in range(0,int(n)):
  a=input()
  A.append(int(a))

for i in range(0,int(n)):
  if ( sorted(A)[-1] == A[i]):
  	print (sorted(A)[-2])
  else:
    print(sorted(A)[-1])

Fixed submission:
a=input()
b=int(a)

S=3*b**2

print(S)
Buggy python submission (verdict: Time Limit Exceeded):
n = input()
A=[]
for i in range(0,int(n)):
  a=input()
  A.append(int(a))

for i in range(0,int(n)):
  if ( sorted(A)[-1] == A[i]):
  	print (sorted(A)[-2])
  else:
    print(sorted(A)[-1])

Fixed submission:
n = input()
A=[]
for i in range(0,int(n)):
  a=input()
  A.append(int(a))
B=[]
B =sorted(A)
  
for i in range(0,int(n)):
  if ( B[-1] == A[i]):
  	print (B[-2])
  else:
    print(B[-1])
Buggy python submission (verdict: Runtime Error):

s=inp()
#s = ("4 2 9")
#print(s) 
s = s.split(" ")


densya = int(s[0])*int(s[1])
taxi   = int( s[2] )

if ( densya < taxi):
    print(densya)
else:
    print(taxi)

Fixed submission:
s=input()
#s = ("4 2 9")
#print(s) 
s = s.split(" ")


densya = int(s[0])*int(s[1])
taxi   = int( s[2] )

if ( densya < taxi):
    print(densya)
else:
    print(taxi)

Buggy python submission (verdict: Runtime Error):

s=inp()
#s = (1 2 2) 
s = s.split(" ")


densya = int(s[0])*int(s[1])
taxi   = int( s[3] )

if ( densya < taxi):
    print(densya)
else:
    print(taxi)

Fixed submission:
s=input()
#s = ("4 2 9")
#print(s) 
s = s.split(" ")


densya = int(s[0])*int(s[1])
taxi   = int( s[2] )

if ( densya < taxi):
    print(densya)
else:
    print(taxi)

Buggy python submission (verdict: Runtime Error):
s=inp()
#s = (1 2 2) 
s = s.split(" ")


densya = s[0]*s[1]
taxi   = s[3]

if ( densya < taxi):
    print(densya)
else:
    print(taxi)

Fixed submission:
s=input()
#s = ("4 2 9")
#print(s) 
s = s.split(" ")


densya = int(s[0])*int(s[1])
taxi   = int( s[2] )

if ( densya < taxi):
    print(densya)
else:
    print(taxi)
Buggy python submission (verdict: Time Limit Exceeded):
s=input()
#s = ("2020 2040")
#print(s) 
s = s.split(" ")
 
L = int( s[0] )
R = int( s[1] )
 
 
result =4.0e9  
for i in range(L,R):
    for j in range(i+1,R+1):
        mod = i*j % 2019
        #print(i,j,i*j,mod)
        if result > mod:
            result = mod
 
print(result)

Fixed submission:
s=input()
#s = ("2020 2040")
#print(s) 
s = s.split(" ")
 
L = int( s[0] )
R = int( s[1] )
 
 
result =4.0e9  
for i in range(L,min(L+2019,R)):
    for j in range(i+1,min(R+1,L+2020)):
        mod = i*j % 2019
        #print(i,j,i*j,mod)
        if result > mod:
            result = mod
 
print(result)
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
Z=[1,2,3]
X=Z.remove(a,b)

print(X)

Fixed submission:
a=int(input())
b=int(input())
Z=[1,2,3]
Z.remove(a)
Z.remove(b)

print(Z[0])

Buggy python submission (verdict: Runtime Error):
a=input()
b=input()
Z=list['1','2','3']
X=Z.remove(a,b)

print(X)


Fixed submission:
a=int(input())
b=int(input())
Z=[1,2,3]
Z.remove(a)
Z.remove(b)

print(Z[0])

Buggy python submission (verdict: Runtime Error):
a=input()
b=input()
Z=list['1','2','3']
X=Z.remove('a','b')

print(X)


Fixed submission:
a=int(input())
b=int(input())
Z=[1,2,3]
Z.remove(a)
Z.remove(b)

print(Z[0])

Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
Z=list[1,2,3]
X=Z.remove(a,b)

print(X)

Fixed submission:
a=int(input())
b=int(input())
Z=[1,2,3]
Z.remove(a)
Z.remove(b)

print(Z[0])
Buggy python submission (verdict: Runtime Error):
N=int(input())
print(n*(n+1)/2)

Fixed submission:
N=int(input())
print(N*(N+1)//2)

Buggy python submission (verdict: Runtime Error):
print(0.5*N*(N+1))

Fixed submission:
N=int(input())
print(N*(N+1)//2)

Buggy python submission (verdict: Runtime Error):
print(0.5(N+1)^2)

Fixed submission:
N=int(input())
print(N*(N+1)//2)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

def main():
    N = int(input())
    D = list(map(int, input().split()))
    if D[0] != 0:
        print(0)
        exit()
    Dnum = [0 for _ in range(N)]
    for i in D:
        Dnum[i] += 1
    if Dnum[0] != 1:
        print(0)
        exit()
    ans = 1
    num = 0
    for i in range(N-1):
        if num == N:
            break
        else:
            ans *= Dnum[i] ** Dnum[i+1]
    print(ans%998244353)


if __name__ == '__main__': main()

Fixed submission:
import sys
from collections import Counter
input = sys.stdin.readline

def main():
    _ = int(input())
    D = list(map(int, input().split()))
    Dnum = Counter(D)
    if D[0] != 0 or Dnum[0] != 1:
        print(0)
        exit()
    ans = 1
    for i in range(1, max(D)+1):
        ans *= Dnum[i] ** Dnum[i+1]
        if ans == 0:
            break
    print(ans%998244353)


if __name__ == '__main__': main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

def main():
    N = int(input())
    D = list(map(int, input().split()))
    if D[0] != 0:
        print(0)
        exit()
    Dnum = [0] * N
    for i in D:
        Dnum[i] += 1
    if Dnum[0] != 1:
        print(0)
        exit()
    ans = 1
    num = 0
    for i in range(N-1):
        if num == N:
            break
        else:
            ans *= Dnum[i] ** Dnum[i+1]
    print(ans%998244353)


if __name__ == '__main__': main()

Fixed submission:
import sys
from collections import Counter
input = sys.stdin.readline

def main():
    _ = int(input())
    D = list(map(int, input().split()))
    Dnum = Counter(D)
    if D[0] != 0 or Dnum[0] != 1:
        print(0)
        exit()
    ans = 1
    for i in range(1, max(D)+1):
        ans *= Dnum[i] ** Dnum[i+1]
        if ans == 0:
            break
    print(ans%998244353)


if __name__ == '__main__': main()
Buggy python submission (verdict: Runtime Error):
from numpy import arctan, pi

def main():
    a, b, x = map(int, input().split())
    if a ** 2 * b > 2 * x:
        ans = arctan(2*x/(a*b*b))
    elif a ** 2 * b < 2 * x:
        ans = arctan(a*a*a/2/(a*a*b-x))
    else:
        ans = arctan(a/b)
    print(90 - ans*180/pi)


if __name__ == '__main__': main()

Fixed submission:
from numpy import arctan, pi

def main():
    a, b, x = map(int, input().split())
    if a * a * b > 2 * x:
        ans = arctan(2*x/(a*b*b))
    elif a * a * b < 2 * x and a * a * b != x:
        ans = arctan(a*a*a/2/(a*a*b-x))
    elif a * a * b < 2 * x:
        print(0)
        exit()
    else:
        ans = arctan(a/b)
    print(90 - ans*180/pi)


if __name__ == '__main__': main()
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline


def main():
    N = int(input())
    d = list(map(int, input().slit()))
    ans = 0
    for i in range(N-1):
        for j in range(i+1, N):
            ans += d[i] * d[j]
    print(ans)


if __name__ == '__main__': main()

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


def main():
    N = int(input())
    d = list(map(int, input().split()))
    ans = 0
    for i in range(N-1):
        for j in range(i+1, N):
            ans += d[i] * d[j]
    print(ans)


if __name__ == '__main__': main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
INF = 100100100100100


def main():
    N, M, L = map(int, input().split())
    graph = [[INF]*N for _ in range(N)]
    for _ in range(M):
        A, B, C = map(int, input().split())
        graph[A-1][B-1] = C
        graph[B-1][A-1] = C
    for i in range(N):
        graph[i][i] = 0
    for k in range(N):
        for i in range(N):
            if graph[i][k] == INF:
                continue
            for j in range(N):
                if graph[k][j] == INF:
                    continue
                graph[i][j] = min(graph[i][j], graph[i][k] + graph[k][j])
    newGraph = [[INF]*N for _ in range(N)]
    for i in range(N):
        newGraph[i][i] = 0
        for j in range(i+1, N):
            if graph[i][j] <= L:
                newGraph[i][j] = 1
                newGraph[j][i] = 1
    for k in range(N):
        for i in range(N):
            if newGraph[i][k] == INF:
                continue
            for j in range(N):
                if newGraph[k][j] == INF:
                    continue
                newGraph[i][j] = min(newGraph[i][j], newGraph[i][k] + newGraph[k][j])
    Q = int(input())
    for _ in range(Q):
        s, t = map(int, input().split())
        if newGraph[s-1][t-1] == INF:
            print(-1)
        else:
            print(newGraph[s-1][t-1]-1)


if __name__ == '__main__': main()

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


def main():
    N, M, L = map(int, input().split())
    graph = [[INF]*N for _ in range(N)]
    for _ in range(M):
        A, B, C = map(int, input().split())
        graph[A-1][B-1] = C
        graph[B-1][A-1] = C
    for i in range(N):
        graph[i][i] = 0
    for k in range(N):
        for i in range(N):
            if graph[i][k] == INF:
                continue
            for j in range(N):
                if graph[k][j] == INF:
                    continue
                graph[i][j] = min(graph[i][j], graph[i][k] + graph[k][j])
    newGraph = [[INF]*N for _ in range(N)]
    for i in range(N):
        newGraph[i][i] = 0
        for j in range(i+1, N):
            if graph[i][j] <= L:
                newGraph[i][j] = 1
                newGraph[j][i] = 1
    for k in range(N):
        for i in range(N):
            if newGraph[i][k] == INF:
                continue
            for j in range(N):
                if newGraph[k][j] == INF:
                    continue
                newGraph[i][j] = min(newGraph[i][j], newGraph[i][k] + newGraph[k][j])
    Q = int(input())
    for _ in range(Q):
        s, t = map(int, input().split())
        if newGraph[s-1][t-1] == INF:
            print(-1)
        else:
            print(newGraph[s-1][t-1]-1)


if __name__ == '__main__': main()
Buggy python submission (verdict: Runtime Error):
N = int(inpput())
print(N**3)

Fixed submission:
N = int(input())
print(N**3)
Buggy python submission (verdict: Runtime Error):
n - int(input())
P = list(map(int, input().split()))
ans = 0
for i in range(n-2):
  if (P[i] < P[i+1]) and (P[i+1] < P[i+2]):
    ans += 1
  elif (P[i] > P[i+1]) and (P[i+1] > P[i+2]):
    ans += 1
print(ans)

Fixed submission:
n = int(input())
P = list(map(int, input().split()))
ans = 0
for i in range(n-2):
  if (P[i] < P[i+1]) and (P[i+1] < P[i+2]):
    ans += 1
  elif (P[i] > P[i+1]) and (P[i+1] > P[i+2]):
    ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
N, A, B, C, D = map(int, input().split())
S = input()
cou1 = 0
ans1 = 0
cou2 = 0
ans2 = []
if C < D:
    S1 = S[A: D-1]
    for i in S1:
        if i == "#":
            cou1 += 1
        else:
            ans1 = max(ans1, cou1)
            cou1 = 0
    if ans1 < 2:
        print("Yes")
    else:
        print("No")
else:
    S1 = S[A: C-1]
    S2 = S[B: D+1]
    for i in S1:
        if i == "#":
            cou1 += 1
        else:
            ans1 = max(ans1, cou1)
            cou1 = 0
    for j in S2:
        if i == ".":
            cou2 += 1
        else:
            ans2.append(cou2)
            cou2 = 0
    if ans1 < 2 and min(ans2) >= 3:
        print("Yes")
    else:
        print("No")

Fixed submission:
N, A, B, C, D = map(int, input().split())
S = input()
Sac = S[A-1:C]
Sbd = S[B-1:D]
if "##" in Sac or "##" in Sbd:
    print("No")
elif C < D:
    print("Yes")
elif "..." in Sbd:
    print("Yes")
else:
    s1 = S[A-1:B-1] + "#" + S[B:C]
    s2 = S[A-1:D-1] + "#" + S[D:C]
    if "##" not in s1 or "##" not in s2:
        print("Yes")
    else:
        print("No")

Buggy python submission (verdict: Runtime Error):
N, A, B, C, D = map(int, input().split())
S = input()
cou1 = 0
ans1 = 0
cou2 = 0
ans2 = []
if C < D:
    S1 = S[A: D-1]
    for i in S1:
        if i == "#":
            cou1 += 1
        else:
            ans1 = max(ans1, cou1)
            cou1 = 0
    if ans1 < 2:
        print("Yes")
    else:
        print("No")
else:
    S1 = S[A: C-1]
    S2 = S[B: D+1]
    for i in S1:
        if i == "#":
            cou1 += 1
        else:
            ans1 = max(ans1, cou1)
            cou1 = 0
    for j in S2:
        if i == ".":
            cou2 += 1
        elif cou2 != 0:
            ans2.append(cou2)
            cou2 = 0
    if ans1 < 2 and min(ans2) >= 3:
        print("Yes")
    else:
        print("No")

Fixed submission:
N, A, B, C, D = map(int, input().split())
S = input()
Sac = S[A-1:C]
Sbd = S[B-1:D]
if "##" in Sac or "##" in Sbd:
    print("No")
elif C < D:
    print("Yes")
elif "..." in Sbd:
    print("Yes")
else:
    s1 = S[A-1:B-1] + "#" + S[B:C]
    s2 = S[A-1:D-1] + "#" + S[D:C]
    if "##" not in s1 or "##" not in s2:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input())
l = []
for i in range(n):
    s, p = input().split()
    l.append((s,int(p),i))
l.sort(key = lambda x:(x[0],x[1]), reverse = True)
for _ in l:
    print(l[2])

Fixed submission:
n = int(input())
l = []
for i in range(n):
    s, p = input().split()
    l.append((s,int(p),i+1))
l.sort(key = lambda x : x[1],reverse=True)
l.sort(key = lambda x : x[0])
for i in range(n):
    print(l[i][2])
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
S=input()
if S[K] == "A":
    ans = S[:K] + "a" + S[K+1:]
elif S[K] == "B":
    ans = S[:K] + "b" + S[K+1:]
else:
    ans = S[:K] + "c" + S[K+1:]
print(ans)

Fixed submission:
N, K = map(int, input().split())
S=input()
if S[K-1] == "A":
    ans = S[:K-1] + "a" + S[K:]
elif S[K-1] == "B":
    ans = S[:K-1] + "b" + S[K:]
else:
    ans = S[:K-1] + "c" + S[K:]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline
INF = 100100100

def solve(M: list, d: list, visited: list, u: int = 0):
    global N
    visited[u] = True
    for i in range(N):
        if M[u][i] != INF and not visited[i]:
            d[i] = d[u] + M[u][i]
            solve(M, d, visited, i)


def main():
    global N
    N = int(input())
    M = [[INF]*N for _ in range(N)]
    for _ in range(N-1):
        u, v, w = map(int, input().split())
        M[u-1][v-1] = w
        M[v-1][u-1] = w
    visited = [False] * N
    d = [0] * N
    solve(M, d, visited)
    for i in d:
        if i%2 == 0:
            print(0)
        else:
            print(1)

if __name__ == '__main__': main()

Fixed submission:
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline

def solve(M: list, d: list, visited: list, u: int = 0):
    global N
    visited[u] = True
    for m in M[u]:
        i = m[0]
        w = m[1]
        if not visited[i]:
            d[i] = d[u] + w
            solve(M, d, visited, i)


def main():
    global N
    N = int(input())
    M = [[] for _ in range(N)]
    for _ in range(N-1):
        u, v, w = map(int, input().split())
        M[u-1].append((v-1, w))
        M[v-1].append((u-1, w))
    visited = [False] * N
    d = [0] * N
    solve(M, d, visited)
    for i in d:
        if i%2 == 0:
            print(0)
        else:
            print(1)

if __name__ == '__main__': main()
Buggy python submission (verdict: Time Limit Exceeded):
r,g,b,n = map(int, input().split())
ans = 0
for i in range(n // r + 1):
        for j in range((n - i * r)// g + 1):
                if ( n -  ( i * r  +  j * g )) % b == 0 and i * r + j * g <= n:
                        ans += 1
print(ans)

Fixed submission:
r,g,b,n = map(int, input().split())
ans = 0
for i in range((n //r + 1)):
        for j in range((n - i * r)// g + 1):
                if ( n -  ( i * r  +  j * g )) % b == 0:
                        ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
r,g,b,n = map(int, input().split())
ans = 0
for i in range(n // r + 1):
        for j in range(n // g + 1):
                if ( n -  ( i * r  +  j * g )) % b == 0 and i * r + j * g <= n:
                        ans += 1
print(ans)

Fixed submission:
r,g,b,n = map(int, input().split())
ans = 0
for i in range((n //r + 1)):
        for j in range((n - i * r)// g + 1):
                if ( n -  ( i * r  +  j * g )) % b == 0:
                        ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
N = input()
A = input()
B = input()
C = input()
D = input()
E = input()
mLsit = [A, B, C, D, E]
m = min(mList)
if N % m == 0:
    print(N // m)
else:
    print(N // m + 1)

Fixed submission:
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
m = min(A, B, C, D, E)
if N % m == 0:
    print(N // m + 4)
else:
    print(N // m + 5)

Buggy python submission (verdict: Runtime Error):
N = input()
ABCDE = []
for i in range(4):
    A = input()
    ABCDE.append(A)
m = min(ABCDE)
if N % m == 0:
    print(N // m)
else:
    print(N // m + 1)

Fixed submission:
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
m = min(A, B, C, D, E)
if N % m == 0:
    print(N // m + 4)
else:
    print(N // m + 5)

Buggy python submission (verdict: Runtime Error):
N = input()
ABCDE = []
for i in range(4):
    A = input()
    ABCDE.append(A)
m = min(ABCDE)
if N % n == 0:
    print(N // m)
else:
    print(N // m + 1)

Fixed submission:
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
m = min(A, B, C, D, E)
if N % m == 0:
    print(N // m + 4)
else:
    print(N // m + 5)

Buggy python submission (verdict: Runtime Error):
N = input()
ABCDE = []
for i in range(5):
    A = input()
    ABCDE.append(A)
m = min(ABCDE)
if N % n == 0:
    print(N // m)
else:
    print(N // m + 1)

Fixed submission:
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
m = min(A, B, C, D, E)
if N % m == 0:
    print(N // m + 4)
else:
    print(N // m + 5)
Buggy python submission (verdict: Runtime Error):
S=input()
l=len(S)
num=0
for i in range(l):
  if S[i] in "AGCT":
    num+=1
  elif num>ans:
    ans=num
    num=0
  else:
    num=0
print(ans)

Fixed submission:
S = input()

ans = 0
tmp = 0
flag = False

for i in S:
    if (i == "A") or (i == "C") or (i == "G") or (i == "T"):
        tmp += 1
        flag = True
    elif (tmp > ans) and flag:
        ans = tmp
        tmp = 0
        flag = False
    elif flag:
        tmp = 0
        flag = False

if (ans < tmp):
    ans = tmp

print(ans)

Buggy python submission (verdict: Runtime Error):
S=input()
l=len(S)
num=0
for i in range(l):
  if S[i]=="A" or S[i]=="G" or S[i]=="C" or S[i]=="T":
    num+=1
  elif num>ans:
    ans=num
    num=0
  else:
    num=0
print(ans)

Fixed submission:
S = input()

ans = 0
tmp = 0
flag = False

for i in S:
    if (i == "A") or (i == "C") or (i == "G") or (i == "T"):
        tmp += 1
        flag = True
    elif (tmp > ans) and flag:
        ans = tmp
        tmp = 0
        flag = False
    elif flag:
        tmp = 0
        flag = False

if (ans < tmp):
    ans = tmp

print(ans)

Buggy python submission (verdict: Runtime Error):
S=input()
l=len(S)
num=0
for i in range(l):
  if S[i]==A or S[i]==G or S[i]==C or S[i]==T:
    num+=1
  elif num>ans:
    ans=num
    num=0
  else:
    num=0
print(ans)

Fixed submission:
S = input()

ans = 0
tmp = 0
flag = False

for i in S:
    if (i == "A") or (i == "C") or (i == "G") or (i == "T"):
        tmp += 1
        flag = True
    elif (tmp > ans) and flag:
        ans = tmp
        tmp = 0
        flag = False
    elif flag:
        tmp = 0
        flag = False

if (ans < tmp):
    ans = tmp

print(ans)