Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
class Doubling():
    def __init__(self,N,log_k,perm):
        """
        与えられた順列のダブリング配列を作成する.

        Parameters
        ----------
            N :  int
                順列の数
            log_k : int
                最大移動回数の対数(切り上げ)
            perm : [int]
                1-indexed の順列が格納されたリスト
        """
        self.N = N
        self.log_k = log_k
        self.doubling = [[0]*(self.N+1) for _ in range(log_k)]

        for i in range(1,self.N+1):
            self.doubling[0][i] = perm[i]

        for j in range(1,self.log_k):
            for i in range(1,self.N+1):
                prev = self.doubling[j-1][i]
                self.doubling[j][i] = self.doubling[j-1][prev]
        
    def query(self,pos,k):
        """
        位置iからk回移動したときの移動先を計算する.

        Parameters
        ----------
            pos : int
                移動元の位置
            k : int
                移動回数(1<=k<=2^(log_k+1)-1)

        Returns
        ----------
            dest : int
                移動先の位置
        """
        for i in range(self.log_k):
            if k & (1<<i) == 0:continue
            pos = self.doubling[i][pos]
        dest = pos
        
        return dest

def main():
    n,k = tuple([int(t)for t in input().split()])

    a = [int(t) for t in input().split()]

    a.insert(0,0)
    log_k = k.bit_length()+1

    doubling = Doubling(n,log_k,a)
    print(doubling.query(1,k))

    
if __name__ == "__main__":
    main()

Fixed submission:
def main():
    n,k = tuple([int(t)for t in input().split()])

    a = tuple([int(t)-1 for t in input().split()])

    route = []
    se = set([])

    t = -1
    s = -1

    looplen = 0

    pos = 0
    for i in range(n):
        route.append(pos)
        se.add(pos)
        if a[pos] in se:
            t = len(route)
            s = route.index(a[pos])
            looplen = t-s
            break  
        pos = a[pos]

    if t>k:
        print(route[k]+1)
    else:
        pos = s+(k-s)%looplen
        print(route[pos]+1)
    
if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    x = int(input())
    
    if x ==1:
        print(1,0)
        return
    for i in range(-int(x**0.2),10**7,1):
        t = pow(i**5+x,1/5)
        if t.is_integer():
            print(int(t),i)
            break
if __name__ == "__main__":
    main()

Fixed submission:
def main():
    x = int(input())
    
    if x ==1:
        print(1,0)
        return
    for i in range(-1000,1000):
        for j in range(-1000,1000):
          if i**5 - j**5 == x:
            print(i,j)
            return

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
 
def main():
    s = list(map(int,input()[::-1]))
 
    t = []
    m = 0
    for i,s_i in enumerate(s):
        m = m+s_i*10**i
        t.append(m%2019)
    
    c = Counter(t)
    ans = c[0]
    for i in c.values():
 
        ans += i*(i-1)//2
    print(ans)
 
if __name__ == "__main__":
    main()

Fixed submission:
from collections import Counter

def main():
    s = list(map(int,input()[::-1]))

    t = []
    m = 0
    for i,s_i in enumerate(s):
        m = m+s_i*pow(10,i,2019)
        t.append(m%2019)
    
    c = Counter(t)
    ans = c[0]
    for i in c.values():

        ans += i*(i-1)//2
    print(ans)

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

def main():
    s = list(map(int,input()[::-1]))

    t = []
    m = 0
    for i,s_i in enumerate(s):
        m = m+s_i*10**i
        t.append(m%2019)
    
    c = Counter(t)
    ans = c[0]
    for i in c.values():

        ans += i*(i-1)//2
    print(ans)

if __name__ == "__main__":
    main()

Fixed submission:
from collections import Counter

def main():
    s = list(map(int,input()[::-1]))

    t = []
    m = 0
    for i,s_i in enumerate(s):
        m = m+s_i*pow(10,i,2019)
        t.append(m%2019)
    
    c = Counter(t)
    ans = c[0]
    for i in c.values():

        ans += i*(i-1)//2
    print(ans)

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
r=input()#入力を受け取れる
ans = r*2*3.14
print(ans)

Fixed submission:
import math

def main():
    n = int(input())
    print(math.tau*n)

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
import math
from collections import deque
def main():
    h,w = tuple([int(t)for t in input().split()])

    s = [['.']*(w+1)]

    s.extend(([list('.'+input()) for _ in range(h)]))

    dp = [[0]*(h+1) for _ in range(w+1)]

    for i in range(h):
        if s[i+1][1] == '.':
            dp[i+1][1] = dp[i][1]
        else:
            if s[i][1]=='.':
                dp[i+1][1] = dp[i][1]+1
            else:
                dp[i+1][1] = dp[i][1]

    for j in range(w):
        if s[1][j+1] == '.':
            dp[1][j+1] = dp[1][j]
        else:
            if s[1][j]=='.':
                dp[1][j+1] = dp[1][j]+1
            else:
                dp[1][j+1] = dp[1][j]

    for i in range(1,h):
        for j in range(1,w):
            if s[i+1][j+1] == '.':
                dp[i+1][j+1] = min(dp[i][j+1],dp[i+1][j])
            else:
                if s[i][j+1] == '.':
                    if s[i+1][j] == '.':
                        dp[i+1][j+1] = min(dp[i][j+1],dp[i+1][j])+1
                    else:
                        dp[i+1][j+1] = min(dp[i][j+1]+1,dp[i+1][j])
                else:
                    if s[i+1][j] == '.':
                        dp[i+1][j+1] = min(dp[i][j+1],dp[i+1][j]+1)
                    else:
                        dp[i+1][j+1] = min(dp[i][j+1],dp[i+1][j])

    print(dp[-1][-1])
if __name__ == "__main__":
    main()

Fixed submission:
import math
from collections import deque
def main():
    h,w = tuple([int(t)for t in input().split()])

    s = [['.']*(w+1)]

    s.extend(([list('.'+input()) for _ in range(h)]))

    dp = [[0]*(w+1) for _ in range(h+1)]

    for i in range(h):
        if s[i+1][1] == '.':
            dp[i+1][1] = dp[i][1]
        else:
            if s[i][1]=='.':
                dp[i+1][1] = dp[i][1]+1
            else:
                dp[i+1][1] = dp[i][1]

    for j in range(w):
        if s[1][j+1] == '.':
            dp[1][j+1] = dp[1][j]
        else:
            if s[1][j]=='.':
                dp[1][j+1] = dp[1][j]+1
            else:
                dp[1][j+1] = dp[1][j]

    for i in range(1,h):
        for j in range(1,w):
            if s[i+1][j+1] == '.':
                dp[i+1][j+1] = min(dp[i][j+1],dp[i+1][j])
            else:
                if s[i][j+1] == '.':
                    if s[i+1][j] == '.':
                        dp[i+1][j+1] = min(dp[i][j+1],dp[i+1][j])+1
                    else:
                        dp[i+1][j+1] = min(dp[i][j+1]+1,dp[i+1][j])
                else:
                    if s[i+1][j] == '.':
                        dp[i+1][j+1] = min(dp[i][j+1],dp[i+1][j]+1)
                    else:
                        dp[i+1][j+1] = min(dp[i][j+1],dp[i+1][j])

    print(dp[-1][-1])
if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
import math
from collections import deque
def main():
    
    t = [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]
    a = int(input())
    
    print(t[a+1])


if __name__ == "__main__":
    main()

Fixed submission:
import math
from collections import deque
def main():
    
    t = [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]
    a = int(input())
    
    print(t[a-1])


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
import sys
sys.setmaxrecursion(100000000)
def dfs(s,n,m,subs):
  if len(subs)==n:
    print(subs)
    return

  for i in range(m+1):
    t = "".join((subs,s[i]))
    dfs(s,n,i+1,t)

s = "abcdefghij"

n = int(input())
s = list(s[:n])
dfs(s,n,1,"a")

Fixed submission:
import sys
sys.setrecursionlimit(100000000)
def dfs(s,n,m,subs):
  if len(subs)==n:
    print(subs)
    return
  
  k = len(set(list(subs)))+1

  for i in range(k):
    t = "".join((subs,s[i]))
    dfs(s,n,k,t)

s = "abcdefghij"

n = int(input())
s = list(s[:n])
dfs(s,n,1,"a")
Buggy python submission (verdict: Runtime Error):
import math
from collections import deque
def main():
    n,p = tuple([int(t)for t in input().split()])
 
    s = input()[::-1]
    subs = [0]*p
    counter =0
    for i in range(0,n):
        subs[int(s[0:i+1])%p] +=1
 
    counter+=subs[0]
 
    for i in range(p//2):
        counter+= subs[i]*subs[-i-1]
 
 
    counter+=subs[0]*(subs[0]-1)//2
 
    print(counter)
 
if __name__ == "__main__":
    main()

Fixed submission:
import math
from collections import deque
def main():
    s = set(input())

    print("Yes" if len(s) == 2 else "No")



if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
s = [input() for _ in range(n)]

c = Counter(s)
ma = max(c.values())
for k,v in c:
  if ma == v:
    print(k)

Fixed submission:
from collections import Counter
n = int(input())
s = [input() for _ in range(n)]

c = Counter(s)
ma = max(c.values())
ans = []
for k,v in c.items():
  if ma == v:
    ans.append(k)

ans = sorted(ans)

for a in ans:
  print(a)
Buggy python submission (verdict: Time Limit Exceeded):
import math
import fractions
import functools
def main():
    n = int(input())
    a = [int(t)for t in input().split()]

    M = 10**9+7
    culcm = functools.reduce(lcm,a)

    b = [culcm//a_i for a_i in a]

    print(sum(b)%M)

def lcm(a,b):
    return a*b//fractions.gcd(a,b)

if __name__ == "__main__":
    main()


Fixed submission:
import math
import fractions
import functools
def main():
    n = int(input())
    a = [int(t)for t in input().split()]

    M = 10**9+7
    culcm = functools.reduce(lcm,a)

    b = [culcm//a_i for a_i in a]

    print(sum(b)%M)

def lcm(a,b):
    return a*b//fractions.gcd(a,b)

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
def primelist(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]
  
x = int(input())

list = primelist(x*10)
print(min([i for i in list if i>x])

Fixed submission:
def primelist(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]
  
x = int(input())

list = primelist(x*2)
print(min([i for i in list if i>=x]))
Buggy python submission (verdict: Runtime Error):
n = int(input())
frag = True
for i in range(n):
  if i*108//100 = n:
    print(i)
    frag=False
    break
if frag:
  print(":(")


Fixed submission:
import sys
n = int(input())
 
for i in range(n+1):
  if i*108//100 == n:
    print(i)
    sys.exit()
    
print(":(")
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
x = int(input())
if x>=2000:
  print(1)
  exit()
else:
  l = list(range(20))
  for nums in itertools.product(l,repeat=6):
    if nums[0]*100+nums[1]*101+nums[2]*102+nums[3]*103+nums[4]*104+nums[5]*105==x:
      print(1)
      exit()
print(0)

Fixed submission:
x = int(input())

c = x//100

if c*100<=x and x<=c*105:
  print(1)
else:
  print(0)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
x = int(input())
if x>=2000:
  print(1)
  exit()
else:
  l = list(range(20))
  for nums in itertools.product(l,repeat=6):
    t = nums[0]*100+nums[1]*101+nums[2]*102+nums[3]*103+nums[4]*104+nums[5]*105
    if t==x:
      print(1)
      exit()
print(0)

Fixed submission:
x = int(input())

c = x//100

if c*100<=x and x<=c*105:
  print(1)
else:
  print(0)

Buggy python submission (verdict: Runtime Error):
x = int(input())
if x<100:
  print(0)
else:
  n = x//100
  m = x%100
  
  dp = set([1,2,3,4,5])
  
  for i in range(n):
    t = set([])
    for dp_i in dp:
      for j in range():
      	t.add((dp_i+j)%100)
    dp = t 
  
  if m in dp:
    print(1)
  else:
    print(0)


Fixed submission:
x = int(input())

c = x//100

if c*100<=x and x<=c*105:
  print(1)
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
n,k,q = tuple(map(int,input().split()))

check = []

for _ in [0]*q:
  check[int(input())-1]+=1
  
for i in range(n):
  judge = k-(q-check[i])
  if judge<=0:
    print("No")
  else:
    print("Yes")

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

check = [0]*n

for _ in [0]*q:
  check[int(input())-1]+=1
  
for i in range(n):
  judge = k-(q-check[i])
  if judge<=0:
    print("No")
  else:
    print("Yes")
Buggy python submission (verdict: Runtime Error):
n = int(input())
b = list(map(int,input().split()))

a = [b.pop()]
for b_i in b[::-1]:
  a.append(min(a[-1],b_i))
a.append(b[0])
print(sum(a))

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

a = [b[-1],b[0]]
for i in range(n-2):
  a.append(min(b[i],b[i+1]))

print(sum(a))
Buggy python submission (verdict: Runtime Error):
from collections import queue
n = int(input())
a = tuple(map(int,input().split()))

a = sorted(a,reversed=True)
while len(a>1):
  a.append((a.pop()+a.pop())/2)
print(a[0])


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

a = sorted(a,reverse=True)
while len(a)>1:
  a.append((a.pop()+a.pop())/2)
print(a[0])
Buggy python submission (verdict: Runtime Error):
M = (10**9+7)
s = list(input())[::-1]

mo = []
fixed = 0
for i in range(len(s)):
  if s[i]!='?':
    t = int(s[i])
    fixed += (t*pow(10,i,13))%13
  else:
    t = []
    for j in range(10):
      t.append((j*pow(10,i,13)%13))
    mo.append(tuple(t))
    
dp = [[-1]*13 for _ in range(len(mo))]

for m in mo[0]:
  dp[0][m] = 1
for i in range(len(mo)-1):
  for j in range(13):
    if dp[i][j]==-1:
      continue
    for m in mo[i+1]:
      p = (j+m)%13
      if dp[i+1][p] == -1:
        dp[i+1][p] = dp[i][j] % M
      else:
        dp[i+1][p] += dp[i][j] 

ans = dp[-1][(18-fixed)%13] % M 
if dp[-1][(18-fixed)%13] == -1:
  print(0)
  exit()
print(ans)

Fixed submission:
M = (10**9+7)
s = list(input())[::-1]

mo = []
fixed = 0
for i in range(len(s)):
  if s[i]!='?':
    t = int(s[i])
    fixed += (t*pow(10,i,13))
    fixed %= 13
  else:
    t = []
    for j in range(10):
      t.append((j*pow(10,i,13)%13))
    mo.append(tuple(t))

if len(mo)==0:
  if fixed == 5:
    print(1)
  else:
    print(0)
  exit()
  
dp = [[-1]*13 for _ in range(len(mo))]

for m in mo[0]:
  dp[0][m] = 1
for i in range(len(mo)-1):
  for j in range(13):
    if dp[i][j]==-1:
      continue
    dp_i = dp[i+1]
    dp_j = dp[i]
    for m in mo[i+1]:
      p = (j+m)%13
      if dp_i[p] == -1:
        dp_i[p] = 0
      dp_i[p] += dp_j[j]
      dp_i[p]  %= M

ans = dp[-1][(18-fixed)%13] % M 
if dp[-1][(18-fixed)%13] == -1:
  print(0)
  exit()
print(ans)

Buggy python submission (verdict: Runtime Error):
M = (10**9+7)
s = list(input())[::-1]

mo = []
fixed = 0
for i in range(len(s)):
  if s[i]!='?':
    t = int(s[i])
    fixed += (t*pow(10,i,13))%13
  else:
    t = []
    for j in range(10):
      t.append((j*pow(10,i,13)%13))
    mo.append(tuple(t))
    
dp = [[-1]*13 for _ in range(len(mo))]

for m in mo[0]:
  dp[0][m] = 1
for i in range(len(mo)-1):
  for j in range(13):
    if dp[i][j]==-1:
      continue
    for m in mo[i+1]:
      p = (j-m)%13
      if dp[i+1][p] == -1:
        dp[i+1][p] = dp[i][j] % M
      else:
        dp[i+1][p] += dp[i][j] 
ans = dp[-1][(18-fixed)%13] % M 
print(ans)


  


Fixed submission:
M = (10**9+7)
s = list(input())[::-1]

mo = []
fixed = 0
for i in range(len(s)):
  if s[i]!='?':
    t = int(s[i])
    fixed += (t*pow(10,i,13))
    fixed %= 13
  else:
    t = []
    for j in range(10):
      t.append((j*pow(10,i,13)%13))
    mo.append(tuple(t))

if len(mo)==0:
  if fixed == 5:
    print(1)
  else:
    print(0)
  exit()
  
dp = [[-1]*13 for _ in range(len(mo))]

for m in mo[0]:
  dp[0][m] = 1
for i in range(len(mo)-1):
  for j in range(13):
    if dp[i][j]==-1:
      continue
    dp_i = dp[i+1]
    dp_j = dp[i]
    for m in mo[i+1]:
      p = (j+m)%13
      if dp_i[p] == -1:
        dp_i[p] = 0
      dp_i[p] += dp_j[j]
      dp_i[p]  %= M

ans = dp[-1][(18-fixed)%13] % M 
if dp[-1][(18-fixed)%13] == -1:
  print(0)
  exit()
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = tuple(map(int,input().split()))

a = sorted(a)

print(a[n//2+1]-a[n//2])

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

a = sorted(a)

print(a[n//2]-a[n//2-1])
Buggy python submission (verdict: Runtime Error):
M = 10**9+7

def factorial(n):
    f = 1
    for i in range(1,n+1):
        f = f*i%M
    return f

def comb(n,k):
    if n==0 or k == 0:
        return 1
    if n<k:
        return 0

    return perm(n,k)*inverse(factorial(k))%M

def mcomb(n,k):
    return comb(n+k-1,k)

def perm(n,k):
    if n==0 or k == 0:
        return 1
    if n<k:
        return 0

    p = 1
    for i in range(n-k+1,n+1):
        p = p*i%M

    return M

def inverse(a):
    return pow(a,M-2,M)
  
n,k = tuple(main(int,input().split()))

for i in range(k):
  i += 1
  ans = comb(n-k+1,i)*comb(k-1,i-1)
  ans %= M
  print(ans)

Fixed submission:
M = 10**9+7

def factorial(n):
    f = 1
    for i in range(1,n+1):
        f = f*i%M
    return f

def comb(n,k):
    if n==0 or k == 0:
        return 1
    if n<k:
        return 0

    return perm(n,k)*inverse(factorial(k))%M

def mcomb(n,k):
    return comb(n+k-1,k)

def perm(n,k):
    if n==0 or k == 0:
        return 1
    if n<k:
        return 0

    p = 1
    for i in range(n-k+1,n+1):
        p = p*i%M

    return p

def inverse(a):
    return pow(a,M-2,M)
  
n,k = tuple(map(int,input().split()))

for i in range(k):
  i += 1
  t = comb(k-1,i-1)
  u = comb(n-k+1,i)
  ans = t*u
  ans %= M
  print(ans)
Buggy python submission (verdict: Runtime Error):
class UnionFind:
    def __init__(self,n):
        super().__init__()
        self.par = [-1]*n
        self.rank = [0]*n
        self.tsize = [1]*n
    
    def root(self,x):
        if self.par[x] == -1:
            return x 
        else:
            self.par[x] = self.root(self.par[x])
            return self.par[x]

    def unite(self, x, y):
        x_r = self.root(x)
        y_r = self.root(y)
        
        if self.rank[x_r]>self.rank[y_r]:
            self.par[y_r] = x_r

        elif self.rank[x_r]<self.rank[y_r]:
            self.par[x_r] = y_r

        elif x_r != y_r:
            self.par[y_r] = x_r
            self.rank[x_r] += 1

        if x_r != y_r:
            size = self.tsize[x_r]+self.tsize[y_r]
            self.tsize[x_r] = size
            self.tsize[y_r] = size

    def isSame(self,x,y):
        return self.root(x) == self.root(y)

    def size(self,x):
        return self.tsize[self.root(x)]

def main():

    n= tuple([int(t)for t in input().split()])
    uf = UnionFind(2*(n+1))
    
    for _ in range(n-1):
      x,y,w = tuple([int(t)for t in input().split()])
      if w%2==0:
        uf.unite(2*x,2*y)
        uf.unite(2*x+1,2*y+1)
      else:
        uf.unite(2*x+1,2*y)
        uf.unite(2*x,2*y+1)

    w = uf.root(0)
    for i in range(n):
      if w == ufroot(2*i):
        print(1)
      else:
        print(0)

if __name__ == "__main__":
    main()


Fixed submission:
class UnionFind:
    def __init__(self,n):
        super().__init__()
        self.par = [-1]*n
        self.rank = [0]*n
        self.tsize = [1]*n
    
    def root(self,x):
        if self.par[x] == -1:
            return x 
        else:
            self.par[x] = self.root(self.par[x])
            return self.par[x]

    def unite(self, x, y):
        x_r = self.root(x)
        y_r = self.root(y)
        
        if self.rank[x_r]>self.rank[y_r]:
            self.par[y_r] = x_r

        elif self.rank[x_r]<self.rank[y_r]:
            self.par[x_r] = y_r

        elif x_r != y_r:
            self.par[y_r] = x_r
            self.rank[x_r] += 1

        if x_r != y_r:
            size = self.tsize[x_r]+self.tsize[y_r]
            self.tsize[x_r] = size
            self.tsize[y_r] = size

    def isSame(self,x,y):
        return self.root(x) == self.root(y)

    def size(self,x):
        return self.tsize[self.root(x)]

def main():

    n= int(input())
    uf = UnionFind(2*(n+1))
    
    for _ in range(n-1):
      x,y,w = tuple([int(t)for t in input().split()])
      if w%2==0:
        uf.unite(2*x,2*y)
        uf.unite(2*x+1,2*y+1)
      else:
        uf.unite(2*x+1,2*y)
        uf.unite(2*x,2*y+1)

    w = uf.root(2)

    for i in range(1,n+1):
      if w == uf.root(2*i):
        print(1)
      else:
        print(0)

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

ans=0
counter = 0
for c in s:
  if c=='A' or c=='C' or c=='G' or c=-'T':
    counter+=1
  else:
    ans = max(ans,counter)
    counter==0
print(ans)
  

Fixed submission:
s = input()
 
ans=0
counter = 0
for c in s:
  if c=='A' or c=='C' or c=='G' or c=='T':
    counter+=1
  else:
    ans = max(ans,counter)
    counter=0
ans = max(ans,counter)
print(ans)
Buggy python submission (verdict: Runtime Error):
def main():
    n,m,c = tuple([int(t)for t in input().split()])
	b = tuple([int(t)for t in input().split()])
    
    ans = 0
    for _ in [0]*n:
      	t = tuple([int(t)for t in input().split()])
        v = c
		for i in range(m):
            v+=b[m]*t[m]
        if v>0:
          ans+=1
    print(ans)
if __name__ == "__main__":
    main()

Fixed submission:
def main():
    n,m,c = tuple([int(t)for t in input().split()])
    b = tuple([int(t)for t in input().split()]) 
    ans = 0
    for _ in [0]*n:
      t = tuple([int(t)for t in input().split()])
      v = c
      for i in range(m):
        v+=b[i]*t[i]
      if v>0:
          ans+=1
    print(ans)
if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
n,m = tuple(map(int,input()))

check = [0]*m

for i in range(n):
  for a_i in tuple(map(int,input()))[1:]:
    check[a_i]+=1
    
print(check.count(n))

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

check = [0]*m

for i in range(n):
  for a_i in tuple(map(int,input().split()))[1:]:
    check[a_i-1]+=1
    
print(check.count(n))
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(1000000)
def watering(l,a,b):
  if b-a <= 1:
    return l[a]
  
  c = 0
  t = a
  
  mi = min(l[a:b])
  for i in range(a,b):
    l[i] -= mi
    
  for i in range(a,b):
    if l[i]==0:
      c += watering(l,t,i)
      t=i+1
  c += watering(l,t,b)
      
  return c+mi

n = int(input())
h = list(map(int,input().split()))

print(watering(h,0,n))

Fixed submission:
import sys
sys.setrecursionlimit(1000000)
def watering(l,a,b):
  if b==a:
    return 0
  if b-a <= 1:
    return l[a]
  
  c = 0
  t = a
  
  mi = min(l[a:b])
  for i in range(a,b):
    l[i] -= mi
    
  for i in range(a,b):
    if l[i]==0:
      c += watering(l,t,i)
      t=i+1
  c += watering(l,t,b)
      
  return c+mi

n = int(input())
h = list(map(int,input().split()))

print(watering(h,0,n))
Buggy python submission (verdict: Runtime Error):
n,x = tuple(map(int,input().split()))
a = tuple(map(int,input().split()))
a = sorted(a,reverse=True)

t = a.pop()
ans = 0
while x>=t:
  ans+=1
  x-=t
  t=a.pop()
  
print(ans)

Fixed submission:
n,x = tuple(map(int,input().split()))
a = tuple(map(int,input().split()))
a = sorted(a)
ans=0

for a_i in a:
  x -= a_i
  if x<0:
    break
  else:
    ans+=1

if x>0:
  ans-=1

print(ans)