Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

s = input()
N = int(input())

S = []
for i in range(len(s)):
    S.append(s[i])
    
back_count = 0
for i in range(N):
    Q = list(map(str, input().split()))
    Q[0] = int(Q[0])
    if Q[0] == 1:
        if back_count == 0:
            back_count = 1
        else:
            back_count = 0
    else:
        Q[1] = int(Q[1])
        if back_count == 0:
            if Q[1] == 1:
                d = deque(S)
                d.appendleft(Q[2])
                S = list(d)
            else:
                S.append(Q[2])
        else:
            if Q[1] == 1:
                S.append(Q[2])
            else:
                d = deque(S)
                d.appendleft(Q[2])
                S = list(d)

if back_count == 0:
    print("".join(S))
else:
    S = S[::-1]
    print("".join(S))

Fixed submission:
from collections import deque

s = input()
N = int(input())

S = []
for i in range(len(s)):
    S.append(s[i])

d = deque(S)
    
back_count = 0
for i in range(N):
    Q = list(map(str, input().split()))
    Q[0] = int(Q[0])
    if Q[0] == 1:
        if back_count == 0:
            back_count = 1
        else:
            back_count = 0
    else:
        Q[1] = int(Q[1])
        if back_count == 0:
            if Q[1] == 1:
                d.appendleft(Q[2])
            else:
                d.append(Q[2])
        else:
            if Q[1] == 1:
                d.append(Q[2])
            else:
                d.appendleft(Q[2])

S = list(d)
if back_count == 0:
    print("".join(S))
else:
    S = S[::-1]
    print("".join(S))

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
N = int(input())

S = []
for i in range(len(s)):
    S.append(s[i])
    
back_count = 0
for i in range(N):
    Q = list(map(str, input().split()))
    Q[0] = int(Q[0])
    if Q[0] == 1:
        if back_count == 0:
            back_count = 1
        else:
            back_count = 0
    else:
        Q[1] = int(Q[1])
        if back_count == 0:
            if Q[1] == 1:
                S.insert(0, Q[2])
            else:
                S.append(Q[2])
        else:
            if Q[1] == 1:
                S.append(Q[2])
            else:
                S.insert(0, Q[2])

if back_count == 0:
    print("".join(S))
else:
    S = S[::-1]
    print("".join(S))

Fixed submission:
from collections import deque

s = input()
N = int(input())

S = []
for i in range(len(s)):
    S.append(s[i])

d = deque(S)
    
back_count = 0
for i in range(N):
    Q = list(map(str, input().split()))
    Q[0] = int(Q[0])
    if Q[0] == 1:
        if back_count == 0:
            back_count = 1
        else:
            back_count = 0
    else:
        Q[1] = int(Q[1])
        if back_count == 0:
            if Q[1] == 1:
                d.appendleft(Q[2])
            else:
                d.append(Q[2])
        else:
            if Q[1] == 1:
                d.append(Q[2])
            else:
                d.appendleft(Q[2])

S = list(d)
if back_count == 0:
    print("".join(S))
else:
    S = S[::-1]
    print("".join(S))
Buggy python submission (verdict: Time Limit Exceeded):
H, N = map(int, input().split())

AB = []
for i in range(N):
    tmp = list(map(int, input().split()))
    AB.append(tmp)
    
dp = [10**9] * (H+1)
dp[0] = 0
    
for i in range(N):
    for j in range(H+1):
        a, b = AB[i]
        if j < a:
            dp[j] = min(dp[0]+b, dp[j])
        else:
            dp[j] = min(dp[j-a]+b, dp[j])
    
print(dp[H])


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

AB = []
for i in range(N):
    tmp = list(map(int, input().split()))
    AB.append(tmp)
    
dp = [10**9] * (H+1)
dp[0] = 0
    
for i in range(N):
    for j in range(H+1):
        a, b = AB[i]
        if j < a:
            dp[j] = min(dp[0]+b, dp[j])
        else:
            dp[j] = min(dp[j-a]+b, dp[j])
    
print(dp[H])
Buggy python submission (verdict: Runtime Error):
N, K, S = map(int, input().split())

mawari = S // K
mid = S // K + S % K

ans = []

for i in range(K-1):
    ans.append(mawari)

ans.append(mid)

for i in range(K-1):
    ans.append(mawari)

for i in range(N - len(ans)):
    ans.append(10**9-1)

print(*ans)

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

ans = []
for i in range(K):
    ans.append(S)
    
for i in range(N - len(ans)):
    ans.append(10**9-1)

print(*ans)

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

mawari = S // K
mid = S // K + S % K

ans = []

for i in range(K-1):
    ans.append(mawari)

ans.append(mid)

for i in range(K-1):
    ans.append(mawari)

for i in range(N - len(ans)):
    ans.append(S)

print(*ans)


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

ans = []
for i in range(K):
    ans.append(S)
    
for i in range(N - len(ans)):
    ans.append(10**9-1)

print(*ans)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

def bfs(maze, visited, sy, sx, gy, gx):
    queue = deque([[sy, sx]])
    visited[sy][sx] = 0
    while queue:
        y, x = queue.popleft()
        if [y, x] == [gy, gx]:
            return visited[y][x]
        for j, k in ([1, 0], [-1, 0], [0, 1], [0, -1]):
            new_y, new_x = y+j, x+k
            if maze[new_y][new_x] == "." and \
                visited[new_y][new_x] == -1:
                visited[new_y][new_x] = visited[y][x] + 1
                queue.append([new_y, new_x])


H, W = map(int, input().split())

sy, sx, gy, gx = 3, 1, 1, 5

maze = ["#"*(W+2)]
for i in range(H):
    tmp = "#"
    tmp += input()
    tmp += "#"
    maze.append(tmp)
maze.append("#"*(W+2))
    
#for i in range(H+2):
#    print(maze[i])

max_bfs = 0
for sy in range(1, H+2):
    for sx in range(1, W+2):
        for gy in range(1, H+2):
            for gx in range(1, W+2):
                if maze[sy][sx] == "." and maze[gy][gx] == ".":
                    visited = [[-1]*(W+2) for j in range(H+2)]
                    tmp_bfs = bfs(maze, visited, sy, sx, gy, gx)
                    if tmp_bfs > max_bfs:
                        max_bfs = tmp_bfs
                
print(max_bfs)


Fixed submission:
from collections import deque

def bfs(maze, visited, sy, sx):
    queue = deque([[sy, sx]])
    visited[sy][sx] = 0
    while queue:
        y, x = queue.popleft()
        for j, k in ([1, 0], [-1, 0], [0, 1], [0, -1]):
            new_y, new_x = y+j, x+k
            if maze[new_y][new_x] == "." and \
                visited[new_y][new_x] == -1:
                visited[new_y][new_x] = visited[y][x] + 1
                queue.append([new_y, new_x])
    return visited[y][x]

H, W = map(int, input().split())

maze = ["#"*(W+2)]
for i in range(H):
    tmp = "#"
    tmp += input()
    tmp += "#"
    maze.append(tmp)
maze.append("#"*(W+2))
    
#for i in range(H+2):
#    print(maze[i])

max_bfs = 0
for sy in range(1, H+2):
    for sx in range(1, W+2):
        if maze[sy][sx] == ".":
            visited = [[-1]*(W+2) for j in range(H+2)]
            tmp_bfs = bfs(maze, visited, sy, sx)
            if tmp_bfs > max_bfs:
                max_bfs = tmp_bfs
        
print(max_bfs)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()

pin = []
for i in range(10):
    for j in range(10):
        for k in range(10):
            pin.append(str(i)+str(j)+str(k))

count = 0
for i in range(len(pin)):
    l, m, n = pin[i][0], pin[i][1], pin[i][2]
    l_idx, m_idx, n_idx = -1, -1, -1
    for i in range(N):
        if S[i] == l:
            l_idx = i
            break
    if l_idx != -1:
        for i in range(l_idx+1, N):
            if S[i] == m:
                m_idx = i
                break
    if m_idx != -1:
        for i in range(m_idx+1, N):
            if S[i] == n:
                n_idx = i
                break
    if l_idx != -1 and m_idx != -1 and n_idx != -1:
        count += 1

print(count)

Fixed submission:
N = int(input())
S = input()

pin = []
for i in range(10):
    for j in range(10):
        for k in range(10):
            pin.append(str(i)+str(j)+str(k))

count = 0
for i in range(len(pin)):
    l, m, n = pin[i][0], pin[i][1], pin[i][2]
    l_idx, m_idx, n_idx = -1, -1, -1
    for i in range(N):
        if S[i] == l:
            l_idx = i
            break
    if l_idx != -1:
        for i in range(l_idx+1, N):
            if S[i] == m:
                m_idx = i
                break
    if m_idx != -1:
        for i in range(m_idx+1, N):
            if S[i] == n:
                n_idx = i
                break
    if l_idx != -1 and m_idx != -1 and n_idx != -1:
        count += 1

print(count)
Buggy python submission (verdict: Time Limit Exceeded):
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
    
import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True
    
A, B = map(int, input().split())

gcd_AB = gcd(A, B)
cd = []
for i in range(2, gcd_AB + 1):
    if A % i == 0 and B % i == 0:
        cd.append(i)

count = 1
for i in range(len(cd)):
    if is_prime(cd[i]) == True:
        count += 1

print(count)

Fixed submission:
import fractions
import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True
    
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors
    
A, B = map(int, input().split())

ans = 1
tmp = make_divisors(fractions.gcd(A ,B))
for x in tmp:
    if is_prime(x):
        ans += 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import bisect

N, M = map(int, input().split())
A = list(map(int, input().split()))

list.sort(A)  # 昇順にソート

for i in range(M):
    A[N-1] = A[N-1] // 2
    tmp = A[N-1]
    del A[N-1]
    insert_index = bisect.bisect_left(A, tmp)
    A.insert(insert_index, tmp)
    
print(sum(A))

Fixed submission:
import heapq

N, M = map(int, input().split())
A = list(map(int, input().split()))
hq = []

for i in range(N):
    heapq.heappush(hq, A[i]*(-1))

for i in range(M):
    tmp = heapq.heappop(hq) * (-1) // 2
    heapq.heappush(hq, tmp*(-1))
    
print(sum(hq)*(-1))

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
A = list(map(int, input().split()))

list.sort(A, reverse=True)  # 降順にソート

for i in range(M):
    A[0] = A[0] // 2
    list.sort(A, reverse=True)
    
print(sum(A))

Fixed submission:
import heapq

N, M = map(int, input().split())
A = list(map(int, input().split()))
hq = []

for i in range(N):
    heapq.heappush(hq, A[i]*(-1))

for i in range(M):
    tmp = heapq.heappop(hq) * (-1) // 2
    heapq.heappush(hq, tmp*(-1))
    
print(sum(hq)*(-1))
Buggy python submission (verdict: Runtime Error):
from math import factorial
 
def cmb(n, r):
  return factorial(n) // (factorial(n - r) * factorial(r))


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

for i in range(1, K+1):
    ans = cmb(N - K + 1, i) * cmb(K - 1, i - 1) % (10**9+7)
    print(ans)

Fixed submission:
from math import factorial
 
def cmb(n, r):
  return factorial(n) // (factorial(n - r) * factorial(r))


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

for i in range(1, K+1):
    try:
        ans = cmb(N - K + 1, i) * cmb(K - 1, i - 1) % (10**9+7)
        print(ans)
    except:
        print(0)

Buggy python submission (verdict: Runtime Error):
from operator import mul
from functools import reduce

mod = 10**9+7
def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under % mod


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

for i in range(1, K+1):
    ans = cmb(N - K + 1, i) * cmb(K - 1, i - 1) % mod
    print(ans)

Fixed submission:
from math import factorial
 
def cmb(n, r):
  return factorial(n) // (factorial(n - r) * factorial(r))


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

for i in range(1, K+1):
    try:
        ans = cmb(N - K + 1, i) * cmb(K - 1, i - 1) % (10**9+7)
        print(ans)
    except:
        print(0)
Buggy python submission (verdict: Runtime Error):
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

A, B, C, D = map(int, input().split())

lcm_CD = lcm(C, D)
count = (B // C - (A-1) // C) + (B // D - (A-1) // D) - (B // lcm_CD - (A-1) // lcm_CD)
    
print((B - A + 1) - count)

Fixed submission:
import fractions

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

A, B, C, D = map(int, input().split())

lcm_CD = lcm(C, D)
count = (B // C - (A-1) // C) + (B // D - (A-1) // D) - (B // lcm_CD - (A-1) // lcm_CD)
    
print((B - A + 1) - count)

Buggy python submission (verdict: Runtime Error):
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

A, B, C, D = map(int, input().split())

lcm_CD = lcm(C, D)
count = (B // C - (A-1) // C) + (B // D - (A-1) // D) - (B // lcm_CD - (A-1) // lcm_CD)
    
print((B - A + 1) - count)

Fixed submission:
import fractions

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

A, B, C, D = map(int, input().split())

lcm_CD = lcm(C, D)
count = (B // C - (A-1) // C) + (B // D - (A-1) // D) - (B // lcm_CD - (A-1) // lcm_CD)
    
print((B - A + 1) - count)
Buggy python submission (verdict: Time Limit Exceeded):
H, W = map(int, input().split())
S = []
for i in range(H):
    S.append(input())
    
ans_W = [[-1 for i in range(W)] for j in range(H)]
for i in range(H):
    count = 0
    now = 0
    for j in range(W):
        if S[i][j] == ".":
            count += 1
        else:
            for k in range(now, min(W, now+1+count)):
                if k == j:
                    ans_W[i][k] = 0
                else:
                    ans_W[i][k] = count
            now += count+1
            count = 0
    if count != 0:
        for k in range(now, min(W, now+1+count)):
            ans_W[i][k] = count

ans_H = [[-1 for i in range(W)] for j in range(H)]
for i in range(W):
    count = 0
    now = 0
    for j in range(H):
        if S[j][i] == ".":
            count += 1
        else:
            for k in range(now, min(H, now+1+count)):
                if k == j:
                    ans_H[k][i] = 0
                else:
                    ans_H[k][i] = count
            now += count+1
            count = 0
    if count != 0:
        for k in range(now, min(H, now+1+count)):
            ans_H[k][i] = count

ans = 0
for i in range(H):
    for j in range(W):
        ans = max(ans, ans_H[i][j] + ans_W[i][j])
            
print(ans-1)


Fixed submission:
H, W = map(int, input().split())
S = []
for i in range(H):
    S.append(input())
    
ans_W = [[-1 for i in range(W)] for j in range(H)]
for i in range(H):
    count = 0
    now = 0
    for j in range(W):
        if S[i][j] == ".":
            count += 1
        else:
            for k in range(now, min(W, now+1+count)):
                if k == j:
                    ans_W[i][k] = 0
                else:
                    ans_W[i][k] = count
            now += count+1
            count = 0
    if count != 0:
        for k in range(now, min(W, now+1+count)):
            ans_W[i][k] = count

ans_H = [[-1 for i in range(W)] for j in range(H)]
for i in range(W):
    count = 0
    now = 0
    for j in range(H):
        if S[j][i] == ".":
            count += 1
        else:
            for k in range(now, min(H, now+1+count)):
                if k == j:
                    ans_H[k][i] = 0
                else:
                    ans_H[k][i] = count
            now += count+1
            count = 0
    if count != 0:
        for k in range(now, min(H, now+1+count)):
            ans_H[k][i] = count

ans = 0
for i in range(H):
    for j in range(W):
        ans = max(ans, ans_H[i][j] + ans_W[i][j])
            
print(ans-1)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = input()

bl = []
if S[0] == "0":
    bl.append(0)
bl.append(0)
for i in range(1, N):
    if S[i-1] != S[i]:
        bl.append(i)
bl.append(N)
bl.append(N)

nbl = len(bl)
m = [bl[i+2 * K+1] - bl[i] 
     for i in range(nbl - 2*K-1) if i%2 == 0]
if len(m) == 0:
    print(N)
else:
    print(max(m))

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

sum_coin = 0
tmp = max(A, B)
sum_coin += tmp
if tmp == A:
    A += -1
else:
    B += -1
tmp = max(A, B)
sum_coin += tmp
print(sum_coin)
Buggy python submission (verdict: Time Limit Exceeded):
N, Q = map(int, input().split())
S = input()
S_list = list(S)

for i in range(Q):
    start, end = map(int, input().split())
    count = 0
    for j in range(start-1, end-1):
        if S_list[j] == "A" and S_list[j+1] == "C":
            count += 1
        else:
            pass
    print(count)

Fixed submission:
N, Q = map(int, input().split())
S = input()
S_list = list(S)
count_list = [0]*N

for i in range(1, N):
    count_list[i] += count_list[i-1] 
    if S_list[i-1] == "A" and S_list[i] == "C":
        count_list[i] += 1

for i in range(Q):
    start, end = map(int, input().split())
    count = count_list[end-1] - count_list[start-1]
    print(count)
Buggy python submission (verdict: Time Limit Exceeded):
A, B = map(int, input().split())

sum_XOR = A
for i in range(A+1, B+1):
    sum_XOR = sum_XOR ^ i

print(sum_XOR)

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

if A%2 == 0 and B%2 == 1:
    if (B - A - 1) % 4 == 0:
        print("1")
    else:
        print("0")
elif A%2 == 0 and B%2 == 0:
    if (B-A) % 4 == 0:
        print(B)
    else:
        print(B ^ 1)
elif A%2 == 1 and B%2 == 1:
    if (B-A) % 4 == 0:
        print(A)
    else:
        print(A ^ 1)
else:
    if (B - A - 1) % 4 == 0:
        print(A ^ B)
    else:
        print(A ^ B ^ 1)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
h = list(map(int, input().split()))

dp = [10**10 for i in range(N+1)]
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(2, N):
    for j in range(max(1, i-K+1), i+1):
        if dp[i] >= dp[j-1] + abs(h[i]-h[j-1]):
            dp[i] = dp[j-1] + abs(h[i]-h[j-1])

print(dp[N-1])
#print(dp)

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

dp = [10**10 for i in range(N+1)]
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(2, N):
    for j in range(max(1, i-K+1), i+1):
        if dp[i] >= dp[j-1] + abs(h[i]-h[j-1]):
            dp[i] = dp[j-1] + abs(h[i]-h[j-1])

print(dp[N-1])
#print(dp)
Buggy python submission (verdict: Time Limit Exceeded):
N, W = map(int, input().split())

wv = []
for i in range(N):
    wv.append(list(map(int, input().split())))
    
dp = [[0 for i in range(W+1)] for j in range(N+1)]

for i in range(N):
    for w in range(W+1):
        if w - wv[i][0] >= 0:
            dp[i+1][w] = max(dp[i][w - wv[i][0]] + wv[i][1], dp[i][w])
        else:
            dp[i+1][w] = dp[i][w]

print(dp[N][W])

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

wv = []
for i in range(N):
    wv.append(list(map(int, input().split())))
    
dp = [[0 for i in range(W+1)] for j in range(N+1)]

for i in range(N):
    for w in range(W+1):
        if w - wv[i][0] >= 0:
            dp[i+1][w] = max(dp[i][w - wv[i][0]] + wv[i][1], dp[i][w])
        else:
            dp[i+1][w] = dp[i][w]

print(dp[N][W])
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
t = input()

dp = [[0 for i in range(3010)] for j in range(3010)]

for i in range(len(s)):
    for j in range(len(t)):
        if s[i] == t[j]:
            dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j] + 1)
        dp[i+1][j+1] = max(dp[i+1][j+1], dp[i+1][j], dp[i][j+1])
        
ans = ""
i = len(s)
j = len(t)
while i > 0 and j > 0:
    if dp[i][j] == dp[i-1][j]:
        i -= 1
    elif dp[i][j] == dp[i][j-1]:
        j -= 1
    else:
        ans = s[i-1] + ans
        i -= 1
        j -= 1

print(ans)

Fixed submission:
s = input()
t = input()

dp = [[0 for i in range(3010)] for j in range(3010)]

for i in range(len(s)):
    for j in range(len(t)):
        if s[i] == t[j]:
            dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j] + 1)
        dp[i+1][j+1] = max(dp[i+1][j+1], dp[i+1][j], dp[i][j+1])
        
ans = ""
i = len(s)
j = len(t)
while i > 0 and j > 0:
    if dp[i][j] == dp[i-1][j]:
        i -= 1
    elif dp[i][j] == dp[i][j-1]:
        j -= 1
    else:
        ans = s[i-1] + ans
        i -= 1
        j -= 1

print(ans)

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

dp = [[0 for i in range(len(s)+2)] for j in range(len(t)+2)]

for i in range(len(s)):
    for j in range(len(t)):
        if s[i] == t[j]:
            dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j] + 1)
        dp[i+1][j+1] = max(dp[i+1][j+1], dp[i+1][j], dp[i][j+1])
        
ans = ""
i = len(s)
j = len(t)
while i > 0 and j > 0:
    if dp[i][j] == dp[i-1][j]:
        i -= 1
    elif dp[i][j] == dp[i][j-1]:
        j -= 1
    else:
        ans = s[i-1] + ans
        i -= 1
        j -= 1

print(ans)

Fixed submission:
s = input()
t = input()

dp = [[0 for i in range(3010)] for j in range(3010)]

for i in range(len(s)):
    for j in range(len(t)):
        if s[i] == t[j]:
            dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j] + 1)
        dp[i+1][j+1] = max(dp[i+1][j+1], dp[i+1][j], dp[i][j+1])
        
ans = ""
i = len(s)
j = len(t)
while i > 0 and j > 0:
    if dp[i][j] == dp[i-1][j]:
        i -= 1
    elif dp[i][j] == dp[i][j-1]:
        j -= 1
    else:
        ans = s[i-1] + ans
        i -= 1
        j -= 1

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

xyh = []
max_h = 0
for i in range(N):
    x = list(map(int, input().split()))
    xyh.append(x)
    if max_h < x[2]:
        max_h = x[2]

flag = False    
while True:
    for i in range(101):
        for j in range(101):
            count = 0
            for k in range(3):
                if xyh[k][2] == max(max_h - abs(xyh[k][0] - i) - abs(xyh[k][1] - j), 0):
                    count += 1
            if count == 3:
                cx = i
                cy = j
                H = max_h
                flag = True
                break
        if flag == True:
            break
            
    max_h += 1
    if flag == True:
        break

print(cx, cy, H)

Fixed submission:
N=int(input())
a=[list(map(int,input().split())) for i in range(N)]
flag=False
for cx in range(101):
    if flag:
        break
    for cy in range(101):
        count=0
        if flag:
            break
        for i in range(N):
            if a[i][2]!=0:
                if count==0:
                    H=a[i][2]+abs(cx-a[i][0])+abs(cy-a[i][1])
                    count+=1
                if H!=a[i][2]+abs(cx-a[i][0])+abs(cy-a[i][1]):
                    break
            if i==N-1:
                x=cx
                y=cy
                flag=True
                for k in range(N):
                    if a[k][2]!=max(H-abs(x-a[k][0])-abs(y-a[k][1]),0):
                        flag=False
print(x,y,H)
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input())

if A*B % 2 == 0:
    print("No")
else:
    print("Yes")

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

if A*B % 2 == 0:
    print("No")
else:
    print("Yes")
Buggy python submission (verdict: Runtime Error):
N = int(input())

W = []
for i in range(N):
    if i == 0:
        x = input()
        W.append(x)
    else:
        x = input()
        if x in W:
            print("No")
            exit()
        elif W[i-1][len(W[i-1]) - 1] != x[0]:
            print("No")
        else:
            W.append(x)

print("Yes")

Fixed submission:
N = int(input())

W = []
for i in range(N):
    if i == 0:
        x = input()
        W.append(x)
    else:
        x = input()
        if x in W:
            print("No")
            exit()
        elif W[i-1][-1] != x[0]:
            print("No")
            exit()
        else:
            W.append(x)

print("Yes")