Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
Jupyter Notebook
Untitled
(unsaved changes)
Current Kernel Logo
Python 3 
File
Edit
View
Insert
Cell
Kernel
Widgets
Help

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

if A == B and B == C:
    re = 'Yes'
else:
    re = 'No'
    
print(re)
A, B, C = list(map(int, input().split()))
​
if A == B and B == C:
    re = 'Yes'
else:
    re = 'No'
    
print(re)
3 4 5
No
1
N = int(input())
s = input()
​
R = 0
B = 0
for c in s:
    if c == 'R':
        R += 1
    else:
        B +=1
        
if R > B:
    re = 'Yes'
else:
    re = 'No'
    
print(re)
4
BRBR
No
​


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

R = 0
B = 0
for c in s:
    if c == 'R':
        R += 1
    else:
        B +=1
        
if R > B:
    re = 'Yes'
else:
    re = 'No'
    
print(re)
Buggy python submission (verdict: Runtime Error):
import collections
N = int(input())
a = []
s = 0
for i in range(N):
    a.append(int(input()))
    s += a[i]

if N >= 2:
    if s == N or s == len(collections.Counter(a)):
        if s % 2 ==0:
            re = 'second'
        else:
            re = 'first'
    else:
        a.sort()
        diff = a[-1] - a[-2]
        if diff > 0:
            if diff % 2 == 0:
                re = 'second'
            else:
                re = 'first'
else:
    if a[0] % 2==0:
        re = 'second'
    else:
        re = 'first'
    
print(re)

Fixed submission:
N = int(input())
a = []
s = 0
for i in range(N):
    a.append(int(input()))
    if a[i] % 2 == 0:
        s += 1
        
if s == N:
    re = 'second'
else:
    re = 'first'
    
print(re)

Buggy python submission (verdict: Runtime Error):
N = int(input())
a = []
s = 0
for i in range(N):
    a.append(int(input()))

a.sort()
diff = a[-1] - a[-2]
if diff % 2 == 0:
    re = 'second'
else:
    re = 'first'
    
print(re)

Fixed submission:
N = int(input())
a = []
s = 0
for i in range(N):
    a.append(int(input()))
    if a[i] % 2 == 0:
        s += 1
        
if s == N:
    re = 'second'
else:
    re = 'first'
    
print(re)
Buggy python submission (verdict: Runtime Error):
N, M , X, Y = list(map(int, input().split()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))

min_y = min(y)
max_x = max(x)

count_x = sum(min_y < Z for t in x)

re = 'War'
if count_x == N : # and count_y == M:
    if  X < min_y and min_y <= Y:
        re = 'No War'
    elif X < max_x + 1 and max_x + 1 <= Y:
        re = 'No War'
    
print(re)

Fixed submission:
N, M , X, Y = list(map(int, input().split()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))

min_y = min(y)
max_x = max(x)

count_x = sum(t < min_y for t in x)

re = 'War'
if count_x == N : # and count_y == M:
    if  X < min_y and min_y <= Y:
        re = 'No War'
    elif X < max_x + 1 and max_x + 1 <= Y:
        re = 'No War'
    
print(re)
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
T = input()

for i in range(len(S)):
    s = S[i]
    t = T[i]
    
    # 文字列の入れ替
    S = S.replace(s, '0')
    S = S.replace(t, s)
    S = S.replace('0', t)

            
if S == T:
    re = 'Yes'
else:
    re = 'No'
    
print(re)

Fixed submission:
S = input()
T = input()

def count_string(strInput):
    tmp = {}
    for s in strInput:
        if s in tmp:
            tmp[s] += 1
        else:
            tmp[s] = 1
    
    re = [tmp[a] for a in tmp]
    re = sorted(re)
    return re

S_count = count_string(S)
T_count = count_string(T)

if S_count == T_count:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
T = input()

def count_string(strInput):
    tmp = {}
    for s in strInput:
        cnt = strInput.count(s)
        tmp[s] = cnt
    
    re = [tmp[a] for a in tmp]
    re.sort()
    return re

S_count = count_string(S)
T_count = count_string(T)

if S_count == T_count:
    print('Yes')
else:
    print('No')

Fixed submission:
S = input()
T = input()

def count_string(strInput):
    tmp = {}
    for s in strInput:
        if s in tmp:
            tmp[s] += 1
        else:
            tmp[s] = 1
    
    re = [tmp[a] for a in tmp]
    re = sorted(re)
    return re

S_count = count_string(S)
T_count = count_string(T)

if S_count == T_count:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
# C
N,K = list(map(int,input().split()))
x = list(map(int,input().split()))

def binarySearch(D, target):
    left = 0
    right = len(D)
    while left < right:
        mid = (left + right) // 2
        if D[mid] == target:
            return mid, 0
        elif target < D[mid]:
            right = mid
        else:
            left = mid + 1
    return mid, 1

# 全てが正の場合
if x[0] >= 0:
    re = x[K-1]
# 全てが負の場合
elif x[-1] <= 0:
    re = abs(x[-K]) # 絶対値
else:
    zero, plus = binarySearch(x, 0)
    s = zero + plus
    e = s + K +1
    if e > N:
        s = s - (e - N) + 1
        e = N - 1
    if N == K:
        s = 0
        e = N
    d_plus = x[e]
    d_minor =  abs(min(x[s], 0)) 
    d_min = 2 * min(d_plus, d_minor) + max(d_plus, d_minor)
    while True:
        d_plus = x[e]
        if d_plus < 0:
            d_plus = 0
        d_minor =  abs(min(x[s], 0)) 
        d = 2 * min(d_plus, d_minor) + max(d_plus, d_minor)
        d_min = min(d_min, d)
#        print(x[s], x[e], d_min)
        e -= 1
        s -= 1
        if e < zero + plus or s < 0:
            break
    re = d_min
    
print(re)

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

s = 0
e = K - 1

re = min(abs(x[s]) + abs(x[s] - x[e]), abs(x[e]) + abs(x[e] - x[s]))
while e < N:
    tmp = min(abs(x[s]) + abs(x[s] - x[e]), abs(x[e]) + abs(x[e] - x[s]))
    re = min (re, tmp)
    s += 1
    e += 1
    
print(re)
Buggy python submission (verdict: Runtime Error):
# B
import math
N = int(input())

def make_prime_list(num):
    if num < 2:
        return []

    prime_list = [i for i in range(num + 1)]
    prime_list[1] = 0 # 1は素数ではない
    num_sqrt = math.sqrt(num)

    for prime in prime_list:
        if prime == 0:
            continue
        if prime > num_sqrt:
            break

        for non_prime in range(2 * prime, num, prime):
            prime_list[non_prime] = 0

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

def search_divisor_num(num):
    if num < 0:
        return None
    elif num == 1:
        return 1
    else:
        num_sqrt = math.floor(math.sqrt(num))
        prime_list = make_prime_list_2(num_sqrt)

        divisor_num = 1
        for prime in prime_list:
            count = 1
            while num % prime == 0:
                num //= prime
                count += 1
            divisor_num *= count

        if num != 1:
            divisor_num *= 2

        return divisor_num

re = 0
for i in range(1, N+1, 2):
    num = search_divisor_num(i)
    if num == 8:
        re += 1
        
print(re)

Fixed submission:
import math
N = int(input())

def make_prime_list(num):
    if num < 2:
        return []

    prime_list = [i for i in range(num + 1)]
    prime_list[1] = 0 # 1は素数ではない
    num_sqrt = math.sqrt(num)

    for prime in prime_list:
        if prime == 0:
            continue
        if prime > num_sqrt:
            break

        for non_prime in range(2 * prime, num, prime):
            prime_list[non_prime] = 0

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

def search_divisor_num(num):
    if num < 0:
        return None
    elif num == 1:
        return 1
    else:
        num_sqrt = math.floor(math.sqrt(num))
        prime_list = make_prime_list(num_sqrt)

        divisor_num = 1
        for prime in prime_list:
            count = 1
            while num % prime == 0:
                num //= prime
                count += 1
            divisor_num *= count

        if num != 1:
            divisor_num *= 2

        return divisor_num

re = 0
for i in range(1, N+1, 2):
    num = search_divisor_num(i)
    if num == 8:
        re += 1
        
print(re)
Buggy python submission (verdict: Runtime Error):
import math

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

def f(m, a):
    re = 0
    for i in a:
        re += m % i
    return re

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

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

m = lcm_list(a) - 1
print(f(m, a))

Fixed submission:
import fractions
from functools import reduce

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

def f(m, a):
    re = 0
    for i in a:
        re += m % i
    return re

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

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

m = lcm_list(a) - 1
print(f(m, a))

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

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

def f(m, a):
    re = 0
    for i in a:
        re += m % i
    return re

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

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

m = lcm_list(a) - 1
print(f(m, a))

Fixed submission:
import fractions
from functools import reduce

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

def f(m, a):
    re = 0
    for i in a:
        re += m % i
    return re

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

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

m = lcm_list(a) - 1
print(f(m, a))
Buggy python submission (verdict: Time Limit Exceeded):
# Q_C
N = int(input())
A = list(map(int, input().split()))
import numpy as np

A = np.array(A)
I = np.array(list(range(1, N + 1)))
G = A - I
#print(G)
b = np.min(G)
#print(b)

re = -1
if b == 0:
    G = np.absolute(G)
    re = np.sum(G)
else:
    uG = np.unique(G)
    for i in uG:
        temp = np.sum(np.absolute(G - np.full(N , i)))
#        print(temp)
        if re > temp or re == -1:
            re = temp
print(int(re))

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

import numpy as np
import collections

A = np.array(A)
I = np.array(list(range(1, N + 1)))

G = A - I

b = np.median(G)
G = np.absolute(G - np.full(N, b))
re = np.sum(G)

print(int(re))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()

cnt = N
for i in range(1, N + 1):
    tmp = S[:i-1].count('W') + S[i:].count('E')#changeDirection(S, i, N)
    if tmp < cnt:
        cnt = tmp
        
print(cnt)

Fixed submission:
def EW(x, char):
    re = 0
    if x == char:
        re = 1
    return re
        
def main(num, string):
    e = list(map(lambda x:EW(x, 'E'), string))
    w = list(map(lambda x:EW(x, 'W'), string))
    
    for i in range(1, num):
        w[i] = w[i-1] + w[i]
        e[num - i -1] = e[num - i  - 1] + e[num - i]
    
    w.insert(0, 0)
    w.insert(num+1,0)
    e.insert(0, 0)
    e.insert(num+1, 0)
    cnt = num
    for i in range(1, num + 1):
        tmp = w[i-1] + e[ i + 1]
        if tmp < cnt:
            cnt = tmp
    return cnt

num = int(input())
string = input()
 
print(main(num, string))

Buggy python submission (verdict: Time Limit Exceeded):
# Q3

N = int(input())
S = input()

def changeDirection(S, L, N):
    Sb = S[:L-1].count('W')
    Sa = S[L:].count('E')
    return Sb + Sa

cnt = N
for i in range(1, N + 1):
    tmp = changeDirection(S, i, N)
    if tmp < cnt:
        cnt = tmp
        
print(cnt)

Fixed submission:
def EW(x, char):
    re = 0
    if x == char:
        re = 1
    return re
        
def main(num, string):
    e = list(map(lambda x:EW(x, 'E'), string))
    w = list(map(lambda x:EW(x, 'W'), string))
    
    for i in range(1, num):
        w[i] = w[i-1] + w[i]
        e[num - i -1] = e[num - i  - 1] + e[num - i]
    
    w.insert(0, 0)
    w.insert(num+1,0)
    e.insert(0, 0)
    e.insert(num+1, 0)
    cnt = num
    for i in range(1, num + 1):
        tmp = w[i-1] + e[ i + 1]
        if tmp < cnt:
            cnt = tmp
    return cnt

num = int(input())
string = input()
 
print(main(num, string))
Buggy python submission (verdict: Runtime Error):
import math
n = input()
n = int(n.replace(' ', ''))

re = 'No'
for n == int(math.sqrt(n) ** 2):
    re = 'Yes'
        
print(re)

Fixed submission:
import math
a, b = list(map(str,input().split()))
re = 'No'
concat = int(a + b)
# print(concat, math.sqrt(concat) ** 2, math.sqrt(concat))
if concat == int(math.sqrt(concat)) ** 2:
    re = 'Yes'
    
print(re)
Buggy python submission (verdict: Runtime Error):
SD = input()
T = input()

ans = ''

for i in range(0, len(SD) - len(T)+1):
    flg = True
    for j in range(len(T)):
        if SD[i+j] == '?' or SD[i+j] == T[j]:
            continue
        else:
            flg = False
    if flg == True:
        ans = SD[0:i] + T + S[i+len(T):]
            
if ans:
    ans = ans.replace('?', 'a')
else:
    ans = 'UNRESTORABLE'
    
print(ans)

Fixed submission:
SD = input()
T = input()

ans = ''

for i in range(0, len(SD) - len(T)+1):
    flg = True
    for j in range(len(T)):
        if SD[i+j] == '?' or SD[i+j] == T[j]:
            continue
        else:
            flg = False
    if flg == True:
        ans = SD[0:i] + T + SD[i+len(T):]
            
if ans:
    ans = ans.replace('?', 'a')
else:
    ans = 'UNRESTORABLE'
    
print(ans)

Buggy python submission (verdict: Runtime Error):
SD = input()
T = input()

ans = ''

for i in range(0, len(SD) - len(T)+1):
    flg = True
    for j in range(len(T)):
        if SD[i+j] == '?' or SD[i+j] == T[j]:
            continue
        else:
            flg = False
    if flg == True:
        ans = SD[:i] + T + S[i+len(T):]
            
if ans:
    ans = ans.replace('?', 'a')
else:
    ans = 'UNRESTORABLE'
    
print(ans)

Fixed submission:
SD = input()
T = input()

ans = ''

for i in range(0, len(SD) - len(T)+1):
    flg = True
    for j in range(len(T)):
        if SD[i+j] == '?' or SD[i+j] == T[j]:
            continue
        else:
            flg = False
    if flg == True:
        ans = SD[0:i] + T + SD[i+len(T):]
            
if ans:
    ans = ans.replace('?', 'a')
else:
    ans = 'UNRESTORABLE'
    
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int, input().split()))

mindiff = 10 ** 9 * 2 * 10 ** 5 + 1
for i in range(N-1):
    s1 = sum(a[0:i + 1])
    s2 = sum(a[i+1:])
    mindiff = min(mindiff, abs(s1 - s2))
    
print(mindiff)

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

mindiff = 10 ** 9 * 2 * 10 ** 5 + 1
s1 = 0
s2 = sum(a)
for i in range(N-1):
    s1 += a[i]
    s2 -= a[i]
    mindiff = min(mindiff, abs(s1 - s2))
    
print(mindiff)
Buggy python submission (verdict: Time Limit Exceeded):
import queue
inf = float('inf')
N = int(input())
paths = [{} for i in range(N+1)]
for i in range(N-1):
    s,t = list(map(int, input().split()))
    paths[s][t] = 1
    paths[t][s] = 1

def dijkstra(start, nodes, N):
    fixed = {}
    cost = [inf] * (N + 1)
    cost[start] = 0
    q = queue.PriorityQueue()
    q.put((0, start))
    while q.empty() == False:
        w, x = q.get()
        if cost[x] < w: continue
        for y in nodes[x]:
            if cost[x] + paths[x][y] < cost[y]:
                cost[y] = cost[x] + paths[x][y]
                q.put((cost[y], y))
    return cost

# それぞれの位置からの到達コストを調べている
score_f = dijkstra(1, paths, N)
score_s = dijkstra(N, paths, N)

score = 0
for i in range(1, N+1):
    if score_f[i] > score_s[i]:
        score -= 1
    else:
        score += 1

if score > 0:
    print("Fennec")
else:
    print("Snuke")


Fixed submission:
#import queue
import heapq
inf = float('inf')
N = int(input())
paths = [{} for i in range(N+1)]
for i in range(N-1):
    s,t = list(map(int, input().split()))
    paths[s][t] = 1
    paths[t][s] = 1

def dijkstra(start, nodes, N):
    cost = [inf] * (N + 1)
    cost[start] = 0
    q = []
    heapq.heappush(q, (0, start))
#    q.put((0, start))
    while q: #q.empty() == False:
        w, x = heapq.heappop(q)
        if cost[x] < w: continue
        for y in nodes[x]:
            if cost[x] + paths[x][y] < cost[y]:
                cost[y] = cost[x] + paths[x][y]
#                q.put((cost[y], y))
                heapq.heappush(q, (cost[y], y))
    return cost

# それぞれの位置からの到達コストを調べている
score_f = dijkstra(1, paths, N)
score_s = dijkstra(N, paths, N)

score = 0
for i in range(1, N+1):
    if score_f[i] > score_s[i]:
        score -= 1
    else:
        score += 1

if score > 0:
    print("Fennec")
else:
    print("Snuke")
Buggy python submission (verdict: Time Limit Exceeded):
K, S = list(map(int, input().split()))
re = 0
for x in range(K+1):
    for y in range(K+1):
        z = min(K, max(0, S-x-y))
        if x + y + z == S:
            re += 1
print(re)

Fixed submission:
K, S = list(map(int, input().split()))
re = 0
for x in range(min(S+1, K+1)):
    for y in range(min(S+1-x, K+1)):
        if S - x - y <= K:
            re += 1
print(re)
Buggy python submission (verdict: Time Limit Exceeded):
N, T = list(map(int, input().split()))
A = list(map(int, input().split()))

re = 0
max_dif = 0
for i in range(1, N):
    dif = A[i] - min(A[0:i])
    if max_dif < dif:
        max_dif = dif
        re = 1
    elif dif == max_dif:
        re += 1

print(re)

Fixed submission:
N, T = list(map(int, input().split()))
A = list(map(int, input().split()))

re = 0
max_dif = 0
A_min = A[0]
for i in range(1, N):
    A_min = min(A_min, A[i-1])
    dif = A[i] - A_min
    if max_dif < dif:
        max_dif = dif
        re = 1
    elif dif == max_dif:
        re += 1

print(re)
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
lst=[list(map(int,input().split()))]
for i in range(n-1):
    a=list(map(int,input().split()))
    x=0
    for j in range(len(lst)):
        if x > m :break
        if lst[j][0] > a[0]:
            lst.insert(j,a)
            break
        x+=lst[j][1]
        
ans=0
num=0
for i in lst:
    if i[1]+num>=m:
        ans+=i[0]*(m-num)
        break
    ans+=i[0]*i[1]
    num+=i[1]
print(ans)

Fixed submission:
H,W=map(int,input().split())
h,w=map(int,input().split())
print(H*W-H*w-h*W+h*w)

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
lst=[list(map(int,input().split()))]
for i in range(n-1):
    a=list(map(int,input().split()))
    x=0
    for j in range(len(lst)):
        if x > m :break
        if lst[j][0] > a[0]:
            lst.insert(j,a)
            break
        x+=lst[j][1]
        
ans=0
num=0
for i in lst:
    if i[1]+num>=m:
        ans+=i[0]*(m-num)
        break
    ans+=i[0]*i[1]
    num+=i[1]
print(ans,lst)

Fixed submission:
H,W=map(int,input().split())
h,w=map(int,input().split())
print(H*W-H*w-h*W+h*w)
Buggy python submission (verdict: Runtime Error):
n=int(input())
lst=list(map(int,input().split()))
dp=[0]*n
dp[1]=abs(lst[0]-lst[1])
for i in range(2,n):
    dp[i]=min(dp[i-1]+abs(lst[i]-lst[i-1]),dp[i-2]+abs(lst[i]-lst[i-2]))
print(dp[i-1])

Fixed submission:
n=int(input())
lst=list(map(int,input().split()))
dp=[0]*n
dp[1]=abs(lst[0]-lst[1])
for i in range(2,n):
    dp[i]=min(dp[i-1]+abs(lst[i]-lst[i-1]),dp[i-2]+abs(lst[i]-lst[i-2]))
print(dp[n-1])
Buggy python submission (verdict: Runtime Error):
N,T=map(int,input().split())
s=2000
for i in range(N):
    a,b=map(int,input().split())
    if b<=T:s=min(s,a)
print(s if ans<2000 else "TLE")


Fixed submission:
N,T=map(int,input().split())
ans=2000
for i in range(N):
    a=list(map(int,input().split()))
    if a[1]<=T:ans=min(ans,a[0])
print(ans if ans<2000 else "TLE")
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a+b=15:print("+")
elif a*b=15:print("*")
else:print("x")

Fixed submission:
a,b=map(int,input().split())
if a+b==15:print("+")
elif a*b==15:print("*")
else:print("x")
Buggy python submission (verdict: Runtime Error):
s=input()
n=input()
a=[]
for i in range(0,len(s),n):
	a.append(s[i])
print(*a,sep="")

Fixed submission:
s=input()
n=int(input())
a=[]
for i in range(0,len(s),n):
	a.append(s[i])
print(*a,sep="")
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=list(map(int,input().split()))
s.sort()
c=0
if len(s)==2:
    ans=[max(s),min(s)]
for i in range(n//2,n):
    for j in s:
        if s[i]//2-2<=j<=s[i]//2+2:
            bunsi=bunbo=1
            for k in range(j):
                bunsi*=(s[i]-k)
                bunbo*=k+1
            if c<=bunsi//bunbo:
                c=bunsi//bunbo
                ans=[s[i],j]
print(*ans)

Fixed submission:
n=int(input())
s=list(map(int,input().split()))
s.sort()
c=float("inf")
a=max(s)
for i in s[0:n]:
    x=abs(a/2-i)
    if x<c:
        c=x
        b=i
print(a,b)
Buggy python submission (verdict: Runtime Error):
abcde,fghihgf,edcba

Fixed submission:
s=input().split(",")
print(*s,sep=" ")
Buggy python submission (verdict: Runtime Error):
a,b = map(int, input().split())
if a > b:
  print(2a - 1)
elif a == b:
  print(2a)
else:
  print(2b -1)

Fixed submission:
a, b = map(int, input().split())
if a > b :
  print(a + a -1)
elif a == b:
  print(a + b)
else:
  print(b + b - 1)

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
if a > b :
  print('a + a -1')
elif a = b:
  print('a + b')
else:
  print('b + b - 1')


Fixed submission:
a, b = map(int, input().split())
if a > b :
  print(a + a -1)
elif a == b:
  print(a + b)
else:
  print(b + b - 1)

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
if a >= b + 1:
  print(a + a -1)
elif a = b:
  print(a + b)
else:
  print(b + b - 1)

Fixed submission:
a, b = map(int, input().split())
if a > b :
  print(a + a -1)
elif a == b:
  print(a + b)
else:
  print(b + b - 1)
Buggy python submission (verdict: Runtime Error):
s = input()
a = s[::2].count('0') + s[1::2].count('1')
a = s[::2].count('1') + s[1::2].count('0')
print(min(a, b))

Fixed submission:
s = input()
a = s[::2].count('0') + s[1::2].count('1')
b = s[::2].count('1') + s[1::2].count('0')
print(min(a, b))

Buggy python submission (verdict: Runtime Error):
s = input()
a = s[::2].count('0') + s[1::2].count('1')
a = s[::2].count('1') + s[1::2].count('0')
print(min(a, b))

Fixed submission:
s = input()
a = s[::2].count('0') + s[1::2].count('1')
b = s[::2].count('1') + s[1::2].count('0')
print(min(a, b))

Buggy python submission (verdict: Runtime Error):
s = input()
a = s[::2].count(0) + s[1::2].count(1)
b = s[::2].count(1) + s[1::2].count(0)
print(min(a, b))

Fixed submission:
s = input()
a = s[::2].count('0') + s[1::2].count('1')
b = s[::2].count('1') + s[1::2].count('0')
print(min(a, b))

Buggy python submission (verdict: Runtime Error):
s = input()
a = s[::2].count(0) + s[1::2].count(1)
b = s[::2].count(1) + s[1::2].count(0)
print(min(a, b)

Fixed submission:
s = input()
a = s[::2].count('0') + s[1::2].count('1')
b = s[::2].count('1') + s[1::2].count('0')
print(min(a, b))
Buggy python submission (verdict: Runtime Error):
b = input()
if b = 'A':
  print'T'
elif b = 'T':
  print'A'
elif b = 'C':
  print'G'
else:
  print'C'

Fixed submission:
b = input()
if b == 'A':
  print('T')
elif b == 'T':
  print('A')
elif b == 'C':
  print('G')
else:
  print('C')
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = list(map(int, input().split()))

center = A.index(1)
left_block = center + 1
right_block = len(A) - center

left_num = 0
if left_block > K:
    tmp = left_block
    while tmp > 0:
        tmp = tmp - K + 1
        left_num += 1
        if tmp == K:
            left_num -= 1
elif 2 <= left_block <= K:
    left_num = 1

right_num = 0
if right_block > K:
    tmp = right_block
    while tmp > 0 :
        tmp = tmp - K + 1
        right_num += 1
        if tmp == K:
            right_num -= 1
elif 2 <= right_block <= K:
    right_num = 1

print(left_num + right_num)

# D
K = int(input())

Fixed submission:
import math

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

print(math.ceil((N-1)/(K-1)))