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

Fixed submission:
r = int(input())
S = 3 * r * r
print(S)

Buggy submission (verdict: Runtime Error):
def main():
    a = int(input())
    lists= [int(input()) for _ in range(a)]
 
    temp = lists.copy()
    first = max(temp)
    temp.remove(first)
    second = max(temp)
 
    for i in range(a):
        if lists[i] == first:
            print(second)
        else:
            print(first)
 
if __name__ == '__main__' :
    main()
Problem p02971 (python)

Fixed submission:
def main():
    a = int(input())
    lists= [int(input()) for _ in range(a)]
 
    temp = lists.copy()
    first = max(temp)
    temp.remove(first)
    second = max(temp)
 
    for i in range(a):
        if lists[i] == first:
            print(second)
        else:
             print(first)
 
if __name__ == '__main__' :
    main()

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

N = int(input())
A = []
for i in range(N):
    A.append(input())

A = np.array(A)

for i in range(N):
    print(max(np.delete(A, [i], axis=0)))
Problem p03385 (python)

Fixed submission:
S = input()
S1 = list(S)
S1.sort()

if S1 == ["a", "b", "c"]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
S = input()
S.list()
S.sort()

if S == ["a", "b", "c"]:
    print("Yes")
else:
    print("No")
Problem p03623 (python)

Fixed submission:
x,a,b = map(int, input().split())
if (abs(x-a) < abs(x-b)):
    print("A")
else:
    print("B")

Buggy submission (verdict: Runtime Error):
x,a,b = map(int, input().split())
if (abs(x-a) > abc(x-b)):
    print("A")
else:
    print("B")
Problem p04043 (python)

Fixed submission:
A,B,C = map(int, input().split())
list_num = [A,B,C]
list_num.sort()

if list_num==[5,5,7]:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
N,K = map(int, input().split())
kirai = [int(i) for i in input().split()] 
usable_num = [1,2,3,4,5,6,7,8,9]
for x in kirai:
    usable_num.remove(x)
    
ketasu = len(str(N))
#print(ketasu)
s = 0
for d in range(ketasu):
    s += min(usable_num) * 10 ** d 

if s >= N:
    print(s)
else:
    print(N+min(usable_num))
Problem p02789 (python)

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

if N == M: 
    print ('Yes')
else: 
    print ('No')

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

if N == M: print 'Yes'
else: print 'No'
Problem p02791 (python)

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

ans = 0
min_v = P[0]

for i in range(0, N):
    if P[i] <= min_v:
        ans += 1
        min_v = P[i]

print (ans)

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

ans = 0
min_v = N


for i in range(0, N):
    if P[i] > min_v: 
        continue
    else:
        min_v = min(P[:i])
        if P[i] <= min_v:
            ans += 1
            min_v = P[i]

print (ans)

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

ans = 0
min = N
for i in range(0, N):
    if i > min:
        continue:
    for j in range(0, i+1):
        if P[i] > P[j]:
            break

        if i == j:
            ans += 1
            min = i

print (ans)
Problem p02947 (python)

Fixed submission:
N = int(input())
dic = {}
count = 0


for i in range(N):
    s = input()
    s_sorted = "".join(sorted(s))
    count += dic.get(s_sorted, 0)
    dic[s_sorted] = dic.get(s_sorted, 0) + 1

print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
s = []
cnt = 0

for i in range(N):
    s.append(input())

for i in range(N):
    for j in range(i+1, N):
        for k in range(len(s[i])):
          	tmp = s[i]
            tmp = s[i].replace(s[j][k], "")
        if tmp == "":
            cnt += 1
        else:
            continue
            
print(cnt)
Problem p02953 (python)

Fixed submission:
N = int(input())
H = list(map(int, input().split()))
ans = 'Yes'

H[0] -= 1
for i in range(N-1):
    if H[i] < H[i+1]:
        H[i+1] -= 1
    elif H[i] > H[i+1]:
        ans = 'No'
        break

print(ans)

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

H[0] -= 1
for i in range(N-1):
    if H[i] < H[i+1]
        H[i+1] -= 1
    elif H[i] > H[i+1]
        ans = 'No'
        break

print(ans)
Problem p02999 (python)

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

if X < A: print(0)
else: print(10)

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

if X < A: print(0)
else: print()10

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

if X < A: print(0)
else print()10
Problem p03369 (python)

Fixed submission:
price = 700

s = input()
if s[0] == 'o':
    price += 100
if s[1] == 'o':
    price += 100
if s[2] == 'o':
    price += 100

print (price)

Buggy submission (verdict: Runtime Error):
price = 700

S = input()
if s[0] == 'o':
    price += 100
if s[1] == 'o':
    price += 100
if s[2] == 'o':
    price += 100
       
print (price)
Problem p03371 (python)

Fixed submission:
A, B, C, X, Y = map(int, input().split())
ans = 0

if A + B <= 2*C:
    ans = A*X + B*Y
else:
    ans += 2*C*min(X, Y)

    if X >= Y:
        ans += min(A, 2*C) * (X-Y)
    else:
        ans += min(B, 2*C) * (Y-X)

print (ans)

Buggy submission (verdict: Runtime Error):
A, B, C, X, Y = map(int, input().split())
ans = 0

if A + B <= C:
    ans = A*X + B*Y
else:
    ans += 2*C*min(X, Y)

    if X >= Y:
        ans + = A*(X-Y)
    else:
        ans + = B*(X-Y)

print (ans)
Problem p03501 (python)

Fixed submission:
N, A, B = map(int, input().split())
ans = min(N*A, B) 

print (ans)

Buggy submission (verdict: Runtime Error):
N, A, B = map(int, input.split())
ans = min(N*A, B) 

print (ans)
Problem p03502 (python)

Fixed submission:
N = int(input())
sum = 0

tmp = N
while (N >= 1):
    sum += N % 10
    N //= 10

if tmp % sum == 0:
    print ('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N = input()
sum = 0

tmp = N
while (N >= 1):
    sum += N % 10
    N /= 10

if tmp % sum == 0:
    print ('Yes')
else:
    print('No')
Problem p03543 (python)

Fixed submission:
N = input()
if (N[0] == N[1] == N[2]) or (N[1] == N[2] == N[3]):
    print("Yes")
else:
    print("No")

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

if N[0] == N[1] and N[1]== N[2]:
    print ('Yes')
elif N[1] == N[2] and N[2]== N[3]:
    print ('Yes')
elif N[2] == N[3] and N[3]== N[4]:
    print ('Yes')
elif N[0] == N[1] and N[1]== N[2] and N[2]== N[3]:
    print ('Yes')
else:
    print ('No')

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

if N[0] == N[1] and N[1]== N[2]:
    print ('Yes')
elif N[1] == N[2] and N[2]== N[3]:
    print ('Yes')
elif N[2] == N[3] and N[3]== N[4]:
    print ('Yes')
elif N[0] == N[1] and N[1]== N[2] and N[2]== N[3]:
    print ('Yes')
else:
    print ('No')

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

if N[0] == N[1] and N[1]== N[2]:
    print ('Yes')
elif N[1] == N[2] and N[2]== N[3]:
    print ('Yes')
elif N[2] == N[3] and N[3]== N[4]:
    print ('Yes')
elif N[0] == N[1] and N[1]== N[2] and N[2]== N[3]:
    print ('Yes')
else:
    print ('No')

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

if N[0] == N[1] and N[1]== N[2]:
    print ('Yes')
elif N[1] == N[2] and N[2]== N[3]:
    print ('Yes')
elif N[2] == N[3] and N[3]== N[4]:
    print ('Yes')
elif N[0] == N[1] and N[1]== N[2] and N[2]== N[3]:
    print ('Yes')
else:
    print ('No')
Problem p03544 (python)

Fixed submission:
N = int(input())
L = [ 0 ] * 1000000

L[0] = 2
L[1] = 1

for i in range(2, N+1):
  L[i] = L[i-2] + L[i-1]

print (L[N])

Buggy submission (verdict: Runtime Error):
N = int(input())
L = [ 0 ] * 86

L[0] = 2
L[1] = 1

for i in range(2, N+1):
  L[i] = L[i-2] + L[i-1]

print (L[N])

Buggy submission (verdict: Runtime Error):
N = int(input())
L = [ 0 ] * 86

L[0] = 2
L[1] = 1

for i in range(2, N):
    L[i] = L[i-2] + L[i-1]

print (L[N])
Problem p03545 (python)

Fixed submission:
abcd = input()
a = int(abcd[0])
b = int(abcd[1])
c = int(abcd[2])
d = int(abcd[3])

op = ["+", "-"]
for op1 in op:
    for op2 in op:
        for op3 in op:
            val = a
            if op1 == "+":
                val += b
            else:
                val -= b
 
            if op2 == "+":
                val += c
            else:
                val -= c
 
            if op3 == "+":
                val += d
            else:
                val -= d
            
            if val==7:
                print("{}{}{}{}{}{}{}=7".format(a,op1,b,op2,c,op3,d))
                exit(0)

Buggy submission (verdict: Runtime Error):
abcd = input()
a = int(abcd[0])
b = int(abcd[1])
c = int(abcd[2])
d = int(abcd[3])

op = ["+", "-"]
for op1 in op:
    for op2 in op:
        for op3 in op:
            val = a
            if op1 == "+":
                val += b
            else:
                val -= b

            if op2 == "+":
                val += c
            else:
                val -= c

            if op3 == "+":
                val += d
            else:
                val -= d

            if val==7:
                print("{}{}{}{}{}{}{}=7".format(a,op1,b,op2,c,op3,d))
                return
Problem p04043 (python)

Fixed submission:
num = list(map(int,input().split()))
if num.count(5) == 2 and num.count(7) == 1:
  print ('YES')
else:
  print('NO')

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

for i in range(N, 10*N+1):
    num = list(map(int,str(i)))
    match = list(set(num) & set(dislike))
    if len(match)==0:
        print(i)
        break

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

for i in range(N, 10*N+1):
    num = list(map(int,str(i)))
    match = list(set(num) & set(dislike))
    if len(match)==0:
        print(i)
        break

Buggy submission (verdict: Runtime Error):
num = list(map(int,input().split()))
if num.count(5) == 2 and num.count(7) == 1:
  print ('YES')
else:
  print('NO)
Problem p04045 (python)

Fixed submission:
N, K = map(int, input().split())
dislike = list(map(int, input().split()))
 
for i in range(N, 10*N+1):
    num = list(map(int,str(i)))
    match = list(set(num) & set(dislike))
    if len(match)==0:
        print(i)
        break

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

for i in range(N, 10*N+1):
    num = list(map(int,str(i)))
    match = list(set(i) & set(dislike))
    if len(match)==0:
        print(i)
        break
Problem p02945 (python)

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

Buggy submission (verdict: Runtime Error):
n = int(input())
d = {}
ans = 0
for i in range(n):
    s = ''.join(sorted(input()))
    if s in d.keys():
        ans += d[s]
        d[s] += 1
    d.setdefault(s, 1)
print(ans)
Problem p02995 (python)

Fixed submission:
from fractions import gcd
A, B, C, D = map(int, input().split())
lcm = int((C*D) / gcd(C, D))
print((B - (B//C + B//D - B//lcm)) -
      ((A-1) - ((A-1)//C + (A-1)//D - (A-1)//lcm)))

Buggy submission (verdict: Runtime Error):
from math import gcd, floor
A, B, C, D = map(int, input().split())
lcm = int((C*D) / gcd(C, D))
anti_b = B - (floor(B/C) + floor(B/D) - floor(B/lcm))
anti_a = (A-1) - (floor((A-1)/C) + floor((A-1)/D) - floor((A-1)/lcm))
print(anti_b-anti_a)

Buggy submission (verdict: Runtime Error):
import math
A, B, C, D = map(int, input().split())
lcm = int((C*D) / math.gcd(C, D))
print((B - (B//C + B//D - B//lcm)) - ((A-1) - ((A-1)//C + (A-1)//D - (A-1)//lcm)))

Buggy submission (verdict: Runtime Error):
import math
A, B, C, D = map(int, input().split())
lcm = int((C*D) / math.gcd(C, D))
print((B - (B//C + B//D - B//lcm)) -
      ((A-1) - ((A-1)//C + (A-1)//D - (A-1)//lcm)))

Buggy submission (verdict: Runtime Error):
import math
A, B, C, D = map(int, input().split())
lcm = int((C*D) / math.gcd(C, D))
print((B - (B//C + B//D - B//lcm)) -
      ((A-1) - ((A-1)//C + (A-1)//D - (A-1)//lcm)))
Problem p02811 (python)

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

if 500*K >= X:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
if 500*K >= X:
	print("Yes")
else:
	print("No")

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

if 500*K >= X:
	print("Yes")
else:
	print("No")
Problem p03103 (python)

Fixed submission:
N, M = map(int, input().split())
AB = [[int(a) for a in input().split()] for _ in range(N)]
AB = sorted(AB, key=lambda x: x[0])

sum = 0
remain_cnt = M
i = 0

while(True):
    if remain_cnt <= AB[i][1]:
        sum += remain_cnt * AB[i][0]
        break

    sum += AB[i][0] * AB[i][1]
    remain_cnt -= AB[i][1]
    i += 1

print(sum)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
AB = [[int(a) for a in input().split()] for _ in range(N)]
AB = sorted(AB, key=lambda x: x[0])

def f(remain_cnt, idx):
    if remain_cnt <= AB[idx][1]:
        return remain_cnt * AB[idx][0]
    return AB[idx][0] * AB[idx][1] + f(remain_cnt - AB[idx][1], idx + 1)

print(f(M, 0))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
AB = [[int(a) for a in input().split()] for _ in range(N)]
AB = sorted(AB, key=lambda x: x[0])

def f(remain_cnt, l):
    if remain_cnt <= l[0][1]:
        return remain_cnt * l[0][0]
    return l[0][0] * l[0][1] + f(remain_cnt - l[0][1], l[1:])

print(f(M, AB))
Problem p03282 (python)

Fixed submission:
S = input()
K = input()
if len(K) > 100:
    K = 110
else:
    K = int(K)


def main():
    if S[0] != '1':
        print(S[0])
        return

    for i in range(len(S)):
        if S[i] != '1':
            break

    if i == len(S) - 1:
        print('1')
        return

    if K <= i:
        print('1')
        return

    print(S[i])


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
S = input()
K = input()
if len(K) > 100:
    K = 110
else:
    K = int(K)


def main():
    if S[0] != '1':
        print(S[0])
        return

    i = 0
    while S[i] == '1':
        i += 1

    if K < i:
        print('1')
        return

    print(S[i])


if __name__ == '__main__':
    main()

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


def main():
    if S[0] != '1':
        print(S[0])
        return

    i = 0
    while S[i] == '1':
        i += 1

    if K < i:
        print('1')
        return

    print(S[i])


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

Fixed submission:

def read():
    h = int(input())
    w = int(input())
    n = int(input())
    return h, w, n


def calc(h, w, n):
    if h > w:
        w = h
    
    if n % w  == 0:
        return int(n / w)
    else:
        return int(n/w)+1


def main():
    print(calc(*read()))


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def read():
    h, w, n = input().splitlines()
    return h, w, n


def calc(h, w, n):
    if h>w:
        return int(n / h) + 1
    else:
        return int(n / w) + 1

def main():
    print(calc(*read()))


if __name__ == "__main__":
    main()
Problem p02848 (python)

Fixed submission:
def myinput():
    n = int(input())
    s = input()
    return n, s

def rot(n, s):
    z = ord('Z')
    chars = []

    for c in s:
        code = ord(c) + n
        if code > z:
            code -= 26
        chars.append(chr(code))
    return ''.join(chars)

def main():
    n, s = myinput()
    ret = rot(n, s)
    print(ret)

main()

Buggy submission (verdict: Runtime Error):
def myinput():
    n = input()
    s = input()
    return n, s

def rot(n, s):
    z = ord('Z')
    chars = []

    for c in s:
        code = ord(c) + n
        if code > z:
            code -= 26
        chars.append(chr(code))
    return ''.join(chars)

def main():
    n, s = myinput()
    ret = rot(n, s)
    print(ret)

main()
Problem p03062 (python)

Fixed submission:

import sys


def parse(file):
    n = int(file.readline().strip())
    nums = map(int, file.readline().split())
    return n, nums


def main(n, nums):
    minimum_abs = 1e20
    negatives = 0
    ans = 0

    for num in nums:
        if num < 0:
            a = - num
            negatives += 1
        else:
            a = num

        if a < minimum_abs:
            minimum_abs = a
        ans += a

    if negatives % 2 == 1:
        ans -= (minimum_abs * 2)

    return ans


if __name__ == '__main__':
    print(main(*parse(sys.stdin)))

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


def parse(file):
    n = int(file.readline().strip())
    nums = map(int, file.readline().split())
    return n, nums


def main(n, nums):
    minimum_abs = math.inf
    negatives = 0
    ans = 0

    for num in nums:
        if num < 0:
            a = - num
            negatives += 1
        else:
            a = num

        if a < minimum_abs:
            minimum_abs = a
        ans += a

    if negatives % 2 == 1:
        ans -= (minimum_abs * 2)

    return ans


if __name__ == '__main__':
    print(main(*parse(sys.stdin)))

Buggy submission (verdict: Runtime Error):
def parse(file):
    n = int(file.readline())
    nums = list(map(int, file.readline().split()))
    return n, nums


def main(n, nums):
    minimum_abs = abs(nums[0])
    negatives = 0
    ans = 0

    for num in nums:
        if num < 0:
            a = - num
            negatives += 1
        else:
            a = num

        if a < minimum_abs:
            minimum_abs = a
        ans += a

    if negatives % 2 == 1:
        ans -= minimum_abs * 2

    return ans


if __name__ == '__main__':
    print(main(*parse(sys.stdin)))

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


def parse(file):
    n = int(file.readline())
    nums = map(int, file.readline().split())
    return n, nums


def main(n, nums):
    minimum_abs = math.inf
    negatives = 0
    ans = 0

    for num in nums:
        if num < 0:
            a = - num
            negatives += 1
        else:
            a = num

        if a < minimum_abs:
            minimum_abs = a
        ans += a

    if negatives % 2 == 1:
        ans -= minimum_abs * 2

    return ans


if __name__ == '__main__':
    print(main(*parse(sys.stdin)))
Problem p02830 (python)

Fixed submission:
from collections import defaultdict
import sys
import math
from datetime import datetime
import re
import math
def sol(n, S, T):
    ans = ""
    for i in range(n):
        ans += S[i]
        ans += T[i]
    return ans





do_submit = True
#do_submit = False

def input_parse(input_str):
    lines = [x.strip() for x in input_str.split("\n") if x.strip()]
    parsed_lines = [list(map(str, line.split())) for line in lines]
    print(parsed_lines)
    # n = int(parsed_lines[0][0])
    # k = int(parsed_lines[0][1])
    S = parsed_lines[0][0]
    return S


if not do_submit:
    S = input_parse("""
    1905
    """)
    print(sol(S))

    S = input_parse("""
    0112
    """)
    print(sol(S))

    S = input_parse("""
    1700
    """)
    print(sol(S))

    S = input_parse("""
    0000
    """)
    print(sol(S))

    S = input_parse("""
    1001
    """)
    print(sol(S))



else:
    #A, B = list(map(int, input().split()))
    n = int(input())
    S, T = list(map(str, input().split()))
    # S = input()
    # T = input()
    print(sol(n, S, T))

    # S = input().strip()
    # print(sol(S))

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
import sys
import math
from datetime import datetime
import re
import math
def sol(n, S, T):
    ans = ""
    for i in range(n):
        ans += S[i]
        ans += T[i]
    return ans





do_submit = True
#do_submit = False

def input_parse(input_str):
    lines = [x.strip() for x in input_str.split("\n") if x.strip()]
    parsed_lines = [list(map(str, line.split())) for line in lines]
    print(parsed_lines)
    # n = int(parsed_lines[0][0])
    # k = int(parsed_lines[0][1])
    S = parsed_lines[0][0]
    return S


if not do_submit:
    S = input_parse("""
    1905
    """)
    print(sol(S))

    S = input_parse("""
    0112
    """)
    print(sol(S))

    S = input_parse("""
    1700
    """)
    print(sol(S))

    S = input_parse("""
    0000
    """)
    print(sol(S))

    S = input_parse("""
    1001
    """)
    print(sol(S))



else:
    #A, B = list(map(int, input().split()))
    n = int(input())
    S = input()
    T = input()
    print(sol(n, S, T))

    # S = input().strip()
    # print(sol(S))
Problem p02921 (python)

Fixed submission:
#-*- coding: utf-8
#  -*-
"""
oj dl https://atcoder.jp/contests/abc116/tasks/abc116_d -d test-d
oj test -d test-d -c "python abc116d.py"
oj test -d test-d -c "python abc116d.py" test-d/sample-3.in
"""
from collections import defaultdict
import sys
import math
from datetime import datetime

def sol(S, T):
    ans = 0
    for i in range(len(S)):
        #print("i:%s, S[i]:%s, T[i]:%s" % (i, S[i], T[i]))
        if S[i] == T[i]:
            ans += 1
    return ans


do_submit = True
#do_submit = False

def input_parse(input_str):
    lines = [x.strip() for x in input_str.split("\n") if x.strip()]
    parsed_lines = [list(map(str, line.split())) for line in lines]
    print(parsed_lines)
    n = int(parsed_lines[0][0])
    k = int(parsed_lines[0][1])
    S = parsed_lines[1][0]
    return n, k, S


if not do_submit:
    a, b, c = input_parse("""
    3 1
    ABC
    """)
    print(sol(a, b, c))

    a, b, c = input_parse("""
    4 3
    CABA
    """)
    print(sol(a, b, c))

else:
    # n, k = list(map(int, input().split()))
    # S = input().split()
    S = input()
    T = input()
    print(sol(S, T))
    # S = input().strip()
    # print(sol(S))

Buggy submission (verdict: Runtime Error):
#-*- coding: utf-8
#  -*-
"""
oj dl https://atcoder.jp/contests/abc116/tasks/abc116_d -d test-d
oj test -d test-d -c "python abc116d.py"
oj test -d test-d -c "python abc116d.py" test-d/sample-3.in
"""
from collections import defaultdict
import sys
import math
from datetime import datetime

def sol(S, T):
    ans = 0
    for i in len(S):
        if S[i] == T[i]:
            ans += 1
    return ans


do_submit = True
#do_submit = False

def input_parse(input_str):
    lines = [x.strip() for x in input_str.split("\n") if x.strip()]
    parsed_lines = [list(map(str, line.split())) for line in lines]
    print(parsed_lines)
    n = int(parsed_lines[0][0])
    k = int(parsed_lines[0][1])
    S = parsed_lines[1][0]
    return n, k, S


if not do_submit:
    a, b, c = input_parse("""
    3 1
    ABC
    """)
    print(sol(a, b, c))

    a, b, c = input_parse("""
    4 3
    CABA
    """)
    print(sol(a, b, c))

else:
    # n, k = list(map(int, input().split()))
    # S = input().split()
    S = input().split()
    T = input().split()
    print(sol(S, T))
    # S = input().strip()
    # print(sol(S))
Problem p03129 (python)

Fixed submission:
#-*- coding: utf-8 -*-
"""
https://yahoo-procon2019-qual.contest.atcoder.jp/tasks/yahoo_procon2019_qual_a
"""


def sol(n, k):
    ans = int(n/2)+1 if n % 2 == 1 else int(n/2)
    return 'YES' if ans >= k else 'NO'

test = False
#test = True
if test:
    n, k = 3, 2
    #S =list( map(int, "1 6 3".split()))
    print(sol(n, k))

    n, k = 5, 5
    #S =list( map(int, "7 4 0 3".split()))
    print(sol(n, k))
    #
    n, k = 31, 10
    #S =list( map(int, "1000000000000".split()))
    print(sol(n, k))

    n, k = 10, 90
    #S =list( map(int, "1000000000000".split()))
    print(sol(n, k))

else:
    n, k = map(int, input().split())
    #S =list( map(int, input().split()))
    print(sol(n, k))

Buggy submission (verdict: Runtime Error):
def sol(n, k):
    ans = int(n/2)+1 if n % 2 == 1 else int(n/2)
    return ans >= k

test = False
#test = True
if test:
    n, k = 3, 2
    #S =list( map(int, "1 6 3".split()))
    print(sol(n, k))

    n, k = 5, 5
    #S =list( map(int, "7 4 0 3".split()))
    print(sol(n, k))
    #
    n, k = 31, 10
    #S =list( map(int, "1000000000000".split()))
    print(sol(n, k))


else:
    n, k = map(int, input().split())
    S =list( map(int, input().split()))
    print(sol(k, S))