Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02963 (python)

Fixed submission:
s = int(input())
a = int(s**(1/2))
if s == a**2:
  b =0 
  print(" ".join(map(str, [0,0,a,1,b,a])))
elif a*(a+1) - s >= 0: 
  b = a*(a+1) - s
  print(" ".join(map(str, [0,0,a+1,1,b,a])))
else:
  b = (a+1)**2 - s
  print(" ".join(map(str, [0,0,a+1,1,b,a+1])))

Buggy submission (verdict: Runtime Error):
s = int(input())
a = int(s**(1/2)) + 1
b = a**2 - s
if s = 10**18:
  print(" ".join(map(str, [0,0,10**9,0,0,10*9])))
else:
  print(" ".join(map(str, [0,0,a,1,b,a])))
Problem p03061 (python)

Fixed submission:
from functools import reduce
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)
def gcd_list(numbers):
    return reduce(gcd, numbers)

n = int(input())
a = list(map(int, input().split()))
if n == 2:
  print(max(a))
else:
  p = gcd_list(a[:3])
  q = max([gcd(a[0], a[1]), gcd(a[0], a[2]), gcd(a[1], a[2])])
  for i in range(3, n):
    q = max([p, gcd(q, a[i])])
    p = gcd(p, a[i])
    
  print(q)

Buggy submission (verdict: Runtime Error):
from functools import reduce
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)
def gcd_list(numbers):
    return reduce(gcd, numbers)

n = int(input())
a = list(map(int, input().split()))
L = []
if n == 2:
  print(max(a))
else:
  for i in range(n):
    b = [_ for _ in a if _ != a[i]]
    L.append(gcd_list(b))

  print(max(L))
Problem p03074 (python)

Fixed submission:
n, k = map(int, input().split())
s = str(input())
Sb = []
zero = 0
for i in range(n):
  if int(s[i]):
    if len(Sb) == 0 or Sb[-1][0] == 0:
      Sb.append([1, 1])
    else:
      Sb[-1][1] += 1
  else:
    if len(Sb) == 0 or Sb[-1][0]:
      Sb.append([0, 1])
      zero += 1
    else:
      Sb[-1][1] += 1
if zero <= k:
  print(n)
else:
  if Sb[0][0] != 1:
    Sb.insert(0, [1, 0])
  if Sb[-1][0] != 1:
    Sb.append([1, 0])
  ans = sum([Sb[i][1] for i in range(2 * k + 1)])
  tmp = ans
  for i in range(zero - k):
    tmp += Sb[2 * k + 2 * (i+1)][1] + Sb[2 * k + 2 * (i+1) - 1][1] - Sb[2 * i][1] - Sb[2 * i + 1][1]
    ans = max(ans, tmp)
  print(ans)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
s = str(input())
Sb = []
zero = 0
for i in range(n):
  if int(s[i]):
    if len(Sb) == 0 or Sb[-1][0] == 0:
      Sb.append([1, 1])
    else:
      Sb[-1][1] += 1
  else:
    if len(Sb) == 0 or Sb[-1][0]:
      Sb.append([0, 1])
      zero += 1
    else:
      Sb[-1][1] += 1
if zero <= k:
  print(n)
else:
  if Sb[0][0] != 1:
    Sb.insert(0, [1, 0])
  if Sb[-1][0] != 1:
    Sb.append([1, 0])
  tmp = ans
  for i in range(zero - k):
    tmp += Sb[2 * k + 2 * (i+1)][1] + Sb[2 * k + 2 * (i+1) - 1][1] - Sb[2 * i][1] - Sb[2 * i + 1][1]
    ans = max(ans, tmp)
  print(ans)
Problem p03078 (python)

Fixed submission:
x, y, z, k = map(int, input().split())
a = sorted(list(map(int, input().split())),reverse=True)
b = sorted(list(map(int, input().split())),reverse=True)
c = sorted(list(map(int, input().split())),reverse=True)
def search(a, b):
  ret = []
  al = len(a)
  bl = len(b)
  for i in range(min(al, k)):
    for j in range(min(bl, k-i)):
      ret.append(a[i] + b[j])
  ret.sort(reverse = True)
  return ret
d = search(a, b)      
e = search(c, d)    

for i in range(k):
  print(e[i])

Buggy submission (verdict: Runtime Error):
x, y, z, k = map(int, input().split())
a = sorted(list(map(int, input().split())),reverse=True)
b = sorted(list(map(int, input().split())),reverse=True)
c = sorted(list(map(int, input().split())),reverse=True)
useA = [a.pop(0)]
useB = [b.pop(0)]
useC = [c.pop(0)]
while True:
  if a[0] == b[0] == c[0] == 0:
    break
  if a[0] >= b[0] and a[0] >= c[0]:
    useA.append(a.pop(0))
    if len(a) == 0:
      a.append(0)
  elif b[0] >= a[0] and b[0] >= c[0]:
    useB.append(b.pop(0))
    if len(b) == 0:
      b.append(0)
  elif c[0] >= b[0] and c[0] >= a[0]:
    useC.append(c.pop(0))
    if len(c) == 0:
      c.append(0)
#  print( len(useA) * len(useB) * len(useC))
  if k**2 <= len(useA) * len(useB) * len(useC):
    break
ans = []
#print(useA, useB, useC)
for i in range(len(useA)):
  for j in range(len(useB)):
    for m in range(len(useC)):
      ans.append(useA[i] + useB[j] + useC[m])
ans.sort(reverse = True)
for i in range(k):
  print(ans[i])

Buggy submission (verdict: Runtime Error):
x, y, z, k = map(int, input().split())
a = sorted(list(map(int, input().split())),reverse=True)
b = sorted(list(map(int, input().split())),reverse=True)
c = sorted(list(map(int, input().split())),reverse=True)
useA = [a.pop(0)]
useB = [b.pop(0)]
useC = [c.pop(0)]
while True:
  if a[0] >= b[0] and a[0] >= c[0]:
    useA.append(a.pop(0))
    if len(a) == 0:
      a.append(0)
  elif b[0] >= a[0] and b[0] >= c[0]:
    useB.append(b.pop(0))
    if len(b) == 0:
      b.append(0)
  elif c[0] >= b[0] and c[0] >= a[0]:
    useC.append(c.pop(0))
    if len(c) == 0:
      c.append(0)
#  print( len(useA) * len(useB) * len(useC))
  if k**2 <= len(useA) * len(useB) * len(useC):
    break
ans = []
#print(useA, useB, useC)
for i in range(len(useA)):
  for j in range(len(useB)):
    for m in range(len(useC)):
      ans.append(useA[i] + useB[j] + useC[m])
ans.sort(reverse = True)
for i in range(k):
  print(ans[i])
Problem p03141 (python)

Fixed submission:
import numpy as np
n = int(input())
a = []
b = []
c = []
for i in range(n):
  a_i, b_i = map(int,input().split())
  a.append(a_i)
  b.append(b_i)
  c.append(a_i+b_i)
c.sort(reverse=True)
k = int((n+1)/2)
print(np.sum(c[::2])-np.sum(b))

Buggy submission (verdict: Runtime Error):
import numpy as np
n = int(input())
a = []
b = []
c = []
for i in range(n):
  a_i, b_i = map(int,input().split())
  a.append(a_i)
  b.append(b_i)
  c.append(a_i+b_i)
c.sort(reverse=True)
k = int((n+1)/2)
print(np.sum(c[::2])-np.sum(b))
Problem p03194 (python)

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

# 0以上整数x「未満」の素数をリストに格納して返す
def primes(x):
    if x < 2: return []

    primes = [i for i in range(x)]
    primes[1] = 0 # 1は素数ではない

    # エラトステネスのふるい
    for prime in primes:
        if prime > math.sqrt(x): break
        if prime == 0: continue
        for non_prime in range(2 * prime, x, prime): primes[non_prime] = 0

    return [prime for prime in primes if prime != 0]

PS = primes(1000000)
def factorint(x):
  d = {}
  for k in PS:
    if(x % k== 0):
      m = 1
      while(x % (k**m) == 0):
        m += 1
      d[k] = m - 1
      x = x / (k ** (m - 1))
      if x == 1:
        break
  return d

fac = factorint(p)
result = 1
for i,j in fac.items():
  result *= i **math.floor(j/n)
if n == 1:
  result = p
print(result)

Buggy submission (verdict: Runtime Error):
n, p = map(int, input().split())
import sympy
import math
fac = sympy.factorint(p)
result = 1
for i,j in fac.items():
  result *= i **math.floor(j/n)
print(result)
Problem p03262 (python)

Fixed submission:
n, x =  map(int, input().split())
xi = map(int, input().strip().split())
c = [x] * n
xi = [x - y for (x,y) in zip(xi,c)]
def gcd(a, b):
  if b == 0: return a
  return gcd(b, a % b)
d0 = xi[0]
for i in range(n-1):
    d = gcd(xi[i+1],d0)
    d0 = d
if len(xi) == 1:
  d = xi[0]
print(abs(d))

Buggy submission (verdict: Runtime Error):
n, x =  map(int, input().split())
xi = map(int, input().strip().split())
c = [x] * n
xi = [x - y for (x,y) in zip(xi,c)]
def gcd(a, b):
  
  if b == 0: return a
  return gcd(b, a % b)
d0 = xi[0]
for i in range(n-1):
    d = gcd(xi[i+1],d0)
    d0 = d
print(abs(d))

Buggy submission (verdict: Runtime Error):
n, x =  map(int, input().split())
xi = map(int, input().strip().split())
c = [1] * x
xi = [x - y for (x,y) in zip(xi,c)]
def gcd(a, b):
  if b == 0: return a
  return gcd(b, a % b)
d0 = xi[0]
for i in range(n-1):
    d = gcd(xi[i+1],d0)
    d0 = d
print(d)

Buggy submission (verdict: Runtime Error):
n, x =  map(int, input().split())
xi = list(map(int, input().strip().split()))
c = [1] * x
xi = [x - y for (x,y) in zip(xi,c)]
def gcd(a, b):
  if b == 0: return a
  return gcd(b, a % b)
d0 = xi[0]
for i in range(n-1):
    d = gcd(xi[i+1],d0)
    d0 = d
print(d)
Problem p02850 (python)

Fixed submission:

#%%
import sys
sys.setrecursionlimit(100000)

def input():
    return sys.stdin.readline().rstrip()

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

    g = [[] for _ in range(N-1)]
    for i in range(N-1):
        a, b = map(int, input().split())
        g[a-1].append((b-1, i))

    ans = [[None] for _ in range(N-1)]

    def dfs(v0, c0):
        c = 1
        for v1, e in g[v0]:
            if c==c0:
                c += 1
            ans[e] = c
            if v1 < N-1:
                dfs(v1, c)
            c += 1

    dfs(0, 0)

    print(max(ans))
    for c in ans:
        print(c)



# %%
if __name__ == '__main__':
    main()

# %%
# from atcoder_test import doTest
# doTest("abc146","d",main)

Buggy submission (verdict: Runtime Error):

#%%
import sys
def input():
    return sys.stdin.readline().rstrip()

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

    g = [[] for _ in range(N-1)]
    for i in range(N-1):
        a, b = map(int, input().split())
        g[a-1].append((b-1, i))

    ans = [[None] for _ in range(N-1)]

    def dfs(v0, c0):
        c = 1
        for v1, e in g[v0]:
            if c==c0:
                c += 1
            ans[e] = c
            if v1 < N-1:
                dfs(v1, c)
            c += 1

    dfs(0, 0)

    print(max(ans))
    for c in ans:
        print(c)



# %%
if __name__ == '__main__':
    main()

# %%
# from atcoder_test import doTest
# doTest("abc146","d",main)

Buggy submission (verdict: Runtime Error):

#%%
import sys
def input():
    return sys.stdin.readline().rstrip()

import numpy as np

def main():
    N = int(input())
    As = [tuple(map(int, input().split())) for _ in range(N-1)]

    m = np.zeros((N, N),dtype=int)

    for a, b in As:
        m[a-1][b-1] = m[b-1][a-1] = 1

    ans = np.zeros((N,N),dtype=int)

    from collections import deque

    max_c = 1
    l = deque([(0,0)])
    while (len(l)):
        v0, c0 = l.popleft()
        c1 = 1
        for v1 in range(N):
            if m[v0][v1]:
                m[v0][v1] = m[v1][v0] = 0
                if c1 == c0:
                    c1 += 1
                max_c = max(max_c, c1)
                ans[v0][v1] = ans[v1][v0] = c1
                l.append((v1, c1))
                c1 += 1

    print(max_c)
    for u, v in As:
        print(ans[u-1][v-1])



# %%
if __name__ == '__main__':
    main()

# %%
# from atcoder_test import doTest
# doTest("abc146","d",main)
Problem p02866 (python)

Fixed submission:
#%%
import sys
def input():
    return sys.stdin.readline().rstrip()

import math

def func(i, j, d):
    if i <= 1:
        return 1
    e = j
    b = int(math.log2(d)/math.log2(i))
    ret = 1
    while e > b:
        ret = ret*(i**b%d)
        e = e - b
    else:
        if e > 0:
            ret = ret*(i**e%d)
    return ret


def main():
    N = int(input())
    Ds = [int(d) for d in input().split()]

    if Ds[0] != 0:
        print(0)
        return

    Ds.sort()
    if Ds[1] == 0:
        print(0)
        return

    i = 1
    l = 1
    r = 1
    ans = 1
    divider = 998244353

    while i < N:
        cnt = 0
        while i < N and Ds[i] == l:
            cnt = cnt + 1
            i = i + 1
        if cnt == 0:
            print(0)
            return

        ans = ans*func(r, cnt, divider)%divider
        r = cnt
        l = l + 1
    
    print(ans)

# %%
if __name__ == '__main__':
    main()

# %%
# from atcoder_test import doTest
# doTest("nikkei2019-2-qual","b",main)

Buggy submission (verdict: Runtime Error):
#%%
import sys
def input():
    return sys.stdin.readline().rstrip()

import numpy as np

def main():
    N = int(input())
    Ds = np.array([int(d) for d in input().split()])

    Ds.sort()
    if Ds[Ds==0].size != 1:
        print(0)
        return
    Ds = Ds[1:]

    l = 0
    r = 1
    c = []
    while len(Ds) > 0:
        l = l + 1
        cnt = Ds[Ds==l].size
        c.append((r, cnt))
        r = cnt
        Ds = Ds[cnt:]
        
    ans = 1
    divider = 998244353
    for i, j in c:
        r = (i**j)%divider
        ans = (ans*r)%divider
    
    print(ans)

# %%
if __name__ == '__main__':
    main()

# %%
# from atcoder_test import doTest
# doTest("nikkei2019-2-qual","b",main)
Problem p02981 (python)

Fixed submission:
#%%
import sys
def input():
    return sys.stdin.readline().rstrip()

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

    print(min(A*N, B))

# %%
if __name__ == '__main__':
    main()

# %%
# from atcoder_test import doTest
# doTest("abc133","a",main)

Buggy submission (verdict: Runtime Error):
#%%
import sys
def input():
    return sys.stdin.readline().rstrip()

def main():
    L, R = map(int, input().split())

    R_r = R%2019
    if (R - L) >= R_r :
        print(0)
    else:
        L_r = L%2019
        ans = (L_r*(L_r+1))%2019
        for l in range(L_r, R_r):
            for r in range(l+1, R_r+1):
                ans = min(ans, (l*r)%2019)
        print(ans)

# %%
if __name__ == '__main__':
    main()

# %%
# from atcoder_test import doTest
# doTest("abc133","c",main)

Buggy submission (verdict: Runtime Error):
#%%
import sys
def input():
    return sys.stdin.readline().rstrip()

def main():
    L, R = map(int, input().split())

    R_r = R%2019
    if (R - L) > R_r :
        print(0)
    else:
        L_r = L%2019
        ans = L_r*(L_r+1)%2019
        for l in range(L_r, R_r):
            for r in range(l+1, R_r+1):
                ans = min(ans, l*r%2019)
        print(ans)

# %%
if __name__ == '__main__':
    main()

# %%
# from atcoder_test import doTest
# doTest("abc133","c",main)
Problem p03141 (python)

Fixed submission:
N=int(input())
AB=[list(map(int, input().split())) for _ in range(N)]

AB.sort(key=lambda x:(x[0]+x[1]),reverse=True)

s=0
for i,v in enumerate(AB):
    if i%2:
        s = s - v[1]
    else:
        s = s + v[0]
print(s)

Buggy submission (verdict: Runtime Error):
N=int(input())
AB=[list(map(int, input().split())) for _ in range(N)]

AB.sort(key=lambda x:(x[0]+x[1]),reverse=True)
print(sum([x for x in zip(*AB[::2])][0])-sum([x for x in zip(*AB[1::2])][1]))
Problem p02732 (python)

Fixed submission:
n=input()
t=map(int,raw_input().split())
l=[0]*(2*pow(10,5)+4)
for i in t:
    l[i]+=1
s=0
for x in l:
    s+=(x*(x-1))/2
for x in t:
    a=l[x]
    print s- (a*(a-1))/2 + (a-1)*(a-2)/2

Buggy submission (verdict: Runtime Error):
n=input()
t=map(int,raw_input().split())
l=[0]*(pow(10,5)+1)
for i in t:
    l[i]+=1
s=0
for x in l:
    s+=(x*(x-1))/2
for x in t:
    a=l[x]
    print s- (a*(a-1))/2 + (a-1)*(a-2)/2
Problem p02969 (python)

Fixed submission:
print((int(input())**2)*3)

Buggy submission (verdict: Runtime Error):
print((input()**2)*3)
Problem p02995 (python)

Fixed submission:
A, B, C, D = [int(e) for e in input().split()]
E = max(C, D)
F = min(C, D)

mod = 1
while mod > 0:
  mod = E % F
  if mod == 0:
    break
  else:
    E = F
    F = mod
G = C*D // F

A_B = []
for AB in [A-1, B]:
  AB_c = AB // C
  AB_d = AB // D
  AB_g = AB // G
  A_B.append(AB_c + AB_d - AB_g)
can_divide = A_B[1] - A_B[0]
ans = (B - (A-1)) - can_divide
print(ans)

Buggy submission (verdict: Runtime Error):
A, B, C, D = [int(e) for e in input().split()]

import math
G = math.gcd(C, D)

A_B = []
for AB in [A-1, B]:
  AB_c = AB // C
  AB_d = AB // D
  AB_g = AB // G
  A_B.append(AB_c + AB_d - AB_g)
can_divide = A_B[1] - A_B[0]
ans = (B - (A-1)) - can_divide
print(ans)
Problem p02999 (python)

Fixed submission:
X, A = [int(xa) for xa in input().split()]
if X < A:
  print(0)
else:
  print(10)

Buggy submission (verdict: Runtime Error):
X, A = [int(xa) for xa input().split()]
if X < A:
  print(0)
else:
  print(10)
Problem p03061 (python)

Fixed submission:
# PDF解説
N = int(input())
A = [int(a) for a in input().split()]

import fractions

L = []
# [gcd(0), gcd(0, A[0]), ... , gcd(0, A[0], A[1], ..., A[N-2])]
R = []
# [gcd(A[1], A[2], ... , A[N-1], 0), gcd(A[2], A[3], ... , A[N-1], 0), ... , gcd(0)]

L.append(0)
for i in range(0, N-1, 1):
  l = fractions.gcd(L[-1], A[i])
  L.append(l)

R.append(0)
for j in range(N-1, 0, -1):
  r = fractions.gcd(R[-1], A[j])
  R.append(r)
R.reverse()

ans = 0
for n in range(N):
  lr = fractions.gcd(L[n], R[n])
  ans = max(ans, lr)

print(ans)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
N = int(input())
A = input().split()
A = [int(a) for a in A]
B = []
for n in range(N):
  for i in range(1, (10^9)+1):
    A[n] = i
    b = reduce(math.gcd, A)
    B.append(b)
B_max = max(B)
print(B_max)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
N = int(input())
A = input().split()
A = [int(a) for a in A]
B = []
for n in range(N):
  for i in range(1, (10^9)+1):
    A[n] = i
    b = reduce(math.gcd, A)
    B.append(b)
B_max = max(b)
print(B_max)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
N = int(input())
A = input().split()
A = [int(a) for a in A]
B = []
for n in range(N):
  for i in range(1:(10^9)+1):
    A[n] = i
    b = reduce(math.gcd, A)
    B.append(b)
B_max = max(b)
print(B_max)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
N = int(input())
A = input().split()
A = [int(a) for a in A]
B = []
for n in range(N):
  for i in range(1:(10^9)-1):
    A[n] = i
    b = reduce(math.gcd, A)
    B.append(b)
B_max = max(b)
print(B_max)
Problem p03078 (python)

Fixed submission:
X, Y, Z, K = [int(x) for x in input().split()]
A = [int(a) for a in input().split()]
B = [int(b) for b in input().split()]
C = [int(c) for c in input().split()]
A = sorted(A, reverse=True)
B = sorted(B, reverse=True)
C = sorted(C, reverse=True)
ABC = []
for a in range(len(A)):
    if a+1 > K:
        break
    for b in range(len(B)):
        if b+1 > K:
            break
        elif (a+1)*(b+1) > K:
            break
        for c in range(len(C)):
            if c+1 > K:
                break
            elif (a+1)*(c+1) > K:
                break
            elif (b+1)*(c+1) > K:
                break
            elif (a+1)*(b+1)*(c+1) > K:
                break
            ABC.append(A[a] + B[b] + C[c])
ABC = sorted(ABC, reverse=True)
for i in range(K):
    print(ABC[i])

Buggy submission (verdict: Runtime Error):
X, Y, Z, K = input().split()
X = int(X)
Y = int(Y)
Z = int(Z)
K = int(K)
A = [int(a) for a in input().split()]
A = sorted(A, reverse=True)
B = [int(b) for b in input().split()]
B = sorted(B, reverse=True)
C = [int(c) for c in input().split()]
C = sorted(C, reverse=True)
ABC = []
a, b, c = 0, 0, 0
ABC.append(A[a] + B[b] + C[c])
k = 1
while K+10>k:
    if len(A)>=a+2:
        for y in range(b+1):
            for z in range(c+1):
                ABC.append(A[a+1] + B[y] + C[z])
                k += 1
        a += 1
    if len(B)>=b+2:
        for x in range(a+1):
            for z in range(c+1):
                ABC.append(A[x] + B[b+1] + C[z])
                k += 1
        b += 1
    if len(C)>=c+2:
        for x in range(a+1):
            for y in range(b+1):
                ABC.append(A[x] + B[y] + C[c+1])
                k += 1
        c += 1
    k += 1
ABC_sorted = sorted(ABC, reverse=True)
for i in range(K):
    print(ABC_sorted[i])
Problem p03086 (python)

Fixed submission:
S = input()
ACGT = ["A", "C", "G", "T"]
K = []
for i in range(len(S)):
    if S[i] in ACGT:
        K.append(i)
if len(K) == 0:
    ans = 0
elif len(K) == 1:
    ans = 1
else:
    count = 0
    mx = 0
    for j in range(len(K)-1):
        if K[j+1]-K[j] == 1:
            count += 2
        else:
            ans = max(count, mx)
            count = 0
            mx = ans
    ans = max(count, mx)
    ans = ans/2 + 1
print(int(ans))

Buggy submission (verdict: Runtime Error):
S = input()
ACGT = ["A", "C", "G", "T"]
count = 0
mx = 0
if S[0] in ACGT:
    count += 1
if len(S) >= 2:
    for i in range(len(S)-1):
        if S[i] in ACGT and S[i+1] in ACGT:
            count += 1
        else:
            ans = max(mx, count)
            count = 0
            mx = ans
print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
ACGT = ["A", "C", "G", "T"]
count = 0
mx = 0
if S[0] in ACGT:
    count += 1
for i in range(len(S)-1):
    if S[i+1] in ACGT:
        if S[i] in ACGT:
            count += 1
        else:
            count = 1
    else:
        ans = max(mx, count)
        count = 0
        mx = ans
print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
ACGT = ["A", "C", "G", "T"]
count = 0
mx = 0
if S[0] in ACGT:
    count += 1
for i in range(len(S)-1):
    if S[i+1] in ACGT:
        if S[i] in ACGT:
            count += 1
    else:
        ans = max(mx, count)
        count = 0
        mx = ans
print(ans)
Problem p03106 (python)

Fixed submission:
A, B, K = [int(akb) for akb in input().split()]
a, b = min(A, B), max(A, B)
r = b % a
while r > 0:
  b = a
  a = r
  r = b % a
gcd = a
ans = a
if K > 1:
  for i in range(1, 100):
    if gcd % (i+1) == 0:
      ans = gcd / (i+1)
      K -= 1
    if K == 1:
      break
print(int(ans))

Buggy submission (verdict: Runtime Error):
A, B, K = [int(akb) for akb in input().split()]
a, b = min(A, B), max(A, B)
r = b % a
while r > 0:
  b = a
  a = r
  r = b % a
gcd = a
ans = a
if K > 1:
  for i in range(100):
    if gcd % (i+1) == 0:
      ans = gcd / i
      K -= 1
    if K == 1:
      break
print(ans)
Problem p03126 (python)

Fixed submission:
N, M = [int(nm) for nm in input().split()]
L = []
for n in range(N):
  KA = [int(ka) for ka in input().split()]
  for ka in range(len(KA)-1):
    L.append(KA[ka+1])
like = 0
for m in range(M):
  if L.count(m+1) == N:
    like += 1
print(like)

Buggy submission (verdict: Runtime Error):
N, M = [int(nm) for nm in input().split()]
for n in range(N):
  KA = [int(ka) for ka in input().split()]
  for ka in range(len(KA)-1):
    L.append(KA[ka+1])
like = 0
for m in range(M):
  if L.count(m+1) == N:
    like += 1
print(like)
Problem p03212 (python)

Fixed submission:
N = input()

l = len(N)
ans = 0
#各桁を「数字無し（０）」「７（１）」「５（２）」「３（３）」で記述するような4進数を作る
for n in range(1, 4**l):
  n4 = ""
  while n > 0:
    mod = n % 4
    n4 = str(mod) + n4
    n //= 4
  
  if "0" in n4:
    continue
  
  if ("1" in n4) and ("2" in n4) and ("3" in n4):
    n4_10 = ""
    for i in range(len(n4)):
      if n4[i] == "1":
        n4_10 = n4_10 + "7"
      elif n4[i] == "2":
        n4_10 = n4_10 + "5"
      else:
        n4_10 = n4_10 + "3"
    if int(n4_10) <= int(N):
      ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
N = input()

l = len(N)
ans = 0
#各桁を「数字無し（０）」「７（１）」「５（２）」「３（３）」で記述するような4進数を作る
for n in range(1, 4**l):
  n4 = ""
  while n > 0:
    mod = n % 4
    n4 = str(mod) + n4
    n //= 4
  
  if "0" in n4:
    continue
  
  if ("1" in n4) and ("2" in n4) and ("3" in n4):
    n4_10 = ""
    for i in range(len(n4)):
      if n4[i] == "1":
        n4_10 = n4_10 + "7"
      elif n4[i] == "2":
        n4_10 = n4_10 + "5"
      else:
        n4_10 = n4_10 + "3"
    if int(n4_10) =< int(N):
      ans += 1

print(ans)