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

Fixed submission:
N = int(input())

if N == 3:
    print("2 5 63")
    exit()

MAX = 30000
v2, v3, v6 = [], [], []

for x in range(2, MAX+1):
    if x%6 == 0:
        v6.append(x)
    elif x%3 == 0:
        v3.append(x)
    elif x%2 == 0:
        v2.append(x)

ans = []
j = 0

while j < len(v2)//2 and N > 3:
    ans.append(v2[j*2])
    ans.append(v2[j*2+1])
    j += 1
    N -= 2

j = 0
while j < len(v3)//2 and N > 1:
    ans.append(v3[j*2])
    ans.append(v3[j*2+1])
    j += 1
    N -= 2

for j in range(N):
    ans.append(v6[j])


print(" ".join(map(str, ans)))

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

if N == 3:
    print("2 3 25")
    exit()

MAX = 30000
v2, v3, v6 = [], [], []

for x in range(2, MAX+1):
    if x%6 == 0:
        v6.append(x)
    elif x%3 == 0:
        v3.append(x)
    elif x%2 == 0:
        v2.append(x)

ans = []
j = 0

while j < len(v2) and N > 3:
    ans.append(v2[j*2])
    ans.append(v2[j*2+1])
    j += 1
    N -= 2

j = 0
while j < len(v3) and N > 1:
    ans.append(v3[j*2])
    ans.append(v3[j*2+1])
    j += 1
    N -= 2

if N == 1:
    ans.append(6)

print(" ".join(map(str, ans)))
Problem p03399 (python)

Fixed submission:
A = int(input())
B = int(input())
C = int(input())
D = int(input())

price = min(A, B) + min(C, D)
print(price)

Buggy submission (verdict: Runtime Error):
import numpy as np

A, B= list(map(int, input().split()))

# White : 1
# Black : 2

def count(field):


    return white, black

field = np.ones([100,100])

def print_():
    print("100 100")
    p = lambda x : "." if x == 1 else "#"
    for f in field:
        print("".join(list(map(p, f))))


A -= 1

x, y = 0, 0 #一つ飛ばしで黒にするところの座標
x_, y_ = 1, 0 #白がたりなくて埋めていくときの座標

while True:
    if A == 0 and B == 0:
        break

    if B > 0 and A > 0:
        if y == 0 or x == 0 or y == 99 or x == 99:
            field[y][x] = 2
            B -= 1
        else:
            field[y][x] = 2
            if field[y-1][x] == 1:
                A -= 1
                B -= 1
            else:
                pass
        x += 2
        if x >= 100:
            y += 1
            x = y%2

    elif B > 0:
        if y == 0 or x == 0 or y == 99 or x == 99:
            field[y][x] = 2
            B -= 1
        x += 2
        if x >= 100:
            y += 2
            x = 0

    elif A > 0:
        field[y_][x_] = 2
        if field[y_+1][x_] == 2 :
            A += 1
        count = 0
        for h, v in zip([0, 1], [1, 0]):
            if h+y_ < 0 or h+y_ >= 100 or v+x_ < 0 or v+x_ >= 100:
                continue
            if field[h+y_][v+x_] == 2:
                count += 1
        B += count
        x_ += 2
        if x_ >= 100:
            y_ += 1
            x_ = 1-y_%2

    else:
        print(A,B)
        raise
    print(A,B)


print_()
Problem p03411 (python)

Fixed submission:
N = int(input())

red = []
blue = []
count = 0

dellist = lambda items, indexes: [item for index, item in enumerate(items) if index not in indexes]

for n in range(2*N):
    v = list(map(int, input().split()))
    if n < N:
        red.append(v)
    else:
        blue.append(v)


for x in range(2*N):

    for k in range(2):
        r_remove_list = []
        b_remove_list = []

        for i, b in enumerate(blue):
            if b[k] == x:
                cand = -1
                max_ = -1
                max_j = -1
                for j, r in enumerate(red):
                    if r[k] < x:
                        if r[1-k] < b[1-k] and max_ < r[1-k]:
                            cand = j
                            max_ = r[1-k]
                            max_j = j
                if cand >= 0:
                    r_remove_list.append(max_j)
                    b_remove_list.append(i)

        blue = dellist(blue,b_remove_list)
        red = dellist(red,r_remove_list)
        count += len(b_remove_list)


print(count)

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

sum_even = sum(map(lambda i: A[i] if A[i] > 0 else 0, range(1, N, 2)))
sum_odd  = sum(map(lambda i: A[i] if A[i] > 0 else 0, range(0, N, 2)))

if sum_even == 0 and sum_odd == 0:
    max_ = max(A)
    print(max_)
    index = A.index(max_)
    print(len(A)-1)
    for _ in range(index):
        print(1)
    for j in range(N-index-1):
        print(N - index - j)
    exit()

print(max(sum_even, sum_odd))
EVEN = sum_even >= sum_odd
ans = []

if EVEN:
    A = A[1:]
    ans.append(1)
if len(A)%2 == 0:
    ans.append(len(A))
    A = A[:-1]

while len(A) > 1:
    if A[0] <= 0:
        ans.append(1)
        ans.append(1)
        A = A[2:]
    else:
        if A[2] <= 0:
            ans.append(3)
            A.pop(2)
            if len(A) == 2:
                ans.append(2)
                A.pop(1)
            else:
                ans.append(3)
                A.pop(2)
        else:
            ans.append(2)
            A.pop(1)
            A[0] += A.pop(1)
print(len(ans))
for a in ans:
    print(a)
Problem p03450 (python)

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

parent = [i for i in range(N+1)]
distance = [0 for i in range(N+1)]
depth = [1 for i in range(N+1)]

def root(x):
    if x == parent[x]:
        return x
    else:
        return root(parent[x])

def to_root(x):
    if x == parent[x]:
        return 0
    else:
        return distance[x] + to_root(parent[x])

for _ in range(M):
    L, R, D = map(int, input().split())
    # print("distance", D, to_root(L), to_root(R))
    # print("root    ", root(L), root(R))
    # print(_, L, R, D)
    if root(L) == root(R):
        l = to_root(L)
        r = to_root(R)
        # print("distance", D, l, r)
        # print("root    ", root(L), root(R))
        if D != r-l:
            # print(parent)
            # print(distance)
            print("No")
            exit()
    else:
        rootL = root(L)
        rootR = root(R)
        if depth[rootL] < depth[rootR]:
            L,R = R,L
            D = -D
        rootL = root(L)
        rootR = root(R)
        parent[rootR] = rootL
        distance[rootR] = -to_root(R)+to_root(L)+D
        depth[rootL] = max(rootL, depth[rootR]+1)
print("Yes")

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

parent = [i for i in range(N+1)]
distance = [0 for i in range(N+1)]
depth = [1 for i in range(N+1)]

def root(x):
    if x == parent[x]:
        return x
    else:
        return root(parent[x])

def to_root(x):
    if x == parent[x]:
        return 0
    else:
        return distance[x] + to_root(parent[x])

for _ in range(M):
    L, R, D = map(int, input().split())
    if root(L) == root(R):
        l = to_root(L)
        r = to_root(R)
        if D != r-l:
            print("No")
            exit()
    else:
        if depth[L] < depth[R]:
            L,R = R,L
            D = -D
        rootL = root(L)
        rootR = root(R)
        parent[rootR] = rootL
        distance[rootR] = -to_root(R)+to_root(L)+D

        depth[rootL] = max(rootL, depth[R]+1)
print("Yes")

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
INF = 10**9+1

parent = [i for i in range(N+1)]
distance = [0 for i in range(N+1)]

def root(x):
    if x == parent[x]:
        return x
    else:
        return root(parent[x])

def to_root(x):
    if x == parent[x]:
        return 0
    else:
        return distance[x] + to_root(parent[x])

for _ in range(M):
    L, R, D = map(int, input().split())
    if root(L) == root(R):
        l = to_root(L)
        r = to_root(R)
        if D != l-r:
            print("No")
            exit()
    else:
        parent[L] = R
        distance[L] = D
print("Yes")
Problem p03474 (python)

Fixed submission:
A,B = map(int, input().split())
S = list(input())
ans = len(S) == A+B+1 and S[A] == '-' and S.count('-') == 1
print(["No", "Yes"][ans])

Buggy submission (verdict: Runtime Error):
A,B = map(int, input().split())
S = list(input())
if A+B+1-S != 0:
    print("No")
    exit()
for i in range(len(S)):
    if (ord(S[i]) < ord("0") or ord(S[i]) > ord("9")) ^ i == A:
        print("No")
        exit()
print("Yes")
Problem p03477 (python)

Fixed submission:
a,b,c,d=map(int, input().split())
x = a+b-c-d
if x == 0:
    print("Balanced")
elif x > 0:
    print("Left")
else:
    print("Right")

Buggy submission (verdict: Runtime Error):

import math
X, Y = list(map(int, input().split()))
"""
print(math.ceil(math.log(Y/X+1, 2)))
"""
count = 0
while X <= Y:
    X *= 2
    count += 1
print(count)
Problem p03504 (python)

Fixed submission:
n, c = map(int, input().split())
T = 10**5+1
l = [[0]*c for _ in range(T)]

for _ in range(n):
    s, t, c_ = map(int, input().split())
    c_ -= 1
    for i in range(s-1, t):
        l[i][c_] = 1

ans = 0
for i in range(T):
    ans = max(ans, sum(l[i]))

print(ans)

Buggy submission (verdict: Runtime Error):
l = [0]*(10**5+10)

n, c = map(int, input().split())
for _ in range(n):
    s, t, c = map(int, input().split())
    l[s*2-1] += 1
    l[t*2]   -= 1
for i in range(1, len(l)):
    l[i] += l[i-1]
print(max(l))
Problem p03697 (python)

Fixed submission:
a, b = map(int, input().split())
if a+b < 10:
    print(a+b)
else:
    print("error")

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

from math import ceil

def can_korosu(t):
    count = 0
    for h in H:
        count += ceil(max(0, h - t*B)/(A-B))
        if count > t:
            return False
    return True

lo = 0
hi = 10**9

p = (lo, hi)
for _ in range(50):
    mid = (hi + lo) // 2
    if can_korosu(mid):
        hi = mid
    else:
        lo = mid
    if p == (lo, hi):
        break
    p = (lo, hi)
print(hi)
Problem p04013 (python)

Fixed submission:
n,a = map(int, input().split())
x = list(map(int, input().split()))
y = max(x)
x = [z-a for z in x]

dp = [[0]*(2*n*y+1) for _ in range(n+1)]
dp[0][n*y] = 1
for k in range(n):
    for i in range(2*n*y+1):
        res = dp[k][i]
        if i+x[k] < 0 or i+x[k] > 2*n*y:
            pass
        else:
            res += dp[k][i+x[k]]
        dp[k+1][i] = res
print(dp[-1][n*y]-1)

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

dp = [[0]*(2*n*y+1) for _ in range(n+1)]
dp[0][n*y] = 1
for k in range(n):
    for i in range(2*n*y+1):
        if i+x[k] < 0 or i+x[k] > 2*n*y:
            dp[k+1][i] = dp[k][i]
        else:
            dp[k+1][i] = dp[k][i] + dp[k][i+x[k]]
print(dp[-1][n*y]-1)
Problem p02821 (python)

Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np

MOD = 10 ** 9 +7

n,m = map(int,readline().split())
a = np.array(read().split(),np.int64)

a.sort()

def shake_cnt(x):
    X=np.searchsorted(a,x-a)
    return n*n-X.sum()

left = 0
right = 10 ** 6
while left+1 <right:
    x = (left + right)//2
    if shake_cnt(x) >= m:
        left = x
    else:
        right = x

left,right

X=np.searchsorted(a,right-a)
Acum = np.zeros(n+1,np.int64)
Acum[1:] = np.cumsum(a)

shake = n * n -X.sum()
happy = (Acum[-1]-Acum[X]).sum()+(a*(n-X)).sum()

happy += (m-shake)*left
print(happy)

Buggy submission (verdict: Runtime Error):
import numpy as np

MOD = 10 ** 9 +7

n,m = map(int,readline().split())
a = np.array(read().split(),np.int64)

a.sort()

def shake_cnt(x):
    X=np.searchsorted(a,x-a)
    return n*n-X.sum()

left = 0
right = 10 ** 6
while left+1 <right:
    x = (left + right)//2
    if shake_cnt(x) >= m:
        left = x
    else:
        right = x

left,right

X=np.searchsorted(a,right-a)
Acum = np.zeros(n+1,np.int64)
Acum[1:] = np.cumsum(a)

shake = n * n -X.sum()
happy = (Acum[-1]-Acum[X]).sum()+(a*(n-X)).sum()

happy += (m-shake)*left
print(happy)
Problem p02619 (python)

Fixed submission:
D = int(input())
clist = list(map(int, input().split()))
slist = [list(map(int, input().split())) for _ in range(D)]
tlist = [int(input()) for _ in range(D)]
zlist = []
dlist = [0] * 26
ans = 0
'''
print(sum(clist))
print('--------------')
print(slist[0][0])
print(slist[1][16])
print(clist[16])

print('--------------')
'''
for i in range(D):
  #print(slist[i],tlist[i]-1)
  zlist.append(clist[tlist[i]-1] * ((i+1) - dlist[tlist[i]-1]))
  dlist[tlist[i]-1] = i+1
  ans += slist[i][tlist[i]-1] - ((i+1) * sum(clist)) + sum(zlist)
  print(ans)

Buggy submission (verdict: Runtime Error):
D = int(input())
clist = list(map(int, input().split()))
slist = [list(map(int, input().split())) for _ in range(D)]
tlist = [int(input()) for _ in range(D)]

print(sum(clist))

for i in range(D):
  print(slist[i][tlist[i]] - sum(clist))
Problem p02630 (python)

Fixed submission:
# ans

N = int(input())
A = list(map(int, input().split()))
cnt = [0] * 100001
for i in A:
  cnt[i] += 1
Q = int(input())
S = sum(A)

for i in range(Q):
  B, C = map(int, input().split())
  diff = (C - B) * cnt[B]
  S += diff
  print(S)
  cnt[C] += cnt[B]
  cnt[B] = 0

Buggy submission (verdict: Runtime Error):
# ans

N = int(input())
A = list(map(int, input().split()))
cnt = [0] * 100000
for i in A:
  cnt[i] += 1
Q = int(input())
S = sum(A)

for i in range(Q):
  B, C = map(int, input().split())
  diff = (C - B) * cnt[B]
  S += diff
  print(S)
  cnt[C] += cnt[B]
  cnt[B] = 0

Buggy submission (verdict: Runtime Error):
# ans

N = int(input())
A = list(map(int, input().split()))
cnt = [0] * 100000
for i in range(N):
  cnt[A[i]] += 1
Q = int(input())
S = sum(A)

for i in range(Q):
  B, C = map(int, input().split())
  diff = (C - B) * cnt[B]
  S += diff
  print(S)
  cnt[C] += cnt[B]
  cnt[B] = 0

Buggy submission (verdict: Runtime Error):
# ans

N = int(input())
A = list(map(int, input().split()))
cnt = [0] * 100000
for i in range(N):
  cnt[i] += 1
Q = int(input())
S = sum(A)

for i in range(Q):
  B, C = map(int, input().split())
  diff = (C - B) * cnt[B]
  S += diff
  print(S)
  cnt[C] += cnt[B]
  cnt[B] = 0

Buggy submission (verdict: Runtime Error):
# ans

N = int(input())
A = list(map(int, input().split()))
cnt = [0] * 100000
for i in range(A):
  cnt[i] += 1
Q = int(input())
S = sum(A)

for i in range(Q):
  B, C = map(int, input().split())
  diff = (C - B) * cnt[B]
  S += diff
  print(S)
  cnt[C] += cnt[B]
  cnt[B] = 0
Problem p02646 (python)

Fixed submission:
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

if abs(A - B) <= (V - W) * T:
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

if (B-A) % abs(V-W) == 0 and V > W:
  print('YES')
else:
  print('NO')
Problem p02663 (python)

Fixed submission:
H1, M1, H2, M2, K = map(int, input().split())
print((H2 - H1) * 60 + (M2 -M1) - K)

Buggy submission (verdict: Runtime Error):
H1, M1, H2, M2, K = map(int, input())
print((H2-H1) * 60 - K)
Problem p02748 (python)

Fixed submission:
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
min = min(a) + min(b)

for i in range(M):
  x, y, c = list(map(int, input().split()))
  tmp = a[x - 1] + b[y - 1] - c
  if min > tmp:
    min = tmp

print(min)

Buggy submission (verdict: Runtime Error):
A, B, M = map(int, input().split())
# items
a = list(map(int, input().split()))
b = list(map(int, input().split()))
# discount
d = [list(map(int,input().split())) for i in range(M)]

list = []

for i in range(M):
  if min(a) + min(b) > a[d[i][0] - 1] + b[d[i][1] - 1] - d[i][2]:
    list.append(a[d[i][0] - 1] + b[d[i][1] - 1] - d[i][2])

print(min(list))
Problem p02801 (python)

Fixed submission:
str = input()

print(chr(ord(str) + 1))

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

print chr(ord(str) + 1)
Problem p02802 (python)

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

wa = [0] * N
pnt = [0] * N
ac = [False] * N

for _ in range(M):
    p, s = list(map(str, input().split()))
    if s == 'WA':
      wa[int(p) - 1] += 1
    elif s == 'AC' and not (ac[int(p) - 1]):
      ac[int(p) - 1] = not (ac[int(p) - 1])
      pnt[int(p) - 1] += wa[int(p) - 1]

print(ac.count(True), sum(pnt))

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

wa = [0] * N
pnt = [0] * N
ac = [False] * N

for _ in range(M):
    tmp = 0
    p, s = list(map(str, input().split()))
    if s == 'WA':
      wa[int(p)] += 1
    elif s == 'AC' and not (ac[int(p)]):
      ac[int(p)] = not (ac[int(p)])
      pnt[int(p)] += wa[int(p)]

print(ac.count(True), sum(pnt))

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

wa = [0] * N
pnt = [0] * N
ac = [False] * N

for _ in range(M):
    tmp = 0
    p, s = list(map(str, input().split()))
    if s == 'WA':
      wa[int(p)] += 1
    elif s == 'AC' and not (ac[int(p)]):
      ac[int(p)] = not (ac[int(p)])
      pnt[int(p)] += wa[int(p)]

print(ac.count(True), sum(pnt))

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

ac = 0
wr = 0
list = []

for _ in range(M):
    tmp = 0
    p, s = list(map(str, input().split()))
    if not(tmp == int(p)) and s == 'AC' and not int(p) in list:
      tmp = int(p)
      list.append(int(p))
      ac += 1
    elif s == 'WA' and not int(p) in list and tmp == 1:
      wr += 1

print(ac, wr)
Problem p02817 (python)

Fixed submission:
S,T = input().split()
print(T+S)

Buggy submission (verdict: Runtime Error):
S = input().split()
 
print(sum(S))

Buggy submission (verdict: Runtime Error):
S,T = input().split()

puts S + T
Problem p02818 (python)

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

if A > K:
  print(A - K, B)
elif B - (K - A) > 0:
  print(0, B - (K - A))
else:
  print(0,0)

Buggy submission (verdict: Runtime Error):
n = list(map(int, input().strip().split()))
count = 0
         
while count < n[2]:
	if n[0] > 0:
    	n[0]-=1   
        count+=1
    elif n[1] > 0:
        n[1]-=1
        count+=1
    else:
        break
 
print(n[0] + " " + n[1])

Buggy submission (verdict: Runtime Error):
n = list(map(int, input().strip().split()))
count = 0
         
while count == n[2]:
	if n[0] > 0:
    	n[0]-=1   
        count+=1
    elif n[1] > 0:
        n[1]-=1
        count+=1
    else:
        break
 
print(n[0] + " " + n[1])

Buggy submission (verdict: Runtime Error):
n = list(map(int, input().split())
count = 0
         
while count == n[2]:
	if n[0] > 0:
    	n[0]-=1   
        count+=1
    elif n[1] > 0:
        n[1]-=1
        count+=1
    else:
        break
 
print(n[0] n[1])

Buggy submission (verdict: Runtime Error):
n = list(map(long, input().split())
count = 0
         
while count == n[2]:
	if n[0] > 0:
    	n[0]-=1   
        count+=1
    elif n[1] > 0:
        n[1]-=1
        count+=1
    else:
        break
 
print(n[0] n[1])

Buggy submission (verdict: Runtime Error):
n = list(map(int, input().split())
count = 0
         
while count == n[2]:
	if n[0] > 0:
    	n[0]-=1   
        count+=1
    elif n[1] > 0:
        n[1]-=1
        count+=1
 
print(n[0] n[1])

Buggy submission (verdict: Runtime Error):
n = list(map(long, input().split())
count = 0
         
while count == n[2]:
	if n[0] > 0:
    	n[0]-=1   
        count+=1
    elif n[1] > 0:
        n[1]-=1
        count+=1

print(n[0] n[1])
Problem p02841 (python)

Fixed submission:
M1, D1 = map(int, input().split())
M2, D2 = map(int, input().split())

if D2 == 1:
  print(1)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
M1, D1 = int(input())
M2, D2 = int(input())

if D2 == 1:
  print(1)
else:
  print(0)
Problem p02953 (python)

Fixed submission:
# ans

N = int(input())
H = list(map(int, input().split()))

if H == 1:
  print('Yes')
  exit()

for i in range(1, N):
  if H[i-1] == H[i]:
    pass
  elif H[i-1] < H[i]:
    H[i] -= 1
  else:
    print('No')
    exit()

print('Yes')

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

if H == 1:
  print('Yes')
  exit()

if H == 2 and H[0] <= H[1]:
  print('Yes')
  exit()
elif H == 2 and H[0] > H[1]:
  print('No')
  exit()

for i in range(1, N-1):
  # 4,4,4(4,4,5 4,5,5 5,5,5) or 4,5,4
  if H[i-1] <= H[i] <= H[i+1] or H[i-1] <= H[i] - 1 <= H[i+1]:
    pass
  # 5,4,4 or 5,5,4
  elif H[i-1] - 1 <= H[i] <= H[i+1] or H[i-1] - 1 <= H[i] - 1 <= H[i+1]:
    passz
  # 5,4,5
  elif H[i-1] - 1 <= H[i] <= H[i+1] - 1:
    pass 
  else:
    print('No')
    exit()

print('Yes')
Problem p02982 (python)

Fixed submission:
import sys,math
input = sys.stdin.readline

N, D = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(N)]
cnt = 0

for i in range(N):
  for j in range(N):
    num = 0
    if i < j:
      for k in range(D):
        num += pow(abs(X[i][k] - X[j][k]) ,2)
      if math.floor(math.sqrt(num)) ** 2 == num:
        cnt += 1

print(cnt)

Buggy submission (verdict: Runtime Error):
import sys,math
input = sys.stdin.readline

N, D = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(N)]
cnt = 0
ans = 0

print(X)

for i in range(1,N):
  for j in range(1,D):
      num += pow(abs(X[i-1][j-1] - X[i][j]) ,2)
      print(X[i-1][j-1],X[i][j])
  if int(math.sqrt(num)):
    print(math.sqrt(num))
    ans += 1

print(ans)
Problem p03086 (python)

Fixed submission:
S = input()
max = 0
ans = 0

for i in range(len(S)):
  if S[i] == 'A' or S[i] == 'T' or S[i] == 'C' or S[i] == 'G':
    ans += 1
    if ans > max:
      max = ans
  else:
    ans = 0

print(max)

Buggy submission (verdict: Runtime Error):
S = input()
max = 0
ans = 0

for i in range(10):
  if S[i] == 'A' or S[i] == 'T' or S[i] == 'C' or S[i] == 'G':
    ans += 1
  else:
    if ans >= max:
      max = ans
    else:
      ans = 0

print(max)
Problem p03150 (python)

Fixed submission:
import re

S = input()

if S == 'keyence' or re.fullmatch(r'[a-z]+keyence', S) or re.fullmatch(r'k[a-z]+eyence', S) or re.fullmatch(r'ke[a-z]+yence', S) or re.fullmatch(r'key[a-z]+ence', S) or re.fullmatch(r'keye[a-z]+nce', S) or re.fullmatch(r'keyen[a-z]+ce', S) or re.fullmatch(r'keyenc[a-z]+e', S) or re.fullmatch(r'keyence[a-z]+', S):
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
import sys, re
input = sys.stdin.readline().rstrip()

S = input()

if S == 'keyence' or re.fullmatch(r'[a-z]+keyence', S) or re.fullmatch(r'k[a-z]+eyence', S) or re.fullmatch(r'ke[a-z]+yence', S) or re.fullmatch(r'key[a-z]+ence', S) or re.fullmatch(r'keye[a-z]+nce', S) or re.fullmatch(r'keyen[a-z]+ce', S) or re.fullmatch(r'keyenc[a-z]+e', S) or re.fullmatch(r'keyence[a-z]+', S):
  print('YES')
else:
  print('NO')
Problem p03273 (python)

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

for i in range(H):
  line = input()
  if line != '.' * W:
    G.append(line)

H = len(G)
ans = []

for i in range(W):
  flg = False
  tmp = ''
  for j in range(H):
    if G[j][i] == '.':
      flg = False
    else:
      flg = True
    tmp += G[j][i]
  if tmp != '.' * H:
    ans.append(tmp)

for i in range(H):
  tmp = ''
  for j in range(len(ans)):
    tmp += ans[j][i]
  print(tmp)

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

for i in range(H):
  line = input()
  if line != '.' * W:
    G.append(line)

H = len(G)
ans = []

for i in range(W):
  flg = False
  tmp = ''
  for j in range(H):
    if G[j][i] == '.':
      flg = False
    else:
      flg = True
    tmp += G[j][i]
  if tmp != '.' * H:
    ans.append(tmp)

for i in range(len(ans[0])):
  tmp = ''
  for j in range(H):
    tmp += ans[j][i]
  print(tmp)
Problem p03282 (python)

Fixed submission:
# ans

S = input()
K = int(input())

if S[0:K].count('1') == K:
  print(1)
  exit()
  
for i in range(K):
  if S[i] != '1':
    print(S[i])
    exit()

Buggy submission (verdict: Runtime Error):
S = input()
K = int(input())

if S[0] != '1':
  print(S[0])
elif S[0] == '1' and K >= 1:
  print(S[1])
else:
  print(1)

Buggy submission (verdict: Runtime Error):
S = input()
K = int(input())

if S[0] != 1:
  print(S[1])
else:
  print(1)
Problem p03284 (python)

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

if N % K != 0:
	print(1)
else:
	print(0)

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

if N % K != 0
	print(N // K - N % K)
else:
	print(N % K)