Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
X, Y = map(int, input().split()) ans = 'No'
for a in range(X + 1):
	b=X-a
	if 2 * a + 4 * b == Y:
		ans = 'Yes' 
print(ans)



Fixed submission:
X, Y = map(int, input().split()) 
ans = 'No'
for a in range(X + 1):
	b=X-a
	if 2 * a + 4 * b == Y:
		ans = 'Yes' 
print(ans)

Buggy python submission (verdict: Runtime Error):
X, Y = map(int, input().split()) ans = 'No'
for a in range(X + 1):
  b=X-a
  if 2 * a + 4 * b == Y:
	ans = 'Yes' 
print(ans)

Fixed submission:
X, Y = map(int, input().split()) 
ans = 'No'
for a in range(X + 1):
	b=X-a
	if 2 * a + 4 * b == Y:
		ans = 'Yes' 
print(ans)
Buggy python submission (verdict: Runtime Error):
def main():
	N = int(input())
    A = list(map(int,input().split()))
    if 0 in A:
      return 0
    ans = 1
    for i in A:
      if ans > 10**18:
        return -1
      ans*=i
    return ans
print(main())

Fixed submission:
def main():
  N = int(input())
  A = list(map(int,input().split()))
  if 0 in A:
    return 0
  ans = 1
  for i in A:
    ans*=i
    if ans > 10**18:
      return -1
  return ans
print(main())

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
ans = 1
for i in A:
  ans*=i
if ans > 10**18:
  ans = -1
print(ans)

Fixed submission:
def main():
  N = int(input())
  A = list(map(int,input().split()))
  if 0 in A:
    return 0
  ans = 1
  for i in A:
    ans*=i
    if ans > 10**18:
      return -1
  return ans
print(main())

Buggy python submission (verdict: Runtime Error):
N - int(input())
A = list(map(int,input().split()))
ans = 1
for i in A:
  ans*=i
if ans > 10**18:
  ans = -1
print(ans)

Fixed submission:
def main():
  N = int(input())
  A = list(map(int,input().split()))
  if 0 in A:
    return 0
  ans = 1
  for i in A:
    ans*=i
    if ans > 10**18:
      return -1
  return ans
print(main())
Buggy python submission (verdict: Runtime Error):
import math
A,B = input().split()
print int(A)*int(B.replace('.',''))//100

Fixed submission:
import math
A,B = input().split()
print (int(A)*int(B.replace('.',''))//100)

Buggy python submission (verdict: Runtime Error):
import math
A,B = map(int,input().split())
print(math.floor(A*B))

Fixed submission:
import math
A,B = input().split()
print (int(A)*int(B.replace('.',''))//100)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
H = list(map(int, input().split()))
S = [[0] * N for _ in range(N)]

for _ in range(M):
    A, B = map(int, input().split())
    S[A-1][B-1] = H[B-1]
    S[B-1][A-1] = H[A-1]
ans = 0
for i in range(N):
    if H[i]>max(S[i]):
        ans+=1
print(ans)

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

S = [1]*N
for _ in range(M):
    A, B = map(int, input().split())
    if H[A-1]>H[B-1]:
        S[B-1]=0
    elif  H[A-1]<H[B-1]:
        S[A-1]=0
    else:
        S[B-1]=0
        S[A-1]=0
print(sum(S))
Buggy python submission (verdict: Runtime Error):
A, B = map(int,input().split()) 

def func():
    b = B*10
    for i in range(b,2*b):
        if math.floor(i*0.08) == A and math.floor(i*0.1) == B:
            return i
    return -1
    
print(func())

Fixed submission:
import math

A, B = map(int,input().split()) 

def func():
    b = B*10
    for i in range(b,2*b):
        if math.floor(i*0.08) == A and math.floor(i*0.1) == B:
            return i
    return -1
    
print(func())
Buggy python submission (verdict: Time Limit Exceeded):
class max_heap():
    def __init__(self,arr):
        self.array = arr
        self.build_heap()

    def heapify(self,i):
        left = 2 * i + 1
        right = 2 * i + 2
        length = len(self.array) - 1
        biggest = i
        
        if left <= length and self.array[i] < self.array[left]:
            biggest = left
        if right <= length and self.array[biggest] < self.array[right]:
            biggest = right
        if biggest != i:
            self.array[i], self.array[biggest] = self.array[biggest], self.array[i]
            self.heapify(biggest)

    def build_heap(self):
        for i in reversed(range(len(self.array)//2)):
            self.heapify(i)
            
    def heappop(self):
        self.array[0], self.array[-1] = self.array[-1], self.array[0]
        res = self.array.pop()
        self.heapify(0)
        return res
    
    def heappush(self,n):
        self.array.append(n)
        self.build_heap()

N, M = map(int,input().split())
A = list(map(int,input().split()))
heap = max_heap(A)
for i in range(M):
    num = heap.heappop()//2
    heap.heappush(num)
print(sum(heap.array))

Fixed submission:
from heapq import (
    heapify,  # 優先度付きキューの生成
    heappop,
    heappush,
    heappushpop,
    heapreplace
    )

N, M = map(int, input().split())

# 最小値が返ってくるので-1倍する
A = [-i for i in map(int,input().split())]
heapify(A)

for _ in range(M):
    s = -heappop(A)
    s //= 2
    heappush(A, -s)

print(-sum(A))
Buggy python submission (verdict: Runtime Error):
N = int(input())
D = list(map(int,input().split()))
D.sort()
print(D[N/2]-D[N/2-1])

Fixed submission:
N = int(input())
D = list(map(int,input().split()))
D.sort()
print(D[N//2]-D[N//2-1])
Buggy python submission (verdict: Runtime Error):
def main():
  N = map(int,input.split())
  S = input()
  black = S.count('#')
  white = S.count('.')

  if black == N or white == N:
    print(0)
    return 
 	
  B = [0]*(N+1)
  W = [0]*(N+1)
  for i in range(N):
    if S[i] == '#':
      B[i+1] = 1
    elif W[i] == '.':
      W[i+1] = 1
  
  for i in range(1,N+1):
    B[i]+=B[i-1]
    W[i]+=W[i-1]
  ans = float('inf')
  for i in range(1,N+1):
    ans = min(ans, B[i]+white-W[i])
  
main()

Fixed submission:
N=int(input())
S=list(map(int,input().replace('#','1').replace('.','0')))
 
cum=[0]
for i in range(N):
  cum.append(cum[-1]+S[i])
  
ans=10**20
for i in range(N+1):
  b = cum[i]
  w = N-i-(cum[-1]-cum[i])
  ans = min(ans,b+w)
  
print(ans)
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
N = int(input())
A = list(map(int,input().split()))
D1 = defaultdict(int)
D2 = defaultdict(int)

for i in range(0,N,2):
  D1[A[i]]+=1
for i in range(1,N,2):
  D2[A[i]]+=1
  
D1_sorted = sorted(D1.items(), key=lambda x:x[1], reverse = True) + [-1,0]
D2_sorted = sorted(D2.items(), key=lambda x:x[1], reverse = True) + [-1,0]

i, j = 0, 0
while i < len(D1_sorted) -1 and j < len(D2_sorted) -1:
  if D1_sorted[i][0] != D2_sorted[j][0]:
    break
  elif D1_sorted[i][1] > D2_sorted[j][1]:
    j+=1
  elif D1_sorted[i][1] < D2_sorted[j][1]:
    i+=1
  else:
    if D1_sorted[i+1][1] > D2_sorted[j+1][1]:
      i+=1
    else:
      j+=1

print(N-D1_sorted[i][1]-D2_sorted[j][1])

Fixed submission:
from collections import defaultdict
N = int(input())
A = list(map(int,input().split()))
D1 = defaultdict(int)
D2 = defaultdict(int)

for i in range(0,N,2):
  D1[A[i]]+=1
for i in range(1,N,2):
  D2[A[i]]+=1
  
D1_sorted = sorted(D1.items(), key=lambda x:x[1], reverse = True) + [(-1,0)]
D2_sorted = sorted(D2.items(), key=lambda x:x[1], reverse = True) + [(-1,0)]
i, j = 0, 0
while i < len(D1_sorted) -1 and j < len(D2_sorted) -1:
  if D1_sorted[i][0] != D2_sorted[j][0]:
    break
  elif D1_sorted[i][1] > D2_sorted[j][1]:
    j+=1
  elif D1_sorted[i][1] < D2_sorted[j][1]:
    i+=1
  else:
    if D1_sorted[i+1][1] > D2_sorted[j+1][1]:
      i+=1
    else:
      j+=1

print(N-D1_sorted[i][1]-D2_sorted[j][1])
Buggy python submission (verdict: Runtime Error):
N = input()
K = int(input())
ans = '1'
for i in range(K):
  if i >= len(N):
    break
  if N[i] != '1':
    ans = N[i]
  	break
print(ans)
  

Fixed submission:
N = input()
K = int(input())
ans = '1'
for i in range(K):
  if i >= len(N):
    break
  if N[i] != '1':
    ans = N[i]
    break
print(ans)

Buggy python submission (verdict: Runtime Error):
N = input()
K = int(input())
if len(N) == 1:
  print(N[0])
elif K = 1:
  print(N[0])
elif N[0] == '1':
  print(N[1])
else:
  print(N[0])
  

Fixed submission:
N = input()
K = int(input())
ans = '1'
for i in range(K):
  if i >= len(N):
    break
  if N[i] != '1':
    ans = N[i]
    break
print(ans)

Buggy python submission (verdict: Runtime Error):
N = input()
K = int(input())
if N[0] == '1':
  print(N[1])
else:
  print(N[0])
  

Fixed submission:
N = input()
K = int(input())
ans = '1'
for i in range(K):
  if i >= len(N):
    break
  if N[i] != '1':
    ans = N[i]
    break
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
for i in range(N):
  A[i]-= i+1
A.sort()
total = sum(A)
mean1 = total//N
mean2 = total//N + 1
med1 = A[N//2]
med2 = A[N//2+1]
ans1 = 0
ans2 = 0
ans3 = 0
ans4 = 0 
for a in A:
  ans1+=abs(a-mean1)
  ans2+=abs(a-mean2)
  ans3+=abs(a-med1)
  ans4+=abs(a-med2)
print(min([ans1,ans2,ans3,ans4]))

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
for i in range(N):
  A[i]-= i+1
A.sort()
total = sum(A)
mean1 = total//N
mean2 = total//N + 1
med1 = A[N//2]
#med2 = A[N//2+1]
ans1 = 0
ans2 = 0
ans3 = 0
ans4 = 0 
for a in A:
  ans1+=abs(a-mean1)
  ans2+=abs(a-mean2)
  ans3+=abs(a-med1)
  #ans4+=abs(a-med2)
print(min([ans1,ans2,ans3]))
Buggy python submission (verdict: Runtime Error):
import math
N, K = map(int,input())
A = list(map(int,input().split()))
print(math.ceil(N/(K-1)))

Fixed submission:
import math
N, K = map(int,input().split())
A = list(map(int,input().split()))
print(math.ceil((N-1)/(K-1)))
Buggy python submission (verdict: Runtime Error):
from collections import deque
H, W = map(int,input().split())
G = [input() for _ in range(H)]
white = 0
dist = [(-1, 0), (1, 0), (0, -1), (0, 1)]
visited = set()
for line in G:
  white+=line.count('.')

D = deque()
D.append((0,0,1))
rout = -1
while D:
  h, w, c = D.popleft()
  if h == H-1 and w == W-1:
    rout = c
    break
  if (h, w) in visited or G[h][w] == '#':
    continue
  else:
    visited.add((h, w))
  for dh, dw in dist:
    if (0<=h+dh<H) and (0<=w+dw<W):
      if (h+dh, w+dw) not in visited and G[h+dh][w+dh] != '#':
        D.append((h+dh, w+dw, c+1))
        
if rout == -1:
  print(rout)
else:
  print(white-rout)



Fixed submission:
from collections import deque
H, W = map(int,input().split())
G = [input() for _ in range(H)]
white = 0
dist = [(-1, 0), (1, 0), (0, -1), (0, 1)]
visited = set()
for line in G:
  white+=line.count('.')

D = deque()
D.append((0,0,1))
rout = -1
while D:
  h, w, c = D.popleft()
  if h == H-1 and w == W-1:
    rout = c
    break
  if (h, w) in visited or G[h][w] == '#':
    continue
  else:
    visited.add((h, w))
  for dh, dw in dist:
    if (0<=h+dh<H) and (0<=w+dw<W):
      if (h+dh, w+dw) not in visited and G[h+dh][w+dw] != '#':
        D.append((h+dh, w+dw, c+1))
        
if rout == -1:
  print(rout)
else:
  print(white-rout)
Buggy python submission (verdict: Runtime Error):
N = int(input())
T = []
X = []
Y = []
T[0] = X[0] = Y[0] = 0
for i in range(N):
    t,x,y = map(int,input().split())
    T.append(t)
    X.append(x)
    Y.append(y)

flag = True
for i in range(N):
    time = T[i+1]-T[i]
    dist = abs(X[i+1]-X[i])+abs(Y[i+1]-Y[i])
    if time < dist or (dist%2!=time%2):
        flag = False
        break
if flag:
    print('Yes')
else:
    print('No')


Fixed submission:
N = int(input())
T = [0]
X = [0]
Y = [0]
for i in range(N):
    t,x,y = map(int,input().split())
    T.append(t)
    X.append(x)
    Y.append(y)

flag = True
for i in range(N):
    time = T[i+1]-T[i]
    dist = abs(X[i+1]-X[i])+abs(Y[i+1]-Y[i])
    if time < dist or (dist%2!=time%2):
        flag = False
        break
if flag:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
N = int(input())
P = list(map(int,input().split()))
L = [False]*N
for i in range(N):
  if P[i] == i+1:
    L = True
ans = 0
for i in range(N):
  if L[i]:
    if i<N-1 and L[i+1]:
      ans+1
      i+=1
    else:
      ans+=1
print(ans)
      

Fixed submission:
N = int(input())
P = list(map(int,input().split()))
L = [False]*N
for i in range(N):
  if P[i] == i+1:
    L[i] = True
ans = 0
i = 0
while i < N:
  if L[i]:
    if i<N-1 and L[i+1]:
      ans+=1
      i+=1
    else:
      ans+=1
  i+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
def main():
  N, M = map(int,input().split())
  fromOne = set()
  toM = set()
  for i in range(N):
    a, b = map(int,input().split())
    if a == 1:
      fromOne.add(b)
    elif b == M:
      toM.add(a)
  return 'POSSIBLE' if fromOne & toM else 'IMPOSSIBLE'
print(main())

Fixed submission:
def main():
  N, M = map(int,input().split())
  fromOne = set()
  toM = set()
  for i in range(M):
    a, b = map(int,input().split())
    if a == 1:
      fromOne.add(b)
    elif b == N:
      toM.add(a)
  return 'POSSIBLE' if fromOne & toM else 'IMPOSSIBLE'
print(main())
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [0]+list(map(int,input().split()))
for i in range(1,N+1):
  A[i] = A[i]+A[i-1]
ans = float('inf')
for i in range(1,N):
  ans = min(ans, ans(A[N]-2*A[i]))
print(ans)

Fixed submission:
N = int(input())
A = [0]+list(map(int,input().split()))
for i in range(1,N+1):
  A[i] = A[i]+A[i-1]
ans = float('inf')
for i in range(1,N):
  ans = min(ans, abs(A[N]-2*A[i]))
print(ans)
Buggy python submission (verdict: Runtime Error):
X = int(input())
for t in range(1,X):
  total = t*(t+1)/2
  if total>=X:
    break
print(t)

Fixed submission:
X = int(input())
t = 1
for t in range(1,X+1):
  total = t*(t+1)/2
  if total>=X:
    break
print(t)

Buggy python submission (verdict: Runtime Error):
X = int(input())
for t in range(1:X):
  total = t*(t+1)/2
  if total>=X:
    print(t)
   	break

Fixed submission:
X = int(input())
t = 1
for t in range(1,X+1):
  total = t*(t+1)/2
  if total>=X:
    break
print(t)

Buggy python submission (verdict: Time Limit Exceeded):
X = int(input())
queue = [(0,0)]
while queue:
  time, location = queue.pop(0)
  if location == X:
    print(time)
    break
  time+=1
  queue.append((time,location+time))
  queue.append((time,location))
  queue.append((time,location-time))

Fixed submission:
X = int(input())
t = 1
for t in range(1,X+1):
  total = t*(t+1)/2
  if total>=X:
    break
print(t)
Buggy python submission (verdict: Runtime Error):
N = int(input())
Array = []
for i in range(N):
  Array.append(tuple(map(int,input().split())))

res = 0
for i in reversed(range(N)):
  a,b = Array[i]
  a+=res
  res+ = b-a%b
print(res)

Fixed submission:
N = int(input())
Array = []
for i in range(N):
  Array.append(tuple(map(int,input().split())))

res = 0
for i in reversed(range(N)):
  a,b = Array[i]
  a+=res
  res+= ((b-a%b)%b)
print(res)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
con = 1;
a = 1;
b = 1;
 
for i1 in range(n):
    con = (con * 10);
for i2 in range(n):
    a = (a * 9);
for i3 in range(n):
    b = (b * 8);
 
c = 2*a - b;
con = (con - c)%1000000007;
print(con)

Fixed submission:
n = int(input())
con = 1;
a = 1;
b = 1;

for i1 in range(n):
    con = (con * 10) % 1000000007;
for i2 in range(n):
    a = (a * 9) % 1000000007;
for i3 in range(n):
    b = (b * 8) % 1000000007;

c = (2*a - b)%1000000007;
con = (con - c)%1000000007;
print(con)
Buggy python submission (verdict: Runtime Error):
s = int(input())
red = [None]*s
red[0]= 0
red[1]= 0
red[2]= 0

for x in range(3,s):
    red[x] = (red[x-1] + red[x-3] + 1) % 1000000007
    
print((red[s-3]+1) % 1000000007)

Fixed submission:
s = int(input())

if s >= 3:
    red = [None]*s
    red[0]= 0
    red[1]= 0
    red[2]= 0
    for x in range(3,s):
        red[x] = (red[x-1] + red[x-3] + 1) % 1000000007
    print((red[s-3]+1) % 1000000007)

else:
    print(0)
Buggy python submission (verdict: Runtime Error):
i = 0;
mod = 0;
while True:
    mod = (mod*10 + 7) % k;
    if mod == 0:
        break;
    i += 1;
    if i == k:
        j = -2
        break;

print(i+1)

Fixed submission:
k = int(input())


i = 0;
mod = 0;
while True:
    mod = (mod*10 + 7) % k;
    if mod == 0:
        break;
    i += 1;
    if i == k:
        i = -2
        break;

print(i+1)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
m = str(input())

red = []
white = []
for i in range(n):
    if m[i] == 'R':
        red.insert(0, i)
    else:
        white.append(i);

re = len(red)
wh = len(white)
if re == 0 or wh == 0:
    print(0);
else:
    k = 0;
    for j in range(min(re,wh)):
        if red[j] > white[j]:
            k += 1;

    print(k);

Fixed submission:
n = int(input())
m = str(input())

red = m.count('R')

con = 0;

for i in range(red):
    if m[i] == 'W':
        con += 1
print(con);
Buggy python submission (verdict: Runtime Error):
import math
con = 0;
n = int(input())
nn = n**4
a = [0]*nn

m = int(math.sqrt(n) // 1);
for x in range(1,m+1):
    for y in range(1,m+1):
        for z in range(1,m+1):
            s = x**2 + y**2 + z**2 + x*y + y*z + z*x;
            a[s-1] += 1;


for v in range(n):
    print(a[v]);

Fixed submission:
import math
con = 0;
n = int(input())
a = [0]*n

m = int(math.sqrt(n) // 1);
for x in range(1,m+1):
    for y in range(1,m+1):
        for z in range(1,m+1):
            s = x**2 + y**2 + z**2 + x*y + y*z + z*x;
            if s <= n:
                a[s-1] += 1;


for v in range(n):
    print(a[v]);

Buggy python submission (verdict: Runtime Error):
import math
con = 0;
n = int(input())
nn = n**2
a = [0]*nn

m = int(math.sqrt(n) // 1);
for x in range(1,m+1):
    for y in range(1,m+1):
        for z in range(1,m+1):
            s = x**2 + y**2 + z**2 + x*y + y*z + z*x;
            a[s-1] += 1;


for v in range(n):
    print(a[v]);

Fixed submission:
import math
con = 0;
n = int(input())
a = [0]*n

m = int(math.sqrt(n) // 1);
for x in range(1,m+1):
    for y in range(1,m+1):
        for z in range(1,m+1):
            s = x**2 + y**2 + z**2 + x*y + y*z + z*x;
            if s <= n:
                a[s-1] += 1;


for v in range(n):
    print(a[v]);
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
import collections

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

con = 0;
for k in range(1,n+1):
    c = collections.Counter(prime_factorize(k))
    x = list(c.values())
    y = len(x);
    kk = k
    for p in range(y):
        kk = kk*(x[p]+1)
    
    con += kk;
        
print(con);

Fixed submission:
n = int(input())
sum = 0;

nn = n//2;
nnn = n-nn
if n <= 5000000:
    for i in range(1,n+1):
        x = n//i;
        sum += i*x*(x+1)//2;
else:
    for i in range(1,5000000+1):
        x = n//i;
        sum += i*x*(x+1)//2;
    sum += (n-5000000)*(5000001+n)//2;
print(sum);
Buggy python submission (verdict: Runtime Error):
x, n = map(int, input().split());
if n == 0:
    print(x);
if n == 1:
    b = int(input());
    if b == x:
        print(x-1);
    else:
        print(x);
else:
    a = list(map(int,input().split()));
    
    for i in range(n):
        if a.count(x-i) == 0:
            ooo = 1;
            break;
        if a.count(x+i) == 0:
            ooo = 2;
            break;
        
            
    if ooo == 1:
        print(x-i);
    else:
        print(x+i);

Fixed submission:
x, n = map(int, input().split());
if n == 0:
    print(x);
elif n == 1:
    b = int(input());
    if b == x:
        print(x-1);
    else:
        print(x);
else:
    a = list(map(int,input().split()));
    
    for i in range(n):
        if a.count(x-i) == 0:
            ooo = 1;
            break;
        if a.count(x+i) == 0:
            ooo = 2;
            break;
        
            
    if ooo == 1:
        print(x-i);
    else:
        print(x+i);

Buggy python submission (verdict: Runtime Error):
x, n = map(int, input().split());
if n == 0:
    print(x);
else:
    a = list(map(int,input().split()));
    
    for i in range(n):
        if a.count(x-i) == 0:
            ooo = 1;
            break;
        if a.count(x+i) == 0:
            ooo = 2;
            break;
            
    if ooo == 1:
        print(x-i);
    else:
        print(x+i);

Fixed submission:
x, n = map(int, input().split());
if n == 0:
    print(x);
elif n == 1:
    b = int(input());
    if b == x:
        print(x-1);
    else:
        print(x);
else:
    a = list(map(int,input().split()));
    
    for i in range(n):
        if a.count(x-i) == 0:
            ooo = 1;
            break;
        if a.count(x+i) == 0:
            ooo = 2;
            break;
        
            
    if ooo == 1:
        print(x-i);
    else:
        print(x+i);
Buggy python submission (verdict: Runtime Error):
k = int(input())
a, b = map(int, input().split());

x = 0;
for i in range(a,b+1);
    if i % k == 0:
        x += 1;

if x == 0:
    print('NG')
else:
    print('OK')

Fixed submission:
c = int(input());
a, b = map(int, input().split())
d = 0;

while a <= b :
    if a % c == 0:
        d = d + 1;

    a = a + 1;
    
if d == 0:
    print("NG");

else:
    print("OK");

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

while a <= b :
    if a % c == 0:
        d = d + 1;

    a = a + 1;
    
if d == 0:
    print("NG");

else:
    print("OK");

Fixed submission:
c = int(input());
a, b = map(int, input().split())
d = 0;

while a <= b :
    if a % c == 0:
        d = d + 1;

    a = a + 1;
    
if d == 0:
    print("NG");

else:
    print("OK");
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split());
i = 0;
while True:
    if (n - i)% k == 0:
        break;
    if (n + i)% k == 0:
        break;
    i += 1;

print(i);

Fixed submission:
n,k = map(int,input().split());
i = 0;
if n == k:
    print(0);
elif n < k:
    print(min(n,k-n));
else:
    v = (n - k)%k;
    if v*2 >= k:
        print(k-v);
    else:
        print(v);

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

if n == k:
    print(0);
elif n > k:
    n = n - k;
    a = [n];
    i = 0;
    while True:
        n = n-k;
        if n < 0:
            break;
        a.append(n);
        i += 1;
else:
    n = k - n;
    a = [n];
    i = 0;
    while True:
        n = n-k;
        if n < 0:
            break;
        a.append(n);
        i += 1;

if a[i] <= (-1)*n:
    print(a[i]);
else:
    print((-1)*n);

Fixed submission:
n,k = map(int,input().split());
i = 0;
if n == k:
    print(0);
elif n < k:
    print(min(n,k-n));
else:
    v = (n - k)%k;
    if v*2 >= k:
        print(k-v);
    else:
        print(v);
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n = int(input())
    ans = 0
    
    for a in range(1, n):
        for b in range(1, n):
            if a * b > n:
                break
            if 1 <= a * b <= n - 1:
                ans += 1
    print(ans)

        
if __name__ == '__main__':
    main()

Fixed submission:
def main():
    n = int(input())
    ans = 0
    
    for a in range(1, n):
        for b in range(1, n):
            if 1 <= a * b <= n - 1:
                ans += 1
            else:
                break
           
    print(ans)

        
if __name__ == '__main__':
    main()