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

Fixed submission:
n=int(input())
ans=n
for i in range(int(n**0.5),0,-1):
    if n%i==0:
        ans=n//i+i-2
        break
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
ans = []
for i in range(int(n**0.5),0,-1):
    if n%i==0:
        ans += n//i+i-2
print(min(ans))

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = n
for i in range(int(n**0.5),0,-1):
  if n % i == 0:
    j = target // i
    if (i+j-2) < ans:
      ans = i+j-2
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = n
for i in range(1,int(n**0.5)):
  if n % i == 0:
    j = target // i
    if (i+j-2) < ans:
      ans = i+j-2
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = n
for i in range(0,int(n**0.5)):
  if n % i == 0:
    j = target // i
    if (i+j-2) < ans:
      ans = i+j-2
print(ans)

Buggy submission (verdict: Runtime Error):
target = int(input())
curAns = target

for i in range(1,target**0.5):
  if target % i == 0:
    j = target // i
    if (i+j-2) < curAns:
      curAns = i+j-2
print(curAns)

Buggy submission (verdict: Runtime Error):
target = int(input())
curAns = target

for i in range(1,target**0.5):
  if target % i == 0:
    j = target // i
    if (i+j-2) < curAns:
      curAns = i+j-2
print(curAns)

Buggy submission (verdict: Runtime Error):
import math
target = int(input())
curAns = target

for i in range(0,int(math.sqrt(target))):
  if target % i == 0:
    j = target // i
    if (i+j-2) < curAns:
      curAns = i+j-2
print(curAns)

Buggy submission (verdict: Runtime Error):
target = int(input())
possibleAns = []
 
for i in range(1,10):
  for j in range(1,10):
    if i*j == target:
		possibleAns.append(i+j)
print(min(possibleAns))

Buggy submission (verdict: Runtime Error):
target = int(input())
possibleAns = []

for i in range(1,10):
  for j in range(1,10):
    if i*j == taget:
		possibleAns.append(i+j)
print(min(possibleAns))
Problem p03207 (python)

Fixed submission:
l = [int(input()) for _ in range(int(input()))]
print(sum(l)-int(max(l))//2)

Buggy submission (verdict: Runtime Error):
l = [int(input()) for _ in range(int(input))]
HIGH = max(l)
print(sum(l)-int(HIGH//2))
Problem p03834 (python)

Fixed submission:
input_ = input().split(',')
print(' '.join(input_))

Buggy submission (verdict: Runtime Error):
input_ = inpur().split(",")
print(" ".join(str for i in input))
Problem p02699 (python)

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

Buggy submission (verdict: Runtime Error):
s,w=map(int,input().split())
if s <= w:
  print("unsafe")
 else:
  print("safe")
Problem p02693 (python)

Fixed submission:
K = int(input())
A, B = map(int, input().split())
i = A // K
nK = K
OK = False
if A-B > K:
  print('OK')
else:
  while nK <= B:
    if (nK >= A) and (nK <= B):
      OK = True
      print('OK')
      break
    nK = i * K
    i = i + 1
if OK == False:
  print('NG')

Buggy submission (verdict: Runtime Error):
K = int(input())
A, B = map(int, input().split())
i = A // K
nK = K
OK = False
if A-B > K:
  print('OK')
else:
  while nK =< B:
    if (nK >= A) and (nK <= B):
      OK = True
      print('OK')
      break
    nK = i * K
    i = i + 1
if OK == False:
  print('NG')

Buggy submission (verdict: Runtime Error):
K = int(input())
A, B = map(int, input().split())
i = A // K
nk = K
OK = False
if A-B >= K:
  print('OK')
else:
  while nK < B:
    if (nK >= A) and (nK <= B):
      OK = True
      print('OK')
    nK = i * K
    i = i + 1
if OK == False:
  print('NG')

Buggy submission (verdict: Runtime Error):
K = int(input())
A, B = map(int, input().split())
i = A // K
nk = K
OK = False
if A-B >= K:
  print('OK')
else:
  while nK < B:
    if (nK >= A) and (nK <= B):
      OK = True
      print('OK')
    nK = i * K
    i = i + 1
if OK = False:
  print('NG')
Problem p03036 (python)

Fixed submission:
r, D, X_1 = input().split()
r = int(r)
D = int(D)
x = int(X_1)
for i in range(10):
  x = r * x - D
  print(str(x))

Buggy submission (verdict: Runtime Error):
r, D, X_1 = input().split()
r = int(r)
D = int(D)
x = int(X_1)
for i in range(10):
  print(str(x))
  x = r * X - D
Problem p02693 (python)

Fixed submission:
k = int(input())
a_b = input()
a = int(a_b.split(" ")[0])
b = int(a_b.split(" ")[1])

for i in range(1, 1000):
  if a<= (i* k) <= b:
    print("OK")
    break
  elif (i* k) > b:
    print("NG")
    break
else:
    print("NG")

Buggy submission (verdict: Runtime Error):
k = int(input())
a_b = input().split()[1].split(" ")
a = int(a_b.split(" ")[0])
b = int(a_b.split(" ")[1])

for i in range(1, 1000):
  if a<= (i* k) <= b:
    print("OK")
    break
  elif (i* k) > b:
    print("NG")
    break
else:
    print("NG")

Buggy submission (verdict: Runtime Error):
_input = input()
k = _input.split()[0]
a = _input.split()[1].split(" ")[0]
b = _input.split()[1].split(" ")[1]

for i in range(1, 1000):
  if a<= (i* k) <= b:
    print("OK")
    break
  elif (i* k) > b:
    break
    print("NG")
Problem p02726 (python)

Fixed submission:
def main():
    n,x,y = map(int,input().split(' '))
    cost = [0 for i in range(n - 1)]
    for i in range(n - 1):
        for l in range(i + 1, n):
            result = min(abs(i - l),abs(i - x + 1) + 1 + abs(l - y + 1),abs(i - y + 1) + 1 + abs(l - x + 1))
            cost[result - 1] += 1
    for per in cost:
        print(per)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
num = input().split(' ')
num_data = [int(num[i]) for i in range(3)]
#N X Y
cost = [0 for i in range(num_data[0] - 1)] #start position has the lowest number
for i in range(num_data[0]):
    for l in range(num_data[0] - 1):
        result = min(abs(i - l),abs(i - num_data[1] - 1) + 1 + abs(l - num_data[2] - 1),abs(i - num_data[2] - 1) + 1 + abs(l - num_data[1] - 1))
        cost[num_data[0] - result] += 1
print(cost)
Problem p02695 (python)

Fixed submission:
N,M,Q = list(map(int, input().split()))
C = []
for i in range(Q):
    C.append(list(map(int, input().split())))
    
import itertools
res = 0
ls=list(range(1,M+1))
for a in itertools.combinations_with_replacement(ls, N):
    p = 0
    for c in C:
        if a[c[1]-1]-a[c[0]-1]==c[2]:
            p += c[3]
        res = max(res,p)
print(res)

Buggy submission (verdict: Runtime Error):
import itertools

N,M,Q = list(map(int, input().split()))
C = []
for i in range(Q):
    C.append(list(map(int, input().split())))
    
res = 0
ls=list(range(1,M+1))

for a in itertools.combinations_with_replacement(ls, N):
    p = 0
    for c in C:
        if a[c[1]]-a[c[0]]==c[2]:
            p += c[3]
        res = max(res,p)

print(res)

Buggy submission (verdict: Runtime Error):
N,M,Q = list(map(int, input().split()))
C = []
for i in range(Q):
    C.append(list(map(int, input().split())))
    
import itertools
res = 0
ls=list(range(1,M+1))
for a in itertools.combinations_with_replacement(ls, N):
    p = 0
    for c in C:
        if a[c[1]]-a[c[0]]==c[2]:
            p += c[3]
        res = max(res,p)
print(res)
Problem p02989 (python)

Fixed submission:
n=int(input())
d=list(map(int,input().split()))
sd=sorted(d)
print(sd[(n//2)]-sd[(n//2)-1])

Buggy submission (verdict: Runtime Error):
n=int(input())
d=list(map(int,input().split()))
sd=sorted(d)
print(sd[(n//2)]-sd[(n//2)-1])n=int(input())
d=list(map(int,input().split()))
sd=sorted(d)
print(sd[(n//2)]-sd[(n//2)-1])
Problem p02990 (python)

Fixed submission:
def cmb(n, r, mod):
    if (r<0 or r>n):
        return(0)
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7
N = 10**4
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]

for i in range(2,N+1):
    g1.append(( g1[-1] * i ) % mod)
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
    
n,k=map(int,input().split())
for i in range(1,k+1):
    ans = cmb(n-k+1,i,mod)*cmb(k-1,i-1,mod)
    print(ans%mod)

Buggy submission (verdict: Runtime Error):
def cmb(n, r, mod):
    if (r<0 or r>n):
        return(0)
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7
N = 10**4
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]

for i in range(2,N+1):
    g1.append(( g1[-1] * i ) % mod)
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
    
n,k=map(int,input().split())
for i in range(1,K+1):
    ans = cmb(n-k+1,i,mod)*cmb(k-1,i-1,mod)
    print(ans%mod)

Buggy submission (verdict: Runtime Error):
def cmb(n, r, mod):
    if (r<0 or r>n):
        return(0)
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7
N = 10**4
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]

for i in range(2,N+1):
    g1.append(( g1[-1] * i ) % mod)
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
    
n,k=map(int,input().split())
for i in range(1,K+1):
    ans = cmb(n-k+1,i,mod)*cmb(k-1,i-1,mod)
    print(ans%mod)

Buggy submission (verdict: Runtime Error):
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7
N = 10**4
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
    
n,k=map(int,input().split())
for i in range(1,K+1):
    ans = cmb(n-k+1,i,mod)*cmb(k-1,i-1,mod)
    print(ans%mod)
Problem p02729 (python)

Fixed submission:
import math
def combination(n, r):
    if n <= 0 or n is 1:
        return 0
    return math.factorial(n) // (math.factorial(r) * math.factorial(n - r))

n, m= input().split(" ")
n = int(n)
m = int(m)

print(combination(n, 2) + combination(m,2))

Buggy submission (verdict: Runtime Error):
import math
def combination(n, r):
    if n <= 0:
        return 0
    return math.factorial(n) // (math.factorial(r) * math.factorial(n - r))

n, m= input().split(" ")
n = int(n)
m = int(m)

print(combination(n, 2) + combination(m,2))

Buggy submission (verdict: Runtime Error):
import math
def combination(n, r):
    return math.factorial(n) // (math.factorial(r) * math.factorial(n - r))

n, m= input().split(" ")
n = int(n)
m = int(m)

print(combination(n, 2) + combination(m,2))
Problem p03208 (python)

Fixed submission:
n,k = map(int,input().split())
s = [int(input()) for i in range(n)]
s.sort()
c = s[k-1] - s[0]
for i in range(1,n-k+1):
    if s[i+k-1] - s[i] < c:
        c = s[i+k-1] - s[i]

print(c)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
s = [int(input()) for i in range(n)]
s.sort()
c = s[n-k-1] - s[0]
for i in range(1,n-k+1):
    if s[i+n-k] - s[i] < c:
        c = s[i+n-k] - s[i]

print(c)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
s = [int(input()) for i in range(n)]
s.sort()
c = s[n-k] - s[0]
for i in range(1,n-k+1):
    t = s[i+n-k] - s[i]
    if s[i+n-k] - s[i] < c:
        c = t

print(c)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
s = [int(input()) for i in range(n)]
s.sort()
c = 10 ** 12
for i in range(n-k+1):
    t = s[i+n-k] - s[i]
    if s[i+n-k] - s[i] < c:
        c = t

print(c)
Problem p02693 (python)

Fixed submission:
k=int(input())
A,B = input().split(" ")
A = int(A)
B = int(B)
c=0
for i in range(A,B+1):
  if i%k==0:
    c=c+1
if c==0:
  print("NG")
else:
  print("OK")

Buggy submission (verdict: Runtime Error):
k=int(input())
a=int(input())
b=int(input())
c=0
for i in range(a,b+1):
  if i%k==0:
    c=c+1
if c==0:
  print("NG")
else:
  print("OK")
Problem p02912 (python)

Fixed submission:
import heapq
 
N, M = [int(item) for item in input().rstrip().split()]
hp = [-1 * int(item) for item in input().rstrip().split()]
heapq.heapify(hp)

for i in range(M):
    _t = heapq.heappop(hp)
    heapq.heappush(hp, -1 * (-1 * _t // 2))
    
_sum = sum([-1 * int(item) for item in hp])
print(_sum)

Buggy submission (verdict: Runtime Error):
import bisect
import math
import sys
imput = sys.stdin

N, M = [int(item) for item in input().rstrip().split()]
As = sorted([int(item) for item in input().rstrip().split()])
cnt = 0
_t = As.pop()
while(cnt < M):
    if _t <= As[-1]:
        bisect.insort_right(As, _t)
        _t = As.pop()
    _t = _t / 2
    cnt += 1
bisect.insort_right(As, _t)
    
_sum = sum([math.floor(item) for item in As])
print(_sum)
Problem p02831 (python)

Fixed submission:
def gcd(A,B):
    if(A<B):
        tmp=A
        A=B
        B=tmp

    r=A%B

    while(r!=0):
        A=B
        B=r
        r=A%B
        
    return B


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

l = a * b /gcd(a, b)
l = int(l)
print("{}".format(l))

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

l = a * b / math.gcd(a, b)
l = int(l)
print("{}".format(l))
Problem p03265 (python)

Fixed submission:
l = input().split(" ")
p = [int(l[0]),int(l[1])]
q = [int(l[2]),int(l[3])]
r = [0,0]
s = [0,0]
if p[0]==q[0]:
    m = q[1]-p[1]
    r[0] = q[0]-m
    r[1] = q[1]
    s[0] = p[0]-m
    s[1] = p[1]
else:
    v = [q[1]-p[1],q[0]-p[0]]
    r[0]= q[0]-v[0]
    r[1]=q[1]+v[1]
    s[0]=p[0]-v[0]
    s[1]=p[1]+v[1]
print(str(r[0])+" "+str(r[1])+" "+str(s[0])+" "+str(s[1]))

Buggy submission (verdict: Runtime Error):
l = input().split()
p = [int(l[0]),int(l[1])]
q = [int(l[2]),int(l[3])]
r = [r1,r2]
s = [s1,s2]

if p[0]==q[0]:
    m = q[1]-p[1]
    r[0]=q[0]-m
    r[1]=q[1]
    s[0]=p[0]-m
    s[1]=p[1]
else:
    m = q[0]-p[0]
    r[0] = q[0] 
    r[1] = q[1]+m
    s[0] = p[0] 
    s[1] = p[1]+m
print(str(r1)+" "+str(r2)+" "+str(s1)+" "+str(s2))
Problem p02785 (python)

Fixed submission:
n,k=list(map(int,input().strip().split(' ')))
h=list(map(int,input().strip().split(' ')))
h.sort()
if(k!=0): print(sum(h[:-k]))
else: print(sum(h))

Buggy submission (verdict: Runtime Error):
n,k=int(input()).split()
h=list(map(int,input().split(' ')))
h.sort()
if(k!=0):
  print(sum(h[:-k]))
else:
  print(sum(h))

Buggy submission (verdict: Runtime Error):
n,k=int(input()).split()
a=list(input().split())
a.sort()
if(k!=0):
  print(sum(a[:-k]))
else:
  print(sum(a))

Buggy submission (verdict: Runtime Error):
n,k=int(input()).split()
a=list(input().split())
for i in range(k):
  a.remove(max(a))
print(sum(a))
Problem p02790 (python)

Fixed submission:
x, y = map(int, input().split())
if(x>y):
  print(x*str(y))
else:
  print(y*str(x))

Buggy submission (verdict: Runtime Error):
n,m=input().split()
if(n>m):
  print(n*str(m))

Buggy submission (verdict: Runtime Error):
n,m=input().split()
if(n>m):
  print(n*str(m))

Buggy submission (verdict: Runtime Error):
n,m =int(input()).strip().split()
if(n>m):
  print(m*(str(n)))
Problem p02933 (python)

Fixed submission:
a = int(input())
s = input()
print(s if a >= 3200 else 'red')

Buggy submission (verdict: Runtime Error):
a=input()
s=input()
if(a>=3200):
  print(s)
else:
  print('red')

Buggy submission (verdict: Runtime Error):
a = input()
if(a<3200):
  print('red')
else:
  print 'pink'
Problem p02729 (python)

Fixed submission:
from scipy.misc import comb
gusu, kisu = input().split()
gusu = int(gusu) # 個数
kisu = int(kisu) # 個数
gusu_num = comb(gusu, 2, exact=True)
kisu_num = comb(kisu, 2, exact=True)
print(gusu_num + kisu_num)

Buggy submission (verdict: Runtime Error):
from scipy.special import comb

gusu, kisu = input().split()
gusu = int(gusu) # 個数
kisu = int(kisu) # 個数
gusu_num = comb(gusu, 2, exact=True)
kisu_num = comb(kisu, 2, exact=True)
print(gusu_num + kisu_num)
Problem p02759 (python)

Fixed submission:
N = input()
N = int(N)
num_paper = int(N / 2)
if (N % 2) > 0:
  num_paper += 1
else:
  pass

print(num_paper)

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

N = input()

num_paper = int(N) / 2
if (N % 2) > 0:
  num_paper += 1
else:
  pass

print(num_paper)

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

N = input()

num_paper = N / 2
if (N % 2) > 0:
  num_paper += 1
else:
  pass

print(num_paper)
Problem p02693 (python)

Fixed submission:
k = int(input())
a,b = map(int,input().split())
for i in range(a,b+1):
  if i%k == 0:
    print('OK')
    break
  if i == b:
    print('NG')

Buggy submission (verdict: Runtime Error):
k = int(input())
a,b = map(int,input().split())1
for i in range(a,b+1):
  if i%k == 0:
    print('OK')
    break
  if i == b:
    print('NG')
Problem p02699 (python)

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

Buggy submission (verdict: Runtime Error):
s = input()
ans = 0
for j in range(len(s)):
  for i in range(j):
    if int(s[i:j+1])%2019 == 0:
      ans+=1
print(ans)
Problem p03307 (python)

Fixed submission:
n = int(input())
if n%2==0:
  print(n)
else:
  print(n*2)

Buggy submission (verdict: Runtime Error):
if n%2==0:
  print(n)
else:
  print(n*2)

Buggy submission (verdict: Runtime Error):
from fractions import gcd
print(int(2 * n / gcd(2, n)))
Problem p02711 (python)

Fixed submission:
num = int(input())
list = list(str(num))
count = 0

for i in range(3):
  if list[i] == "7":
    print("Yes")
    break
  else:
    count += 1

if count == 3:
  print("No")
else:
  None

Buggy submission (verdict: Runtime Error):
num = int(input())
list = list(num)
count = 0

for i in range(3):
  if list[i] == 7:
    print("Yes")
    break
  else:
    count += 1
    
if count == 3:
  print("No")
else:
  None
Problem p02777 (python)

Fixed submission:
s,t=map(str,input().split())
a,b=map(int,input().split())
u=str(input())
l=[]
if s==u:
    l=[a-1,b]
elif t==u:
    l=[a,b-1]
else:
    l=[a,b]
print(l[0],l[1])

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
ll=list(set(l))
n=len(l)
nn=len(ll)
if n==nn:
    print("YES")
else:
    print("NO")
Problem p02815 (python)

Fixed submission:
n=int(input())
c=list(map(int,input().split()))
c.sort(reverse=True)
res=0
ans=0
mod=10**9+7
p=pow(2,n*2-2,mod)
for i in range(n):
   ans+=(c[i]*(i+2)%mod)*p
print(ans%mod)

Buggy submission (verdict: Runtime Error):
n=int(input())
c=list(map(int,input().split()))
c.sort(reverse=True)
res=0
ans=0
mod=10**9+7
p=pow(2,n*2-2,mod)
for i in range(n):
   ans+=(c[i]*(i+2)%mod)*p
prit(ans)
Problem p03775 (python)

Fixed submission:
n=int(input())
ans=10**20
for x in range(1,10**5+1):
    if n%x==0:
        ans=min(ans,max(len(str(x)),len(str(n//x))))
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
ans=float(inf)
for x in range(1,min(n,10**5)):
    if n%x==0:
        m=len(str(x))*len(str(n//x))
        ans=min(ans,m)
print(ans)
Problem p02699 (python)

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

Buggy submission (verdict: Runtime Error):
th,td,ah,ad = map(int,input().split())
x,y = (td+ah-1)//td,(ad+th-1)//ad
if(x<=y):print("Yes")
else:print("No")
Problem p02701 (python)

Fixed submission:
n = int(input())
s = set()
for _ in range(n):
    string = input()
    s.add(string)
print(len(s))

Buggy submission (verdict: Runtime Error):
n = int(input())
s = set()
for _ in range(n):
    string = input()
    s.add(string)
return len(s)
Problem p02712 (python)

Fixed submission:
N=input()
sum=0
for i in range(1,int(N)+1):
    if i % 3 != 0 and i % 5 != 0:
        #print(i)
        sum += i
print(sum)

Buggy submission (verdict: Runtime Error):
N=input()
sum=0
for i in range(1,N+1):
    if i % 3 != 0 and i % 5 != 0:
        #print(i)
        sum += i
print(sum)

Buggy submission (verdict: Runtime Error):
N=input()
sum=0
for i in range(1,N+1):
    if i % 3 != 0 and i % 5 != 0:
        #print(i)
        sum += i
print(sum)

Buggy submission (verdict: Runtime Error):
N=input()
sum=0
for i in range(1,N+1):
    if i % 3 != 0 and i % 5 != 0:
        sum += i
print(sum)
Problem p02897 (python)

Fixed submission:
N = int(input())
c = 0
for i in range(1, N+1):
  if i % 2 == 1:
    c+=1

print(c/N)

Buggy submission (verdict: Runtime Error):
c = 0
for i in range(1, N+1):
  if i % 2 == 1:
    c+=1

print(c/N)

Buggy submission (verdict: Runtime Error):
c = 0
for i in range(1, N+1):
  if i % 2 == 0:
    c+=1

print(c/N)

Buggy submission (verdict: Runtime Error):
if N % 2 == 0:
  print(N/2)
else:
  print((N+1)/2)
Problem p02693 (python)

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

for i in range(1001):
    if k*i >= a and k*i<=b:
        print("OK")
        exit()
    if k*i > b:
        break

print("NG")

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

for i in range(1000):
    if k*i >= a and k*i=<b:
        print("OK")
        exit()
    if k*i > b:
        break

print("NG")
Problem p03127 (python)

Fixed submission:
N = int(input())
monsters = list(map(int,input().split()))
monsters = sorted(monsters)

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

if N == 1:
    print(monsters[0])
else:
    ans = gcd(monsters[0], monsters[1])
    if N == 2:
        print(ans)
    else:
        for i in range(2, N):
            ans = gcd(ans,monsters[i])
        print(ans)

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

N = int(input())
monsters = list(map(int,input().split()))

print(reduce(math.gcd, monsters))
Problem p02693 (python)

Fixed submission:
i = int(input())
i2 = list(map(int,input().split()))

f = 0
for x in range(i2[0],i2[1]+1):
    if x % i == 0:
        f = 1

if f == 1:
    print("OK")
else:
    print("NG")

Buggy submission (verdict: Runtime Error):
i = list(map(int,input().split()))
f = 0
for x in range(i[1],i[2]+1):
    if x % i[0] == 0:
        f = 1

if f == 1:
    print("OK")
else:
    print("No")
Problem p02954 (python)

Fixed submission:
S = list(input())
N = len(S)
child = [1] * N
memo = []

# RLのインデックスを取得する
for i in range(N-1):
    if S[i] == "R" and S[i+1] == "L":
        memo.append(i)
        memo.append(i+1)
memo.append("dummy")
count = 0
for i in range(N):
    if i != memo[count]:
        if S[i] == "R":
            if (memo[count] - i) % 2 == 0:
                child[memo[count]] += 1
                child[i] -= 1
            else:
                child[memo[count+1]] += 1
                child[i] -= 1
        elif S[i] == "L":
            if (i - memo[count-1]) % 2 == 0:
                child[memo[count-1]] += 1
                child[i] -= 1
            else:
                child[memo[count-2]] += 1
                child[i] -= 1
    else:
        count += 1

ans = [str(n) for n in child]
ans = " ".join(ans)
print(ans)

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

N = len(S)
child = [1] * N 
memo = [child]
loopmemo = []

for count in range(1,10**100):
    tmpChild = child.copy()
    for i in range(N):
        if S[i] == "R" and child[i] >= 1:
            tmpChild[i+1] += child[i]
            tmpChild[i] -= child[i]

        elif S[i] == "L" and child[i] >= 1:
            tmpChild[i-1] += child[i]
            tmpChild[i] -= child[i]
    if child == tmpChild:
        ans = [str(n) for n in child]
        ans = " ".join(ans)
        print(ans)
        break
    child = tmpChild
    memo.append(child)
    if len(memo) >= 3:
        if memo[count-2] == memo[count]:
            ansNum = count - 2
            loopmemo.append(memo[count])
            loopmemo.append(memo[count-1])
            ans = [str(n) for n in loopmemo[(10 * 100 - ansNum) % 2]]
            ans = " ".join(ans)
            print(ans)
            break
Problem p03042 (python)

Fixed submission:
s = list(input())
YYMM = False
MMYY = False
 
if s[2] == '1':
    if (s[3] == '0') | (s[3] == '1') | (s[3] == '2'):
        YYMM = True
elif s[2] == '0':
    if s[3] != '0':
        YYMM = True
 
if s[0] == '1':
    if (s[1] == '0') | (s[1] == '1') | (s[1] == '2'):
        MMYY = True
elif s[0] == '0':
    if s[1] != '0':
        MMYY = True
 
if YYMM & MMYY:
    print("AMBIGUOUS")
elif YYMM:
    print("YYMM")
elif MMYY:
    print("MMYY")
else:
    print("NA")

Buggy submission (verdict: Runtime Error):
s = list(input())
YYMM = False
MMYY = False

if s[2] == '1':
    if s[3] == '0' | s[3] == '1' | s[3] == '2':
        YYMM = True
if s[2] == '0':
    YYMM = True

if s[0] == 1:
    if s[1] == '0' | s[1] == '1' | s[1] == '2':
        MMYY = True
if s[0] == '0':
    MMYY = True

if YYMM & MMYY:
    print("AMBIGUOUS")
elif YYMM:
    print("YYMM")
elif MMYY:
    print("MMYY")
else:
    print("NA")