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

Fixed submission:
import collections
import copy
import sys
N = int(input())

cost = 0
diff_list = []
x_y_list = []

if N == 1:
    print(1)
    sys.exit()

for n in range(N):
    x, y = map(int, input().split())
    x_y_list.append((x, y))
    cost += 1

x_y_list_copy = copy.copy(x_y_list)

for n in range(N):
    x_y = x_y_list.pop()
    x = x_y[0]
    y = x_y[1]
    for tmp_x, tmp_y in x_y_list:
        diff_list.append((x - tmp_x, y - tmp_y))

for n in range(N):
    x_y = x_y_list_copy.pop(0)
    x = x_y[0]
    y = x_y[1]
    for tmp_x, tmp_y in x_y_list_copy:
        diff_list.append((x - tmp_x, y - tmp_y))

counter = collections.Counter(diff_list)
print(cost - max(counter.values()))

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

cost = 0
diff_list = []
x_y_list = []

if N == 1:
    print(1)

for n in range(N):
    x, y = map(int, input().split())
    x_y_list.append((x, y))
    cost += 1

x_y_list_copy = copy.copy(x_y_list)

for n in range(N):
    x_y = x_y_list.pop()
    x = x_y[0]
    y = x_y[1]
    for tmp_x, tmp_y in x_y_list:
        diff_list.append((x - tmp_x, y - tmp_y))

for n in range(N):
    x_y = x_y_list_copy.pop(0)
    x = x_y[0]
    y = x_y[1]
    for tmp_x, tmp_y in x_y_list_copy:
        diff_list.append((x - tmp_x, y - tmp_y))

counter = collections.Counter(diff_list)
print(cost - max(counter.values()))

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

cost = 0
diff_list = []
x_y_list = []

if N == 1:
    print(1)

for n in range(N):
    x, y = map(int, input().split())
    x_y_list.append((x, y))
    cost += 1

for n in range(N):
    x, y = x_y_list.pop()
    for tmp_x, tmp_y in x_y_list:
        diff_list.append((x - tmp_x, y - tmp_y))

counter = collections.Counter(diff_list)
print(cost - max(counter.values()))

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

cost = 0
diff_list = []

past_x, past_y = map(int, input().split())
cost += 1

for n in range(N - 1):
    x, y = map(int, input().split())
    diff_list.append((x - past_x, y - past_y))
    past_x = x
    past_y = y
    cost += 1

counter = collections.Counter(diff_list)

print(cost - max(counter.values()))
Problem p03031 (python)

Fixed submission:
t = input().rstrip().split(' ')
switch = int(t[0])
lamp = int(t[1])
s = [list(map(int, input().split())) for _ in range(lamp)]
p = list(map(int, input().split()))
ans = 0

for i in range(2 ** switch):
    ptn = bin(i)[2:].rjust(switch, '0')
    light = True
    for j in range(lamp):
        temp = 0
        for n in range(1, s[j][0] + 1):
            if ptn[s[j][n] - 1] == '1':
                temp += 1
        if temp % 2 != p[j] % 2:
            light = False
    if light:
        ans += 1

print(ans)

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

s_list = []
a = []
for i in range(M):
    s = list(map(int, input().split()))
    k = s[0]
    for j in range(1, k):
        a[s[j] - 1] |= 1 << i

p = list(map(int, input().split()))

p = 0
for i, x in enumerate(p):
    p |= x << i

ans = 0
for s in range(1 << N):
    t = 0
    for i in range(N):
        if s >> i & 1:
            t ^= a[i]
    if t == p:
        ans += 1

print(ans)
Problem p03106 (python)

Fixed submission:
A, B, K = list(map(int, input().split()))
count = 0

for i in range(min(A, B), 0, -1):
    if A % i == 0 and B % i == 0:
        count += 1
    if count == K:
        print(i)
        exit()

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


def cf(x1, x2):
    cf = []
    for i in range(2, min(x1, x2) + 1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)

    cf = sorted(cf)
    return cf

cf_list = cf(A, B)

if len(cf_list) == 0:
    print(1)
else:
    print(cf_list[-K])
Problem p03162 (python)

Fixed submission:
N = int(input())

a_b_c_list = []

for i in range(N):
    a_b_c_list.append(list(map(int, input().split())))

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

for i in range(N):
    for j in range(3):
        for k in range(3):
            if j == k:
                continue
            if dp[i+1][k] < dp[i][j] + a_b_c_list[i][k]:
                dp[i+1][k] = dp[i][j] + a_b_c_list[i][k]

print(max(dp[N]))

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

N = int(input())

a_b_c_list = []

for i in range(N):
    a_b_c_list.append(list(map(int, input().split())))

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

for i in range(N):
    for j in range(3):
        for k in range(3):
            if j == k:
                continue
            if dp[i+1][k] < dp[i][j] + a_b_c_list[i][k]:
                dp[i+1][k] = dp[i][j] + a_b_c_list[i][k]

print(max(dp[N]))
Problem p03478 (python)

Fixed submission:
# -*- coding: utf-8 -*-
N, a, b = map(int, input().split()) 
 
sum = 0
for x in range(N + 1):
  l = [int(y) for y in list(str(x))]
  temp_sum = 0
  for z in l:
    temp_sum += z
  if a <= temp_sum and b >= temp_sum:
     sum += x
print(sum)

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

sum = 0
for x in N:
  l = [int(y) for y in list(str(x))]
  temp_sum = 0
  for z in l:
    tmep_sum += z
  if a <= temp_sum and b <= temp_sum:
      sum += x
print(sum)
Problem p03854 (python)

Fixed submission:
S = input()

new_S = "".join(list(reversed(S)))
string_list = ["dream", "dreamer", "erase", "eraser"]
reverse_string_list = []
for i in range(len(string_list)):
    reverse_string_list.append("".join(list(reversed(string_list[i]))))

can = True
index = 0
for i in range(len(new_S)):
    if index >= len(new_S):
        break
    can2 = False
    for each_string in reverse_string_list:
        if new_S[index:index + len(each_string)] == each_string:
            index += len(each_string) - 1
            can2 = True
    if can2 is False:
        can = False
        break
    index += 1

if can is True:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
S = input()
string_list = ["dream", "dreamer", "erase", "eraser"]

dp = []

dp[0] = 1
for i in range(len(S)):
    if dp[i] != 1:
        continue
    for string in string_list:
        if S[i: i + len(string) - 1] == string:
            dp[i + len(string) - 1] = 1

if dp[len(S)] == 1:
    print("Yes")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
S = input()
string_list = ["dream", "dreamer", "erase", "eraser"]

dp = []

dp[0] = 1
for i in range(len(S)):
    if dp[i] != 1:
        continue
    for string in string_list:
        if S[i: i + len(string) - 1] == string:
            dp[i + len(string) - 1] = 1

if dp[len(S)] == 1:
    print("Yes")
else:
    print("NO")
Problem p02760 (python)

Fixed submission:
a = []
for j in range(3):
    a.append([int(x) for x in input().split()])
n = int(input())
b = [int(input()) for i in range(n)]
def hasbingo(ps):
    for x, y in ps:
        if a[y][x] not in b:
            return False
    return True

def hasany():
    for i in range(3):
        if hasbingo([(i, 0),(i, 1),(i, 2)]):
            return True
        if hasbingo([(0, i), (1, i), (2, i)]):
            return True
    if hasbingo([(0,0),(1,1),(2,2)]):
        return True
    return hasbingo([(0,2),(1,1), (2,0)])

if hasany():
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
a = []
for j in range(3):
    a.append([int(x) for x in input().split()])
n = int(input())
b = [int(input()) for i in range(n)]
def hasbingo(ps):
    for x, y in ps:
        if a[y][x] not in b:
            return False
    return True

def hasany():
    for i in range(3):
        if hasbingo([(i, 0),(i, 1),(i, 2)]):
            return True
        if hasbingo([(0, i), (1, i), (2, i)]):
            return True
    if hasbingo([[0,0],[1,1],[2,2]]):
        return True
    return hasbingo([[0,2],[1,1][2,0]])

if hasany():
    print('Yes')
else:
    print('No')
Problem p02761 (python)

Fixed submission:
n, m = [int(x) for x in input().split()]
sc = [[int(x) for x in input().split()] for i in range(m)]
r = [-1] * n
def solution():
    for s, c in sc:
        if s == 1 and c == 0 and n != 1:
            return '-1'
        if r[s - 1] >= 0 and r[s - 1] != c:
            return '-1'
        r[s - 1] = c
    for i in range(n):
        if r[i] < 0:
            if i == 0 and n != 1:
                r[i] = 1
            else:
                r[i] = 0
    return ''.join(str(r[i]) for i in range(n))

print(solution())

Buggy submission (verdict: Runtime Error):
File Edit Options Buffers Tools Python Help                                             
n, m = [int(x) for x in input().split()]
sc = [[int(x) for x in input().split()] for i in range(m)]
r = [-1] * n
def solution():
    for s, c in sc:
        if r[s - 1] >= 0 and r[s - 1] != c or (s == 1 and c == 0 and n != 1):
            return '-1'
        r[s - 1] = c
    for i in range(n):
        if r[i] < 0:
            if i == 0:
                r[i] = 1
            else:
                r[i] = 0
    return ''.join(str(r[i]) for i in range(n))

print(solution())
Problem p02756 (python)

Fixed submission:
from collections import deque

s = deque(input())
q = int(input())
 
r = 0
for i in range(q):
  tfc = input().split()
  if tfc[0] == '1':
    r += 1
  else:
    if tfc[1] == '1':
      if r % 2 == 0:
        s.appendleft(tfc[2])
        #s.insert(0, tfc[2])
      else:
        s.append(tfc[2])
    if tfc[1] == '2':
     if r % 2 == 1:
        s.appendleft(tfc[2])
     else:
        s.append(tfc[2])          
if r % 2 == 0:
  for i in s:
      print(i, end='')
else:
  for i in (reversed(s)):
    print(i, end='')

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

s = input()
q = int(input())

for i in range(q):
  tfc = input().split()
  if tfc[0] == '1':
    s.reverse()
    #s = s[::-1]
  else:
    if tfc[1] == '1':
      s = tfc[2] + s
    else:
      s = s + tfc[2]
print(s)
Problem p03773 (python)

Fixed submission:
x=input().split()
ans=int(x[0])+int(x[1])
print(int(ans%24))

Buggy submission (verdict: Runtime Error):
def ncr(x,y):
	ans=1
	q=x-y
	while x>y:
		ans*=x
		x=x-1
	
	while q>1:
		ans=ans/q
		q=q-1
	
	return ans

x=input().split()
n=int(x[0])
a=int(x[1])
b=int(x[2])
v=[0]*n
x = input().split()
ind=0
M={1:0}
M2={1:0}
for i in x:
	v[ind]=int(i)
	if int(i) in M:
		M[v[ind]]+=1
	else:
		M[v[ind]]=1
	ind+=1
v.sort(reverse=True)

cnt=0
ind=0
m=0
while cnt<a:
	cnt+=1
	m=((cnt-1)*m+v[ind])/cnt
	if v[ind] in M2:
		M2[v[ind]]+=1
	else:
		M2[v[ind]]=1
	ind+=1
while cnt<b:
	if (cnt*m+v[ind])/(cnt+1)<m-0.5:
		break
	else:
		cnt+=1;
		if v[ind] in M2:
			M2[v[ind]]+=1
		else:
			M2[v[ind]]=1
		ind+=1
print(m)
maxw=cnt;
ways=0;
for i in range(cnt,a-1,-1):
	if v[ind-1] not in M2:
			M2[v[ind]]=0
	if v[ind-1] not in M:
			M[v[ind-1]]=0
	ways+=ncr(M[v[ind-1]],M2[v[ind-1]])
	
	M2[v[ind-1]]-=1

print(int(ways))
Problem p03105 (python)

Fixed submission:
a = list(map(int, input().split()))
b = a[1]//a[0]
print(b if b < a[2] else a[2])

Buggy submission (verdict: Runtime Error):
#include <iostream>
using namespace std;

int main() {
    int a, b, c, q;
    cin >> a >> b >> c;
    q = b/a;
    if(q < c){
        cout << q << endl;
    }else{
        cout << c << endl;
    };
    return 0;
}

Buggy submission (verdict: Runtime Error):
import fractions


def main():
    a = list(map(int, input().split()))
    b = fractions.gcd(a[0], a[1])
    c = b
    for i in range(a[2]-1):
        while True:
            c -= 1
            if b % c == 0:
                break
    print(c)


main()
Problem p03106 (python)

Fixed submission:
import fractions


def main():
    a = list(map(int, input().split()))
    b = fractions.gcd(a[0], a[1])
    c = b
    for i in range(a[2]-1):
        while True:
            c -= 1
            if b % c == 0:
                break
    print(c)


main()

Buggy submission (verdict: Runtime Error):
import math


def main():
    a = list(map(int, input().split()))
    b = math.gcd(a[0], a[1])
    c = b
    for i in range(a[2]-1):
        while True:
            c -= 1
            if b % c == 0:
                break
    print(c)


main()

Buggy submission (verdict: Runtime Error):
import fraction


def main():
    a = list(map(int, input().split()))
    b = fraction.gcd(a[0], a[1])
    c = b
    for i in range(a[2]-1):
        while True:
            c -= 1
            if b % c == 0:
                break
    print(c)


main()
Problem p02885 (python)

Fixed submission:
a,b= map(int, input().split())
c=a-b*2
if(c>=0):
    print(c)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
a,b= map(int, input().split())

if(c=a-b*2 >=0):
    print(c)
else:
    print(0)
Problem p03243 (python)

Fixed submission:
st=raw_input()
s=list(st)
if int(s[2])>int(s[1]):
  s[1]=str(int(s[1])+1)
  s[2]=s[1]
else:
  s[2]=s[1]
if int(s[1])>int(s[0]):
  s[0]=str(int(s[0])+1)
  s[1]=s[0]
  s[2]=s[1]
else:
  s[1]=s[0]
  s[2]=s[1]
unko=""
for i in s:
  unko+=i
print(unko)

Buggy submission (verdict: Runtime Error):
str=raw_input()
if int(str[2])>int(str[1]):
  str[1]=str(int(str[1])+1)
  str[2]=str[1]
else:
  str[2]=str[1]
if int(str[1])>int(str[0]):
  str[0]=str(int(str[0])+1)
  str[1]=str[0]
else:
  str[1]=str[0]
print(str)

Buggy submission (verdict: Runtime Error):
str=raw_input()
if int(str[2])<int(str[1]):
  str[2]=str[1]
else:
  str[2]=str(int(str[1]+1))
  str[2]=str[1]
if int(str[1])<int(str[0]):
  str[1]=str[0]
else:
  str[1]=str(int(str[0]+1))
  str[1]=str[0]
print(str)
Problem p02717 (python)

Fixed submission:
x,y,z = map(int, input().split())

print(z, x, y)

Buggy submission (verdict: Runtime Error):
from collections import deque


k = int(input())
d = deque([1,2,3,4,5,6,7,8,9])

for i in range(k):
    a = d.popleft()
    if a % 10 != 0:
        d.append(a*10 + a % 10 - 1)
    d.append(a*10 + a % 10)
    if a % 10 != 9:
        d.append(i*10 + i % 10 + 1)

print(a)
Problem p02718 (python)

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

A = list(map(int, input().split()))
S = sum(A)
x = S/(4*M)

count = 0

for i in A:
    if i >= x:
        count += 1

if count>=M:
    print("Yes")
else:
    print("No")

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

A = list(map(int, input().split()))
S = sum(A)
x = S/(4*m)

count = 0

for i in A:
    if i >= x:
        count += 1

if count>=M:
    print("Yes")
else:
    print("No")
Problem p02719 (python)

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

a = N % K
if a == 0:
    print(0)
else:
    print(min(a, abs(a-K)))

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

a = N % K
if a == 0:
    print(0)
else:
    print(min(a, abs(a-k)))
Problem p02730 (python)

Fixed submission:
S = input()
N = len(S)
a = S[0:(N-1)//2]
b = S[(N+3)//2-1:]


def k(a):
    for i in range(len(a)):
        if a[i] != a[len(a)-1-i]:
            return False
    else:
        return True

if k(S) & k(a) & k(b):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
S = input()
N = len(S)
a = S[0:(N-1)//2]
b = S[(N+3)//2-1:]


def k(a):
    for i in ragne(len(a)):
        if a[i] != a[len(a)-1-i]:
            return False
        else:
            return True

if k(S) & k(a) & k(b):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
S = input()
N = len(S)
a = S[1:(N-1)/2+1]
b = s[(N+3)/2:]

def kaibun(l):
    for i in range(len(l)):
        if l[i] != l[-i]:
            return(False)
    return(True)

if kaibun(S) & kaibun(a) & kaibun(b):
    print("Yes")
else:
    print("No")
Problem p02731 (python)

Fixed submission:
L = int(input())
print((L**3)/27)

Buggy submission (verdict: Runtime Error):
L = int(input)
print((L**3)/27)
Problem p02813 (python)

Fixed submission:
import math


N = int(input())
list1 = list(map(int, input().split()))
list2 = list(map(int, input().split()))

def CO(l):
    n = len(l)
    if n != 1:
        m = sorted(l)
        a = l[0]
        s = m.index(a)
        l.remove(a)
        return((s)*math.factorial(n-1)+CO(l))
    else:
        return 1

print(abs(CO(list1)-CO(list2)))

Buggy submission (verdict: Runtime Error):
import math


N = int(input())
list1 = list(map(int, input().split()))
list2 = list(map(int, input().split()))

def CO(l):
    n = len(l)
    if n >= 1:
        m = sorted(l)
        a = l[0]
        s = m.find(a)
        return((s+1)*math.factorial(n-1)+CO(l.pop(0)))
    else:
        return 1

print(abs(CO(list1)-CO(list2)))
Problem p03494 (python)

Fixed submission:
N = int(input())
x = list(map(int, input().split()))
flag = True
count = 0

while flag:
    for i in range(N):
        if x[i] % 2 == 0:
            x[i] = x[i] / 2
        else:
            flag = False
            break
    else:
        count += 1

print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
arrray = list(map(int,input().split()))
fleg = True
count = 0

while flag:
    for i in range(N):
        if array[i] % 2 == 0:
            array[i] = array[i] / 2
        else:
            flag = False
            break
    else:
        count += 1

print(count)
Problem p03564 (python)

Fixed submission:
N = int(input())
K = int(input())
x = 1

for i in range(N):
    x = min(x*2,x+K)

print(x)

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

for i in range(N):
    x = min(x*2,x+K)

print(x)
Problem p04001 (python)

Fixed submission:
S = input()

x = len(S)-1

s = 0
for i in range(1 << x):
    t = 0
    for j in range(x):
        if ((i >> j) & 1 == 1):
            s += int(''.join(S[t:j+1]))
            t = j+1
    s += int(''.join(S[t:]))
print(s)

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

x = len(S)-1

s = 0
for i in range(1 << x):
    t = 0
    for j in range(x):
        if ((i >> j) & 1 == 1):
            s += int(''.join(s[t:j+1]))
            t = j+1
    s += int(''.join(s[t:]))
print(s)

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

x = len(S)-1

s = 0
for i in range(1 << x):
    t = 0
    for j in range(x):
        if ((i >> j) & 1 == 1):
            s += int(''.join(s[t:j+1]))
            t = j+1
    s = int(''.join(s[t:]))
print(s)

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

x = len(S)-1

a = 0
b = 0
s = 0
for i in range(1 << x):
    for j in range(x):
        if ((i >> j) & 1 == 1):
            b = j
            s += int(S[a:b])
            a = j

print(s)

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

n = len(S)
e = ""
s = 0

for i in range(2**(n-1)):
    for j in range(n-1):
        e += S[j]
        if (i << j & 1):
            e += "+"
    s += sum(map(int, e.split("+")))
    
print(s)
Problem p02720 (python)

Fixed submission:
from collections import deque
import sys

stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))

K = read_int()[0]

q = deque()
for i in range(1, 10):
    q.append(i)

def solve():
    for _ in range(K - 1):
        x = q.popleft()
        if x % 10 != 0:
            q.append(10 * x + (x % 10 - 1))
        q.append(10 * x + (x % 10))
        if x % 10 != 9:
            q.append(10 * x + + (x % 10 + 1))
    return q.popleft()

if __name__ == "__main__":
    print(solve())

Buggy submission (verdict: Runtime Error):
from collections import deque

stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))

K = read_int()[0]

q = deque()
for i in range(1, 10):
    q.append(i)
def solve():
    for _ in range(K - 1):
        x = q.popleft()
        if x % 10 != 0:
            q.append(10 * x + (x % 10 - 1))
        q.append(10 * x + (x % 10))
        if x % 10 != 9:
            q.append(10 * x + + (x % 10 + 1))
    print()
    return q.popleft()

if __name__ == "__main__":
    print(solve())
Problem p02818 (python)

Fixed submission:
A, B, K = [int(s) for s in input().split()]
X = A+B
if K <= A:
  print(str(A-K)+' '+str(B))
elif K <= X:
  print(str(0)+' '+str(X-K))
else:
  print(str(0)+' '+str(0))

Buggy submission (verdict: Runtime Error):
A, B, K = [int(s) for s in input().split()]
if K <= A:
  print(str(A-K)+' '+str(B))
else
  print(str(0)+' '+str(A+B-K))
Problem p02953 (python)

Fixed submission:
N = int(input())
H = [int(s) for s in input().split()]
if N == 1:
  print('Yes')
else:
  Hc = H.copy()
  Hc[0] = Hc[0]-1
  flg = 'Yes'
  for i in range(N-1):
    if Hc[i+1] - Hc[i] >= 1:
      Hc[i+1] = Hc[i+1] - 1
    elif Hc[i+1] - Hc[i] < 0:
      flg = 'No'
  print(flg)

Buggy submission (verdict: Runtime Error):
N = int(input())
H = [int(s) for s in input().split()]
if N == 1:
  print('Yes')
else:
  Hc = H.copy()
  Hc[0] = Hc[0]-1
  flg = 'Yes'
  for i in range(N-1):
    if Hc[i+1] - Hc[i] >= 1:
      Hc[i+1] = Hc[i+1] - 1
    elif Hc[i+1] - Hc[i] < 0:
      flg = 'No'
  print(flg)
Problem p03067 (python)

Fixed submission:
r_str = input()
r_str = r_str.split()
r = [int(s) for s in r_str]
a = 'Yes'
 
if r[0] <= r[1]:
    if r[0] <= r[2] and r[2] <= r[1]:
        a = 'Yes'
    else:
        a = 'No'
else:
    if r[1] <= r[2] and r[2] <= r[0]:
        a = 'Yes'
    else:
        a = 'No'
 
print(a)

Buggy submission (verdict: Runtime Error):
r_str = r_str.split()
r = [int(s) for s in r_str]
a = 'Yes'
 
if r[0] <= r[1]:
    if r[0] <= r[2] and r[2] <= r[1]:
        a = 'Yes'
    else:
        a = 'No'
else:
    if r[1] <= r[2] and r[2] <= r[0]:
        a = 'Yes'
    else:
        a = 'No'
 
print(a)
Problem p02720 (python)

Fixed submission:
K = int(input())
cand = [[1, 2, 3, 4, 5, 6, 7, 8, 9]]
for _ in range(9):
    tmp = []
    for v in cand[-1]:
        if v%10 != 0:
            tmp.append(v*10 + (v%10-1))
        tmp.append(v*10 + (v%10))
        if v%10 != 9:
            tmp.append(v*10 + (v%10+1))
    cand.append(tmp)
ans = []
for i in range(len(cand)):
    for v in cand[i]:
        ans.append(v)
ans = sorted(ans)
print(ans[K-1])

Buggy submission (verdict: Runtime Error):
K = int(input())
cand = [[1, 2, 3, 4, 5, 6, 7, 8, 9]]
for _ in range(4):
    tmp = []
    for v in cand[-1]:
        if v%10 != 0:
            tmp.append(v*10 + (v%10-1))
        tmp.append(v*10 + (v%10))
        if v%10 != 9:
            tmp.append(v*10 + (v%10+1))
    cand.append(tmp)
ans = []
for i in range(len(cand)):
    for v in cand[i]:
        ans.append(v)
ans = sorted(ans)
print(ans[K-1])
Problem p02718 (python)

Fixed submission:
n,m = map(int,input().split())
a = list(map(int,input().split()))
a.sort(reverse=True)
sum_a = sum(a)
# print(a)
ans = 0
for i in range(n):
    if a[i] >= sum_a/(4*m): 
        ans = i+1
# print(ans)
# print(sum_a/(4*m))
if ans >=m:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
a = list(map(int,input().split()))
a.sort(reverse=True)
sum_a = sum(a)
for i in range(n):
    if a[i] > sum_a/(4*m): 
        ans = i
# print(sum_a/(4*m))
if ans >=m:
    print("Yes")
else:
    print("No")
Problem p02780 (python)

Fixed submission:
# import numpy as np

def cal_ans(x):
    ans = (x+1)/2
    return ans
n,k = map(int,input().split())
p = list(map(int,input().split()))
p = list(map(cal_ans,p))

ans_temp = 0
ans_list = []
S = [0]
for i in range(n):
    S.append(S[i]+p[i])
# print(p)
# print(S)
# for i in range(n-k+1):
#     ans_list.append(sum(p[i:i+k]))
t_len = len(S)
ans1 = 0
for i in range(t_len - k):
    if ans1 < S[i+k]-S[i]:
        ans1 = S[i+k]-S[i]
print(ans1)
# ans = 0
# for i in range(k):
#     ans += (ans_list[i]*(ans_list[i]+1)/2)/ans_list[i]
#     # print((ans_list[i]*(ans_list[i]+1)/2))
# print(ans)

Buggy submission (verdict: Runtime Error):
def cal_ans(x):
    ans = (x*(x+1)/2)/x
    return ans
n,k = map(int,input().split())
p = list(map(int,input().split()))
p = list(map(cal_ans,p))

ans_temp = 0
ans_list = []
for i in range(n-k+1):
    if ans_temp < np.sum(p[i:i+k]):
            ans_temp = np.sum(p[i:i+k])
print(ans_temp)