Harryxun/stf_run huggingface dataset:
import math
H = int(input())


def iterated_power(z: int, n: int, mod=None) -> int:
    beta = bin(n)[2:]

    Z, q, t = z, 0, len(beta)
    while beta[t - q - 1] == '0':
        Z = Z * Z
        if mod is not None:
            Z = Z % mod
        q += 1
    result = Z

    for k in range(q + 1, t):
        Z = Z * Z
        if mod is not None:
            Z = Z % mod
        if beta[t - k - 1] == '1':
            result = result * Z
            if mod is not None:
                result = result % mod

    if mod is not None:
        result = result % mod

    return result

cnt = 0
while True:
    H = math.floor(H/2)
    cnt += 1
    if H ==1:
        break
cnt += 1

ans = iterated_power(2, cnt) - 1

print(ans)


### FIXED CODE ###


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

if H % A == 0:
    print(int(H / A))
else:
    print((H // A)+1)
a,b,c,d=map(int,input().split());m=998244353;x=range(c+d);D=[[0]*3011for _ in [0]*3011];D[a][b]=1
for i in x:
 for j in x:D[i+1][j+1]+=(D[i+1][j]*(i+1)+D[i][j+1]*(j+1)-D[i][j]*i*j)%m
print(D[c][d])

### FIXED CODE ###

A,B,C,D=map(int,input().split())
m=998244353
d=[[0]*(D+1) for _ in range(C+1)]
d[A][B]=1
for i in range(A,C+1):
 for j in range(B,D+1):
        d[i][j]+=(d[i][j-1]*i+d[i-1][j]*j-d[i-1][j-1]*(i-1)*(j-1))%m
print(d[C][D])
N,M = map(int,input().split())
S = input()
T = input()
ans = 0
a = 2

if S[0] != T[0]:ans = -1

elif N % M != 0 and M % N != 0:
    if N >= M:
        while True:
            if N * a % M == 0:
                ans = N * a
                b = int(N*a/M)
                for i in range(M):
                    if T[i] != S[b*i]:
                        ans = -1
                        break
                break
            else:
                a += 1
    elif N < M:
        while True:
            if M * a % N == 0:
                ans = M * a
                b = int(M*a/N)
                for i in range(N):
                    if S[i] != T[b*i]:
                        ans = -1
                        break
                break
            else:
                a += 1

elif N % M == 0:
    b = int(N/M)
    ans = N
    for i in range(M):
        if T[i] != S[b*i]:
            ans = -1
            break   

elif M % N == 0:
    b = int(M/N)
    ans = M
    for i in range(N):
        if S[i] != T[b*i]:
            ans = -1
            break   

print(ans)


### FIXED CODE ###

N,M = map(int,input().split())
S = input()
T = input()
ans = 0
a = 2

if S[0] != T[0]:ans = -1

elif N % M != 0 and M % N != 0:
    if N >= M:
        while True:
            if N * a % M == 0:
                ans = N * a
                b = int(N*a/M)
                for i in range(int(N/b)):
                    if T[a*i] != S[b*i]:
                        ans = -1
                        break
                break
            else:
                a += 1
    elif N < M:
        while True:
            if M * a % N == 0:
                ans = M * a
                b = int(M*a/N)
                for i in range(int(M/b)):
                    if T[b*i] != S[a*i]:
                        ans = -1
                        break
                break
            else:
                a += 1

elif N % M == 0:
    b = int(N/M)
    ans = N
    for i in range(M):
        if T[i] != S[b*i]:
            ans = -1
            break   

elif M % N == 0:
    b = int(M/N)
    ans = M
    for i in range(N):
        if S[i] != T[b*i]:
            ans = -1
            break   

print(ans)
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
X,Y,A,B,C = map(int,readline().split())
P = list(map(int,readline().split()))
Q = list(map(int,readline().split()))
R = list(map(int,readline().split()))
P = sorted(P,reverse=True)
Q = sorted(Q,reverse=True)
R = sorted(R,reverse=True)
P = P[:X]
Q = Q[:Y]
PQ = sorted(P+Q,reverse = True)
total = sum(PQ)
for i in range(C):
    if R[i] < PQ[-(i+1)]:
      if i ==0:
        ans = total
      else:
        ans = total + sum(R[:i]) - sum(PQ[-i:])
      break
    if i == C-1:
      ans = total + sum(R[:i+1]) - sum(PQ[-(i+1):])
print(ans)

### FIXED CODE ###

import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
X,Y,A,B,C = map(int,readline().split())
P = list(map(int,readline().split()))
Q = list(map(int,readline().split()))
R = list(map(int,readline().split()))
P = sorted(P,reverse=True)
Q = sorted(Q,reverse=True)
R = sorted(R,reverse=True)
P = P[:X]
Q = Q[:Y]
PQR = sorted(P+Q+R,reverse = True)
ans = sum(PQR[:X+Y])
print(ans)
import numpy

class UnionFind:
    def __init__(self, N):
        self.N = N

        # the parent of all node is itself
        # self.parent = list(range(N))
        self.parent = [-1] * N

    def root(self, i):
        if self.parent[i] < 0:
            return i
        else:
            r = self.root(self.parent[i])
            self.parent[i] = r
            return r

    def unite(self, i, j):
        # print('root {}, {} = '.format(i, j), end='')
        i = self.root(i)
        j = self.root(j)
        # print(i, j)

        if i >= 0 and  j >= 0 and  i == j:
            return 

        self.parent[i] += self.parent[j]
        self.parent[j] = i
        # print(self.parent)

    def same(self, i, j):
        return self.root(i) == self.root(j)

    def size(self, i):
        return -self.parent[self.root(i)]

N, M = map(int, input().split())
R = numpy.array([[int(r) for r in input().split()] for _ in range(M)]) - 1

forest = UnionFind(N)
for p1, p2 in R:
    forest.unite(p1, p2)

s = [forest.size(i) for i in range(N)]
print(max(s))

### FIXED CODE ###

import numpy

class UnionFind:
    def __init__(self, N):
        self.N = N

        # the parent of all node is itself
        # self.parent = list(range(N))
        self.parent = [-1] * N

    def root(self, i):
        if self.parent[i] < 0:
            return i

        r = self.root(self.parent[i])
        self.parent[i] = r
        return r

    def unite(self, i, j):
        # print('root {}, {} = '.format(i, j), end='')
        i = self.root(i)
        j = self.root(j)
        # print(i, j)

        if i == j:
            return

        if i > j:
            i, j = j, i

        self.parent[i] += self.parent[j]
        self.parent[j] = i
        # print(self.parent)

    def same(self, i, j):
        return self.root(i) == self.root(j)

    def size(self, i):
        return -self.parent[self.root(i)]

N, M = map(int, input().split())
R = numpy.array([[int(r) for r in input().split()] for _ in range(M)]) - 1

forest = UnionFind(N)
for p1, p2 in R:
    forest.unite(p1, p2)

s = [forest.size(i) for i in range(N)]
print(max(s))
import numpy as np

##素数判定を行う関数
def prime(p):
    if p==2 or p==3:
        return True
    else:
        i = int(np.sqrt(p))
        while i>=2:
            if p%i==0:
                return False
                break
            i-=1
        return True
                
            

N = int(input())
count = 0

for i in range(N):
    a = int(input())
    if prime(a)==True:
        count+=1
        
print(count)


### FIXED CODE ###


import math

##素数判定を行う関数
def prime(p):
    if p==2 or p==3:
        return True
    else:
        i = int(math.sqrt(p))
        while i>=2:
            if p%i==0:
                return False
                break
            i-=1
        return True
                
            

N = int(input())
count = 0

for i in range(N):
    a = int(input())
    if prime(a)==True:
        count+=1
        
print(count)
#!/usr/bin/env python

from collections import deque
import itertools as it
import sys
import math

while True:
    n = input()
    lst = []
    if n == 0:
        break
    if n == 1:
        num = input()
        print num
        continue
    for loop in range(n):
        S = raw_input()
        lst.append((len(S), S[-1]))
    n += 1
    
    c_lst = [0 for i in range(1000)]
    v_lst = [0 for i in range(1000)]

    rank = 1
    for i in range(n):
        r = lst[i][0]
        c = lst[i][1]
        while r < rank:
            if c_lst[rank - 1] == '+':
                v_lst[rank - 1] += v_lst[rank]
            else:
                v_lst[rank - 1] *= v_lst[rank]
            rank -= 1
        if c == '+':
            r += 1
            c_lst[r] = '+'
            v_lst[r] = 0
            rank += 1
            continue
        elif c == '*':
            r += 1
            c_lst[r] = '*'
            v_lst[r] = 1
            rank += 1
            continue
        if c_lst[r] == '+':
            v_lst[r] += int(c)
        else:
            v_lst[r] *= int(c)
    print v_lst[2]
    


### FIXED CODE ###

#!/usr/bin/env python

from collections import deque
import itertools as it
import sys
import math

while True:
    n = input()
    lst = []
    if n == 0:
        break
    if n == 1:
        num = input()
        print num
        continue
    for loop in range(n):
        S = raw_input()
        lst.append((len(S), S[-1]))
    if lst[0][1] == '+':
        lst.append((0, '0'))
    else:
        lst.append((0, '1'))
    n += 1
    
    c_lst = [0 for i in range(1000)]
    v_lst = [0 for i in range(1000)]

    rank = 1
    for i in range(n):
        r = lst[i][0]
        c = lst[i][1]
        while r < rank:
            if c_lst[rank - 1] == '+':
                v_lst[rank - 1] += v_lst[rank]
            else:
                v_lst[rank - 1] *= v_lst[rank]
            rank -= 1
        if c == '+':
            r += 1
            c_lst[r] = '+'
            v_lst[r] = 0
            rank += 1
            continue
        elif c == '*':
            r += 1
            c_lst[r] = '*'
            v_lst[r] = 1
            rank += 1
            continue
        if c_lst[r] == '+':
            v_lst[r] += int(c)
        else:
            v_lst[r] *= int(c)
    print v_lst[2]
import fractions
A, B = map(int, input().split())
gcd = fractions.gcd(A, B)
ans = 1
sqrt = math.sqrt(gcd)
for i in range(2, int(sqrt) + 2):
    if gcd % i == 0:
        ans += 1
        while True:
            gcd //= i
            if gcd % i != 0:
                break
if sqrt < gcd:
    ans += 1
print(ans)

### FIXED CODE ###

import fractions
A, B = map(int, input().split())
gcd = fractions.gcd(A, B)
ans = 1
sqrt = gcd ** 0.5
for i in range(2, int(sqrt) + 2):
    if gcd % i == 0:
        ans += 1
        while True:
            gcd //= i
            if gcd % i != 0:
                break
if sqrt < gcd:
    ans += 1
print(ans)
x, n = list(map(int, input().split()))
if not n:
  print(x) 
else:
  l = list(map(int, input().split()))
  dic = {} 
  for ll in l: dic[l] = 1
  i = 1
  while true:
    if not dic.get(x-i,0):
      print(x-i)
      break
    elif not dic.get(x+i, 0):
      print(x+i) 
      break
    i+=1

### FIXED CODE ###

x, n = list(map(int, input().split()))
if not n:
  print(x) 
else:
  l = list(map(int, input().split()))
  dic = {} 
  for ll in l: dic[ll] = 1
  i = 0
  while True:
    if not dic.get(x-i,0):
      print(x-i)
      break
    elif not dic.get(x+i, 0):
      print(x+i) 
      break
    i+=1
N = int(input())
A = list(map(int, input().split()))

A.sort()
cnt = [] 
bad = 0
j = True
for i in range(1, A[1]):
    for n in range(N):
        if bad==2:
            cnt.append(0)
            j = False
            break
        elif A[n]%i != 0:
            bad += 1
    if j:
        cnt.append(i)



print(max(cnt))

### FIXED CODE ###

def gcd(x,y):
  if y==0:
    return x
  else:
    return gcd(y, x%y)

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

left_gcd = [A[0]]
a = A[0]
for i in range(1,N-1):
  a = gcd(a, A[i])
  left_gcd.append(a)

right_gcd = [A[N-1]]
b = A[N-1]
for k in range(N-2, 0, -1):
  b = gcd(b, A[k])
  right_gcd.append(b)

ans_gcd = [right_gcd[N-2], left_gcd[N-2]]

for p in range(N-2):
  ans_gcd.append(gcd(left_gcd[p], right_gcd[N-p-3]))

print(max(ans_gcd))
from itertools import combinations
while 1:
 n,s=map(int,input().split())
 if n:print(sum([1 for p in combinations(range(10),n)if sum(p)==s]))


### FIXED CODE ###

import itertools
for e in iter(input,'0 0'):
 n,s=map(int,e.split())
 print(sum(s==sum(p)for p in itertools.combinations(range(10),n)))
n,x=map(int,input().split())
a=list(map(int,input().split()))
i,s=0,0
while s<=x:
  s=s+a[i]
  i=i+1
print(i)

### FIXED CODE ###

x,a=map(int,input().split())
if x<a:
  print("0")
else:
  print("10")
n = int(input())
house = []
for i in range(4):
    house.append([])
    for j in range(3):
        house[i].append([])
        for k in range(10):
            house[i][j].append(0)

for i in range(n):
    b,f,r,v = map(int,input().split())
    house[b][f][r] += v


for i in range(4):
    for j in range(3):
        for k in range(10):
            print("" , house[i][j][k], end="")
        print()
    if b < 3:
        print("#" * 20)

### FIXED CODE ###

n = int(input())
house = []
for i in range(4):
    house.append([])
    for j in range(3):
        house[i].append([])
        for k in range(10):
            house[i][j].append(0)

for i in range(n):
    b,f,r,v = map(int,input().split())
    house[b-1][f-1][r-1] += v


for i in range(4):
    for j in range(3):
        for k in range(10):
            print("" , house[i][j][k], end="")
        print()
    if i < 3:
        print("#" * 20)
N, M = map(int, input().split())
G = [[] for _ in range(N+1)]
MEMO = [-1 for _ in range(N+1)]

for _ in range(M):
  x, y = map(int, input().split())
  G[x].append(y)


def dp_LP(v):# 頂点nから始まる最長経路を返す.
  if MEMO[v] != -1:
    return MEMO[v]
  else:
    ans = 0
    for i in G[v]:
      ans = max(ans, dp_LP(i)+1)
    MEMO[v] = ans

    return ans



answer = 0
for n in range(1,N+1):
  answer = max(answer, dp_LP(n))
print(answer)




### FIXED CODE ###

import sys
sys.setrecursionlimit(200000)
N, M = map(int, input().split())
G = [[] for _ in range(N+1)]
MEMO = [-1 for _ in range(N+1)]

for _ in range(M):
  x, y = map(int, input().split())
  G[x].append(y)


def dp_LP(v):# 頂点nから始まる最長経路を返す.
  if MEMO[v] != -1:
    return MEMO[v]
  else:
    ans = 0
    for i in G[v]:
      ans = max(ans, dp_LP(i)+1)
    MEMO[v] = ans

    return ans



answer = 0
for n in range(1,N+1):
  answer = max(answer, dp_LP(n))
print(answer)
def counter():#島の数をカウントする
    count=0
    #12*12個の値をひとつずつ調べる
    for x in range(12):
        for y in range(12):
            if is_data[x][y] == 1:#島が発見されたら
                dfs(x,y)
                count+=1
    return count
def dfs(x,y):
    if x<0 or x == len(is_data[x]) or y<0 or y == len(is_data):
        return
    if is_data[x][y] == 1:
        is_data[x][y] = 0
        dfs(x+1,y)
        dfs(x,y+1)
        dfs(x-1,y)
        dfs(x,y-1)
while True:
    try:
        is_data=[]
        while True:
            s = list(input())#入力
            if not s :#空入力のときループぬける
                break
            is_data.append(s)
    if len(is_data) != 12:break
    except EOFError:
        print(counter())


### FIXED CODE ###

def counter():#島の数をカウントする
    count=0
    #12*12個の値をひとつずつ調べる
    for x in range(len(is_data)):
        for y in range(len(is_data)):
            if is_data[x][y] == '1':#島が発見されたら
                dfs(x,y)
                count+=1
    return count
def dfs(x,y):
    if x<0 or x == len(is_data) or y<0 or y == len(is_data):
        return
    if is_data[x][y] == '1':
        is_data[x][y] = '0'
        dfs(x+1,y)
        dfs(x,y+1)
        dfs(x-1,y)
        dfs(x,y-1)

is_data=[]
while True:
    try:
        s = list(input())#入力
        if not s:#空入力のとき
            print(counter())
            is_data=[]
            s = []
        else:
            is_data.append(s)
    except EOFError:
        print(counter())
        break
a,b,c=[int(input()) for i range(3)]
print(((a+b)*c)/2)

### FIXED CODE ###

a,b,c=[int(input()) for i in range(3)]
print(((a+b)*c)//2)
n = int(input())
for x in range(1, 10)
  for y in range(x, 10)
    if x * y == n:
      print("Yes")
      exit()
print("No")
  

### FIXED CODE ###

n = int(input())
for x in range(1, 10):
  for y in range(x, 10):
    if x * y == n:
      print("Yes")
      exit()
print("No")
n, k = map(int, raw_input().split())
print(k * (k-1)**(n-1))

### FIXED CODE ###

a, b, c = map(int, raw_input().split())
print(len(set([a,b,c])))
import numpy as np

def set_list(es):
    return len(list(set(es))) == 1

n = int(input())
a = [int(i) for i in input().split()]

if(len(a)==2):
    print((a[0]+a[1])/2)  
elif(len(a)!=2 and set_list(a)):
    print(a[0])
else:
  for i in range(1,n):
    idx = np.argmin(a)
    num1 = a.pop(idx)
    idx = np.argmin(a)
    num2 = a.pop(idx)
    a.append((num1+num2)/2)
	print(a[0])

### FIXED CODE ###

import numpy as np

def set_list(es):
    return len(list(set(es))) == 1

n = int(input())
a = [int(i) for i in input().split()]

if(len(a)==2):
    print((a[0]+a[1])/2)    
elif(len(a)!=2 and set_list(a)):
    print(a[0])
else:
    for i in range(1,n):
        idx = np.argmin(a)
        num1 = a.pop(idx)
        idx = np.argmin(a)
        num2 = a.pop(idx)
        a.append((num1+num2)/2)
    print(a[0])
s = input().split( )
print(s[0]/s[1])

### FIXED CODE ###

s = list(map(float ,input().split( )))
print(s[0]/s[1])
n=int(input())
S=input()
s=list(S)
 

def jokyolist(s):
  jokyo=[]
  #jokyo配列はこれから除去すべき奴の番号のリスト
  for i in range(len(s)-1):
    if s[i]==s[i+1]:
      jokyo.append(i)
    jokyo=sorted(jokyo,reverse=True)
  return jokyo
 
def remov(s,jokyo):
  for i in range(len(jokyo)):
    s.pop(jokyo[i])
    return s
def removtimes(jokyo):
  t=len(jokyo)
  return t
 
i=0
while i<=n:
  jokyo=jokyolist(s)
  if removtimes(jokyo)==0:
    break
  s=remov(s,jokyo)
  i+=1

print(len(s))


### FIXED CODE ###

A,B=input().split()
a=int(A)
b=int(B)
if a>=b*2:
  print(a-2*b)
else:
  print(0)
N, W = map(int, input().split())
wv = [[0 for i in range(2)] for j in range(N)]

for i in range(N):
    w, v = map(int, input().split())
    wv[i] = [w, v]

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

for i in range(N):
    for j in range(W+1):
        if (j - wv[i][0] >= 0):
            dp[i+1][j] = max(dp[i+1][j], dp[i][j-wv[i][0]] + wv[i][1])
        
        dp[i+1][j] = max(dp[i+1][j], dp[i][j])

print(dp[N][W])

### FIXED CODE ###

N, W = map(int, input().split())
wv = [[0 for i in range(2)] for j in range(N)]

for i in range(N):
    w, v = map(int, input().split())
    wv[i] = [w, v]

dp = [[0 for i in range(2*W)] for j in range(2*N)]

for i in range(N):
    for j in range(W+1):
        if (j - wv[i][0] >= 0):
            dp[i+1][j] = max(dp[i+1][j], dp[i][j-wv[i][0]] + wv[i][1])
        dp[i+1][j] = max(dp[i+1][j], dp[i][j])

print(dp[N][W])
S = list(input())[::-1]
L = len(S)
from collections import defaultdict

mod = 2019
t = 0
dic = defaultdict(int)
ans = 0
for l in range(L+1):
    t += pow(10, l)*int(S[l])
    i = t%mod
    ans += dic[i]
    dic[i] += 1

print(ans)

### FIXED CODE ###

S = list(input())[::-1]
L = len(S)
from collections import defaultdict

mod = 2019
t = 0
dic = defaultdict(int)
ans = 0
for l in range(L):
    t += pow(10, l, mod)*int(S[l])%mod
    t %= mod
    ans += dic[t]
    dic[t] += 1
    if t==0:
        ans += 1

print(ans)
a = [int(i) for i in input().split()] 

b = a[1]*a[2] - (a[3]*a[2] + a[4]*(a[1]-1[3]))
print(b)

### FIXED CODE ###

a = [int(i) for i in input().split()] 
b = [int(i) for i in input().split()] 


c = a[0]*a[1] - ( b[0]*a[1] + b[1]*(a[0]-b[0]) )
print(c)
import sys
import collections

def max_fetch(k,c,N):
    if c[0]*k <= N:
        return N//k
    else:
        return max_fetch(k-1,c[1:],N-c[0])

def solve(N: int, A: "List[int]"):
    counter = sorted(list(collections.Counter(A).values()),reverse=True)
    for i in range(1,N+1):
        if counter[0]*i <= N:
            print(N//i)
            continue
        print(max_fetch(i,counter,N))
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
import collections

def solve(N: int, A: "List[int]"):
    counter = sorted(list(collections.Counter(A).values()),reverse=True)
    c_index = 0
    k=0
    for i in range(1,N+1):
        k+=1
        if len(counter)<i:
            print(0)
            continue
        while counter[c_index]*k > N and c_index<len(counter)-1:
            N-=counter[c_index]
            c_index+=1
            k-=1
        print(N//k)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()
import sys
sys.setrecursionlimit(50000)

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

array = [[int(x) for x in input().split()] for x in range(m)]

if m == 0 or m == 1:
    print(1)
    sys.exit()

adjacency_list = [[] for x in range(n + 1)]

for i in array:
    adjacency_list[i[0]].append(i[1])
    adjacency_list[i[1]].append(i[0])

searched = [False for x in range(m+1)]


def calc(start, maze, searched):
    res = 0
    if searched[start]:
        return 0
    searched[start] = True

    if searched.count(True) == n:
        return 1
    else:
        for next in maze[start]:
            res += calc(next, maze, list(searched))
    return res


print(calc(1, adjacency_list, searched))


### FIXED CODE ###

import sys

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

array = [[int(x) for x in input().split()] for x in range(m)]

if m == 0:
    print(0)
    sys.exit()

adj_array = [[] for x in range(n + 1)]
res_array = [True] + [False for x in range(n)]
for item in array:
    adj_array[item[0]].append(item[1])
    adj_array[item[1]].append(item[0])


def dfs(n, res_array, res):
    res_array[n] = True
    if False not in res_array:
        return res+1
    else:
        for next in adj_array[n]:
            if not res_array[next]:
                res = dfs(next, list(res_array), res)
    return res


res = 0
res_array[1] = True
print(dfs(1, res_array, res))
a, b, n = map(int, input().split(" "))

max_score = 0
y = b // a

for x in range(max(y - 1000000, 1) , min(y + 2000000, n+1)):
    score = a * x // b - a * ( x // b )
    if score > max_score:
        max_score = score
print(max_score)


### FIXED CODE ###

x = int(input())
p, q = map(int, input().split())

ok = 0
for i in range(p, q+1):
    if i % x == 0:
        ok += 1
        break
if ok == 1:
    print("OK")
else:
    print("NG")