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

Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
import itertools

def input():
    return sys.stdin.readline()


def resolve():
    n, m, q = map(int, input().split())
    a_d_list = []
    for i in range(q):
        a_d_list.append(list(map(int,input().split())))

    l = [i for i in range(1, m+1)]
    combi_list = list(itertools.combinations_with_replacement(l, n))

    ans_dic = {}
    for combi in combi_list:
        ans_dic[str(combi)] = 0

    for combi in combi_list:

        for i, a_d in enumerate(a_d_list):
            a = a_d[0]
            b = a_d[1]
            c = a_d[2]
            d = a_d[3]

            if combi[b-1] - combi[a-1] == c:

                ans_dic[str(combi)] += d


    print(max(ans_dic.values()))





if __name__ == "__main__":
    resolve()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
import itertools

def input():
    return sys.stdin.readline()


def resolve():
    n, m, q = map(int, input().split())
    a_d_list = []
    for i in range(q):
        a_d_list.append(list(map(int,input().split())))

    l = [i for i in range(1, m)]
    combi_list = list(itertools.combinations_with_replacement(l, n))

    ans_dic = {}
    for combi in combi_list:
        ans_dic[str(combi)] = 0

    for combi in combi_list:

        for i, a_d in enumerate(a_d_list):
            a = a_d[0]
            b = a_d[1]
            c = a_d[2]
            d = a_d[3]

            if combi[b-1] - combi[a-1] == c:

                ans_dic[str(combi)] += d


    print(max(ans_dic.values()))





if __name__ == "__main__":
    resolve()
Problem p02723 (python)

Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys


def input():
    return sys.stdin.readline()


def resolve():
    s = input()

    if s[2] == s[3] and s[4] == s[5]:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    resolve()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys


def input():
    return sys.stdin.readline()


def resolve():
    k, x = map(int, input().split())

    sum_money = k * 500

    if sum_money >= x:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    resolve()
Problem p02785 (python)

Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

n, k = map(int, input().split())
hp_list = list(map(int, input().split()))

if n < k:
    print(0)
    exit()

# ソートする
hp_list.sort()

# 必殺技の回数ぶん除去
for i in range(k):
    hp_list.pop()

sum_hp = 0
for hp in hp_list:
    sum_hp += hp

print(sum_hp)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-

n, k = map(int, input().split())
hp_list = list(map(int, input().split()))

# ソートする
hp_list.sort(reverse=True)

# 必殺技の回数ぶん除去
for i in range(k):
    hp_list.pop(0)

sum_hp = 0
for hp in hp_list:
    sum_hp += hp

print(sum_hp)
Problem p02659 (python)

Fixed submission:
from decimal import Decimal
x,y = map(str,input().split())
import math
x=int(x)
y=Decimal(y)
val_floor = math.floor(x*y)
print(int(val_floor))

Buggy submission (verdict: Runtime Error):
x,y = map(float,input().split())
import math
from decimal import Decimal
y_ = Decimal('y')
x_ = Decimal('x')

print(math.floor(x_*y_))

Buggy submission (verdict: Runtime Error):
x,y = map(int,input().split())
import math

print(math.floor(x*y))
Problem p02723 (python)

Fixed submission:
a = input()
if (a[2]==a[3]) & (a[4] == a[5]):
    print('Yes')
else:
	print('No')

Buggy submission (verdict: Runtime Error):
(n,m)=map(int,input().split())
a=input().split()
a=list(map(int,a))
l=[]
k=0
a=sorted(a)
for i in range(m-1):
    d=abs(a[i]-a[i+1])
    k=k+d
    l.append(d)
# k=k-d
c=n-k
l.append(c)
l=sorted(l)

print(n-l[-1])

Buggy submission (verdict: Runtime Error):
(n,m)=map(int,input().split())
a=input().split()
a=list(map(int,a))
l=[]
k=0
a=sorted(a)
for i in range(m-1):
    d=abs(a[i]-a[i+1])
    k=k+d
    l.append(d)
# k=k-d
c=n-k
l.append(c)
l=sorted(l)

print(n-l[-1])
Problem p02725 (python)

Fixed submission:
(n,m)=map(int,input().split())
a=input().split()
a=list(map(int,a))
l=[]
k=0
a=sorted(a)
for i in range(m-1):
    d=abs(a[i]-a[i+1])
    k=k+d
    l.append(d)
# k=k-d
c=n-k
l.append(c)
l=sorted(l)

print(n-l[-1])

Buggy submission (verdict: Runtime Error):
k=int(input())
n=int(input())
n_list=[int(input()) for i in range(n)]
for i in range(len(n_list)):
  if n_list[i] > k-n_list[i]:
    n_list[i]=-(k-n_list[i])
n_list.sort()
print(n_list[-1]-n_list[0])
Problem p02754 (python)

Fixed submission:
nums = [int(e) for e in input().split()]
n = nums[0]
a = nums[1]
b = nums[2]

sum1 = a + b
iter1 = n // sum1
amari = n % sum1
if amari >= a:
	print(iter1 * a + (a))
else:
  print(iter1 * a + (amari))

Buggy submission (verdict: Runtime Error):
nums = [int(e) for e in input().split()]
n = nums[0]
a = nums[1]
b = nums[2]
22 3 4
bbb4444bbb4444bbb4444b
sum = a + b
iter = n // sum
amari = n % sum
if amari >= b:
	print(iter * a + (b))
else:
  print(iter * a + (amari))
Problem p02759 (python)

Fixed submission:
n = int(input())
if (n % 2) == 1:
  print((n // 2) + 1)
else:
  print(n // 2)

Buggy submission (verdict: Runtime Error):
n = input()
if (n % 2) == 1:
  print((n // 2) + 1)
else:
  print(n // 2)

Buggy submission (verdict: Runtime Error):
n = input()
if n % 2 == 1:
  print((n // 2) + 1)
else:
  print(n // 2)
Problem p03013 (python)

Fixed submission:
li = list(map(int,input().split()))
n,m=li[0],li[1]
_list=[int(input()) for i in range(m)]
is_safe = [True] * (n+1)
for a in _list:
  is_safe[a] = False
DP=[1, 1] if is_safe[1] == True else [1, 0]
for i in range(n-1):
  if is_safe[i+2] == False:
    DP+= [0]
  else:
    DP += [DP[i] + DP[i+1]]
print(DP[n] % 1000000007 if DP[n] != 0 else 0)

Buggy submission (verdict: Runtime Error):
li = list(map(int,input().split()))
n,m=li[0],li[1]
_list=[int(input()) for i in range(m)]
is_safe = [True] * (n+1)
for a in _list:
  is_safe[a] = False
DP=[1, 1] if is_safe[1] == True else [1, 0]
for i in range(n-1):
  if is_safe[i+2] == False:
    DP+= [0]
  else:
    DP += [DP[i] + DP[i+1]]
print(DP[n]%=1000000007 if DP[n] != 0 else 0)

Buggy submission (verdict: Runtime Error):
li = list(map(int,input().split()))
n,m=li[0],li[1]
_list=[int(input()) for i in range(m)]
is_safe = [True] * (N)
for a in _list:
  is_safe[a] = False
DP=[1, 1] if is_safe[1] == True else [1, 0]
for i in range(n-1):
  if is_safe[i+2] == False:
    DP+= [0]
  else:
    DP += [DP[i] + DP[i+1]]
print(DP[n])
Problem p03329 (python)

Fixed submission:
L=[1]
n=int(input())
x = 6
y = 9
while x <= n:
  L.append(x)
  x *= 6
while y <= n:
  L.append(y)
  y *= 9
L.sort()#[1,6,9,36,81]
dp = [float("Inf")]*(n+1)
dp[0] = 0
for i in range(n+1):#0~81
  for j in L:#1,6,9
    if i+j <= n:
      dp[i+j] = min(dp[i+j],dp[i]+1)#dp=[0,1,...1,.1]
    else:
      break
print(dp[n])

Buggy submission (verdict: Runtime Error):
L=[1]
n=int(input())
x = 6
y = 9
while x <= n:
  L.append(x)
  x *= 6
while y <= n:
  L.append(y)
  y *= 9
L.sort()#[1,6,9,36,81]
dp = [float("Inf")]*(n+1)
dp[0] = 0
for i in range(n+1):#0~81
  for j in L:#1,6,9
    dp[i+j] = min(dp[i+j],dp[i]+1)#dp=[0,1,...1,.1]
print(dp[n])
Problem p03775 (python)

Fixed submission:
N = int(input())
import math
if N == 1:
    print(1)
else:
    for a in reversed(range(1, (int(math.sqrt(N)))+1)):
        if N % a == 0:
            b = N/a
            ans=max(len(str(int(a))), len(str(int(b))))
            break
    print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
import math
if N == 1:
    print(1)
else:
    for a in reversed(range(1, (int(math.sqrt(N)))+1)):
        if N % a == 0:
            b = N/a
            ans=max(len(str(int(a))), len(str(int(b))))
            break
print(ans)

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

if N == 1:
    print(1)
else:
    for a in reversed(range(1, (N//2)+1)):
        if N % a == 0:
            b = N/a
            ans=max(len(str(int(a))), len(str(int(b))))
            break
print(ans)
Problem p02699 (python)

Fixed submission:
s, w = map(int, input().split())
if s <= w: print('unsafe')
else     : print('safe')

Buggy submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())
x = -(-c // b)
y = -(-a // d)
if x <= y:
    print('Yes')
else:
    print('No')
Problem p02723 (python)

Fixed submission:
s = input()
if s[2] == s[3] and s[4] == s[5]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
s = input()
if s[3]==s[4] and s[5]==s[6]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
s = input()
if s[3] == s[4] and s[5] == s[6]:
    print('Yes')
else:
    print('No')
Problem p02753 (python)

Fixed submission:
s = input()
if s=='AAA' or s=='BBB':
    print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
s = input()
if s=='AAA' or s==s'BBB:
    print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
s = input()
if s[1]!=s[2] and s[2]!=s[3]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
s = input()
if not s[1]==s[2]==s[3]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
s = input()
if not s[1]==s[2] and s[2]==s[3]:
    print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
s = input()
if not s[1]==s[2]==s[3]:
    print('No')
else:
    print('Yes')
Problem p02759 (python)

Fixed submission:
from decimal import Decimal, ROUND_HALF_UP

n = int(input())
print(Decimal(n/2).quantize(Decimal(0), rounding=ROUND_HALF_UP))

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

if n%2 == 0: print({}.format(n/2))
else:        print({}.format(n/2+1))
Problem p02771 (python)

Fixed submission:
a,b,c = map(int, input().split())
if a==b!=c or a==c!=b or b==c!=a:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split)
if a==b!=c or a==c!=b or b==c!=a:
    print('Yes')
else:
    print('No')
Problem p02859 (python)

Fixed submission:
r = int(input())
print(r**2)

Buggy submission (verdict: Runtime Error):
print(int(input(**2))
Problem p02951 (python)

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

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
ans = c-(a-b)
if ans >= 0:
    print(ans)
else:
    print(o)
Problem p03036 (python)

Fixed submission:
r,t,x=map(int,input().split())
a=r*x-t
b=r*a-t
c=r*b-t
d=r*c-t
e=r*d-t
f=r*e-t
g=r*f-t
h=r*g-t
i=r*h-t
j=r*i-t
print(a)
print(b)
print(c)
print(d)
print(e)
print(f)
print(g)
print(h)
print(i)
print(j)

Buggy submission (verdict: Runtime Error):
r,t,x=map(int,input().split())
print(a=r*x-t)
print(b=r*a-t)
print(c=r*b-t)
print(d=r*c-t)
print(e=r*d-t)
print(f=r*e-t)
print(g=r*f-t)
print(h=r*g-t)
print(i=r*h-t)
print(j=r*i-t)
Problem p03327 (python)

Fixed submission:
n=int(input())
print('ABC' if n < 1000 else 'ABD')

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())
 
diff = B - A
height_A = diff * (diff - 1) // 2
 
ans = height_A - A
 
print(ans)
Problem p03011 (python)

Fixed submission:

p,q,r = map(int,input().split())
ans = 999
ans = min(p+q,ans)
ans = min(p+r,ans)
ans = min(q+r,ans)

print(ans)

Buggy submission (verdict: Runtime Error):
#https://atcoder.jp/contests/abcXXX
import __input
#-------------------------以下を提出-------------------------

p,q,r = map(int,input().split())
ans = 999
ans = min(p+q,ans)
ans = min(p+r,ans)
ans = min(q+r,ans)

print(ans)
Problem p03072 (python)

Fixed submission:
#https://atcoder.jp/contests/abc124
# -*- coding: utf-8 -*-

n = int(input())
h = list(map(int,input().split()))

current=0
cnt=0
for i in h:
    if i >= current:
        current = i
        cnt += 1

print(cnt)

Buggy submission (verdict: Runtime Error):
#https://atcoder.jp/contests/abc124
# -*- coding: utf-8 -*-

n = int(input())
h = list(map(int,input().split()))

current=0
cnt=0
for i in h:
    if i >= current:
        current = i
        cunt += 1

print(cnt)
Problem p02880 (python)

Fixed submission:
n = int(input())
A = 0
for i in range(1,10):
  for j in range(1,10):
    x = i * j
    if x == n:
      A += 1
if A >= 1:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
A = 0
for i in range(1,10):
  for j in range(1,10):
    x = i * j
      if x == n:
        A += 1
if A >= 1:
  print("Yes")
else:
  print("No")
Problem p02773 (python)

Fixed submission:
N = int(input())
Dictionary = {}
for i in range(N):
    S = input()
    if S not in Dictionary :
        Dictionary[S] = 1
    else :
        Dictionary[S] = Dictionary[S]+1

sorted_Dic = sorted(Dictionary.items(), key=lambda x: x[1],reverse=True)

if len(sorted_Dic)==1:
  print(sorted_Dic[0][0])
else:
  ans_list = []
  for i in range(N):
      if sorted_Dic[i][1]==sorted_Dic[0][1]:
          ans_list.append(sorted_Dic[i][0])
      else:
          break;
  for item in sorted(ans_list):
    print(item)

Buggy submission (verdict: Runtime Error):
N = int(input())
Dictionary = {}
for i in range(N):
    S = input()
    if S not in Dictionary :
        Dictionary[S] = 1
    else :
        Dictionary[S] = Dictionary[S]+1
sorted_Dic = sorted(Dictionary.items(), key=lambda x: x[1],reverse=True)

ans_list = []
for i in range(N):
    if sorted_Dic[i][1]==sorted_Dic[0][1]:
        ans_list.append(sorted_Dic[i][0])
    else:
        break;
for item in sorted(ans_list):
  print(item)
Problem p02831 (python)

Fixed submission:
from fractions import gcd
def lcm(a, b):
  return a * b / gcd(a, b)
 
A, B = map(int,input().split())
print(int(lcm(A,B)))

Buggy submission (verdict: Runtime Error):
import math
def lcm(a, b):
  return a * b / gcd(a, b)

A, B = map(int,input().split())
print(lcm(A,B))
Problem p02912 (python)

Fixed submission:
import heapq

n, m = map(int, input().split())
a = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(a)  # aを優先度付きキューに

for _ in range(m):
    tmp_min = heapq.heappop(a)
    heapq.heappush(a, (-1)*(-tmp_min//2))  # 計算誤差の関係で-1を2回かけてます
print(-sum(a))

Buggy submission (verdict: Runtime Error):
import numpy as np
%time N, M =map(int, input().split())
%time A = np.array(list(map(int, input().split())))
#print(A)
log_A = np.log2(A)

for i in range(M):
    maximum =  log_A.argmax()
    log_A[maximum] = log_A[maximum]-1
    #print(A)
A = np.power(2, log_A)
%time A = np.trunc(A)
print(int(A.sum()))
Problem p03209 (python)

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

table_l = [-1 for _ in range(51)]
table_p = [-1 for _ in range(51)]
table_l[0] = 1
table_p[0] = 1

for i in range(1, 51):
    table_l[i] = table_l[i-1] * 2 + 3
    table_p[i] = table_p[i-1] * 2 + 1


def f(level, x):
    if level == 1:
        if x == 0 or x == 1:
            return 0
        if x == 2:
            return 1
        if x == 3:
            return 2
        else:
            return 3

    if table_l[level] == x:
        return table_p[level]

    if x - 1 <= table_l[level - 1]:
        return f(level - 1, x - 1)

    if x - 2 == table_l[level - 1]:
        return table_p[level - 1] + 1
    if x - 2 > table_l[level - 1]:
        xx = x - 2 - table_l[level - 1]
        return table_p[level - 1] + 1 + f(level - 1, xx)


print(f(n, x))

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

table_l = [-1 for _ in range(50)]
table_p = [-1 for _ in range(50)]
table_l[0] = 1
table_p[0] = 1

for i in range(1, 50):
    table_l[i] = table_l[i-1] * 2 + 3
    table_p[i] = table_p[i-1] * 2 + 1


def f(level, x):
    if level == 1:
        if x == 0 or x == 1:
            return 0
        if x == 2:
            return 1
        if x == 3:
            return 2
        else:
            return 3

    if table_l[level] == x:
        return table_p[level]

    if x - 1 <= table_l[level - 1]:
        return f(level - 1, x - 1)

    if x - 2 == table_l[level - 1]:
        return table_p[level - 1] + 1
    if x - 2 > table_l[level - 1]:
        xx = x - 2 - table_l[level - 1]
        return table_p[level - 1] + 1 + f(level - 1, xx)


print(f(n, x))
Problem p03252 (python)

Fixed submission:
s = input()
t = input()


s_to_t = {}
t_to_s = {}

for i in range(len(s)):
    if s[i] not in s_to_t:
        if t[i] not in t_to_s:
            s_to_t[s[i]] = t[i]
            t_to_s[t[i]] = s[i]
            continue
        else:
            print('No')
            exit(0)
    elif s_to_t[s[i]] == t[i] and t_to_s[t[i]] == s[i]:
        continue
    else:
        print('No')
        exit(0)
        
print('Yes')

Buggy submission (verdict: Runtime Error):
s_to_t = {}
t_to_s = {}

for i in range(len(s)):
    if s[i] not in s_to_t:
        if t[i] not in t_to_s:
            s_to_t[s[i]] = t[i]
            t_to_s[t[i]] = s[i]
            continue
        else:
            print('No')
            exit(0)
    elif s_to_t[s[i]] == t[i] and t_to_s[t[i]] == s[i]:
        continue
    else:
        print('No')
        exit(0)
        
print('Yes')
Problem p02633 (python)

Fixed submission:
X=int(input())
if 360%X==0:
  K=360//X
  print(K)
elif 360%X!=0:
  i=1
  while True:
    if (X*i)%360==0:
      break
    i+=1
  print(i)

Buggy submission (verdict: Runtime Error):
X=int(input())
if 360%K==0:
  K=360//X
  print(K)
elif 360%K!=0:
  K=2*360//(180-X)
  print(K)
Problem p02781 (python)

Fixed submission:
def comb(n, k):
    ans = 1
    for i in range(k):
        ans *= (n-i)
    for i in range(k):
        ans //= (k-i)
    return ans

def count(n, k):
    if len(n) < k:
        return 0
    if k == 0:
        return 1
    if int(n) == 0:
        return 0
    if n[0] == "0":
        return count(n[1:], k)
    return count(n[1:], k-1) + comb(len(n)-1, k)*9**(k) + (int(n[0])-1)*comb(len(n)-1, k-1)*9**(k-1)

n = input()
k = int(input())
print(count(n, k))

Buggy submission (verdict: Runtime Error):
def comb(n, k):
    ans = 1
    for i in range(k):
        ans *= (n-i)
    for i in range(k):
        ans //= (k-i)
    return ans

def count(n, k):
    if k == 0:
        return 1
    if int(n) == 0:
        return 0
    if n[0] == "0":
        return count(n[1:], k)
    return count(n[1:], k-1) + comb(len(n)-1, k)*9**(k) + (int(n[0])-1)*comb(len(n)-1, k-1)*9**(k-1)

n = input()
k = int(input())
print(count(n, k))
Problem p02689 (python)

Fixed submission:
n,m = map(int,input().split())
height = list(map(int,input().split()))
lower_list = []
for i in range(m):
    r = list(map(int,input().split()))
    if height[r[0]-1] > height[r[1]-1]:
        lower_list.append(r[1])
    elif height[r[0]-1] == height[r[1]-1]:
        lower_list.append(r[0])
        lower_list.append(r[1])
    else:
        lower_list.append(r[0])
count = len(set(lower_list))
print(n-count)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
height = list(map(int,input().split()))
lower_list = []
for i in range(m):
    r = list(map(int,input().split()))
    if height[r[0]-1] > height[r[1]-1]:
        lower_list.append(r[1])
    elif height[r[0]-1] < height[r[1]-1]:
        lower_list.append(r[0],r[1])
    else:
        lower_list.append(r[0])
count = len(set(lower_list))
print(n-count)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
height = list(map(int,input().split()))
lower_list = []
for i in range(m):
    r = list(map(int,input().split()))
    if height[r[0]-1] > height[r[1]-1]:
        lower_list.append(r[1])
    elif:
        lower_list.append(r[0],r[1])
    else:
        lower_list.append(r[0])
count = len(set(lower_list))
print(n-count)
Problem p02695 (python)

Fixed submission:
from itertools import combinations_with_replacement

n,m,q = map(int,input().split())
s_list = [list(map(int,input().split())) for _ in range(q)]

ans = 0
for c in combinations_with_replacement(range(1,m+1),n):
    v = 0
    for s in s_list:
        if c[s[1]-1] - c[s[0]-1] == s[2]:
            v+=s[3]
    
    ans = max(ans,v)
print(ans)

Buggy submission (verdict: Runtime Error):
#166d
x = int(input())
for i in range(-73,73):
    for j in range(-73,73):
        print(i,j)
        if i**5-j**5==x:
            a = i
            b = j
            break
        
print(a,b)
Problem p02693 (python)

Fixed submission:
import sys
K=int(input())
A,B=map(int,input().split())
for i in range(A,B+1):
    if i%K==0:
        print("OK")
        sys.exit()
print("NG")

Buggy submission (verdict: Runtime Error):
K=int(input())
A,B=map(int,input().split())
for i in range(A,B+1):
    if i%K==0:
        print("OK")
        sys.exit()
print("NG")

Buggy submission (verdict: Runtime Error):
K=int(input())
A,B=map(int,input().split())
#print(K,A,B)
for i in range(A,B+1):
    if i%K==0:
        print("OK")
        sys.exit()
print("NG")
Problem p02699 (python)

Fixed submission:
s,w=map(int,input().split())
if s>w:
    print("safe")
else:
    print("unsafe")

Buggy submission (verdict: Runtime Error):
A,B,C,D=map(int,input().split())
while A>0:
  C-=B
  if C<=0:
    print("Yes")
    exit()
  A-=D
print("No")
Problem p02785 (python)

Fixed submission:
import sys
n,k=map(int,input().split())
h=list(map(int,input().split()))
h.sort()
if n<=k:
    print(0)
    sys.exit()
else:
    for i in range(k):
        h[-i-1]=0
ans=0
for i in h:
    ans+=i
print(ans)

Buggy submission (verdict: Runtime Error):
3 0
1000000000 1000000000 1000000000
Problem p02831 (python)

Fixed submission:
a,b=map(int,input().split())
def gcd(x, y):
    while y:
        x, y = y, x % y
    return x
l=gcd(a,b)
print(int(a*b/l))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
import math
l=math.gcd(a,b)
print(int(a*b/l))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
import math
l=math.gcd(a,b)
print(int(a*b/l))
Problem p03107 (python)

Fixed submission:

import sys
sys.setrecursionlimit(1000000)

S=input()
s=[]
for i in S:
    s+=[i]
ans=0
que=[]
que+=[s[0]]
def cube(i):
    global ans
    if i==len(s):
        print(ans)
    else:
        que.append(s[i])
        flag=True
        while flag:
            if len(que)==0 or len(que)==1:
                flag=False
            elif que[-1]==que[-2]:
                flag=False
            elif que[-1]!=que[-2]:
                del que[-1]
                del que[-1]
                ans+=2
        cube(i+1)
cube(1)

Buggy submission (verdict: Runtime Error):
S=input()
s=[]
for i in S:
    s+=[i]
ans=0
que=[]
que+=[s[0]]
def cube(i):
    global ans
    if i==len(s):
        print(ans)
    else:
        que.append(s[i])
        flag=True
        while flag:
            if len(que)==0 or len(que)==1:
                flag=False
            elif que[-1]==que[-2]:
                flag=False
            elif que[-1]!=que[-2]:
                del que[-1]
                del que[-1]
                ans+=2
        cube(i+1)
cube(1)

Buggy submission (verdict: Runtime Error):
S=input()
s=[]
for i in S:
    s+=[i]
ans=0
que=[]
que+=[s[0]]
def cube(i):
    global ans
    if i==len(s):
        return 1
    else:
        que.append(s[i])
        flag=True
        while flag:
            if len(que)==0 or len(que)==1:
                flag=False
            elif que[-1]==que[-2]:
                flag=False
            elif que[-1]!=que[-2]:
                del que[-1]
                del que[-1]
                ans+=2
        cube(i+1)
cube(1)
print(ans)
Problem p02754 (python)

Fixed submission:
# c = list(map(int, input().split()))
# a, b, c = map(int, input().split())
# a = [list(map(int, list(input()))) for i in range(n)]
n, a, b = map(int, input().split())

m = n % (a + b)

if (m <= a):
    v = m
else:
    v = a

print(int(n / (a + b)) * a + v)

Buggy submission (verdict: Runtime Error):
# c = list(map(int, input().split()))
# a, b, c = map(int, input().split())
# a = [list(map(int, list(input()))) for i in range(n)]
n, a, b = map(int, input().split())

r = (n / (a + b))
m = n % (a + b)

if (m <= a):
    v = m
elif m >= a and m <= b:
    v = a

print(int(r * a + v))

Buggy submission (verdict: Runtime Error):
# c = list(map(int, input().split()))
# a, b, c = map(int, input().split())
# a = [list(map(int, list(input()))) for i in range(n)]
n, a, b = map(int, input().split())

r = int(n / (a + b))
m = n % (a + b)

if (m <= a):
    v = m
elif m >= a and m <= b:
    v = a

print(r * a + v)