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

Fixed submission:
from sys import stdin

n, k = map(int, stdin.readline().rstrip().split())
a = map(int, stdin.readline().rstrip().split())

a = list(a) 
count = 0 
for i in range(1, n):
    for j in range(i):
        if a[j] > a[i]:
            count += 1
import copy
b = copy.copy(a)
b.sort()
count *= k
import bisect
ans2 = 0
for i in range(n):
  ans2 += bisect.bisect_left(b, a[i])
print((count + ans2 * (((k-1)* k)//2))%(1000000007))

Buggy submission (verdict: Runtime Error):
from sys import stdin

n, k = map(int, stdin.readline().rstrip().split())
a = map(int, stdin.readline().rstrip().split())

class Bit:
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)
  
    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
  
    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i
 
bit = Bit(n*k)
ans = 0
a = list(a)*k
for i, p in enumerate(a):
    ans += (i - bit.sum(p)) % (10^9+7)
    bit.add(p, 1)
print(ans)
Problem p03231 (python)

Fixed submission:
import fractions
import sys
from sys import stdin

n, m = map(int, stdin.readline().rstrip().split())
s = stdin.readline().rstrip()
t = stdin.readline().rstrip()


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


g = fractions.gcd(n, m)
for i in range(g):
    if s[n // g * i] != t[m // g * i]:
        print(-1)
        sys.exit()
print(lcm(n, m))

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

n, m = map(int, stdin.readline().rstrip().split())
s = stdin.readline().rstrip()
t = stdin.readline().rstrip()


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


if max(n, m) % min(n, m) == 0:
    print(-1)
else:
    print(lcm(n, m))
Problem p03476 (python)

Fixed submission:
def is_prime(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True
c=[0]
ci=0
for i in range(1,10**5+1):
  if is_prime(i) and is_prime((i+1)//2):
    ci+=1
  c.append(ci)
q=int(input())
lr=[list(map(int,input().split())) for _ in range(q)]
for lri in lr:
  print(c[lri[1]]-c[lri[0]-1])

Buggy submission (verdict: Runtime Error):
import bisect
import math
import sys
from bisect import bisect_left
from math import ceil, sqrt

q = int(sys.stdin.readline().rstrip())
lr = [list(map(int, sys.stdin.readline().rstrip().split())) for i in range(q)]


def era_prime(N):
    temp = [True]*(N+1)
    temp[0] = temp[1] = False
    for i in range(2, ceil(sqrt(N+1))):
        if temp[i]:
            temp[i+i::i] = [False]*(len(temp[i+i::i]))
    primes = [n for n in range(N+1) if temp[n]]
    return primes


primes = era_prime(100000)
post_primes = []
ind = 0
tmp = 0
p = [0]
for pi in primes:
    if (pi + 1) // 2 in primes:
        post_primes.append(pi)

for i in range(1, 100000):
    if ind >= len(post_primes):
        break
    if i == post_primes[ind]:
        tmp += 1
        ind += 1
    p.append(tmp)
for lri in lr:
    ans = 0
    print(p[lri[1]]-p[lri[0]-1])

Buggy submission (verdict: Runtime Error):
import math
import sys
from bisect import bisect_left
from math import ceil, sqrt

q = int(sys.stdin.readline().rstrip())
lr = [list(map(int, sys.stdin.readline().rstrip().split())) for i in range(q)]


def era_prime(N):
    temp = [True]*(N+1)
    temp[0] = temp[1] = False
    for i in range(2, ceil(sqrt(N+1))):
        if temp[i]:
            temp[i+i::i] = [False]*(len(temp[i+i::i]))
    primes = [n for n in range(N+1) if temp[n]]
    return primes


primes = era_prime(100000)
post_primes = []
for pi in primes:
    if (pi + 1) // 2 in primes:
        post_primes.append(pi)


for lri in lr:
    l = bisect_left(post_primes, lri[0])
    r = bisect_left(post_primes, lri[1])
    ans = r - l
    # if post_primes[l] == post_primes[r] and post_primes[l] in lri:
    #     ans += 1
    if post_primes[r] in lri:
        ans += 1
    print(ans)
Problem p03293 (python)

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

flag = False
s_tmp = S
for cnt in range(len(S)):
    s_tmp = s_tmp[-1] + s_tmp[:-1]
    if s_tmp == T:
        flag = True
        break

if flag:
    print("Yes")
else:
    print("No")

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

flag = False
s_tmp = S
for cnt in range(len(s)):
    s_tmp = s_tmp[-1] + s_tmp[:-1]
    if s_tmp == T:
        flag = True
        break

if flag:
    print("Yes")
else:
    print("No")
Problem p02730 (python)

Fixed submission:
def check(s):
  n=len(s)
  if s!=s[::-1]:
    return "No"
  temp=s[:(n-1)//2]
  if temp!=temp[::-1]:
    return "No"
  temp=s[((n+3)//2)-1:]
  if temp!=temp[::-1]:
    return "No"
  return "Yes"
s=input()
print(check(s))

Buggy submission (verdict: Runtime Error):
def check(s):
  n=len(s)
  if s!==s[::-1]:
    return "No"
  temp=s[:(n-1)//2]
  if temp!=temp[::-1]:
    return "No"
  temp=s[((n+3)//2)-1:]
  if temp!=temp[::-1]:
    return "No"
  return "Yes"
s=input()
print(check(s))
Problem p03473 (python)

Fixed submission:
# coding = SJIS

m = int(input())

ans = 48 - m

print(ans)

Buggy submission (verdict: Runtime Error):
print(48 - input())
Problem p03501 (python)

Fixed submission:
# coding = SJIS

n, a, b = map(int, input().split())

print(min((n * a), b))

Buggy submission (verdict: Runtime Error):
# coding = SJIS

n, a, b = map(int, input().split())

print(min(n * a), b)
Problem p03697 (python)

Fixed submission:
# coding = SJIS

a, b = map(int, input().split())

if a + b >= 10:
    print("error")
else:
    print(a + b)

Buggy submission (verdict: Runtime Error):
# coding = SJIS

a, b = map(int, input())

if a + b >= 10:
    print("error")
else:
    print(a + b)
Problem p03698 (python)

Fixed submission:
# coding = SJIS

s = str(input())
if len(set(s)) == len(s):
    print("yes")
else:
    print("no")

Buggy submission (verdict: Runtime Error):
# coding = SJIS

a, b = map(int, input().split())

if a + b >= 10:
    print("error")
else:
    print(a + b)
Problem p02700 (python)

Fixed submission:
vals = [int(i) for i in input().split()]
a = vals[0]
b = vals[1]
c = vals[2]
d = vals[3]
res2 = a//d + (1 if(a % d > 0) else 0)
res1 = c//b + (1 if(c % b > 0) else 0)
res = "Yes" if(res1 <= res2) else "No"
print(res)

Buggy submission (verdict: Runtime Error):
    vals = [int(i) for i in input().split()]
    a = vals[0]
    b = vals[1]
    c = vals[2]
    d = vals[3]
    res2 = a//d + (1 if(a % d > 0) else 0)
    res1 = c//b + (1 if(c % b > 0) else 0)
    res = "Yes" if(res1 <= res2) else "No"
    print(res)

Buggy submission (verdict: Runtime Error):
    vals = [int(i) for i in input().split()]
    a = vals[0]
    b = vals[1]
    c = vals[2]
    d = vals[3]
    res2 = a//d + (1 if(a % d > 0) else 0)
    res1 = c//b + (1 if(c % b) > 0 else 0)
    res = "Yes" if(res1 <= res2) else "No"
    print(res)
Problem p02700 (python)

Fixed submission:
a, b, c, d = map(int, input().split())
if ((a + d - 1) // d) >= ((c + b - 1) // b):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
import math
if(math.ceil(a/d)>=math.ceil(c/b)):
    print("Yes")
else:
    print("No")
Problem p02823 (python)

Fixed submission:
N,A,B = map(int,input().split())
if (B - A) % 2 == 0:
	print((B - A)//2)
else:
	print(min(A - 1,N - B) + 1 + (B - A - 1)//2)

Buggy submission (verdict: Runtime Error):
N,A,B = map(int,input().split())
if (B - A) % 2 == 0:
	print((B - A)//2))
else:
	print(min(A - 1,N - B) + 1 + (B - A - 1)//2)

Buggy submission (verdict: Runtime Error):
N,A,B = map(int,input().split())
if (B - A) % 2 == 0:
	print(B - A//2))
else:
	print(min(A - 1,N - B) + 1 + (B - A - 1)//2)
Problem p02947 (python)

Fixed submission:
N = int(input())
S = []
for i in range(N):
    S.append("".join(sorted(input())))
S.sort()
C = []
cnt = 1
for i in range(N - 1):
    if S[i] == S[i + 1]:
        cnt += 1
    else:
        C.append(cnt)
        cnt = 1
C.append(cnt)
ans = 0
for cnt in C:
    ans += cnt * (cnt-1) // 2
print(ans)

Buggy submission (verdict: Runtime Error):
from scipy.special import comb
N = int(input())
S = []
for i in range(N):
    S.append("".join(sorted(input())))
S.sort()
C = []
cnt = 1
for i in range(N - 1):
    if S[i] == S[i + 1]:
        cnt += 1
    else:
        C.append(cnt)
        cnt = 1
C.append(cnt)
ans = 0
for cnt in C:
    ans += int(comb(cnt,2))
print(ans)
Problem p02995 (python)

Fixed submission:
import fractions
A,B,C,D = map(int,input().split())
num_gcd = C*D//fractions.gcd(C,D)
ans_B = 0 - B//C - B//D + B//num_gcd
ans_A = 0 - (A-1)//C - (A-1)//D + (A-1)//num_gcd
ans = B - A + 1 + ans_B - ans_A
print(ans)

Buggy submission (verdict: Runtime Error):
#from fractions import gcd
import math
A,B,C,D = map(int,input().split())
num_gcd = C*D//math.gcd(C,D)
ans_B = 0 - B//C - B//D + B//num_gcd
ans_A = 0 - (A-1)//C - (A-1)//D + (A-1)//num_gcd
ans = B - A + 1 + ans_B - ans_A
print(ans)
Problem p03001 (python)

Fixed submission:
W,H,x,y = map(int,input().split())
if  x*2==W and y*2==H:
	s = 1
else:
	s = 0
print(W*H/2,s)

Buggy submission (verdict: Runtime Error):
W,H,x,y = map(int,input().split())
if(W//2==x and H//2==y):
	print(W*H/2,end=" ")
	print(1)
	exit()
if(W//2==x or H//2==y):
	print(W*H/2,end=" ")
	print(0)
	exit()
minX = 0
minY = 0
min = 0
if not(W//2==x or H//2==y):
	minX = min(x,W-x)
	minY = min(y,H-y)
	if(minX>minY):
		print(minX*H//2,end=" ")
	else:
		print(minY*W//2,end=" ")
	if(x==y):
		print(1)
	else:
		print(0)
Problem p03140 (python)

Fixed submission:
N = int(input())
A = input()
B = input()
C = input()
ans = 0
for i in range(N):
	ans += len(set([A[i],B[i],C[i]])) - 1
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = input()
B = input()
C = input()
ans = 0
for i in range(N):
	ans += len(set(A[i],B[i],C[i])) - 1
print(ans)
Problem p03282 (python)

Fixed submission:
S = input()
K = int(input())
ans = 1
if K == 1:
	print(S[0])
	exit()
else:
	for i in range(len(S)):
		if S[i] != "1" and i < K:
			ans = int(S[i])
			break
print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
K = int(input())
if K == 1:
	print(int(S[i]))
else:
	if S[0] == "1":
		print(S[1])
	else:
		print(S[0])
Problem p04029 (python)

Fixed submission:
N = int(input())
sum = 0
for i in range(1,N+1):
	sum += i
print(sum)

Buggy submission (verdict: Runtime Error):
N = int(input())
sum = 0
for i in range(1,N+1)
	sum += i
print(sum)
Problem p02812 (python)

Fixed submission:
n = int(input())
s= input()
print(s.count("ABC"))

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

print(s.count("ABC")
Problem p03323 (python)

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

if a<9 and b<9:
  print("Yay!")
else:
  print(":(")

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

for a<9 and b<9:
  print("Yay!")
else:
  print(":(")
Problem p03386 (python)

Fixed submission:
a,b,k = map(int,input().split())
n = b - a + 1
if n <= k*2:
  for i in range(a,b+1):
    print(i)
else:
  for i in range(a,a+k):
    print(i)
  for j in range(b-k+1,b+1):
     print(j)

Buggy submission (verdict: Runtime Error):
a,b,k = map(int,input().split())
n = b - a + 1
if n <= k*2:
  for i in range(a,b+1):
    print(i)
else:
  for i in range(a,k+1):
    print(i)
  fot j in range(b-k+1,b+1)
  print(j)
Problem p03545 (python)

Fixed submission:
n = input()
s = len(n)-1


for i in range(2**s):
  op = ""
  for j in range(s):
    if (i>>j)&1:
      op += "+"
    else:
      op += "-"
  ans =int(n[0])
  for j in range(len(op)):
    if op[j]=="+":
      ans += int(n[j+1])
    else:
      ans -= int(n[j+1])
  if ans == 7:
      ret = ""
      for k in range(len(op)):
        ret += n[k]
        ret += op[k]
      ret += n[-1]
      ret += "=7"
      print(ret)
      exit(0)

Buggy submission (verdict: Runtime Error):
nums = input() 
N = 3
for i in range(2**N):
    equation = ''
    for j in range(N+1):
        equation += nums[j]
        if ((i >> j) & 1):
            equation += '+'
        else:
            equation += '-'
    if eval(equation) == 7:
        print(equation + '=7')
        exit()
Problem p03564 (python)

Fixed submission:
n = int(input())
k = int(input())
sum = 1
for i in range(n):
  sum = min(sum*2,sum+k)    
print(sum)

Buggy submission (verdict: Runtime Error):
n = int(input())
k = int(input())
sum_list = []
for i in range(1,n+1):
  j = n-i
  if j >= 1:
    sum_list.append((2*i)+(j+k))
sum_list.sort()
print(sum_list[0])
Problem p02910 (python)

Fixed submission:
S = ' ' + input()
even_pat = ['R','U','D']
odd_pat = ['L','U','D']

flag = True

for i in range(1,len(S)):
    if i % 2 == 1:
        if not(S[i] in even_pat):
            flag = False
            break
    
    else:
        if not(S[i] in odd_pat):
            flag = False
            break

print('Yes' if flag else 'No')

Buggy submission (verdict: Runtime Error):
S = ' ' + input()
even_dance = ['R','U','D']
odd_dance = ['L','U','D']

flag = True

for i in range(1,len(S)):
	if i % 2 == 1:
      if S[i] in even_dance:
        pass
      else:
        flag = False
        break
        
	else:
      if S[i] in odd_dance:
        pass
      else:
        flag = False
        break
if flag:
  print('Yes')
else:
  print('No')
Problem p02934 (python)

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

s_1 = 0

for a in A:
    s_1 += 1/a

print(1/s_1)

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

print(1/sum(s_1))
Problem p02982 (python)

Fixed submission:
N, D = map(int,input().split())
li = []
for _ in range(N):
    li.append(list(map(int,input().split())))

s = 0
c = 0
for n1 in range(-1,N-1):
    for n2 in range(n1+1,N-1):
        for d in range(D):
            s = s + abs(li[n1][d] - li[n2][d]) ** 2
        s_float = float(s**(1/2))
        if s_float.is_integer():
            c += 1
        s = 0
print(c)

Buggy submission (verdict: Runtime Error):
N, D = map(int,input().split())
li = []
for _ in range(N):
    li.append(list(map(int,input().split())))

s = 0
c = 0
for n in range(-1,N-1):
    for d in range(D):
        s = s + abs(li[n][d] - li[n+1][d]) ** 2
    if (s**(1/2)).is_interger():
        c += 1
    s = 0
Problem p02988 (python)

Fixed submission:
n = int(input())

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

co = 0

for i in range(1,len(li)-1):
  work = sorted([li[i-1],li[i],li[i+1]])

  if work.index(li[i]) == 1:
    co += 1
print(co)

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

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

co = 0

for i in range(1,len(li)-1):
  work = sort([li[i-1],li[i],li[i+1]])

  if work.index(li[i]) == 1:
    co += 1
print(co)
Problem p02743 (python)

Fixed submission:
a, b, c = map(int, input().split())
print('Yes' if (c-a-b)>0 and 4*a*b < (c - a- b)**2 else 'No')

Buggy submission (verdict: Runtime Error):
 numpy as np
a, b, c = map(np.sqrt, map(lambda x:100*x, map(int, input().split())))
print('Yes' if a + b - c < 0  else 'No')

Buggy submission (verdict: Runtime Error):
import numpy as np
a, b, c = map(np.sqrt, map(lambda x:100*x, map(int, input().split())))
print('Yes' if a + b - c < 0 and  else 'No')

Buggy submission (verdict: Runtime Error):
a, b, c = int(input().split())
print('Yes' if a**2+b**2-2*a*b - c**2 < 0 else 'No')
Problem p02910 (python)

Fixed submission:
import re
hoge = list(input())
i = 0
while i < len(hoge):
    if i%2==0 and re.findall(r'[RDU]',hoge[i]):
        pass
    elif i%2==1 and re.findall(r'[LDU]',hoge[i]):
        pass
    else:
        break
    i+=1
if i == len(hoge):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
hoge = input().split()
i = 0
while i <= len(hoge):
  if i%2==0 and hoge[i] == ('L' or 'D' or 'U'):
    pass
  elif i%2==1 and hoge[i] == ('R' or 'D' or 'U'):
    pass
  else:
    break
  i+=1
if i == len(hoge):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
hoge = input().split()
i = 0
while i < range(len(hoge)):
  if i%2==0 and hoge[i] == ('R' or 'D' or 'U'):
    pass
  elif i%2==1 and hoge[i] == ('L' or 'D' or 'U'):
    pass
  else:
    break
  i+=1
if i == len(hoge):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
hoge = input().split()
i = 0
while i < range(len(hoge)):
  if i%2==0 and hoge[i] == 'L' or 'D' or 'U':
    pass
  elif i%2==1 and hoge[i] == 'R' or 'D' or 'U':
    pass
  else:
    break
  i+=1
if i == len(hoge):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
hoge = input().split()
while i < range(len(hoge)):
  if i%2==0 and hoge[i] == 'L' or 'D' or 'U':
    pass
  elif i%2==1 and hoge[i] == 'R' or 'D' or 'U':
    pass
  else:
    break
  i+=1
if i == len(hoge):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
hoge = input().split
while i < range(len(hoge)):
  if i%2==0 and hoge[i] == 'L' or 'D' or 'U':
    pass
  elif i%2==1 and hoge[i] == 'R' or 'D' or 'U':
    pass
  else:
    break
  i+=1
if i == len(hoge):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
hoge = input().strip()
int i = 0
while i < range(len(hoge)):
  if i%2==0 and hoge[i] == 'L' or 'D' or 'U':
    pass
  elif i%2==1 and hoge[i] == 'R' or 'D' or 'U':
    pass
  else:
    break
  i+=1
if i == len(hoge):
  print('Yes')
else:
  print('No')
Problem p03611 (python)

Fixed submission:
import collections

num = int(input())
s = sorted(list(map(int, input().split())))
if num == 1:
    print(1)
else:
    c = collections.Counter(s)
    max_ans = 0
    for i in range(num):
        start = s[i]
        current_ans = c[start]+c[start+1]+c[start+2]
        max_ans = max(current_ans,max_ans)
        i += c[start]
    print(max_ans)

Buggy submission (verdict: Runtime Error):
import counter

num = int(input())
s = sorted(list(map(int, input().split())))
if num == 1:
    print(1)
else:
    max_ans = 0
    for i in range(num):
        start = s[i]
        c = s.collections.Counter(1)
        current_ans = c[start]+c[start+1]+c[start+2]
        max_ans = max(current_ans,max_ans)
    print(max_ans)

Buggy submission (verdict: Runtime Error):
import counter

num = int(input())
s = [input() for i in range(num)].sort
if num == 1:
    print(1)
else:
    max_ans = 0
    for i in range(num):
        start = int(s[i])
        c = s.collections.Counter(1)
        current_ans = c[start]+c[start+1]+c[start+2]
        max_ans = max(current_ans,max_ans)
    print(max_ans)

Buggy submission (verdict: Runtime Error):
import counter

num = int(input())
s = [input() for i in range(num)].sort
if num == 1:
    print(1)
else:
    max_ans = 0
    for i in range(num):
        start = int(s[i])
        c = s.collections.Counter(1)
        current_ans = c[start]+c[start+1]+c[start+2]
        max_ans = max(current_ans,max_ans)
    print(max_ans)
Problem p03633 (python)

Fixed submission:
import fractions
n = int(input())
t = [int(input()) for _ in range(n)]

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

ans = 1
for i in range(n):
    ans = lcm(t[i],ans)
print(ans)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
t = [int(input()) for _ in range(n)]

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

ans = 1
for i in range(n):
    ans = lcm(t[i],ans)
print(ans)
Problem p03657 (python)

Fixed submission:
a = list(map(int, input().split()))
if a[0]%3==0 or a[1]%3==0 or (a[0]+a[1])%3==0:
  print('Possible')
else:
  print('Impossible')

Buggy submission (verdict: Runtime Error):
a = list(map(int, input().split()))
if a[0]%3==0 or a[1]%3==0 or (a[0]+a[1])%3==0:
  print(Possible)
else:
  print(Impossible)

Buggy submission (verdict: Runtime Error):
a = list(map(int(), input().split()))
if a[0]%3==0 or a[1]%3==0 or (a[0]+a[1])%3==0:
  print(Possible)
else:
  print(Impossible)
Problem p04047 (python)

Fixed submission:
a = int(input())
x = sorted(list(map(int,input().split())))
cnt=0
for i in range(a):
  cnt += x[2*i]
print(cnt)

Buggy submission (verdict: Runtime Error):
a = input()
x = sorted(list(map(int,input().split())))
cnt=0
for i in range(a-1):
  cnt += x[2*i]
print(cnt)

Buggy submission (verdict: Runtime Error):
a = input()
x = sorted(list(map(int,input().split())))
cnt=0
for i in range(a):
  cnt += x[2*i]
print(cnt)
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,inpput().split(' '))

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

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

Buggy submission (verdict: Runtime Error):
a,b = map(input().split(' '))
print(maximum(a-2*b,0))

Buggy submission (verdict: Runtime Error):
a,b = map(input().split(' '))
print(max(a-2*b,0))
Problem p02718 (python)

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

a.sort(reverse=True)
total = sum(a)

if a[m - 1] < 1/(4*m) * total:
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
n, m = map(int, intput().split())
a = list(map(int, intput().split()))

total = sum(a)
for vote in a:
  if vote < 1/(4*m) * total:
    print("No")
    
print("Yes")
Problem p02724 (python)

Fixed submission:
X = int(input())

print(X // 500 * 1000 + X % 500 // 5 * 5)

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

print(X // 500 * 1000 + X % 500 // 5 * 5)
Problem p03437 (python)

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

if X % Y == 0:
    print(-1)
else:
   print(X)

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

if X==Y:
    print(-1)
else:
    for i in range(10**18):
        X1 = int(X*i)
        if X1 % Y != 0:
            print(str(X1))
            break
Problem p02700 (python)

Fixed submission:
t_hp_str,t_atack_str,a_hp_str,a_atack_str= input().split()
t_hp = int(t_hp_str)
t_atack = int(t_atack_str)
a_hp=int(a_hp_str)
a_atack = int(a_atack_str)

for num in range(300):
  if num%2 == 0:
    a_hp = a_hp - t_atack
    if a_hp <= 0:
      print("Yes")
      break
  else:
    t_hp = t_hp - a_atack
    if t_hp <= 0:
      print("No")
      break

Buggy submission (verdict: Runtime Error):
t_hp_str,t_atack_str,a_hp_str,a_atack_str= input().split()
t_hp = int(t_hp_str)
t_atack = int(t_atack_str)
a_hp=int(a_hp_str)
a_atack = int(a_atack_str)

while True:
  if num%2 == 0:
    a_hp = a_hp - t_atack
    if a_hp <= 0:
      print("Yes")
      break
  else:
    t_hp = t_hp - a_atack
    if t_hp <= 0:
      print("No")
      break
Problem p02795 (python)

Fixed submission:
import math
a=input()
b=input()
c=input()
if int(a)>int(b):
 print(math.ceil(int(c)/int(a)))
elif int(a)<int(b):
 print(math.ceil(int(c)/int(b)))
elif int(a)==int(b):
 print(math.ceil(int(c)/int(b)))

Buggy submission (verdict: Runtime Error):
import math
a=input()
b=input()
c=input()
if a>b:
 print(math.ceil(int(c)/int(a)))
elif a<b:
 print(math.ceil(int(c)/int(b)))
print(int(c)/int())
Problem p02801 (python)

Fixed submission:
s = input()
tmp = ord(s)
ans = tmp + 1
print(chr(ans))

Buggy submission (verdict: Runtime Error):
s = input()
tmp = ord(s)
ans = tmp += 1
print(chr(ans))
Problem p03074 (python)

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

i = 0
for j in range(N):
    if S[j] == "0" and (j==0 or S[j-1] == "1"):
        K -= 1
    if (K<0):
        if(S[i]=="0" and S[i+1] == "1"):
            K += 1
        i+=1

print(N-i)

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

pos = 0
i_s = [pos]
continue_s = S[0]
while True:
    pos += 1
    if pos == N :
        break
    s = S[pos]
    if continue_s == s:
        continue
    else:
        continue_s = s
        i_s.append(pos)


i_length = len(i_s) - 1
X = []
rev = K * 2
for n,i in enumerate(i_s):
    if S[i] == "1":
        if i_length - n >= rev-1:
            if i_length - n == rev-1:
                X.append(N-i)
            elif i_length - n == rev:
                X.append(N-i)
            else:
                X.append(i_s[n+rev+1]-i)

print(max(X))