Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
from bisect import bisect_left, bisect_right, insort
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def MS(): return map(str,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
#N = I()
#A = [LI() for _ in range(N)]

n,k = MI()
a = LI()
ans = [1] * n
memo = [-1] * n
memo[0] = 0
s = 0
for i in range(1,n):
    if memo[a[ans[i-1]-1]-1] == -1:
        ans[i] = a[ans[i-1]-1]
        s += 1
        memo[ans[i] - 1] = s

    else:
        t = memo[a[ans[i-1]-1]-1]
        break
if k <= t:
    print(ans.index(k) + 1)
elif t == 0:
    print(ans[(k - 1) % (s-t +1) +1])
else:
    print(ans[(k-(t-1)-1) % (s-t+1) + t])

Fixed submission:
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
from bisect import bisect_left, bisect_right, insort
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def MS(): return map(str,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
#N = I()
#A = [LI() for _ in range(N)]

n,k = MI()
a = LI()
ans = [1] * n
memo = [-1] * n
memo[0] = 0
s = 0
for i in range(1,n):
    if memo[a[ans[i-1]-1]-1] == -1:
        ans[i] = a[ans[i-1]-1]
        s += 1
        memo[ans[i] - 1] = s

    else:
        t = memo[a[ans[i-1]-1]-1]
        break
if k <= t:
    print(ans[k])
elif t == 0:
    print(ans[(k - 1) % (s-t +1) +1])
else:
    print(ans[(k-(t-1)-1) % (s-t+1) + t])
Buggy python submission (verdict: Time Limit Exceeded):
import sys
 
x = int(input())
 
 
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)
 
    # divisors.sort()
    return divisors
 
 
for i in range(len(make_divisors(x))):
    for j in range(150):
        if j ** 5 - (j - make_divisors(x)[i]) ** 5 == x:
            print(j, j - make_divisors(x)[i])
            sys.exit()

Fixed submission:
import sys
 
x = int(input())
 
 
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)
 
    # divisors.sort()
    return divisors
 
 
for i in range(len(make_divisors(x))):
    for j in range(130):
        if j ** 5 - (j - make_divisors(x)[i]) ** 5 == x:
            print(j, j - make_divisors(x)[i])
            sys.exit()

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

x = int(input())


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)

    # divisors.sort()
    return divisors


for i in range(len(make_divisors(x))):
    for j in range(180):
        if j ** 5 - (j - make_divisors(x)[i]) ** 5 == x:
            print(j, j - make_divisors(x)[i])
            sys.exit()

Fixed submission:
import sys
 
x = int(input())
 
 
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)
 
    # divisors.sort()
    return divisors
 
 
for i in range(len(make_divisors(x))):
    for j in range(130):
        if j ** 5 - (j - make_divisors(x)[i]) ** 5 == x:
            print(j, j - make_divisors(x)[i])
            sys.exit()
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a= list(map(int, input().split()))
for i in range(n):
     print(a.count(i+1))


Fixed submission:
n = int(input())
a= list(map(int, input().split()))
aa=[0]*n
for i in range(n-1):
     aa[a[i]-1]+=1
for i in range(n):
     print(aa[i])
Buggy python submission (verdict: Time Limit Exceeded):
s = str(input())
q = int(input())
quer = [input().split() for i in range(q)]


for i in range(q):
    if quer[i][0] == '1':
        s = ''.join(list(reversed(s)))
    else:
        if quer[i][1] == '1':
            s = quer[i][2] + s
        else:
            s = s + quer[i][2]

print(s)


Fixed submission:
s = str(input())
q = int(input())
quer = [input().split() for i in range(q)]

k = 0
fo = ''
re = ''
for i in range(q):
    if quer[i][0] == '1':
        k += 1
    else:
        if quer[i][1] == '1':
            if k % 2 == 0:
                re = re + quer[i][2]
            else:
                fo = fo + quer[i][2]
        else:
            if k % 2 == 0:
                fo = fo + quer[i][2]
            else:
                re = re + quer[i][2]

if k % 2 ==0:
    print( ''.join(list(reversed(re))) + s + fo)
else:
    print(''.join(list(reversed(fo))) + ''.join(list(reversed(s))) + re)
Buggy python submission (verdict: Runtime Error):
import sys
n,m = map(int,input().split())
s = [0] * m
c = [0] * m
for i in range(m):
    s[i],c[i] = map(int,input().split())
ans = [10] * max(s)
for i in range(m):
    if s[i] == 1 and c[i] == 0:
        print(-1)
        sys.exit()
    if ans[s[i] - 1] == 10:
        ans[s[i] - 1] = c[i]
    else:
        if c[i] != ans[s[i] - 1]:
            print(-1)
            sys.exit()
    
for i in range(len(ans)):
    if i == 0 and ans[i] == 10:
        ans[i] = 1
    elif ans[i] == 10:
        ans[i] = 0
print(''.join([str(i) for i in ans]))

Fixed submission:
n,m = map(int,input().split())
s = [0] * m
c = [0] * m
for i in range(m):
    s[i],c[i] = map(int, input().split())

if n>1:
    ans=[1]+[0]*(n-1)
else:
    ans=[0]
flag = False


for i in range(m):
    if n>2 and s[i]==1 and c[i]==0:
        flag = True
    ans[s[i]-1]=c[i]
    for j in range(i+1,m):
        if s[i]==s[j]:
            if c[i]!=c[j]:
                flag=True

if flag:
    print(-1)
else:
    print("".join(map(str,ans)))

Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
s = [0] * m
c = [0] * m
for i in range(m):
    s[i],c[i] = map(int, input().split())
if n>2:
    ans=[1]+[0]*(n-1)
else:
    ans=[0]
flag = False


for i in range(m):
    if n>2 and s[i]==1 and c[i]==0:
        flag = True
    ans[s[i]-1]=c[i]
    for j in range(i+1,m):
        if s[i]==s[j]:
            if c[i]!=c[j]:
                flag=True

if flag:
    print(-1)
else:
    print("".join(map(str,ans)))


Fixed submission:
n,m = map(int,input().split())
s = [0] * m
c = [0] * m
for i in range(m):
    s[i],c[i] = map(int, input().split())

if n>1:
    ans=[1]+[0]*(n-1)
else:
    ans=[0]
flag = False


for i in range(m):
    if n>2 and s[i]==1 and c[i]==0:
        flag = True
    ans[s[i]-1]=c[i]
    for j in range(i+1,m):
        if s[i]==s[j]:
            if c[i]!=c[j]:
                flag=True

if flag:
    print(-1)
else:
    print("".join(map(str,ans)))
Buggy python submission (verdict: Runtime Error):
n = int(input())
x = list(map(int, input().split()))

k=max(x)-min(x)
box=[0]*k

for i in range(0,k):
    aa=0
    for j in range(0,n):
        aa = aa+(x[j]-min(x)-i)**2
    box[i]=aa


print(min(box))

Fixed submission:
n = int(input())
x = list(map(int, input().split()))
if max(x)-min(x)==0:
    print(0)
else:
    k=max(x)-min(x)
    box=[0]*k

    for i in range(0,k):
        aa=0
        for j in range(0,n):
           aa = aa+(x[j]-min(x)-i)**2
        box[i]=aa


    print(min(box))
Buggy python submission (verdict: Time Limit Exceeded):
def power_func(a,b,p):
  """a^b mod p を求める"""
  if b==0: return 1
  if b%2==0:
    d=power_func(a,b//2,p)
    return d*d %p
  if b%2==1:
    return (a*power_func(a,b-1,p ))%p

def comb(n,k,p):
  """power_funcを用いて(nCk) mod p を求める"""
  from math import factorial
  if n<0 or k<0 or n<k: return 0
  if n==0 or k==0: return 1
  a=factorial(n) %p
  b=factorial(k) %p
  c=factorial(n-k) %p
  return (a*power_func(b,p-2,p)*power_func(c,p-2,p))%p

n,a,b = map(int,input().split())
p = 10**9 +7
print((power_func(2,n,p)-1-comb(n,a,p)-comb(n,b,p))%p)

Fixed submission:
def power_func(a,b,p):
  """a^b mod p を求める"""
  if b==0: return 1
  if b%2==0:
    d=power_func(a,b//2,p)
    return d*d %p
  if b%2==1:
    return (a*power_func(a,b-1,p ))%p

def comb(n,r,mod=10**9+7):
    a=1
    b=1
    r = min(r,n-r)
    for i in range(r):
        a = a*(n-i)%mod
        b = b*(i+1)%mod
    return a*pow(b,mod-2,mod)%mod

n,a,b = map(int,input().split())
p = 10**9 +7
print((pow(2,n,p)-1-comb(n,a,p)-comb(n,b,p))%p)
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
p=list(map(int,input().split()))
box=[0]*(n-k+1)
for i in range(0,n-k+1):
    aa=0
    if i==0:
        for j in range(0,k):
          aa+=p[j]+1
    if i>0 and p[i-1]<p[i+k-1]:
        for j in range(0,k):
          aa+=p[i+j]+1
    box[i]=aa
print(max(box)/2)

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

s=0
for i in range(k):
    s += (p[i]+1)/2

ans=s

for i in range(n-k):

    s += (p[i+k]-p[i])/2

    if s>ans:
        ans=s
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
p=list(map(int,input().split()))
box=[0]*(n-k+1)
for i in range(0,n-k+1):
    aa=0
    for j in range(0,k):
        aa+=p[i+j]+1
    box[i]=aa
print(max(box)/2)

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

s=0
for i in range(k):
    s += (p[i]+1)/2

ans=s

for i in range(n-k):

    s += (p[i+k]-p[i])/2

    if s>ans:
        ans=s
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = list(map(int,input().split()))

box = [n+1 for i in range(n)]
ans = 1
for i in range(1,n):
     if min([p[j] for j in range(i)]) >= p[i]:
          ans += 1
print(ans)


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

box = [n+1 for i in range(n)]
ans = 1
min = p[0]
for i in range(1,n):
     if min >= p[i]:
          ans += 1
          min = p[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
a,b = map(int,input().split())
print(int(a*b/math.gcd(a,b)))

Fixed submission:
import fractions
a,b = map(int,input().split())
print(int(a*b/fractions.gcd(a,b)))

Buggy python submission (verdict: Runtime Error):
import math
a,b = map(int,input().split())
print(int(a*b/math.gcd(a,b)))

Fixed submission:
import fractions
a,b = map(int,input().split())
print(int(a*b/fractions.gcd(a,b)))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))

box = [0] * 61
for i in range(n):
    s = bin (a[i])
    for j in range(len(s)-1):
        if s[-j] == '1':
            box[j] += 1
ans = 0
for i in range(1,61):
    ans += box[i] * (n - box[i]) * pow(2,i-1,10**9+7)
print(ans % (10**9+7))

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

box = [0] * 61
for i in range(n):
    s = bin (a[i])
    for j in range(len(s)-1):
        if s[-j] == '1':
            box[j] += 1
ans = 0
for i in range(1,61):
    ans += box[i] * (n - box[i]) * pow(2,i-1,10**9+7)
print(ans % (10**9+7))
Buggy python submission (verdict: Time Limit Exceeded):
def power_func(a,b,p):
  """a^b mod p を求める"""
  if b==0: return 1
  if b%2==0:
    d=power_func(a,b//2,p)
    return d*d %p
  if b%2==1:
    return (a*power_func(a,b-1,p ))%p

def comb(n,k,p):
  """power_funcを用いて(nCk) mod p を求める"""
  from math import factorial
  if n<0 or k<0 or n<k: return 0
  if n==0 or k==0: return 1
  a=factorial(n) %p
  b=factorial(k) %p
  c=factorial(n-k) %p
  return (a*power_func(b,p-2,p)*power_func(c,p-2,p))%p
x,y = map(int,input().split())
if (x+y)%3 != 0:
     print(0)
else:
     a = (2*y-x) / 3
     b = (2*x - y) / 3
     print(comb(a+b, b,1000000007))


Fixed submission:
x,y = map(int,input().split())
s = (2 * y -x) / 3
t = (2 * x -y) / 3
if s.is_integer() and t.is_integer() and s >= 0 and t >= 0:
    def comb(n, r, mod=10 ** 9 + 7):
        a = 1
        b = 1
        r = min(r, n - r)
        for i in range(r):
            a = a * (n - i) % mod
            b = b * (i + 1) % mod
        return a * pow(b, mod - 2, mod) % mod
    s = int(s)
    t = int(t)
    print(comb(s + t, t, mod=10 ** 9 + 7))
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
import numpy as np
n = int(input())
d = list(map(int,input().split()))
print(int((np.sum(np.array(d))**2 - np.sum(np.array(d)**2)) /

Fixed submission:
import numpy as np
n = int(input())
d = list(map(int,input().split()))
print(int((np.sum(np.array(d))**2 - np.sum(np.array(d)**2)) /2))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int,input().split()))
l.sort()
ans = 0
for i in range(n-2):
     for j in range(i + 1,n-1):
          flag = True
          for k in range(j + 1,n):
               if l[i] + l[j] > l[k]  :
                    ans += 1
               else:
                    break
print(ans)

Fixed submission:
import bisect
n = int(input())
l = list(map(int,input().split()))
l.sort()
ans = 0
for i in range(n-2):
     for j in range(i + 1,n-1):
          ans += bisect.bisect_left(l,l[i] + l[j]) - j - 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int,input().split()))
l.sort()
ans = 0
for i in range(n-2):
     for j in range(i + 1,n-1):
          flag = True
          for k in range(j + 1,n):
               if l[i] + l[j] > l[k] and flag :
                    ans += 1
               else:
                    flag = False
print(ans)

Fixed submission:
import bisect
n = int(input())
l = list(map(int,input().split()))
l.sort()
ans = 0
for i in range(n-2):
     for j in range(i + 1,n-1):
          ans += bisect.bisect_left(l,l[i] + l[j]) - j - 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int,input().split()))
l.sort()
ans = 0
for i in range(n-2):
     for j in range(i + 1,n-1):
          flag = True
          for k in range(j + 1,n):
               if l[i] + l[j] > l[k] and flag :
                    ans += 1
               else:
                    flag = False
print(ans)

Fixed submission:
import bisect
n = int(input())
l = list(map(int,input().split()))
l.sort()
ans = 0
for i in range(n-2):
     for j in range(i + 1,n-1):
          ans += bisect.bisect_left(l,l[i] + l[j]) - j - 1
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
a, b = map(int,input().split())
g = math.gcd(a,b)
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
if g == 1:
     print(1)
else:
     print(len(factorization(g))+1)

Fixed submission:
import fractions
a, b = map(int,input().split())
g = fractions.gcd(a,b)
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
if g == 1:
     print(1)
else:
     print(len(factorization(g))+1)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 0
for i in range(n):
     ans += i
print(ans)

Fixed submission:
n = int(input())
print(n*(n-1)//2)
Buggy python submission (verdict: Runtime Error):
n = str(input())
s = len(n)
if s == 1:
     print(n)
elif s == 2:
     print(9)
elif s == 3:
     print(9 + int(n) - 99)
elif s == 4:
     print(9 + 900)
elif s == 5:
     print(909 + n - 9000)
else:
     print(90909)

Fixed submission:

n = str(input())
s = len(n)
if s == 1:
     print(n)
elif s == 2:
     print(9)
elif s == 3:
     print(9 + int(n) - 99)
elif s == 4:
     print(9 + 900)
elif s == 5:
     print(909 + int(n) - 9999)
else:
     print(90909)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [0] * n
for i in range(n):
    a[i] = int(input())
aa = [0,0]
for i in range(n):
    if a[i] > aa[-1]:
        aa[-1] = a[i]
    else:
        if a[i] >= aa[-2]:
            aa[-2] = a[i]

if aa[-1] == aa[-2]:
    for i in range(n):
        print(aa[-1])
else:
    for i in range(n):
        if i == a.index(aa[-1]):
            print(aa[-2])
        else:
            print(aa[-1])

Fixed submission:
n = int(input())
a = [int(input()) for i in range(n)]
maxi = max(a)
s = sorted(a,reverse=True)
 
for i in range(n):
    if a[i] != maxi:
        print(maxi)
    else:
        print(s[1])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [0] * n
for i in range(n):
    a[i] = int(input())
aa = sorted(a)
if aa[-1] == aa[-2]:
    for i in range(n):
        print(aa[-1])
else:
    for i in range(n):
        if i == a.index(aa[-1]):
            print(aa[-2])
        else:
            print(aa[-1])

Fixed submission:
n = int(input())
a = [int(input()) for i in range(n)]
maxi = max(a)
s = sorted(a,reverse=True)
 
for i in range(n):
    if a[i] != maxi:
        print(maxi)
    else:
        print(s[1])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [0] * n
for i in range(n):
    a[i] = int(input())
aa = sorted(a)
if aa[-1] == aa[-2]:
    for i in range(n):
        print(aa[-1])
else:
    for i in range(n):
        if i == a.index(aa[-1]):
            print(aa[-2])
        else:
            print(aa[-1])

Fixed submission:
n = int(input())
a = [int(input()) for i in range(n)]
maxi = max(a)
s = sorted(a,reverse=True)
 
for i in range(n):
    if a[i] != maxi:
        print(maxi)
    else:
        print(s[1])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [0] * n
for i in range(n):
     a[i] = int(input())

s = [i for i, v in enumerate(a) if v == max(a)]
if len(s) >= 2:
     for i in range(n):
          print(max(a))
else:
     for i in range(n):
          if i == s[0]:
               print(sorted(a)[-2])
          else:
               print(max(a))

Fixed submission:
n = int(input())
a = [int(input()) for i in range(n)]
maxi = max(a)
s = sorted(a,reverse=True)
 
for i in range(n):
    if a[i] != maxi:
        print(maxi)
    else:
        print(s[1])
Buggy python submission (verdict: Runtime Error):
import numpy as np
n = int(input())
a = list(map(int,input().split()))
mat = np.matrix([np.zeros(n) for i in range(n)])
for i in range(n-1):
    mat[i,i] = 1/2
    mat[i,i + 1] = 1/2
mat[n-1,0] = 1/2
mat[n-1,n-1] = 1/2

ans = np.linalg.inv(mat) * np.matrix(a).T
anss = []
for i in range(n):
    anss.append(int(ans[i,0]))
print(*anss)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
 
m = [0]*n
m[0] = sum(a)
 
for i in range((n-1)//2):
	m[0] -= 2*(a[1+i*2])
 
for i in range(1,n):
	m[i] = 2*a[i-1] - m[i-1]
 
print(' '.join(map(str, m)))

Buggy python submission (verdict: Runtime Error):
import numpy as np
n = int(input())
a = list(map(int,input().split()))
mat = np.matrix([np.zeros(n) for i in range(n)])
for i in range(n-1):
    mat[i,i] = 1/2
    mat[i,i + 1] = 1/2
mat[n-1,0] = 1/2
mat[n-1,n-1] = 1/2

ans = np.linalg.inv(mat) @ np.matrix(a).T
anss = []
for i in range(n):
    anss.append(int(ans[i,0]))
print(*anss)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
 
m = [0]*n
m[0] = sum(a)
 
for i in range((n-1)//2):
	m[0] -= 2*(a[1+i*2])
 
for i in range(1,n):
	m[i] = 2*a[i-1] - m[i-1]
 
print(' '.join(map(str, m)))

Buggy python submission (verdict: Runtime Error):
import numpy as np
n = int(input())
a =list(map(int,input().split()))
box = [[0]*n for _ in range(n)]
for i in range(n-1):
     box[i][i] = 1
     box[i][i+1] = 1

box[n-1][0] = 1
box[n-1][n-1] = 1
boxx = np.array(box)
inv = np.linalg.inv(boxx)
aa = np.array(a)
ans = np.dot(inv,aa)
print(*ans//2)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
 
m = [0]*n
m[0] = sum(a)
 
for i in range((n-1)//2):
	m[0] -= 2*(a[1+i*2])
 
for i in range(1,n):
	m[i] = 2*a[i-1] - m[i-1]
 
print(' '.join(map(str, m)))
Buggy python submission (verdict: Runtime Error):
w,h,x,y = map(float,input().split())
if x == w/2 and y == h/2:
     print(w*h/2,1)
else:
     print(w*h2,0)

Fixed submission:
w,h,x,y = map(float,input().split())
if x == w/2 and y == h/2:
     print(w*h/2,1)
else:
     print(w*h/2,0)
Buggy python submission (verdict: Runtime Error):
s =str(input())
ans = 0
aa = []
for i in range(1,len(s)):
    if s[i] in ['A', 'C', 'G', 'T']:
        if s[i-1] in ['A', 'C', 'G', 'T']:
            ans += 1
        else:ans = 1
    else:
        aa.append(ans)
        ans = 0
print(max(aa))

Fixed submission:
s =str(input())
ans = 0
aa = []
if s[0] in ['A', 'C', 'G', 'T']:
    ans =1
for i in range(1,len(s)):
    if s[i] in ['A', 'C', 'G', 'T']:
        if s[i-1] in ['A', 'C', 'G', 'T']:
            ans += 1
        else:ans = 1
    else:
        aa.append(ans)
        ans = 0
aa.append(ans)
print(max(aa))
Buggy python submission (verdict: Runtime Error):
n,m = map (int,input().split())
a = [0] * n
b = [0] * n
box = [0] * n
for i in range(n):
    a[i],b[i] = map(int,input().split())
    box[i] = [a[i],b[i]]
box.sort(key = lambda x:x[0])
s = 0
ans = 0
while m >= 0:
    m -= box[s][1]
    ans += box[s][0] * box[s][1]
    s += 1
    
print(ans - (-m) * box[s - 1][0])


Fixed submission:
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
#N = I()
#A = [LI() for _ in range(N)]


n,m = map (int,input().split())
a = [0] * n
b = [0] * n
box = [0] * n
for i in range(n):
    a[i],b[i] = map(int,input().split())
    box[i] = [a[i],b[i]]
box.sort(key = lambda x:x[0])
s = 0
ans = 0
while m > 0:
    
    m -= box[s][1]
    ans += box[s][0] * box[s][1]
    s += 1

print(ans - (-m) * box[s - 1][0])