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

Fixed submission:
H,W=map(int,input().split())

A=[list(map(int,input().split())) for _ in range(H)]
B=[list(map(int,input().split())) for _ in range(H)]

#dp[i][j]=マス(i,j)における可能なポイントのリスト
dp=[[set() for _ in range(W)] for _ in range(H)]
dp[0][0].add(0)

for i in range(W+H-1):
  I,J=0,0
  if i < H:
    I=i
    J=0
  else:
    I=H-1
    J=i-H+1
  while I>=0 and J<W:
    sa = abs(A[I][J] - B[I][J])
    for point in dp[I][J]:
      if I!=H-1:
        dp[I+1][J].add(point+sa)
        dp[I+1][J].add(abs(point-sa))
      if J!=W-1:
        dp[I][J+1].add(point+sa)
        dp[I][J+1].add(abs(point-sa))
    I-=1
    J+=1

ans=dp[H-1][W-1]
sa = abs(A[H-1][W-1] - B[H-1][W-1])
res=float("inf")
for p in ans:
  res=min(res,abs(p+sa),abs(p-sa))
print(res)

Buggy submission (verdict: Runtime Error):
H,W=map(int,input().split())

A=[list(map(int,input().split())) for _ in range(H)]
B=[list(map(int,input().split())) for _ in range(H)]
num=0
for i in range(H):
  for j in range(W):
    num+=abs(A[i][j]-B[i][j])
    
#dp[i][j]=マス(i,j)における可能なポイントのリスト
dp=[[[False]*(num) for _ in range(W)] for _ in range(H)]
dp[0][0][0]=True

for i in range(W+H-1):
  I,J=0,0
  if i < H:
    I=i
    J=0
  else:
    I=H-1
    J=i-H+1
  while I>=0 and J<W:
    sa = abs(A[I][J] - B[I][J])
    for n in range(num):
      if not dp[I][J][n]:
        continue
      if I!=H-1:
        dp[I+1][J][n+sa]=True
        dp[I+1][J][abs(n-sa)]=True
      if J!=W-1:
        dp[I][J+1][n+sa]=True
        dp[I][J+1][abs(n-sa)]=True
    I-=1
    J+=1

sa = abs(A[H-1][W-1] - B[H-1][W-1])
ans=float("inf")
for n in range(num):
  if not dp[-1][-1][n]:
    continue
  ans = min(ans,abs(n-sa),n+sa)
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
H,W=map(int,input().split())

A=[list(map(int,input().split())) for _ in range(H)]
B=[list(map(int,input().split())) for _ in range(H)]

#dp[i][j]=マス(i,j)における可能なポイントのリスト
dp=[[[] for _ in range(W)] for _ in range(H)]
dp[0][0].append(0)

for i in range(W+H-1):
  I,J=0,0
  if i < H:
    I=i
    J=0
  else:
    I=H-1
    J=i-H+1
  while I>=0 and J<W:
    sa = A[I][J] - B[I][J]
    for point in dp[I][J]:
      if I!=H-1:
        dp[I+1][J].append(point+sa)
        dp[I+1][J].append(point-sa)
      if J!=W-1:
        dp[I][J+1].append(point+sa)
        dp[I][J+1].append(point-sa)
    I-=1
    J+=1

ans=dp[H-1][W-1]
sa = A[H-1][W-1] - B[H-1][W-1]
res=float("inf")
for p in ans:
  res=min(res,abs(p+sa),abs(p-sa))
print(res)
print(dp[0][1])
Problem p02861 (python)

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

dist=[[0]*N for _ in range(N)]
ans=0
for i in range(N):
  for j in range(N):
    if i==j:
      continue
    ans+=((AB[i][0]-AB[j][0])**2+(AB[i][1]-AB[j][1])**2)**0.5
ans/=N
print(ans)

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

dist=[[0]*N in range(N)]
for i in range(N):
  for j in range(N):
    dist[i][j]=((AB[i][0]-AB[j][0])**2+(AB[i][1]-AB[j][1])**2)**0.5
    
ans=0
def go(town,rest):
  for i in len(rest):
    nrest=rest[:]
    ntown=nrest.pop(i)
    ans+=dist[town][ntown]
    if len(rest)==0:
      return
    go(ntown,nrest)
    
print(ans)
Problem p02913 (python)

Fixed submission:
N=int(input())
S=input()
ans=0
for i in range(N-1):
  jstart=i+ans+1
  for j in range(jstart,N):
    if S[i:j] in S[j:]:
      ans=max(ans,j-i)
    else:
      break
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
S=input()
ans=0
for i in range(N-1):
  #jstart=i+ans+1
  for j in range(jstart,N):
    if S[i:j] in S[j:]:
      ans=max(ans,j-i)
    else:
      break
print(ans)
Problem p02936 (python)

Fixed submission:
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**9)
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()


n,q = na()
g = [[] for i in range(n)]
c = [0]*n

for i in range(n-1):
    a,b = na()
    g[a-1].append(b-1)
    g[b-1].append(a-1)
for i in range(q):
    p,x = na()
    c[p-1] += x

def f(b,a,r):
    r += c[a]
    c[a] = r
    for i in g[a]:
        if i != b:
            f(a,i,r)

f(-1,0,0)
print(' '.join([str(s) for s in c]))

Buggy submission (verdict: Runtime Error):
def addScore(Point,Score):
    score[Point]+=Score
    min_index = binary_search(ab,Point)
    while min_index < n-1 and ab[min_index][0] == Point:
        addScore(ab[min_index][1],Score)
        min_index+=1
    

"""
minnum以上で最小の数のindexを返す。無いときはlen(list)を返す
計算量log(len(list))
"""

def binary_search(list, item):
    if list[0][0]>=item:
        return 0
    if list[-1][0]<item:
        return len(list)

    low = 0
    high = len(list) - 1

    while low <= high:
        mid = (low + high) //2
        guess = list[mid][0]
        if guess >= item and list[mid-1][0] < item:
            return mid
        if guess >= item:
            high = mid -1
        else:
            low = mid + 1

    return None






n,q=map(int,input().split())

ab = []
for i in range(n-1):
    ab.append(list(map(int,input().split())))

ab.sort()

score=[0]*(n+1)

for _ in range(q):
    p,x=map(int,input().split())
    addScore(p,x)

print(*(score[1:]))
Problem p02937 (python)

Fixed submission:
import copy
import bisect
S=input()
T=input()

sbasic=[[] for _ in range(26)]
for i,s in enumerate(S):
  sbasic[ord(s)-ord("a")].append(i)

for t in set(T):
    if len(sbasic[ord(t)-ord("a")])==0:
        print(-1)
        exit()

slist=copy.deepcopy(sbasic)
index=-1
roop=0
for t in T:
  if len(sbasic[ord(t)-ord("a")])==0:
    roop+=1
    #slist=copy.deepcopy(sbasic)
    index=-1
  pos=bisect.bisect_right(sbasic[ord(t)-ord("a")],index)
  if pos==len(sbasic[ord(t)-ord("a")]):
    roop+=1
    #slist=copy.deepcopy(sbasic)
    index=-1
    pos=0
  index=sbasic[ord(t)-ord("a")][pos]
  
print(len(S)*roop+index+1)

Buggy submission (verdict: Runtime Error):
import copy
import bisect
S=input()
T=input()

sbasic=[[] for _ in range(26)]
for i,s in enumerate(S):
  sbasic[ord(s)-ord("a")].append(i)

for s in set(S):
    if len(sbasic[ord(s)-ord("a")])==0:
        print(-1)
        exit()

slist=copy.deepcopy(sbasic)
index=-1
roop=0
for t in T:
  if len(sbasic[ord(t)-ord("a")])==0:
    roop+=1
    #slist=copy.deepcopy(sbasic)
    index=-1
  pos=bisect.bisect_right(sbasic[ord(t)-ord("a")],index)
  if pos==len(sbasic[ord(t)-ord("a")]):
    roop+=1
    #slist=copy.deepcopy(sbasic)
    index=-1
    pos=0
  index=sbasic[ord(t)-ord("a")][pos]
  
print(len(S)*roop+index+1)
Problem p02949 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10000)

N,M,P=map(int,input().split())
ways=[[] for _ in range(N)]
Rways=[[] for _ in range(N)]

for i in range(M):
  A,B,C=map(int,input().split())
  ways[A-1].append([B-1,C-P])
  Rways[B-1].append(A-1)
  
  
visited=[-float("inf")]*N
visited[0]=0

blacklist=[True]*N
blacklist[-1]=False
"""
for c in range(M):
  for i in range(N):
    if blacklist[i]==True:
      continue
    for to in Rways[i]:
      blacklist[to]=False
"""
def b_update(nord):
  global blacklist
  for to in Rways[nord]:
    if blacklist[to]==True:
      blacklist[to]=False
      b_update(to)
      
b_update(N-1)

for c in range(N):
  flag=False
  for i in range(N):
    debit=visited[i]
    if debit==-float("inf"):
      continue
    for to,cost in ways[i]:
      if visited[to]<debit+cost and not blacklist[to]:
        visited[to]=debit+cost
        flag=True
        
  if not flag:
    break
  if c==N-1:
    print(-1)
    exit()
      
ans=visited[-1]
if ans==-float("inf"):
  print(-1)
else:
  print(max(ans,0))

Buggy submission (verdict: Runtime Error):
N,M,P=map(int,input().split())
ways=[[] for _ in range(N)]
Rways=[[] for _ in range(N)]

for i in range(M):
  A,B,C=map(int,input().split())
  ways[A-1].append([B-1,C-P])
  Rways[B-1].append(A-1)
  
  
visited=[-float("inf")]*N
visited[0]=0

blacklist=[True]*N
blacklist[-1]=False
"""
for c in range(M):
  for i in range(N):
    if blacklist[i]==True:
      continue
    for to in Rways[i]:
      blacklist[to]=False
"""
def b_update(nord):
  global blacklist
  for to in Rways[nord]:
    if blacklist[to]==True:
      blacklist[to]=False
      b_update(to)
      
b_update(N-1)

for c in range(M+1):
  flag=False
  for i in range(N):
    debit=visited[i]
    if debit==-float("inf"):
      continue
    for to,cost in ways[i]:
      if visited[to]<debit+cost and not blacklist[to]:
        visited[to]=debit+cost
        flag=True
        
  if not flag:
    break
  if c==M:
    print(-1)
    exit()
      
ans=visited[-1]
if ans==-float("inf"):
  print(-1)
else:
  print(max(ans,0))
Problem p02985 (python)

Fixed submission:
import sys
sys.setrecursionlimit(100000)

N,K=map(int,input().split())
MOD=10**9+7
branch=[[] for _ in range(N)]
for i in range(N-1):
  a,b=map(int,input().split())
  branch[a-1].append(b-1)
  branch[b-1].append(a-1)

if K==1:
  if N==1:
    print(1)
  else:
    print(0)
  exit()
  
P=[0]*(K-1)
P[K-2]=K-2
for i in range(K-3,0,-1):
  P[i]=P[i+1]*i%MOD
  
def PPP(start,num):
  if start<num:
    return 0
  if start==K-2:
    return P[start-num+1]
  if start==K-1:
    return P[start-num+2]*(K-1)%MOD
  
ans=1

def draw(parent,nord):
  global ans
  children=len(branch[nord])-(parent !=-1)
  if children==0:
    return
  #(K-2)*(K-1)*... をchildrenの数だけ掛ける。
  ans=ans*PPP(K-1-(parent !=-1),children)%MOD
  for b in branch[nord]:
    if b != parent:
      draw(nord,b)

for i in range(len(branch[0])+1):
  ans=ans*(K-i)%MOD
for bra in branch[0]:
  draw(0,bra)
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(100000)

N,K=map(int,input().split())
MOD=10**9+7
branch=[[] for _ in range(N)]
for i in range(N-1):
  a,b=map(int,input().split())
  branch[a-1].append(b-1)
  branch[b-1].append(a-1)

P=[-1]*(K-1)
P[K-2]=K-2
for i in range(K-3,0,-1):
  P[i]=P[i+1]*i%MOD
  
def PPP(start,num):
  if start==K-2:
    return P[start-num+1]
  if start==K-1:
    return P[start-num+2]*(K-1)%MOD
  
ans=1

def draw(parent,nord):
  global ans
  children=len(branch[nord])-(parent !=-1)
  if children==0:
    return
  #(K-2)*(K-1)*... をchildrenの数だけ掛ける。
  ans=ans*PPP(K-1-(parent !=-1),children)%MOD
  for b in branch[nord]:
    if b != parent:
      draw(nord,b)

for i in range(len(branch[0])+1):
  ans=ans*(K-i)%MOD
for bra in branch[0]:
  draw(0,bra)
print(ans)
Problem p02713 (python)

Fixed submission:
from math import gcd
K = int(input())
ans = 0
for a in range(1, K+1):
    for b in range(1, K+1):
        for c in range(1, K+1):
            ans += gcd(gcd(a, b), c)
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
K = int(input())
ans = 0
for a in range(1, K+1):
    for b in range(1, K+1):
        for c in range(1, K+1):
            ans += np.gcd.reduce([a, b, c])
print(ans)
Problem p02802 (python)

Fixed submission:
N, M = map(int, input().split())

ac_list = [0] * (N + 1)
wa_list = [0] * (N + 1)
a = 0
w = 0
for i in range(M):
    l = input().split()
    if ac_list[int(l[0])]!='AC':
        if l[1] == 'AC':
            ac_list[int(l[0])] = 'AC'
            a += 1
            w += wa_list[int(l[0])]
        else:
            wa_list[int(l[0])] += 1

print('{} {}'.format(a, w))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())

ac_list = [0] * (N + 1)
wa_list = [0] * (M + 1)
a = 0
w = 0
for i in range(M):
    l = input().split()
    if ac_list[int(l[0])]!='AC':
        if l[1] == 'AC':
            ac_list[int(l[0])] = 'AC'
            a += 1
            w += wa_list[int(l[0])]
        else:
            wa_list[int(l[0])] += 1

print('{} {}'.format(a, w))

Buggy submission (verdict: Runtime Error):
import sys
s = sys.stdin.readlines()

c = res.append
a = 0
b = 0
c = 0
N, M = map(int, s[0].split())
for e in s[1:M + 1]:
  p, S = e.split()
  if p not in c:
    if S == 'AC':
        c(p)
        a += 1
        c = b
    else:
        b += 1

print('{} {}'.format(a, c))

Buggy submission (verdict: Runtime Error):
import sys
def main():  
    s = sys.stdin.readlines()

    c = []
    a = 0
    b = 0
    N, M = map(int, s[0].split())
    for e in s[1:M + 1]:
    p, S = e.split()
    if p not in c:
        if S == 'AC':
            c.append(p)
            a += 1
        else:
            b += 1

    print('{} {}'.format(a, b)) 


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    import sys
    s = sys.stdin.readlines()

    c = []
    a = 0
    b = 0
    N, M = map(int, s[0].split())
    for e in s[1:M + 1]:
    p, S = e.split()
    if p not in c:
        if S == 'AC':
            c.append(p)
            a += 1
        else:
            b += 1

    print('{} {}'.format(a, b)) 


if __name__ == '__main__':
    main()
Problem p02817 (python)

Fixed submission:
s, t = input().split()
print("{}{}".format(t, s))

Buggy submission (verdict: Runtime Error):
s, t = input().split()
print("{}{}".format(t, s)
Problem p02995 (python)

Fixed submission:
import fractions
a, b, c, d = map(int, input().split())
a -= 1
B = b - (b//c + b//d)+b//(c*d//fractions.gcd(c, d))
A = a - (a//c + a//d)+a//(c*d//fractions.gcd(c, d))

print(B - A)

Buggy submission (verdict: Runtime Error):
from math import *
a, b, c, d = map(int, input().split())
a -= 1
B = b - (b//c + b//d)+b//(c*d//gcd(c, d))
A = a - (a//c + a//d)+a//(c*d//gcd(c, d))

print(B - A)
Problem p03059 (python)

Fixed submission:
A, B, T = map(int, input().split())
print((T//A)*B)

Buggy submission (verdict: Runtime Error):
A, B, T = map(int, input().split())
print((T//A)*B)20
Problem p03106 (python)

Fixed submission:
A, B, K = map(int, input().split())
c = []

for i in range(1, 101):
    if A % i == 0 and B % i == 0:
        c.append(i)
print(c[-K])

Buggy submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
C = 0
for i in range(min(A, B), 1, -1):
    if A%i == 0 and B%i == 0:
        C += 1
        if C == K:
            break
print(i)
Problem p03352 (python)

Fixed submission:
X = int(input())
ans = 1
for b in range(1,X):
    for p in range(2, X):
        if X < b**p:
            break
        if ans < b**p:
            ans = b**p
print(ans)

Buggy submission (verdict: Runtime Error):
X = int(input())

for i in range(X):
    for j in range(2, X):
        if X >= i**j:
            ans = i**j
        else:
            break
print(ans)
Problem p03377 (python)

Fixed submission:
A, B, X = map(int, input().split())
if A > X:
    print('NO')
else:
    if X >= A + B:
        print('NO')
    else:
        print('YES')

Buggy submission (verdict: Runtime Error):
A, B, X = map(int, input().split())
if A > X:
    print('NO')
else:
    if X >= A + B:
    print('NO')
    else:
        print('YES')
Problem p03605 (python)

Fixed submission:
print('Yes' if '9' in list(input()) else 'No')

Buggy submission (verdict: Runtime Error):
print('Yes' if '9' in 9list(input(())) else 'No')
Problem p03633 (python)

Fixed submission:
import functools
import fractions
n = int(input())
t = [int(input()) for _ in range(n)]

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
    
ans = functools.reduce(lcm, t)
print(ans)

Buggy submission (verdict: Runtime Error):
import math
import functools
n = int(input())
t = [int(input()) for _ in range(n)]

def lcm(x, y):
    return (x * y) // math.gcd(x, y)
    
ans = functools.reduce(lcm, t)
print(str(ans))

Buggy submission (verdict: Runtime Error):
import math
import functools
n = int(input())
t = [int(input()) for _ in range(n)]

def lcm(x, y):
    return (x * y) // math.gcd(x, y)
ans = functools.reduce(lcm, t)
print(ans)
Problem p03679 (python)

Fixed submission:
x, a, b = map(int, input().split())
ans = 'dangerous'
if b-a <= 0:
    ans = 'delicious'
elif (b-a) <= x:
    ans = 'safe'
print(ans)

Buggy submission (verdict: Runtime Error):
import math
n, m = map(int, input().split())

N = math.factorial(n)
M = math.factorial(m)
INF = 10**9 + 7

if abs(n-m) > 1:
    print(0)
elif abs(n-m) == 1:
    print(N*M%INF)
else:
    print(2*N*M%INF)
Problem p02612 (python)

Fixed submission:
n = int(input())
n = n % 1000
print(1000 - n if n != 0 else 0)

Buggy submission (verdict: Runtime Error):
n = input()
n = int(n[1:])

if n == 0:
    print(0)
else:
    print(1000-n)
Problem p02645 (python)

Fixed submission:
s = input()
print(s[:3])

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
a = list(map(int, input().split()))

for _ in range(k):
    l = []
    b = [0]*n
    for i in range(1, n+1):
        x = i-a[i-1]-0.5
        y = i+a[i-1]+0.5
        l.append([x, y])
    for j in range(1, n+1):
        for x, y in l:
            if x <= j <= y:
                b[j-1] += 1
    a = b
print(' '.join(map(str, b)))
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):
import math
n=int(input())

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

f = factorization(n)
ans = 0
for i, j in f:
    ans += int((-1+pow(1+8*j,0.5))/2)
print(ans)

Buggy submission (verdict: Runtime Error):
a, b = int(input())
print(a*b)
Problem p02660 (python)

Fixed submission:
n = int(input())

def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct

f = factorize(n)
ans = 0
for i,j in f:
    ans += int((-1+pow(1+8*j,0.5))/2)
print(ans)

Buggy submission (verdict: Runtime Error):
import math
n=int(input())

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

f = factorization(n)
ans = 0
for i in f[1]:
    ans += int((-1+ math.sqrt(1+8*i))/2)
print(ans)

Buggy submission (verdict: Runtime Error):
import sympy
sympy.divisors(10**9)

num = 24

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

l = make_divisors(num)
cnt = 0

for z in l[1:]:
    if num == 1:
        break
    elif num % z == 0:
        num /= z
        cnt += 1

print(cnt)

Buggy submission (verdict: Runtime Error):
import sympy
sympy.divisors(10**9)

num = int(input())

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

l = make_divisors(n)
cnt = 0

for z in l[2:]:
    if num == 1:
        print(cnt)
    elif num % z == 0:
        num /= z
        cnt += 1
Problem p02784 (python)

Fixed submission:
h, n = map(int, input().split())
a = list(map(int, input().split()))
print('Yes' if sum(a) >= h else 'No')

Buggy submission (verdict: Runtime Error):
import itertools

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

s = [sum(c) for c in list(itertools.combinations(a, 2))]

f = False
for i in range(n):
    if s[i] >= h:
        f = True
        break

print('Yes' if f == True else 'No')
Problem p03030 (python)

Fixed submission:
n = int(input())
l = []
for i in range(n):
    sp = input().split()
    l.append((sp[0], int(sp[1]), i+1))

a = sorted(l, key=lambda i: i[1], reverse=True)
a = sorted(a, key=lambda i: i[0])

for i in range(n):
    print(a[i][2])

Buggy submission (verdict: Runtime Error):
n = int(input())
l = []
for i in range(n):
    sp = input().split()
    l.append((sp[0], int(sp[1]), i+1))

a = sorted(l, key=lambda i: (i[0], -l[1]))

for i in range(n):
    print(a[i][2])
Problem p03086 (python)

Fixed submission:
s = input()

cnt = 0
li = []
for i in range(len(s)):
    if s[i] == 'A' or s[i] == 'C' or s[i] == 'G' or s[i] == 'T':
        cnt += 1
    else:
        li.append(cnt)
        cnt = 0

li.append(cnt)
print(max(li))

Buggy submission (verdict: Runtime Error):
s = input()
l = []
cnt = 0
for c in s:
    if c == 'A' or c =='C' or c == 'G' or c == 'T':
        cnt += 1
    else:
        l.append(cnt)
        cnt = 0

print(max(l))

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

c = 0
cnt = []
for i in range(len(s)):
    if s[i] == 'A' or s[i] == 'C' or s[i] == 'G' or s[i] == 'T':
        c += 1
    else:
        cnt.append(c)
        c = 0

print(max(cnt))
Problem p03219 (python)

Fixed submission:
x, y = map(int, input().split())
print(x + (y//2))

Buggy submission (verdict: Runtime Error):
x, y = int(input().split())
print(x + (y//2))
Problem p03260 (python)

Fixed submission:
a, b = map(int, input().split())
for c in range(1, 4):
    if (a * b * c) % 2 == 1:
        print('Yes')
        exit()
print('No')

Buggy submission (verdict: Runtime Error):
a, b = int(input())
for c in range(1, 4):
    if (a * b * c) % 2 == 1:
        print('Yes')
        exit()
print('No')
Problem p03361 (python)

Fixed submission:
h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]

for i in range(1, h-1):
    for j in range(1, w-1):
        if s[i][j] == '#' and s[i - 1][j] != '#' and s[i][j - 1] != '#' and s[i + 1][j] != '#' and s[i][j + 1] != '#':
            print('No')
            exit()
print('Yes')

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
S = [input().split() for i in range(H)]
F = [[0]*(W+2) for i in range(H+2)]
D = [(-1,0), (0,1), (0, -1), (1, 0)]

for i in range(H):
    for j in range(W):
        if S[i][j] == '#':
            for d in D:
                F[i+1+d][j+1+d] == '#'

print('Yes' if F[1:H+1][1:W+1] == S else 'No')
Problem p03386 (python)

Fixed submission:
a, b, k = map(int, input().split())
if b-a+1 < k*2:
    for i in range(a, b+1):
        print(i)
else:
    for j in range(a, a+k):
        print(j)
    for k in range(b-k+1 , b+1):
        print(k)

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
ab = list(range(a, b+1))
for i in ab:
    if i <= k or i >= b - k:
        print(i)

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
ab = list(range(a, b+1))
ans = sorted(set(ab[:k]+ab[-k:]))
for i in ans:
  print(i)
Problem p03469 (python)

Fixed submission:
s = input()
print(s.replace('2017/', '2018/'))

Buggy submission (verdict: Runtime Error):
n, y = map(int, input().split())
y //= 1000

for a in range(n + 1):
    for b in range(n + 1):
        c = n - a - b
        if 10*a + 5*b + c == y:
            print(a, b, c)
            exit()

print(-1, -1, -1)
Problem p03574 (python)

Fixed submission:
H, W = map(int, input().split())
s = [list(input()) for i in range(H)]
n = [[0]*(W+2) for i in range(H+2)]
dxy = [(-1,-1),(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1)]

for h in range(H):
  for w in range(W):
    if s[h][w] == '#':
      for i in dxy:
        n[h + 1 + i[0]][w + 1 + i[1]] += 1

for i in range(H):
  for j in range(W):
    if s[i][j] == '#':
      n[i + 1][j + 1] = '#'
    else:
      n[i + 1][j + 1] = str(n[i + 1][j + 1])

for a in n[1:H+1]:
    print(''.join(a[1:W+1]))

Buggy submission (verdict: Runtime Error):
# numpyを使用した場合
import numpy as np

h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]
f = np.zeros((h+2, w+1), dtype='int64')
d = np.ones((3, 3), dtype='int64')

for i in range(h):
    for j in range(w):
        if s[i][j] == '#':
            f[i:i+3, j:j+3] += d 

for i in range(h):
    ans = ''
    for j in range(w):
        if s[i][j] == '#':
            ans += '#'
        else:
            ans += str(f[i+1, j+1])
    print(ans)