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

Fixed submission:
A,B = (int(i) for i in input().split())

if A>=13:
    print(B)
elif 6<=A and A<=12:
    print(int(B/2))
else:
    print(0)

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

N,M = map(int, input().split())
A_array = np.array([int(i) for i in input().split()])
Current_Min = A_array[A_array.argmin()]
for j in range(M):
    B_tmp, C_tmp = map(int,input().split())
    if Current_Min >= C_tmp:
        continue
    for k in range(B_tmp):
        A_array[A_array.argmin()] = C_tmp
    
    Current_Min = A_array[A_array.argmin()]
    

print(sum(A_array))
Problem p03059 (python)

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

ans = (T // a) *b

print(ans)

Buggy submission (verdict: Runtime Error):
import copy

tmp = 0
Max = 1

N = int(input())

A_list = [int(i) for i in input().split()]
tmp_list = A_list

def operation(a,b):
    while a%b != 0:
        complete = a%b
        a = b
        b = complete
    return b

for i in range(N):
    
    tmp_list = copy.copy(A_list)
    del tmp_list[i] #i番目が存在しないリストを作成
    #print(tmp_list)
        
    tmp = operation(tmp_list[0],tmp_list[1])#最初の2つの最大公約数
    
    for k in range(N-2):
        tmp = operation(tmp,tmp_list[k])
    
    if tmp > Max:
        Max = tmp

print(Max)

Buggy submission (verdict: Runtime Error):
import copy

tmp = 0
Max = 1

N = int(input())

A_list = [int(i) for i in input().split()]
tmp_list = A_list

def operation(a,b):
    while a%b != 0:
        complete = a%b
        a = b
        b = complete
    return b

for i in range(N):
    
    tmp_list = copy.copy(A_list)
    del tmp_list[i] #i番目が存在しないリストを作成
    #print(tmp_list)
        
    tmp = operation(tmp_list[0],tmp_list[1])#最初の2つの最大公約数
    
    for k in range(N-2):
        tmp = operation(tmp,tmp_list[k])
    
    if tmp > Max:
        Max = tmp

print(Max)
Problem p03379 (python)

Fixed submission:
import numpy as np
import copy

N = int(input())
X = [int(i) for i in input().split()]

max_value = max(X)
min_value = min(X)

tmp_list = copy.deepcopy(X)
tmp_list.sort()
all_med = tmp_list[int((len(tmp_list)+1) / 2) - 1]

tmp_list.remove(max_value)
min_med = tmp_list[int((len(tmp_list)+1) / 2) - 1]

tmp_list = copy.deepcopy(X)
tmp_list.remove(min_value)
tmp_list.sort()
max_med = tmp_list[int((len(tmp_list)+1) / 2) - 1]

for i in range(N):
    if X[i] <= all_med:
        print(int(max_med))
    else:
        print(int(min_med))

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

N = int(input())
X = [int(i) for i in input().split()]

for i in range(0, N):
    tmp_list = []
    if i==0:
        tmp_list = []
    else:
        tmp_list = X[:i]
    tmp_list.extend(X[i+1:])
    med = np.median(tmp_list)
    print(int(med))
Problem p02684 (python)

Fixed submission:
n, k = map(int,input().split())
a_l = list(map(int,input().split()))

town = 1
count = 0
town_visited = set()
while count < k:
    town_visited.add(town)
    town = a_l[town-1]
    count += 1
    if town in town_visited:
        break

k -= count
if k == 0:
    print(town)
    exit()
count = 0
town_visited = set()
while count < k:
    town_visited.add(town)
    town = a_l[town-1]
    count += 1
    if town in town_visited:
        break

remain = k%count
count = 0
while count < remain:
    town = a_l[town-1]
    count += 1
   
print(town)

Buggy submission (verdict: Runtime Error):
n, k = map(int,input().split())
a_l = list(map(int,input().split()))

town = 1
count = 0
town_visited = set()
while count < k:
    town_visited.add(town)
    town = a_l[town-1]
    count += 1
    if town in town_visited:
        break

k -= count
if k = 0:
    print(town)
    exit()
count = 0
town_visited = set()
while count < k:
    town_visited.add(town)
    town = a_l[town-1]
    count += 1
    if town in town_visited:
        break

remain = k%count
count = 0
while count < remain:
    town = a_l[town-1]
    count += 1
   
print(town)

Buggy submission (verdict: Runtime Error):
n, k = map(int,input().split())
a_l = list(map(int,input().split()))

town = 1
count = 0
town_visited = set()
while count < k:
    town_visited.add(town)
    town = a_l[town-1]
    count += 1
    if town in town_visited:
        break

k -= count
count = 0
town_visited = set()
while count < k:
    town_visited.add(town)
    town = a_l[town-1]
    count += 1
    if town in town_visited:
        break

remain = k%count
count = 0
while count < remain:
    town = a_l[town-1]
    count += 1
   
print(town)
Problem p02691 (python)

Fixed submission:
n = int(input())
a_l = list(map(int,input().split()))
ia = list(enumerate(a_l))

x_dict = {}
y_dict = {}
for i, a in ia:
    x = i+a
    y = i-a
    if x in x_dict:
        x_dict[x] += 1
    else:
        x_dict[x] = 1
    if y in y_dict:
        y_dict[y] += 1
    else:
        y_dict[y] = 1

count = 0
for xkey in x_dict.keys():
    if xkey in y_dict:
        count += x_dict[xkey] * y_dict[xkey]

print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
a_l = list(map(int,input().split()))
ia = list(enumerate(a_l))
del_l = []
for j in range(n):
    if ia[j][1] >= n-1:
        del_l.append(j)
for j in del_l[::-1]:
    del ia[j]
        
count = 0
i = 0
while True:
    if i > len(ia)-1:
        break
    i1, a1 = ia[i]
    if a1 >= n-1-i1:
        del ia[i]
        continue
    for i2, a2 in ia[i1+a1+1:n]:
        if a2 >= n-1-i1:
            del ia[i2]
            continue
        if (i2-i1) == (a2+a1):
            count += 1
    i += 1

print(count)
Problem p03150 (python)

Fixed submission:
s = input()
k = 'keyence'

for i in range(len(s)):
    for j in range(i,len(s)):
        if s[:(i+1)]+s[j:] == 'keyence':
            print('YES')
            exit()

print('NO')

Buggy submission (verdict: Runtime Error):
s = list(input())
k_index = []
k = list('keyence')

for i in range(len(s)):
    if s[i] == k[0]:
        k_index.append(i)

ans = 'NO'
for i in k_index:
    j = 0
    flag = 0
    for a in s[i:]:
        if a == k[j]:
            j += 1
            if flag == 0:
                flag = 1 # reading 1st half
            elif flag == 2:
                flag = 3 # reading 2nd half
            if j == len(k):
                ans = 'YES'
        elif flag == 1: # end of 1st half
            flag = 2 # reading middle
        elif flag == 3:
            break

print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
k = 'keyence'
i = 0
flag = 0
ans = 'YES'
for a in s:
    if a == k[i]:
        i += 1
        if flag == 0:
            flag = 1 # reading 1st half
        elif flag == 2:
            flag = 3 # reading 2nd half
    elif flag == 1: # end of 1st half
        flag = 2 # reading middle
    elif flag == 3:
        ans = 'NO'
        break

if flag == 0:
    ans = 'NO'
print(ans)
Problem p03457 (python)

Fixed submission:
judge = 'Yes'
n = int(input())
txy_l = [[0,0,0]]
for _ in range(n):
    txy_l.append(list(map(int,input().split())))

for i in range(n):
    t_dif = txy_l[i+1][0] - txy_l[i][0]
    x_dif = txy_l[i+1][1] - txy_l[i][1]
    y_dif = txy_l[i+1][2] - txy_l[i][2]
    spare_time = t_dif - (abs(x_dif)+abs(y_dif))
    if spare_time < 0 or spare_time%2 != 0:
        judge = 'No'

print(judge)

Buggy submission (verdict: Runtime Error):
judge = 'Yes'
n = int(input())
txy_l = [0]
for i in range(n):
    txy_l.append(list(map(int,input().split())))

for i in range(n):
    t_dif = txy_l[i+1][0] - txy_l[i][0]
    x_dif = txy_l[i+1][1] - txy_l[i][1]
    y_dif = txy_l[i+1][2] - txy_l[i][2]
    spare_time = t_dif - (abs(x_dif)+abs(y_dif))
    if spare_time < 0 or spare_time%2 != 0:
        judge = 'No'

print(judge)
Problem p03640 (python)

Fixed submission:
h, w = map(int,input().split())
n = int(input())
a_l = list(map(int,input().split()))

ans = []
for _ in range(h):
    ans.append([0]*w)

direction = 0
posx = 0
posy = 0
for i in range(n):
    for j in range(a_l[i]):
        ans[posy][posx] = i+1
        if w == 1:
            direction = 1
        if direction == 0:
            posx += 1
            if posx == w-1:
                direction = 1
        elif direction == 1:
            posy += 1
            direction = 2
        elif direction == 2:
            posx -= 1
            if posx == 0:
                direction = 3
        elif direction == 3:
            posy += 1
            direction = 0

for val in ans:
    print(' '.join(map(str,val)))

Buggy submission (verdict: Runtime Error):
h, w = map(int,input().split())
n = int(input())
a_l = list(map(int,input().split()))

ans = []
for _ in range(h):
    ans.append([0]*w)

direction = 0
posx = 0
posy = 0
for i in range(n):
    for j in range(a_l[i]):
        ans[posy][posx] = i+1
        if direction == 0:
            posx += 1
            if posx == w-1:
                direction = 1
        elif direction == 1:
            posy += 1
            direction = 2
        elif direction == 2:
            posx -= 1
            if posx == 0:
                direction = 3
        elif direction == 3:
            posy += 1
            direction = 0

for val in ans:
    print(' '.join(map(str,val)))
Problem p04029 (python)

Fixed submission:
#! python3
def main():
    N = int(input())
    ans = 0
    for i in range(N):
        ans += (i+1)
    print(ans)
main()

Buggy submission (verdict: Runtime Error):
#! python3
def main():
    N = input()
    ans = 0
    for i in range(1,N+1):
        ans += i
    print(ans)
main()
Problem p02696 (python)

Fixed submission:
import math

def main():
    A, B, N = map(int, input().split(" "))
    max_score = -float("inf")

    if B <= N:
        x = B-1 
    else:
        x = N
    score = math.floor((A*x)/B) - A*math.floor(x/B)
    print(score)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    A, B, N = map(int, input().split(" "))
    max_score = -float("inf")

    if B <= N:
        x = B-1 
    else:
        x = N
    score = math.floor((A*x)/B) - A*math.floor(x/B)
    print(score)

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

Fixed submission:
import math

r = int(input())

print(r * 2 * math.pi)

Buggy submission (verdict: Runtime Error):
import math

r = int(intput())

print(math.pi * 2 * r)
Problem p02713 (python)

Fixed submission:
import math
from functools import reduce
from sys import stdin
import itertools

def gcd(*numbers):
    return reduce(math.gcd, numbers)
  
def main():
  N = int(stdin.readline())
  N_list = list(range(1, N+1))
  
  ans = 0
  
  for xs in itertools.combinations_with_replacement(N_list, 3):
    if len(set(xs)) == 1:
      ans += gcd(xs[0], xs[1], xs[2])
    elif len(set(xs)) == 2:
      ans += 3*gcd(xs[0], xs[1], xs[2])
    else:
      ans += 6*gcd(xs[0], xs[1], xs[2])
      
  print(ans)

if __name__ == '__main__':
  main()

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
from sys import stdin
import itertools

def gcd(*numbers):
    return reduce(math.gcd, numbers)
  
def main:
  N = int(stdin.readline())
  N_list = list(range(1, N+1))
  
  ans = 0
  
  for xs in itertools.combinations_with_replacement(N_list, 3):
    if len(set(xs)) == 1:
      ans += gcd(xs[0], xs[1], xs[2])
    elif len(set(xs)) == 2:
      ans += 3*gcd(xs[0], xs[1], xs[2])
    else:
      ans += 6*gcd(xs[0], xs[1], xs[2])
      
  print(ans)

if __name__ == '__main__':
  main()

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
from sys import stdin
import itertools

def gcd(*numbers):
    return reduce(math.gcd, numbers)
  
def main:
  N = int(stdin.readline())
  N_list = lsit(range(1, N+1))
  
  ans = 0
  
  for xs in itertools.combinations_with_replacement(N_list, 3):
    if len(set(xs)) == 1:
      ans += 6*gcd(xs[0], xs[1], xs[2])
    elif len(set(xs)) == 2:
      ans += 3*gcd(xs[0], xs[1], xs[2])
    else:
      ans += gcd(xs[0], xs[1], xs[2])
      
  print(ans)
Problem p02705 (python)

Fixed submission:
import math
r = int(input())
print(2 * r * math.pi)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = list(map(int, input().split()))
if n - sum(a) >= 0:
    print(n - sum(a))
else:
    print(-1)
Problem p03545 (python)

Fixed submission:
def dfs(i, f, result):
    if i == l - 1:
        if result == 7:
            print(f + '=7')
            exit()
    else:
        dfs(i + 1, f + '-' + s[i + 1], result - int(s[i + 1]))
        dfs(i + 1, f + '+' + s[i + 1], result + int(s[i + 1]))


s = input()
l = len(s)

dfs(0, s[0], int(s[0]))

Buggy submission (verdict: Runtime Error):
from math import ceil


def dfs(i, sum, count, residue):
    global ans
    if i == d:
        if sum < g:
            use = max(residue)
            n = min(pc[use - 1][0], ceil((g - sum) / (use * 100)))
            count += n
            sum += n * use * 100

        if g <= sum:
            ans = min(ans, count)

    else:
        dfs(i + 1, sum, count, residue)
        dfs(i + 1, sum + pc[i][0] * (i + 1) * 100 + pc[i][1], count + pc[i][0], residue - {i + 1})


d, g = map(int, input().split())

pc = [list(map(int, input().split())) for _ in range(d)]

ans = float('inf')

dfs(0, 0, 0, set(range(1, d + 1)))
print(ans)
Problem p03633 (python)

Fixed submission:
from fractions import gcd

n = int(input())

t = [int(input()) for _ in range(n)]

ans = t[0]
for i in range(1, n):
    ans = ans * t[i] // gcd(ans, t[i])
print(ans)

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

n = int(input())

t = [int(input()) for _ in range(n)]

print(np.lcm.reduce(np.array(t)))
Problem p02747 (python)

Fixed submission:
str = input()
str_len = len(str)
h_flag = 0
for cat_i in range(str_len):
  if str_len % 2 == 1:
    print('No')
    break
  
  if h_flag == 0 and str[cat_i] == 'h':
    h_flag = 1
  elif h_flag == 1 and str[cat_i] == 'i':
    h_flag = 0
  else:
    print('No')
    break
    
  if cat_i == (str_len - 1):
    print('Yes')

Buggy submission (verdict: Runtime Error):
str = input()
str_len = len(str)
h_flag = 0
for cat_i in range(str_len):
  if h_flag == 0 & str[cat_i] == 'h':
    h_flag = 1
  elif h_flag == 1 & str[cat_i] == 'i':
    h_flag = 0
  else:
    print('No')
    break;
    
  if cat_i == (str_len - 1):
    print('Yes')

Buggy submission (verdict: Runtime Error):
str = input()
str_len = len(str)
for cat_i in range(str_len):
  if str[cat_i] == 'h':
    h_flag = 1
  elif h_flag == 1 & str[cat_i] == 'i':
    h_flag = 0
  else:
    print('No')
    break;
    
  if cat_i == (str_len - 1):
    print('Yes')
Problem p02843 (python)

Fixed submission:
X = int(input())

item_value = [100, 101, 102, 103, 104, 105]
dp = [0] * (100001)
for value in item_value:
    dp[value] = 1

for i in range(200, X + 1):
    for value in item_value:
        if dp[i - value] == 1:
            dp[i] = 1

print(dp[X])

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

item_value = [100, 101, 102, 103, 104, 105]
dp = [0] * (X + 1)
for value in item_value:
    dp[value] = 1

for i in range(200, X + 1):
    for value in item_value:
        if dp[i - value] == 1:
            dp[i] = 1

print(dp[X])

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

item_list = [100, 101, 102, 103, 104, 105]

pre_list = []
sum_value = 0
for i in range(1, 1001):
    tmp_list = []
    for value in item_list:
        tmp_list.append(i * value)
    
    pre_list.append(tmp_list)

sum_list = [[0] * 7 for i in range(1001)]
for i in range(1000):
    for j in range(6):
            sum_list[i + 1][j + 1] = sum_list[i][j + 1] + sum_list[i + 1][j] - sum_list[i][j] + pre_list[i][j]

flag = 0
for i1 in range(0, 1000):
    for i2 in range(i1+1, 1001):
        for j1 in range(0, 6):
            for j2 in range(j1+1, 7):
                    value = sum_list[i2][j2] - sum_list[i1][j2] - sum_list[i2][j1] + sum_list[i1][j1]  
                if X == value:
                    flag = 1

print(flag)
Problem p02882 (python)

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

V_max = a * a * b

if x <= 0.5 * V_max:
    theta = math.atan((a*b*b)/(2*x))
else:
    theta = math.atan(2*(a**2*b - x)/(a**3))

print(math.degrees(theta))

Buggy submission (verdict: Runtime Error):
import math
import scipy.optimize

a, b, x = [int(i) for i in input().split()]

def func_a(theta):
    S = 0.5 * b**2 / math.tan(theta)
    V = S * a
    equal = V - x

    return equal

def func_b(theta):
    S = a * b - 0.5 * a**2 * math.tan(theta)
    V = S * a
    equal = V - x

    return equal

if x <= 0.5 * a**2 * b:
    result = scipy.optimize.bisect(func_a, math.atan(a/b), math.pi/2 - 10**(-6))
else:
    result = scipy.optimize.bisect(func_b, 0, math.atan(a/b))

print(math.degrees(result))

Buggy submission (verdict: Runtime Error):
import math
import scipy.optimize

a, b, x = [int(i) for i in input().split()]

def func_a(theta):
    S = 0.5 * b**2 / math.tan(theta)
    V = S * a
    equal = V - x

    return equal

def func_b(theta):
    S = a * b - 0.5 * a**2 * math.tan(theta)
    V = S * a
    equal = V - x

    return equal

if x <= 0.5 * a**2 * b:
    result = scipy.optimize.bisect(func_a, math.pi/4, math.pi/2 - 10**(-6))
else:
    result = scipy.optimize.bisect(func_b, 0, math.atan(a/b))

print(math.degrees(result))

Buggy submission (verdict: Runtime Error):
import math
import scipy.optimize

a, b, x = [int(i) for i in input().split()]

def func_a(theta):
    S = 0.5 * b**2 / math.tan(theta)
    V = S * a
    equal = V - x

    return equal

def func_b(theta):
    S = a * b - 0.5 * a**2 * math.tan(theta)
    V = S * a
    equal = V - x

    return equal

if x <= 0.5 * a**2 * b:
    result = scipy.optimize.bisect(func_a, math.pi/4, math.pi/2 - 10**(-6))
else:
    result = scipy.optimize.bisect(func_b, 0 + 10**(-6), math.pi/4)

print(math.degrees(result))

Buggy submission (verdict: Runtime Error):
import math
import scipy.optimize

a, b, x = [int(i) for i in input().split()]

def func_a(theta):
    S = 0.5 * b**2 / math.tan(theta)
    V = S * a
    equal = V - x

    return equal

def func_b(theta):
    S = a * b - 0.5 * a**2 * math.tan(theta)
    V = S * a
    equal = V - x

    return equal

if x <= 0.5 * a**2 * b:
    result = scipy.optimize.bisect(func_a, 0 + 10**(-6), math.pi/2 - 10**(-6))
else:
    result = scipy.optimize.bisect(func_b, 0 + 10**(-6), math.pi/2 - 10**(-6))

print(math.degrees(result))

Buggy submission (verdict: Runtime Error):
import math
import scipy.optimize

a, b, x = [int(i) for i in input().split()]

def func_a(theta):
    S = 0.5 * b**2 / math.tan(theta)
    V = S * a
    equal = x - V

    return equal

def func_b(theta):
    S = a * b - 0.5 * a**2 * math.tan(theta)
    V = S * a
    equal = x - V

    return equal

if x <= 0.5 * a**2 * b:
    result = scipy.optimize.bisect(func_a, 0 + 10**(-6), math.pi/2 - 10**(-6))
else:
    result = scipy.optimize.bisect(func_b, 0 + 10**(-6), math.pi/2 - 10**(-6))

print(math.degrees(result))
Problem p02888 (python)

Fixed submission:
N = int(input())
L = [int(i) for i in input().split()]

from bisect import bisect_left

L.sort()

count = 0
for i in range(0, N - 2):
    for j in range(i + 1, N - 1):
        length = L[i] + L[j]
        idx = bisect_left(L, length)
        count += idx - j - 1

print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
L = [int(i) for i in input().split()]

L_len = len(L)

count = 0
for i in range(L_len - 2):
    for j in range(i + 1, L_len - 1):
        for k in range(j + 1, L_len):
            f = 0
            if a >= b + c:
                f = 1
            if b >= a + c:
                f = 1
            if c >= a + b:
                f = 1
            
            if f == 0:
                count += 1

print(count)
Problem p02898 (python)

Fixed submission:
N, K = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]

count = 0

for i in range(N):
    if h[i] >= K:
        count += 1

print(count)

Buggy submission (verdict: Runtime Error):
import time

N, K = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]

count = 0

for i in range(N):
    if n[i] >= K:
        count += 1

print(count)

Buggy submission (verdict: Runtime Error):
N, K = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]

h.sort()

left = 0
right = len(h) - 1
center = 0

if right == 0:
    if a[0] >= K:
        print(1)
    else:
        print(0)
else:
    while right - left >= 1:
        center = int((left + right) / 2)
        if h[center] >= K:
            right = center
        else:
            left = center
        
    print(len(h) - center)
Problem p02900 (python)

Fixed submission:
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)
    divisors.sort()

    return divisors

def is_remainder(n):
    if n == 1:
        return True

    for i in range(2, int(n**0.5)+1):
        if n % i == 0:
            return False
    
    return True
        

A, B = [int(i) for i in input().split()]

import fractions
n = fractions.gcd(A, B)
divisors = make_divisors(n)
N = len(divisors)

count = 0
flag = [0] * N
for item in divisors:
    if is_remainder(item):
        count += 1

print(count)

Buggy submission (verdict: Runtime Error):
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)
    divisors.sort()

    return divisors

def is_remainder(n):
    if n == 1:
        return True

    for i in range(2, int(n**0.5)+1):
        if n % i == 0:
            return False
    
    return True
        

A, B = [int(i) for i in input().split()]

import math
n = math.gcd(A, B)
divisors = make_divisors(n)
N = len(divisors)

count = 0
flag = [0] * N
for item in divisors:
    if is_remainder(item):
        count += 1

print(count)

Buggy submission (verdict: Runtime Error):
A, B = [int(i) for i in input().split()]

def gcd(x, y):
    r = x % y
    while r > 0:
        x = y
        y = r
        r = x % y
    
    return y

def cd (x, y):
    a = gcd(x, y)
    cd_list = []

    i = 1
    while i**2 <= a:
        if a % i == 0:
            cd_list.append(i)
            cd_list.append(int(a/i))
        i += 1

    cd_list.sort()

    return cd_list, len(cd_list)

cd_list, length = cd(A, B)
f_list = [0] * length
for i in range(1, length - 1):
    for j in range(i + 1, length):
        if cd_list[j] % cd_list[i] == 0:
            f_list[j] = 1
            count += 1

print(length - count)
Problem p02780 (python)

Fixed submission:
n, k = map(int, input().split())
p = list(map(int, input().split()))
s = [0] * (n+1)

for i in range(0, n):
    s[i+1] = s[i] + p[i]

s_max = -1
pos = 0
for i in range(n-k+1):
    ss = s[i+k] - s[i]
    if ss > s_max:
        s_max = ss
        pos = i

ans = 0.0
for i in range(pos, pos+k):
    ans += (p[i]+1) / 2

print(ans)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
p = list(map(int, input().split()))
tmp = [0] * 10000

rmax = -1
pos = -1
for i in range(n-k+1):
    _t = sum(p[i: i+k])
    if pos < _t:
        pos = _t
        rmax = i

ans = 0
for i in range(rmax, rmax+k):
    if tmp[i] == 0:
        t = 0
        for j in range(1, p[i]+1):
            t += j
            #tmp[j] = t / j
        t = t / p[i]

        tmp[i] = t
        ans += t
#        print(t)
#    else:
#        ans += tmp[i]
#        print(tmp[i])

print(ans)
Problem p02796 (python)

Fixed submission:
import sys

input = sys.stdin.readline
p = []
n = int(input())
for _ in range(n):
    x, l = map(int, input().split())
    p.append([x-l, x+l])

r = sorted(p, key=lambda x: x[1])

ans = 0
cur = - (1<<60)

for i in r:
    if cur > i[0]:
        continue
    ans += 1
    cur = i[1]

print(ans)

Buggy submission (verdict: Runtime Error):
import sys
from collections import OrderedDict

input = sys.stdin.readline
r = OrderedDict()

n = int(input())
for _ in range(n):
    x, l = map(int, input().split())
    r[x-l] = x+l

r = sorted(r.items(), key=lambda x: x[0])

cp = 0
fp = 1
ans = n
while True:
    if r[cp][1] > r[fp][0]:
        ans -= 1
        fp += 1
    else:
        cp = fp
        fp += 1

    if n <= fp:
        break

print(ans)