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

Fixed submission:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10 ** 7)


def solve(N: int, u: "List[int]", v: "List[int]", w: "List[int]"):
    res = [0 for i in range(N)]
    G = [[] for i in range(N)]
    for i, j, k in zip(u, v, w):
        # print(i, j, k)
        i -= 1
        j -= 1
        # print(i, j, k)
        G[i].append((j, k))
        G[j].append((i, k))
    # print(G)

    # v を c に塗る。 p は v の親。
    def dfs(v, p, c):
        res[v] = c
        for e in G[v]:
            if e[0] == p:
                continue
            if e[1] & 1:
                dfs(e[0], v, 1 - c)
            else:
                dfs(e[0], v, c)

    dfs(0, -1, 1)

    for x in res:
        print(x)

    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools
# (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    u = [int()] * (N - 1)  # type: "List[int]"
    v = [int()] * (N - 1)  # type: "List[int]"
    w = [int()] * (N - 1)  # type: "List[int]"
    for i in range(N - 1):
        u[i] = int(next(tokens))
        v[i] = int(next(tokens))
        w[i] = int(next(tokens))
    solve(N, u, v, w)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys


def solve(N: int, u: "List[int]", v: "List[int]", w: "List[int]"):
    res = [0 for i in range(N)]
    G = [[] for i in range(N)]
    for i, j, k in zip(u, v, w):
        # print(i, j, k)
        i -= 1
        j -= 1
        # print(i, j, k)
        G[i].append((j, k))
        G[j].append((i, k))

    # v を c に塗る。 p は v の親。
    def dfs(v, p, c):
        res[v] = c
        for e in G[v]:
            if e[0] == p:
                continue
            if e[1] & 1:
                dfs(e[0], v, 1 - c)
            else:
                dfs(e[0], v, c)

    dfs(0, -1, 1)

    for x in res:
        print(x)

    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools
# (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    u = [int()] * (N - 1)  # type: "List[int]"
    v = [int()] * (N - 1)  # type: "List[int]"
    w = [int()] * (N - 1)  # type: "List[int]"
    for i in range(N - 1):
        u[i] = int(next(tokens))
        v[i] = int(next(tokens))
        w[i] = int(next(tokens))
    solve(N, u, v, w)


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

Fixed submission:
#!/usr/bin/env python3
import sys


def solve(M: int, K: int):
    if M == 0:
        if K == 0:
            print('0 0')
        else:
            print(-1)
    elif M == 1:
        if K == 0:
            print('0 0 1 1')
        else:
            print(-1)
    else:
        if K >= 2 ** M:
            print(-1)
        else:
            ans = [i for i in range(2 ** M) if i != K]
            ans = ans + [K] + ans[::-1] + [K]
            print(*ans)
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools
# (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    M = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(M, K)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys


def solve(M: int, K: int):
    if M == 0:
        if K == 0:
            print('0 0')
        else:
            print(-1)
    elif M == 1:
        if K == 0:
            print('0 0 1 1')
        else:
            print(-1)
    else:
        if K > 2 ** M:
            print(-1)
        else:
            l = list(map(str, list(range(2 ** M))))
            l.pop(K)
            print(' '.join(l), end=' ')
            print(K, end=' ')
            print(' '.join(l[::-1]), end=' ')
            print(K)
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools
# (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    M = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(M, K)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys


def solve(M: int, K: int):
    if M == 0:
        if K == 0:
            print('0 0')
        else:
            print(-1)
    elif M == 1:
        if K == 0:
            print('0 0 1 1')
        else:
            print(-1)
    else:
        if K > 2 ** M:
            print(-1)
        else:
            l = list(range(2 ** M))
            l.pop(K)
            print(' '.join(l), end=' ')
            print(K, end=' ')
            print(' '.join(l[::-1]), end=' ')
            print(K)
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools
# (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    M = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(M, K)


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

Fixed submission:
#!/usr/bin/env python3
from fractions import gcd
import sys
sys.setrecursionlimit(10 ** 7)


def solve(N: int, A: "List[int]"):
    L, R = [0], [0]
    for i in range(N - 1):
        L.append(gcd(L[i], A[i]))
        R.append(gcd(R[i], A[-i - 1]))
    ans = 0
    for i in range(N):
        ans = max(ans, gcd(L[i], R[N - i - 1]))
    print(ans)
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools
# (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import math
import sys
from functools import reduce
sys.setrecursionlimit(10 ** 7)


def solve(N: int, A: "List[int]"):
    ans = 0
    for i in range(N):
        ans = max(ans, reduce(math.gcd, A[0:i] + A[i + 1:]))
    print(ans)
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools
# (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)


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

Fixed submission:
x, a = [int(x) for x in input().split()]
if x < a:
  print(0)
elif x >= a:
  print(10)

Buggy submission (verdict: Runtime Error):
if x < a:
  print(0)
elif x > a:
  print(10)

Buggy submission (verdict: Runtime Error):
x = int(input()) % 10
a = int(input()) % 10
if x < a:
  print(0)
elif x > a:
  print(10)
Problem p02982 (python)

Fixed submission:
import itertools
import numpy

N, D = map(int, input().split())

grid = []
for i in range(N):
    X = list(map(int, input().strip().split()))
    grid.append(X)

# print(grid)
cnt = 0
grid2 = list(itertools.combinations(grid, 2))
for i in grid2:
    x = numpy.array(i[0])
    y = numpy.array(i[1])
  #  print(x, y)
    dis = numpy.linalg.norm(y - x)
    # print(dis)
    if (dis.is_integer()):
        # print(dis)
        cnt += 1

  # print("-------------")
print(cnt)
# distance = [math.sqrt(() ^ 2+() ^ 2) for i in rang(N)]
# for i in range(N):

Buggy submission (verdict: Runtime Error):

N, D = map(int, input().split())

grid = []
for i in range(N):
    X = list(map(int, input().strip().split()))
    grid.append(X)

# print(grid)
cnt = 0
grid2 = list(itertools.combinations(grid, 2))
for i in grid2:
    x = numpy.array(i[0])
    y = numpy.array(i[1])
  #  print(x, y)
    dis = numpy.linalg.norm(y - x)
    # print(dis)
    if (dis.is_integer()):
        #print(dis)
        cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):

N, D = map(int, input().split())

grid = []
for i in range(N):
    X = list(map(int, input().strip().split()))
    grid.append(X)

# print(grid)
cnt = 0
grid2 = list(itertools.combinations(grid, 2))
for i in grid2:
    x = numpy.array(i[0])
    y = numpy.array(i[1])
  #  print(x, y)
    dis = numpy.linalg.norm(y - x)
    # print(dis)
    if (dis.is_integer()):
        #print(dis)
        cnt += 1
Problem p02994 (python)

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


lis = []
for n in range(1, N+1):
    azi = L + n - 1
    lis.append(azi)

lis2 = [abs(l) for l in lis]

min = lis2.index(min(lis2))
del lis[min]

print(sum(lis))

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


lis = []
for n in range(1, N+1):
    azi = L + n - 1
    lis.append(azi)

lis2 = [abs(l) for l in lis]

min = min(lis2)
del lis[min]

print(sum(lis))
Problem p03060 (python)

Fixed submission:
import itertools
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))

M = [[V[i], C[i]]for i in range(N)]
#print(M)


tx = 0
R = 0
for i in range(N):
    tx = V[i] - C[i]
    if (tx > 0):
        R += tx

print(R)

Buggy submission (verdict: Runtime Error):
import itertools
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))

M = [[V[i], C[i]]for i in range(N)]
# print(M)

com_M = list(itertools.combinations(M, 2))
m_M = []
for i in range(N):
    X = com_M[i][0][0] + com_M[i][1][0]
    Y = com_M[i][0][1] + com_M[i][1][1]
    # print(X)
    # print(Y)
    m_M.append(X - Y)

print(max(m_M))

Buggy submission (verdict: Runtime Error):
import itertools
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))

M = [[V[i], C[i]]for i in range(N)]
print(M)

com_M = list(itertools.combinations(M, 2))
m_M = []
for i in range(N):
    X = com_M[i][0][0] + com_M[i][1][0]
    Y = com_M[i][0][1] + com_M[i][1][1]
    #print(X)
    #print(Y)
    m_M.append(X - Y)

print(max(m_M))
Problem p03632 (python)

Fixed submission:
a, b , c ,d = map(int, input().split())



mi = min(b,d )
ma = max(a,c)

print(max(0,mi - ma))

Buggy submission (verdict: Runtime Error):

if b <= c:
    print("0")
elif c <= a:
    print("0")



if a<c and (c<b and b<d):
    print(b-c)
elif (a<c and a<d) and (c<b and d<b):
    print(d-c)
elif (c<a and a<d) and (c<b and b<d):
    print(b-a)
elif (c<a and a<d) and (c<b and d<b):
    print(d-a)
else:
    print("0")

Buggy submission (verdict: Runtime Error):
a, b , c ,d = map(int, input().split())



if b<c:
    print("0")
elif a<c and (c<b and b<d):
    print(b-c)
elif (a<c and c<n) and (a<d and d<b):
    print(d-c)
elif (c<a and a<d) and (c<b and b<d):
    print(b-a)
elif (c<a and a<d) and (c<b and d<b):
    print(d-a)
elif d<a:
    print("0")

Buggy submission (verdict: Runtime Error):
a, b , c ,d = map(int, input().split())


if b < c:
    print("0")
    exit()

if c<b and b<d:
    print((d-c)-(d-b))
elif a<c adn d<b:
    print(d-c)
else:
    print("0")
Problem p02981 (python)

Fixed submission:
x =  [int(s) for s in input().split()]
if(x[0]*x[1]<x[2]):
  print(x[0]*x[1])
else:
  print(x[2])

Buggy submission (verdict: Runtime Error):
x = raw_input().split()
if(x[0] * x[1] < x[2]):
  print(x[0] * x[1])
  elif:
    print(x[2])
Problem p03076 (python)

Fixed submission:
# coding: utf-8
# Your code here!

food = [int(input()) for i in range(5)]

minr = 10
minf = 0
for f in food:
    if f % 10 != 0 :
        if f % 10 < minr :
            minr = f % 10
            minf = f
if minf == 0:
    minf = food[0]
        

food.remove(minf)
food.append(minf)

sumf = 0
i = 0
for f in food:
    if i == 4:
        sumf += f
    elif f % 10 != 0:
        sumf += int(f/10) * 10 + 10
    else:
        sumf += f
    i+=1
print(sumf)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!

food = [int(input()) for i in range(5)]

minr = 10
minf = 0
for f in food:
    if f % 10 != 0 :
        if f % 10 < minr :
            minr = f % 10
            minf = f

food.remove(minf)
food.append(minf)

sumf = 0
i = 0
for f in food:
    if i == 4:
        sumf += f
    elif f % 10 != 0:
        sumf += int(f/10) * 10 + 10
    else:
        sumf += f
    i+=1
print(sumf)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!

food = [int(input()) for i in range(5)]

minr = 9
minf = 0
for f in food:
    if f % 10 != 0 :
        if f % 10 < minr :
            minr = f % 10
            minf = f

food.remove(minf)
food.append(minf)

sumf = 0
i = 0
for f in food:
    if i == 4:
        sumf += f
    elif f % 10 != 0:
        sumf += int(f/10) * 10 + 10
    else:
        sumf += f
    i+=1
print(sumf)

Buggy submission (verdict: Runtime Error):
t = 0
l = [int(input()) for i in range(5)]
min1 = 9
minN = 0
for i in l:
    if i%10 != 0:
        if i%10 < min1:
            min1 = i%10
            minN = i
l.remove(minN)
l.append(minN)

for i in range(5):
    if(l[i]%10 != 0 and i != 4):
        t += int(l[i]/10) * 10 + 10

    elif l[i]%10 == 0 or i == 4:
        t += l[i]
    
print(t)
Problem p03086 (python)

Fixed submission:
Str = list(input())
tmp = 0
maxLen = 0

for s in Str:
    if s in "ACGT":
        tmp += 1
        maxLen = max(maxLen, tmp)
    else:
        tmp = 0


print(maxLen)

Buggy submission (verdict: Runtime Error):
https://atcoder.jp/contests/abc128/tasks/abc128_a
Problem p03106 (python)

Fixed submission:
# coding: utf-8
# Your code here!

a,b,k = map(int, input().split())

def d(n):
    div = []
    for i in range(1,n+1):
        if(n % i == 0):
            div.append(i)
    return div
        
a_d = d(a)
b_d = d(b)
s = []
l = []
ab = []

if len(a_d) < len(b_d):
    s = a_d
    l = b_d
else:
    s = b_d
    l = a_d

for i in s:
    if i in l:
        ab.append(i)
print(ab[len(ab)-k])

Buggy submission (verdict: Runtime Error):
100 50 4
Problem p02952 (python)

Fixed submission:
N=int(input())
count=0
for i in range(1,N+1):
  ks=len(str(i))
  if ks!=2 and ks!=4 and ks!=6:
    count=count+1
print(count)

Buggy submission (verdict: Runtime Error):
N=input()
count=0
for i in range(1,N+1):
  ks=len(str(i))
  if ks!=2 and ks!=4:
    count=count+1
print(count)

Buggy submission (verdict: Runtime Error):
N=input()
count=0
for i in range(1,N+1):
  ks=len(str(i))
  if ks!=2 and ks!=4:
    count=count+1
print count
Problem p02957 (python)

Fixed submission:
A,B=map(int,input().split())
if (A+B) % 2 == 0:
  K = (A+B)//2
else:
  K ="IMPOSSIBLE"
print(K)

Buggy submission (verdict: Runtime Error):
A,B=map(int,input().split())
if (A+B) % 2 = 0:
  K = (A+B)/2
else:
  K ="IMPOSSIBLE"
print(K)
Problem p03694 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
print(max(a)-min(a))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int.input().split()))
print(max(a)-min(a))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split())
print(max(a)-min(a))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int.input().split())
print(max(a)-min(a))
Problem p03777 (python)

Fixed submission:
a,b=input().split()
if a=="H" and b=="H":
  print("H")
elif a=="H" and b=="D":
  print("D")
elif a=="D" and b=="H":
  print("D")
elif a=="D" and b=="D":
  print("H")

Buggy submission (verdict: Runtime Error):
a,b=map(input().split())
if a=="H" and b=="H":
  print("H")
elif a=="H" and b=="D":
  print("D")
elif a=="D" and b=="H":
  print("D")
elif a=="D" and b=="D":
  print("H")

Buggy submission (verdict: Runtime Error):
a,b=map(input().split())
if a="H" and b="H":
  print("H")
elif a="H" and b="D":
  print("D")
elif a="D" and b="H":
  print("D")
elif a="D" and b="D":
  print("H")
Problem p02953 (python)

Fixed submission:
import sys

hs = list(map(int, sys.stdin.read().strip().splitlines()[1].split(" ")))
if len(hs) == 1:
  print("Yes")
  sys.exit(0)
if hs[0] > hs[1]:
  hs[0] -= 1

for i in range(1, len(hs)):
  pre = hs[i-1]
  diff = hs[i] - pre
  if diff >= 1:
    hs[i] -= 1
  elif diff < 0:
    print("No")
    sys.exit(0)
print("Yes")

Buggy submission (verdict: Runtime Error):
import sys

hs = list(map(int, sys.stdin.read().strip().splitlines()[1].split(" ")))
if len(hs) == 1:
  print("Yes")
  sys.exit(0)

def solver(pre, i):
  for v in (hs[i]-1, hs[i]):
    if v >= pre:
      if i == len(hs)-1:
        return True

      if solver(v, i+1):
        return True
  return False

if solver(hs[0], 1) or solver(hs[0]-1, 1):
  print("Yes")
else:
  print("No")
Problem p03455 (python)

Fixed submission:
import sys

a, b = [int(v) for v in sys.stdin.read().split(" ")]
if (a * b) % 2 == 0:
  print("Even")
else:
  print("Odd")

Buggy submission (verdict: Runtime Error):
import sys

a = sys.argv[1]
b = sys.argv[2]

if (a + b) % 2 == 0:
  print("Even")
else:
  print("Odd")
Problem p03854 (python)

Fixed submission:
import sys

s = sys.stdin.read().strip()
words = ["dream", "dreamer", "erase", "eraser"]

stack = [0]
match = False
while not match and stack:
  i = stack.pop()
  for w in words:
    if s.startswith(w, i):
      n = i + len(w)
      if n == len(s):
        match = True
        break
      stack.append(n)
print("YES" if match else "NO")

Buggy submission (verdict: Runtime Error):
import sys

s = sys.stdin.read().strip()
words = ["dream", "dreamer", "erase", "eraser"]

def dfs(i):
  for w in words:
    if s.startswith(w, i):
      n = i + len(w)
      if n == len(s):
        return True
      if dfs(n):
        return True
  return False

print("YES" if dfs(0) else "NO")

Buggy submission (verdict: Runtime Error):
import sys

s = sys.stdin.read().strip()
words = ["dream", "dreamer", "erase", "eraser"]

def dfs(i):
  for w in words:
    if s.startswith(w, i):
      n = i + len(w)
      if n == len(s):
        print("YES")
        sys.exit(0)
      dfs(n)

dfs(0)
print("NO")
Problem p02952 (python)

Fixed submission:
N = int(input())
ans = 0
i = 1

for i in range(N):
    s = str(i+1)
    if len(s) == 1 or len(s) == 3 or len(s) == 5:
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
N = input()
ans = 0
i = 1

for i in range(N):
    s = str(i+1)
    if len(s) == 1 or len(s) == 3 or len(s) == 5:
        ans += 1
        
print(ans)

Buggy submission (verdict: Runtime Error):
N = input()
ans = 0
i = 1

for i in range(N):
    s = str(i+1)
    if len(s) == 1 or len(s) == 3 or len(s) == 5:
        ans += 1
Problem p03799 (python)

Fixed submission:
u, v = map(int, input().split())
if 2*u > v:
  print(v//2)  
else:
  print((2*u+v)//4)

Buggy submission (verdict: Runtime Error):
    u, v = map(int, input().split())
    print(min(u//2, (2*u+v)//4))

Buggy submission (verdict: Runtime Error):
u, v = map(int, input().split())
print(min(u//2, (2*u+v)//4)
Problem p03844 (python)

Fixed submission:
arr = input().split()
if arr[1] == "+":
  print(int(arr[0]) + int(arr[2])) 
elif arr[1] == "-":
  print(int(arr[0]) - int(arr[2]))

Buggy submission (verdict: Runtime Error):
arr = input().split()
if arr[1] == "+"
  print(int(arr[0]) + int(arr[2])) 
elif arr[1] == "-"
  print(int(arr[0]) - int(arr[2]))
Problem p02952 (python)

Fixed submission:
n = int(input())
res = 0
for i in range(1,n+1):
  if(len(str(i))%2):
    res+=1
print(res)

Buggy submission (verdict: Runtime Error):
n = int(input())
res = 0
for i in range(1,n+1):
  if(len(i)%2):
    res+=1
print(res)
Problem p03076 (python)

Fixed submission:

t = [int(input()) for i in range(5)]

min=t[0]
length=len(t)
for i in range(length):
    if min%10>t[i]%10 and t[i]%10!=0:
        min=t[i]
t.remove(min)
t.append(min)
ans=0
for _ in range(length-1):
    if t[_]%10!=0:
        ans+=t[_]+10-t[_]%10
    else:
        ans+=t[_]
print(ans+t[length-1])

Buggy submission (verdict: Runtime Error):

t = [int(input()) for i in range(5)]
min=9
length=len(t)
for i in range(length):
    if min%10>t[i]%10 and t[i]%10!=0:
        min=t[i]
t.remove(min)
t.append(min)
ans=0
for _ in range(length-1):
    if t[_]%10!=0:
        ans+=t[_]+10-t[_]%10
    else:
        ans+=t[_]
print(ans+t[length-1])
Problem p03079 (python)

Fixed submission:
a = list(map(int, input().split()))
print('Yes') if a[0]==a[1]==a[2] else print('No')

Buggy submission (verdict: Runtime Error):
N,Q = map(int, input().split())
s = input()
gorem=[1]*len(s)
t = [input().split(" ") for i in range(Q)]
for i in t:
    tmp=[j for j in range(len(s)) if s[j]==i[0]]
    if i[1]=='L':
        for _ in tmp:
            if _ == 0:
                gorem[_]=0
            else:
                gorem[_-1]+=gorem[_]
                gorem[_]-=gorem[_]
    else:
        for _ in tmp:
            if _ == len(s)-1:
                gorem[_]=0
               
            else:
                gorem[_+1]+=gorem[_]
                gorem[_]-=gorem[_]
print(sum(gorem))

Buggy submission (verdict: Runtime Error):
N,Q = map(int, input().split())
s = input()
gorem = []
for _ in range(len(s)):
    gorem.append(1)
t = [input().split(" ") for i in range(Q)]
for i in t:
    tmp = []
    for j in range(len(s)):
        if s[j]==i[0]:
            tmp.append(j)
    if i[1]=='L':
        for _ in tmp:
            if _ == 0:
                gorem[_]=0
            else:
                gorem[_-1]+=gorem[_]
                gorem[_]-=gorem[_]
    else:
        for _ in tmp:
            if _ == len(s)-1:
                gorem[_]=0
               
            else:
                gorem[_+1]+=gorem[_]
                gorem[_]-=gorem[_]
                
print(sum(gorem))
Problem p03085 (python)

Fixed submission:
i = input()
if i == "A":
    print("T")
elif i == "C":
    print("G")
elif i == "G":
    print("C")
elif i == "T":
    print("A")

Buggy submission (verdict: Runtime Error):
# coding: utf-8
length,question = map(int, input().split())
string = input()
e = [[int(i) for i in input().split()] for i in range(question)]
c = 0
tmp = []

for i in e:
    s = ''
    for j in range(i[0],i[1]+1):
        s+=string[j-1]
    
    for n in range(len(s)):
        if s[n:n+2] == "AC":
            c+=1

    print(c)
    c = 0
Problem p03086 (python)

Fixed submission:

string = input()
pattern = ["A","C","G","T"]

c = 0
result = []
for i in string:
    if i in pattern:
        c += 1
        if string[len(string)-1] == i:
            result.append(c)
    else:
        result.append(c)
        c = 0

if len(result) == 0:
    print(len(string))
else:
    print(max(result))

Buggy submission (verdict: Runtime Error):
string = input()
pattern = ["A","C","G","T"]

c = 0
result = []
for i in string:
    if i in pattern:
        c += 1
    else:
        result.append(c)
        c = 0

print(max(result))
Problem p03455 (python)

Fixed submission:
a, b = map(int, input().split())
print(["Even","Odd"][a*b%2])

Buggy submission (verdict: Runtime Error):
package main

import "fmt"

func main(){
    var a, b int
    fmt.Scan(&a, &b)
    if (a*b%2==0){
        fmt.Println("even")
    }else{
        fmt.Println("odd")
    }
     
}

Buggy submission (verdict: Runtime Error):
a = [int(i) for i in input().split()] 
if a[0]*a[1]/2==0:
  print("Even")
 else:
  print("Odd")

Buggy submission (verdict: Runtime Error):
a = [int(i) for i in input().split()] 
if a[0]*a[1]/2==0:
  print("Even")
 else:
  print("Odd")