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

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

num = list(range(1,N+1))
ans = []


if M % 2 == 0:
    for i in range(M // 2):
        ans.append([i+1,M+1-i])
    for i in range(M // 2):
        ans.append([i+2+M,2*M+1-i])


if M % 2 != 0:
    for i in range(M // 2):
        ans.append([i+1,M-i])
    for i in range(M - M//2):
        ans.append([i+1+M,2*M+1-i])


for an in ans:
    print(an[0],an[1])

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

stack = list(range(1,N+1))
stack.reverse()

ans = []
for i in range(M):
    # print(stack)
    now = stack.pop()
    cand = now+i+1
    # cand = now+i+1 if now + i + 1 >N else now+i+1-N
    if N - cand + 1== cand - now:
        now = cand
        cand = now+i+1

    # pair = stack.pop(cand)
    stack.remove(cand)
    pair = cand
    
    # print(cand)
    # print("a")
    ans.append([now,pair])

for an in ans:
    print(an[0],an[1])
Problem p02997 (python)

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

f = 1

if len(list(itertools.combinations(range(1,N),2))) < K:
    f = 0

if f == 0:
    print(-1)

if f!=0:
    ans_list = []
    kumi = list(itertools.combinations(range(2,N+1), 2))
    kumilen = len(kumi)
    # ans_list.append(kumi)
    for i in range(2,N+1):
        ans_list.append((1,i))
    for i in range(0,kumilen-K):
        ans_list.append(kumi[i])
    
    print(len(ans_list))
    for i in range(len(ans_list)):
        print(ans_list[i][0],ans_list[i][1])

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

f = 1
if math.factorial(N-1) < K:
    f = 0

if f == 0:
    print(-1)

if f!=0:
    ans_list = []
    kumi = list(itertools.permutations(range(2,N+1), 2))
    # ans_list.append(kumi)
    for i in range(2,N+1):
        ans_list.append((1,i))
    for i in range(0,K):
        ans_list.append(kumi[i])
    
    print(len(ans_list))
    for i in range(len(ans_list)):
        print(ans_list[i][0],ans_list[i][1])
Problem p03061 (python)

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


#累積GCD
L = [0]*(N+2)
R = [0]*(N+2)
for i in range(N):
    L[i+1] = fractions.gcd(L[i],A[i])
    R[i+1] = fractions.gcd(R[i],A[N-i-1])

M = []

# print(L,R)

for i in range(N):
    ans = fractions.gcd(L[i],R[N-i-1])
    M.append(ans)

print(max(M))

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

import copy

import math
from functools import reduce

ans = 1

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

for i in range(N):
    A_sub = copy.deepcopy(A)
    del(A_sub[i])
    ans_sub = gcd_list(A_sub)
    if ans < ans_sub:
        ans = ans_sub

print(ans)
Problem p03086 (python)

Fixed submission:
def solve(b):
    u = []
    lenu = []
    p = ''
    for i in range(len(b)):
        if (b[i]=='A')or(b[i]=='T')or(b[i]=='G')or(b[i]=='C'):
            p += b[i]
        else:
            u.append(p)
            lenu.append(len(p))
            p=p.replace(p,'')
    u.append(p)
    lenu.append(len(p))
    
    
    
    # print(u,lenu)

    print(max(lenu))


 
 
def main():
    b = input()
    solve(b)
 
 
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def solve(b):
    u = []
    lenu = []
    p = ''
    for i in range(len(b)):
        if (b[i]=='A')or(b[i]=='T')or(b[i]=='G')or(b[i]=='C'):
            p += b[i]
        else:
            u.append(p)
            lenu.append(len(p))
            p=p.replace(p,'')
    
    
    # print(u,lenu)
    print(max(lenu))


 
 
def main():
    b = input()
    solve(b)
 
 
if __name__ == '__main__':
    main()
Problem p03109 (python)

Fixed submission:
S = input()

month = S[5:7]

# print(int(month))
answer = 'Heisei'



if int(month)>4:
    answer = 'TBD'



print(answer)

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

month = S[5:7]
day = S[8:10]


answer = 'Heisei'



if int(month)>4:
    answer = 'TBD'



print(int(S))
Problem p03262 (python)

Fixed submission:
import sys
sys.setrecursionlimit(500000)

n,x= map(int,input().split())
a = input().rstrip().split()
b = [0]*n
# a
for i in range(0,n):
    b[i]=abs(int(a[i])-x)
b.sort()#昇順

def GCD(a,b):
    if b == 0:
        return a
    return GCD(b,a%b)

def multi_GCD(le):
    # print(le)
    if len(le)==1:
        return
    mxle=le[-1]
    del(le[-1])
    le[-1]=GCD(le[-1],mxle)
    multi_GCD(le)

if(len(b)==1):
    print(b[0])
if(len(b)==2):
    print(GCD(b[0],b[1]))
if(len(b)>2):
    multi_GCD(b)
    print(b[0])

Buggy submission (verdict: Runtime Error):
n,x= map(int,input().split())
a = input().rstrip().split() 
b = [0]*n

for i in range(0,n):
    b[i]=abs(int(a[i])-x)
b.sort()#昇順

def GCD(a,b):
    if b == 0:
        return a
    return GCD(b,a%b)

def multi_GCD(le):
    # print(le)
    if len(le)==1:
        return 
    mxle=le[-1]
    del(le[-1])
    le[-1]=GCD(le[-1],mxle)
    multi_GCD(le)

if(len(b)==1):
    print(b[0])
if(len(b)==2):
    print(GCD(b[0],b[1]))
if(len(b)>2):
    multi_GCD(b)
    print(b[0])
Problem p03274 (python)

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

answer = 10**9

for i in range(N):
    if i+K-1>= N: break
    answer = min(answer,abs(X[i+K-1]-X[i])+min(abs(X[i]),abs(X[i+K-1])))

print(answer)

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

import numpy as np 


flag = 0
x_plus = [i for i in X if i>=0]
x_minus = [i for i in X if i<0]
x_minus.reverse()

len_plus = len(x_plus)
len_minus = len(x_minus)

use_x = []
answer = 0

i = 0
j = 0
if len_plus==0:
    answer = abs(x_minus[K-1])
    
if len_minus==0:
    answer = abs(x_plus[K-1])

if len_plus!=0 and len_minus!=0:
    while(1):
        if len(use_x)==K: break
        if x_plus[i] > abs(x_minus[j]):
            use_x.append(x_minus[j])
            if j+1>=len_minus:
                i += 1
            else:
                j += 1
        else:
            use_x.append(x_plus[i])
            if i+1>=len_minus:
                j += 1
            else:
                i += 1
    use_x.sort()
    # print(use_x)
    answer = use_x[-1]-use_x[0]+min(use_x[-1],abs(use_x[0]))

print(answer)
Problem p03436 (python)

Fixed submission:
h,w = map(int,input().split())
s = [input() for _ in range(h)]

from collections import deque

ans = 0
stack = deque([[0,0,1]])
dxdy = [(0,1),(0,-1),(1,0),(-1,0)]
visited = [[0 for i in range(w)] for j in range(h)]
minus = 0
for i in range(h):
    for j in range(w):
        if s[i][j] == "#":
            visited[i][j] = 1
            minus += 1


ans = -1
while(stack):
    ne = stack.popleft()
    x,y = ne[0],ne[1]
    if x < 0 or x > h-1: continue
    if y < 0 or y > w-1: continue
    if visited[x][y] == 1: continue
    if x== h -1 and y == w-1:
        ans = h*w - ne[2] - minus

    visited[x][y] = 1

    for dx,dy in dxdy:
        stack.append([dx+x,dy+y,ne[2]+1])

print(ans)

Buggy submission (verdict: Runtime Error):
#全部#の数を数える
#最小のルートを探し、そのルートで使ったますを数える（見つかんなかったら-1
#マスの数-最小のルートで使った歩数-最初に数えた#の数が答え
h,w= map(int,input().split())
arr = [input() for i in range(h)]
routed =  [[False for i in range(w)] for j in range(h)]
"""
arr=['.....................................',
 '...#...####...####..###...###...###..',
 '..#.#..#...#.##....#...#.#...#.#...#.',
 '..#.#..#...#.#.....#...#.#...#.#...#.',
 '.#...#.#..##.#.....#...#.#.###.#.###.',
 '.#####.####..#.....#...#..##....##...',
 '.#...#.#...#.#.....#...#.#...#.#...#.',
 '.#...#.#...#.##....#...#.#...#.#...#.',
 '.#...#.####...####..###...###...###..',
 '.....................................']

arr=['..#','#..','...']
h=3
w=3
"""
mnct=100000000
mn=[0]
cnt=0
def tansaku(x,y,cnt,mnct):
    # print(x,y,cnt)
    # print(routed)
    #この道は通った
    cnt+=1
    #ゴールに着いたら最小経路を更新してリターン
    if (x==h-1) and (y == w-1):

        # print("Goal!")
        if mnct>cnt:
            mnct= cnt
            mn[0]=mnct
        return
    #下に行ける


    if(x<h-1)and(arr[x+1][y]!='#')and(routed[x+1][y]==False):
        routed[x+1][y]=True
        tansaku(x+1,y,cnt,mnct)
        routed[x+1][y]=False
    #→にいける

    if(y<h-1)and(arr[x][y+1]!='#')and(routed[x][y+1]==False):
        routed[x][y+1]=True
        tansaku(x,y+1,cnt,mnct)
        routed[x][y+1]=False

    #左にいける
    if(y>0)and(arr[x][y-1]!='#')and(routed[x][y-1]==False):
        routed[x][y-1]=True
        tansaku(x,y-1,cnt,mnct)
        routed[x][y-1]=False
    #上にいける

    if(x>0)and(arr[x-1][y]!='#')and(routed[x-1][y]==False):
        routed[x-1][y]=True
        tansaku(x-1,y,cnt,mnct)
        routed[x-1][y]=False



    # print("Game Over!")
    return

tansaku(0,0,0,mnct)


ans=0
for i in range(0,h):
    ans+=arr[i].count('#')

print(h*w-mn[0]-ans)
Problem p03633 (python)

Fixed submission:
N = int(input())
le = [int(input()) for i in range(N)]
le.sort()#昇順
#３数以上の最小公倍数を求める問題
#a,b2数の最小公倍数とcの最小公倍数で求められる
#２数の最小公倍数はユークリッドの互除法を利用して再帰関数で求められる。

def GCD(a,b):
    if b == 0:
        return a
    return GCD(b,a%b)


def LCM(a,b):
    return int(a*b//GCD(a,b))

def multi_LCM(le):
    # print(le)
    if len(le)==1:
        return
    mxle=le[-1]
    del(le[-1])
    le[-1]=LCM(le[-1],mxle)
    multi_LCM(le)

if(len(le)==2):
    le[0]=LCM(le[0],le[1])
if(len(le)>=2):
    multi_LCM(le)

print(le[0])

Buggy submission (verdict: Runtime Error):
N = int(input())
le = [int(input()) for i in range(N)]
le.sort()#昇順
#３数以上の最小公倍数を求める問題
#a,b2数の最小公倍数とcの最小公倍数で求められる
#２数の最小公倍数はユークリッドの互除法を利用して再帰関数で求められる。

def GCD(a,b):
    if b == 0:
        return a
    return GCD(b,a%b)


def LCM(a,b):
    return int(a/GCD(a,b)*b)

def multi_LCM(le):
    if len(le)==1:
        return 
    mxle=le[-1]
    del(le[-1])
    le[-1]=LCM(le[-1],mxle)
    multi_LCM(le)

if(len(le)==2):
    le[0]=LCM(le[0],le[1])
if(len(le)>=2):
    multi_LCM(le)

print(le[0])

Buggy submission (verdict: Runtime Error):
N = int(input())
le = [int(input()) for i in range(N)]
le.sort()#昇順
#３数以上の最小公倍数を求める問題
#a,b2数の最小公倍数とcの最小公倍数で求められる
#２数の最小公倍数はユークリッドの互除法を利用して再帰関数で求められる。

def GCD(a,b):
    if b == 0:
        return a
    return GCD(b,a%b)


def LCM(a,b):
    return int(a*b/GCD(a,b))

def multi_LCM(le):
    if len(le)==1:
        return 
    mxle=le[-1]
    del(le[-1])
    le[-1]=LCM(le[-1],mxle)
    multi_LCM(le)

if(len(le)==2):
    le[0]=LCM(le[0],le[1])
if(len(le)>=2):
    multi_LCM(le)

print(le[0])

Buggy submission (verdict: Runtime Error):
N = int(input())
le = [int(input()) for i in range(N)]
le.sort()#昇順
#３数以上の最小公倍数を求める問題
#a,b2数の最小公倍数とcの最小公倍数で求められる
#２数の最小公倍数はユークリッドの互除法を利用して再帰関数で求められる。

def GCD(a,b):
    if b == 0:
        return a
    return GCD(b,a%b)


def LCM(a,b):
    return int(a*b/GCD(a,b))

def multi_LCM(le):
    if len(le)==1:
        return 
    mxle=le[-1]
    del(le[-1])
    le[-1]=LCM(le[-1],mxle)
    multi_LCM(le)
multi_LCM(le)
print(le[0])
Problem p02642 (python)

Fixed submission:
n = int(input())
a_list = sorted(map(int, input().split()))

max_num = max(a_list)

is_ans = [False]*(max_num+1)
memo = [0]*(max_num+1)
for i in a_list:
    is_ans[i] = True
    memo[i] += 1

for i in range(1, max_num+1):
    if is_ans[i]:
        for j in range(2*i, max_num+1, i):
                is_ans[j] = False

    if memo[i] > 1:
        is_ans[i] = False

ans = is_ans.count(True)
print(ans)

Buggy submission (verdict: Runtime Error):
import collections
n = int(input())
a_list = sorted([int(i) for i in input().split()])

count = 0
while len(a_list) > 2:
    x = a_list[0]
    if x == a_list[1]:
        a_list = a_list[1:]
    else:
        count += 1
        a_list = [i for i in a_list[1:] if i % x != 1]

if a_list[0] % a_list[1] != 0:
    count += 1

print(count)

Buggy submission (verdict: Runtime Error):
import collections
n = int(input())
counter = collections.Counter()

for i in input().split():
    x = int(i)
    counter[x] += 1

a_list = sorted([i for i, v in counter.items() if v == 1])

def func(x, nums, count):
    if len(nums) == 0:
        return count
    else:
        new_nums = [i for i in nums if i % x != 0]
        count += 1
        return func(new_nums[0], new_nums[1:], count)

if len(a_list) == 0:
    count = 0
else:
    count = func(a_list[0], a_list[1:], 1)

print(count)
Problem p02658 (python)

Fixed submission:
n = int(input())
a_list = sorted([int(i) for i in input().split()])

if a_list[0] == 0:
  print(0)
else:
  ans = 1
  for i in a_list:
    ans *= i
    if ans > 10**18:
      ans = -1
      break
  print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a_list = sorted([int(i) for i in input().split()])

if a[0] == 0:
  print(0)
else:
  ans = 1
  for i in a_list:
    ans *= i
    if i > 10**18:
      ans = -1
      break
  print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a_list = sorted[int(i) for i in input().split()])

if a[0] == 0:
  print(0)
else:
  ans = 1
  for i in a_list:
    ans *= i
    if i > 10**18:
      ans = -1
      break
  print(ans)
Problem p02677 (python)

Fixed submission:
import math
def solve(a, b, h, m):

    deg_a = math.radians(0.5 * (h * 60 + m))
    deg_b = math.radians(6 * m)

    y_a = a * math.cos(deg_a)
    x_a = a * math.sin(deg_a)

    y_b = b * math.cos(deg_b)
    x_b = b * math.sin(deg_b)
    ans = math.sqrt((x_b - x_a)**2 + (y_b - y_a)**2)
    return ans

if __name__ == "__main__":
    a,b,h,m = [int(i) for i in input().split()]
    print(solve(a, b, h, m))

Buggy submission (verdict: Runtime Error):
import math
def solve(a, b, h, m):

    deg_a = math.radians(0.5 * (h * 60 + m))
    deg_b = math.radians(6 * m)

    y_a = a * round(math.cos(deg_a),10)
    x_a = a * round(math.sin(deg_a),10)

    y_b = b * round(math.cos(deg_b),10)
    x_b = b * round(math.sin(deg_b),10)
    ans = math.sqrt((x_b - x_a)**2 + (y_b - y_a)**2)
    return ans

if __name__ == "__main__":
    a,b,h,m = [int(i) for i in input()]
    print(solve(a, b, h, m))

Buggy submission (verdict: Runtime Error):
import math
def solve(a, b, h, m):

    deg_a = math.radians(0.5 * (h * 60 + m))
    deg_b = math.radians(6 * m)

    y_a = a * round(math.cos(deg_a),10)
    x_a = a * round(math.sin(deg_a),10)

    y_b = b * round(math.cos(deg_b),10)
    x_b = b * round(math.sin(deg_b),10)
    print(x_a, y_a)
    print(x_b, y_b)
    ans = math.sqrt((x_b - x_a)**2 + (y_b - y_a)**2)
    return ans

if __name__ == "__main__":
    a,b,h,m = [int(i) for i in input()]
    print(solve(a, b, h, m))
Problem p02709 (python)

Fixed submission:
def slove(n, a_list):

    dp = [[0]*(n+1) for i in range(n+1)]
    for i in range(n):
        for j in range(n-i):
            dp[i+1][j] = max(dp[i+1][j],
                         dp[i][j]+a_list[i+j][0]*abs(a_list[i+j][1]-i))
            dp[i][j+1] = max(dp[i][j+1],
                         dp[i][j]+a_list[i+j][0]*abs((n-1-j)-a_list[i+j][1]))

    return max([max(i) for i in dp])

if __name__ == "__main__":
    n = int(input())
    k = sorted([(int(x),i) for i,x in enumerate(input().split())], reverse=True)
    print(slove(n, k))

Buggy submission (verdict: Runtime Error):
def func(a_list, index_list):

    if len(a_list) == 0:
        score = 0
    else:
        i,x = a_list.pop()
        hoge = []
        for j in index_list:
            tmp = index_list.copy()
            tmp.pop(tmp.index(j))
            hoge.append(x*abs(i-j)+func(a_list.copy(), tmp))

        score = max(hoge)

    return score

def slove(n, k):
    a_list = sorted([(i, int(x)) for i,x in enumerate(k.split(), 1)],
                    key= lambda x:x[1], reverse=True)
    index_list = list(range(1,n+1))
    a = func(a_list, index_list)
    return a

if __name__ == "__main__":
    n = int(input())
    k = input()
    print(slove(n, k))
Problem p02791 (python)

Fixed submission:
def solve(n, p_list):

    count = 0
    j = 2 * 10**5 +1
    for i in p_list:
        if j > i:
            count += 1
            j = i

    return count

if __name__ == "__main__":

    n = int(input())
    p_list = [int(i) for i in input().split()]
    ans = solve(n, p_list)
    print(ans)

Buggy submission (verdict: Runtime Error):
def solve(n, p_list):

    count = 0
    j = 2 * 10^^5 +1
    for i in p_list:
        if j > i:
            count += 1
            j = i

    return count

if __name__ == "__main__":

    n = int(input())
    p_list = [int(i) for i in input().split()]
    ans = solve(n, p_list)
    print(ans)
Problem p02802 (python)

Fixed submission:
n, m = [int(i) for i in input().split(" ")]
score_dict = {}
 
for i in range(m):
    p, s = input().split(" ")
    if p not in score_dict:
        score_dict[p] = []
    
    score_dict[p].append(s)
 
ac_count = 0
wa_count = 0
 
for i in score_dict.values():

    if "AC" in i:
        ac_count += 1
        wa_count += i.index("AC")
 
print("{0} {1}".format(ac_count, wa_count))

Buggy submission (verdict: Runtime Error):
n, m = [int(i) for i in input().split(" ")]
score_dict = {}
 
for i in range(m):
    p, s = input().split(" ")
    if p not in score_dict:
        score_dict[p] = []
    
    score_dict[p].append(s)
 
ac_count = 0
wa_count = 0
 
for i in score_dict.values():

    if "AC" in i:
        ac_count += 1
        wa_count += i.index("AC")]
    else:
        wa_count += len(i)
 
print("{0} {1}".format(ac_count, wa_count))

Buggy submission (verdict: Runtime Error):
n, m = input().split(" ")
score_dict = {}
 
for i in range(m):
    p, s = input().split(" ")
    if p not in score_dict:
        score_dict[p] = []
    
    score_dict[p].append(s)
 
ac_count = 0
wa_count = 0
 
for i in score_dict.values():
    if "AC" in i:
        ac_count += 1
    
    wa_count += len(i[:i.index("AC")])
 
print("{0} {1}".format(ac_count, wa_count))

Buggy submission (verdict: Runtime Error):
n, m = [int(i) for i in input().split(" ")]
score_dict = {}
 
for i in range(m):
    p, s = input().split(" ")
    if p not in score_dict:
        score_dict[p] = []
    
    score_dict[p].append(s)
 
ac_count = 0
wa_count = 0
 
for i in score_dict.values():
    if "AC" in i:
        ac_count += 1
    
    wa_count += len(i[:i.index("AC")])
 
print("{0} {1}".format(ac_count, wa_count))

Buggy submission (verdict: Runtime Error):
n, m = [int(i) for i in input().split(" ")]
score_dict = {}

for i in range(m):
    p, s = input().split(" ")
    if p not in score_dict:
        score_dict[p] = []
    
    score_dict[p].append(s)

ac_count = 0
wa_count = 0

for i in score_dict.values():
    tmp = i[:i.index("AC")+1]
    if "AC" in tmp:
        ac_count += 1
    
    wa_count += tmp.count("WA")

print("{0} {1}".format(ac_count, wa_count))
Problem p02813 (python)

Fixed submission:
import copy

n = int(input())
p = int(input().replace(" ", ""))
q = int(input().replace(" ", ""))

def hoge(numbers, s, n_list):

    for i in range(len(numbers)):
        copy_numbers = copy.deepcopy(numbers)
        ss = s+copy_numbers.pop(i)
        if len(copy_numbers) > 0:
            hoge(copy_numbers, ss, n_list)
        else:
            n_list.append(int(ss))

n_list = []
for i in range(n):
    number_list = [str(i) for i in range(1, n+1)]
    s = number_list.pop(i)
    hoge(number_list, s, n_list)

n_list.sort()

ans = abs((n_list.index(p) + 1) - (n_list.index(q) + 1))
print(ans)

Buggy submission (verdict: Runtime Error):
import copy

n = int(input())
p = int(input().replace(" ", ""))
q = int(input().replace(" ", ""))

def hoge(numbers, s, n_list):

    for i in range(len(numbers)):
        copy_numbers = copy.deepcopy(numbers)
        ss = s+copy_numbers.pop(i)
        if len(copy_numbers) > 0:
            hoge(copy_numbers, ss, n_list)
        else:
            n_list.append(ss)

n_list = []
for i in range(n):
    number_list = [str(i) for i in range(1, n+1)]
    s = number_list.pop(i)
    hoge(number_list, s, n_list)

n_list.sort()

ans = abs((n_list.index(p) + 1) - (n_list.index(q) + 1))
print(ans)
Problem p03289 (python)

Fixed submission:
s = input()
ans = "WA"

if s[0] == "A" and s[2:-1].count("C") == 1:
  tmp = s[1:]
  tmp = tmp.replace("C","")
  ans = "AC" if tmp.islower() else "WA"
  
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
ans = "WA"

if s[0] == "A" and a[2:-2].count("C") == 1:
  tmp = s[1:]
  tmp.replace("C","")
  ans = "AC" if tmp.islower() else "WA"
  
print(ans)
Problem p03351 (python)

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

ab = abs(a - b)
bc = abs(b - c)
ca = abs(c - a)

if(ab <= d and bc <= d or ca <=d):
  print("Yes")
else:
  print("No")

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

i = 2
max_num = 1
while i**2 < a:
    j = 1
    temp = 0
    while i**j < a:
        temp = i**j
        j+=1

    if temp > max_num:
        max_num = temp
    i+=1
print(max_num)

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

def func(n, a):
  b = a**2
  if b >= n:
    return (a-1)**2
  else:
    c = a+1
    d = func(n, c)
  
  return d

d = func(n, 1)

print(d)

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

def func(n, a):
  b = a**2
  if b > n:
    return (a-1)**2
  else:
    c = a+1
    d = func(n, c)
  
  return d

d = func(n, 1)

print(d)
Problem p03352 (python)

Fixed submission:
a = int(input())

i = 2
max_num = 1
while i <= a:
    j = 2
    temp = 0
    while i**j <= a:
        temp = i**j
        j+=1

    if temp > max_num and temp <= a:
        max_num = temp
    i+=1
print(max_num)

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

i = 2
max_num = 1
flag_outer = True
while i < a:      
    j = 2
  	temp = 0

  	while i**j < a:
    	temp = i**j
    	j+=1

    if temp > max_num and temp < a:
    	max_num = temp
      	i+=1
print(max_num)
Problem p03359 (python)

Fixed submission:
a, b = [int(i) for i in input().split()]
     
print(a if a <= b else a - 1)

Buggy submission (verdict: Runtime Error):
a, b = [int(i) for i in input().spili()]

print(a if a <= b else a - 1)
Problem p03385 (python)

Fixed submission:
import collections
counter = collections.Counter()

for i in input():
  	counter[i] += 1

if len([i for i in counter.values() if i >= 1]) == 3:
	print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
import collections
counter = collections.Counter()

for i in input():
  counter[i] += 1
  
if len([i for i in counter.values() if i >= 1]) == 3:
  print*"Yes")
else:
  print("No")
Problem p03386 (python)

Fixed submission:
a, b, k = [int(i) for i in input().split()]

if k < b-a+1:
    tmp1 = list(range(a, a+k))
    tmp2 = list(range(b-k+1, b+1))
    tmp1.extend(tmp2)
    tmp = sorted(list(set(tmp1)))
    
else:
    tmp = list(range(a, b+1))
    
for i in tmp:
    print(i)

Buggy submission (verdict: Runtime Error):
a, b, k = [int(i) for i in input().split()]

tmp = list(range(a, b+1))

ans = tmp[:k]
ans.extend(tmp[-1*k:])

for i in list(set(ans)):
    print(i)
Problem p03409 (python)

Fixed submission:
n = int(input())
red_point_list = [[int(j) for j in input().split()] for i in range(n)]
blue_point_list = [[int(j) for j in input().split()] for i in range(n)]

count = 0
for c, d in sorted(blue_point_list, key=lambda x: x[0]):
    tmp_index = 0
    tmp_y = -1
    for i, p in enumerate(red_point_list):
        if c > p[0] and d > p[1]:
            if p[1] >= tmp_y:
                tmp_index = i
                tmp_y = p[1]

    if tmp_y > -1:
        count += 1
        red_point_list.pop(tmp_index)

print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
red_point_list = [[int(j) for j in input().split()] for i in range(n)]
blue_point_list = [[int(j) for j in input().split()] for i in range(n)]

count = 0
memo = []

def func(red_points, blue_points, count):
    
    if len(red_points) == 0:
        memo.append(count)
    else:
        a = red_points[0][0]
        b = red_points[0][1]
        x = 0
        for i, p in enumerate(blue_points):
            if a < p[0] and b < p[1]:
                new_red_points = red_points[1:]
                new_blue_points = blue_points.copy()
                new_blue_points.pop(i)
                new_count = count + 1
                x += 1
                func(new_red_points, new_blue_points, new_count)
        if x == 0:
            new_red_points = red_points[1:]
            new_blue_points = blue_points.copy()
            func(new_red_points, new_blue_points, count)


func(red_point_list, blue_point_list, count)
print(max(memo))