Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

N, K, Q = map(int, input().split())
A = [int(input()) for i in range(Q)]

N_K = [K for i in range(N)]
for i, a in enumerate(A):
    for j, n_k in enumerate(N_K):
        N_K[j] = n_k-1 if a-1 != j else n_k

for k, n_k in enumerate(N_K):
    if n_k <= 0:
        print("No")
    else:
        print("Yes")


### FIXED CODE ###

N, K, Q = map(int, input().split())
A = [0]*N
# print(A)

for i in range(Q):
    A[int(input())-1] +=1
    # print(A)

for i in range(N):
    if K-Q+A[i] <= 0:
        print("No")
    else:
        print("Yes")
### BUGGY CODE ###

def solve(V, G):
    for i in range(V):
        G[i][i] = float("inf")
    for k in range(V):
        for i in range(V):
            for j in range(V):
                #print(G)
                if G[i][k] + G[k][j] < G[i][j] < float("inf"):
                    return False, G
                elif G[i][j] == G[i][k] + G[k][j]:
                    G[i][j] = float("inf")
    return True, G


def dist(G):
    ans = 0
    for i in range(N):
        for j in range(N):
            if G[i][j] < float("inf"):
                ans += G[i][j]
    return ans

N = int(input())
G = [[int(i) for i in input().split()] for i in range(N)]

flag, G = solve(N, G)

if flag:
    print(dist(G)//2)
else:
    print(-1)


### FIXED CODE ###

def solve(V, G):
    ans = 0
    for i in range(V - 1):
        for j in range(i + 1, V):
            direct = G[i][j]
            for k in range(V):
                if k == i or k == j:
                    continue
                ind = G[i][k] + G[k][j]
                if direct > ind:
                    return -1
                elif direct == ind:
                    break
            else:
                ans += direct
    return ans


def main():
    V = int(input())
    G = [[int(i) for i in input().split()] for i in range(V)]
    print(solve(V, G))


if __name__ == "__main__":
    main()
### BUGGY CODE ###

A, B = (int(i) for i in input().split())
def euclid(a, b):
    while b:
        a, b = b, a%b
    return a
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors
num = make_divisors(euclid(A,B))
if len(num) <= 2:
  print(len(num))
else:
  total_num  = [0]*len(num)
  for i in range(1,len(num)):
    for j in range(i,len(num)):
      #print(i)
      #print(" "+str(j))
      try:
        #print(i)
        #print(" "+str(j))
        tmp_index = num[i]*num[j]
        total_num[num.index(tmp_index)] = 1
      except:
        #print("NG")
        total_num = total_num
  print(total_num.count(0))


### FIXED CODE ###

A, B = (int(i) for i in input().split())
def euclid(a, b):
    while b:
        a, b = b, a%b
    return a
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table
try:
  print(len(list(set(prime_decomposition(euclid(A,B)))))+1)
except:
  print(1)
### BUGGY CODE ###

N = int(input())
list6,list9 = [6],[9]
i = 2
while list6[-1] <= 100000:
    list6.append(6**i)
    i += 1
i = 2
while list9[-1] <= 100000:
    list9.append(9**i)
    i += 1
ans = 0
def f(N,ans):
    if N < 6:
        return ans + N
    if N < 9:
        return ans + (N-6)+1
 
    max6 = max(y for y in list6 if N >= y)
    max9 = max(z for z in list9 if N >= z)
 
    a6 = N-max6
    a9 = N-max9
    return min(f(a6,ans+1),f(a9,ans+1))
print(f(N,0))

### FIXED CODE ###

N = int(input())

def f9(a,i):
    if a < 9**i:
        return i-1
    return f9(a,i+1)

def f6(a,i):
    if a < 6**i:
        return i-1
    return f6(a,i+1)

def func(a,ans):
    if a < 6:
        return ans+a
    elif a < 9:
        return ans+1+(a-6)
    return min(func(a-6**f6(a,0),ans+1),func(a-9**f9(a,0),ans+1))

print(func(N,0))
### BUGGY CODE ###

import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return map(list,zip(*read_all))

#################

import numpy as np

def F2_GaussJordan(A, is_extended = False):
    rank = 0
    for col in range(len(A[0])):
        if (is_extended and col == len(A[0])-1):
            break
        pivot = -1
        for row in range(rank,len(A)):
            if A[row][col]:
                pivot = row
                break
        if pivot == -1: 
            continue
        A[[pivot,rank]] = A[[rank,pivot]]
        for row in range(len(A)):
            if (row != rank and A[row][col]):
                A[row] ^= A[rank]
        rank += 1
    return A

N = I()
A = III()

xor = 0
for i in range(N):
    xor ^= A[i]

use_digit = []
ans = 0
for j in range(60)[::-1]:
    if xor>>j & 1:
        ans += 2**j
    else:
        use_digit.append(j)

a = np.zeros((N,len(use_digit)), dtype=int)
for i in range(N):
    k = 0
    for j in use_digit:
        if A[i]>>j & 1:
            a[i][k] = 1
        else:
            a[i][k] = 0
        k += 1

g = F2_GaussJordan(a,False)

s = np.zeros(len(use_digit),dtype=int)
row = 0
for j in range(len(use_digit)):
    for i in range(row,N):
        if g[i][j]==1:
            s ^= g[i]
            row = i+1
            break

for j,k in enumerate(s):
    ans += k*2**(use_digit[j]+1)

print(ans)

### FIXED CODE ###

import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return map(list,zip(*read_all))

#################

N = I()
A = III()

xor = 0
for i in range(N):
    xor ^= A[i]

for i in range(N):
    A[i] &= ~xor

max_digit = len(format(max(A), 'b'))
rank = 0
for col in range(max_digit)[::-1]:
    pivot = -1
    for row in range(rank,N):
        if A[row]>>col & 1:
            pivot = row
            break
    if pivot == -1: 
        continue
    A[pivot],A[rank] = A[rank],A[pivot]
    for row in range(rank+1,N):
        if A[row]>>col & 1:
            A[row] ^= A[rank]
    rank += 1

val = 0
for i in range(N):
    val = max(val,val^A[i])

print(2*val + xor)
### BUGGY CODE ###

data=[int(input()) for i in range(int(input()))]
print(len([m for m in data if data.count(m)%2==1]))


### FIXED CODE ###

data=[int(input()) for i in range(int(input()))]
data.sort()
count=-1
value=1
predata=None
for i in range(0,len(data)):
    if predata!=data[i]:
        count+=value%2
        value=1
    else:
        value+=1
    predata=data[i]
count+=value%2
print(count)
### BUGGY CODE ###

K, N = map(int, input().split())
A = sorted(map(int, input().split()))
assert len(A) == N


dists = []
for i,start in enumerate(A):
  # 右回り
  posR = max([a + K for a in A[:i]] + A[i+1:])
  # 左回り
  posL = min(A[:i] + [a - K for a in A[i+1:]])
  dists.append(min(posR - start, - posL + start))
print(min(dists))

### FIXED CODE ###

K, N = map(int, input().split())
A = sorted(map(int, input().split()))
assert len(A) == N


dists = []
for i,start in enumerate(A):
  # 右回り
  posR = A[(i - 1) % N] + (K if A[(i - 1) % N] < start else 0)
  #max([a + K for a in A[:i]] + A[i+1:])
  # 左回り
  posL = A[(i + 1) % N] - (K if A[(i + 1) % N] > start else 0)
  #posL = min(A[:i] + [a - K for a in A[i+1:]])
#  print(start, posL, posR)
  dists.append(min(posR - start, - posL + start))
#print(dists)
print(min(dists))
### BUGGY CODE ###

N = int(input())
A = [0]
total = 0
count = 0
for a in input().split():
    total += int(a)
    for b in A:
        if b == total:
            count += 1 
    A.append(total)
print(count)

### FIXED CODE ###

N = int(input())
A = {0:1}
total = 0
count = 0
for a in input().split():
    total += int(a)
    if total in A:
        count += A[total]
        A[total] += 1
    else:
        A[total] = 1
print(count)
### BUGGY CODE ###

N, K = map(int, input().split())
h = [int(input()) for i in range(N)]


def quick(a):
    if len(a) < 2:
        return a
    p = a[0]
    x, y = quick_div(p, a[1:])
    return quick(x) + [p] + quick(y)


def quick_div(p, a):
    if len(a) < 1:
        return ([], [])
    x, y = quick_div(p, a[1:])
    if a[0] < p:
        return ([a[0]] + x, y)
    else:
        return (x, [a[0]] + y)


h = quick(h)
dh = []
for i in range(len(h) - K + 1):
    dh = dh + [h[i + K - 1]-h[i]]

print(min(dh))

### FIXED CODE ###

N, K = map(int, input().split())
h = sorted([int(input()) for _ in range(N)])
print(min([h[i+K-1]-h[i] for i in range(N - K + 1)]))
### BUGGY CODE ###

def main():
    import numpy as np
    h, w, K = map(int, input().split())
    grid = np.array([list(map(int, list(input())))
                     for _ in [0]*h], dtype=np.int16)
    m = 10**9
    for i in range(2**(h-1)):
        i = (("0"*h)+bin(i)[2:])[-h:]+"2"
        memo = [0]
        ma = memo.append
        [ma(j+1) for j in range(h) if i[j] != i[j+1]]
        ans = len(memo)-1
        ans2 = [0]
        aa = ans2.append
        memo2 = [0]*ans
        j = 0
        flag = False
        while j < w:
            if flag:
                break
            p, l = memo[0], ans2[-1]
            for k, q in enumerate(memo[1:ans+1]):
                memo2[k] += np.sum(grid[p:q, j])
                p = q
                if memo2[k] > K:
                    aa(j)
                    memo2 = [0]*ans
                    if j == l:
                        flag = True
                    l = j
                    break
            else:
                j += 1
        if not flag:
            m = min(m, ans+(len(ans2)-2))
    print(m)


main()


### FIXED CODE ###

def main():
    from itertools import product
    h, w, K = map(int, input().split())
    grid = [list(input()) for _ in [0]*h]
    m = 10**9
    for i in range(2**h):
        i = (("0"*h)+bin(i)[2:])[-h:]+"2"
        memo = [0]
        for j in range(h):
            if i[j] == i[j+1]:
                pass
            else:
                memo.append(j+1)
        ans = len(memo)-1
        ans2 = [0]
        memo2 = [0]*ans
        j = 0
        flag = False
        while j < w:
            if flag:
                break
            for k in range(ans):
                memo2[k] += [grid[l][j]
                             for l in range(memo[k], memo[k+1])].count("1")
                if memo2[k] > K:
                    ans2.append(j)
                    memo2 = [0]*ans
                    if ans2[-1] == ans2[-2]:
                        flag = True
                    break
            else:
                j += 1
        if flag == False:
            m = min(m, ans+(len(ans2)-2))
    print(m)


main()
### BUGGY CODE ###

S = list(input())
count = 0

def black_and_white(S):
  global count
  for i in range(0,len(S)-1):
    if(S[i] == "B" and S[i+1] == "W"):
      count += 1
      tmp = S[i]
      S[i] = S[i+1]
      S[i+1] = tmp
      return True
  return False

while(1):
  if not black_and_white(S): break

print(count)



### FIXED CODE ###

S = list(input())
b_count = 0
ans = 0

for i in range(0,len(S)):
  if S[i] == "B":
    b_count += 1
  elif S[i] == "W":
    ans += b_count

print(ans)
### BUGGY CODE ###

import collections, itertools

h, w = map(int, input().split())
ch, cw = tuple(int(s) - 1 for s in input().split())
dh, dw = tuple(int(s) - 1 for s in input().split())
s = [input() for _ in range(h)]

q = collections.deque()
q.append((ch, cw))
score = [[float('inf')] * w for _ in range(h)]
score[ch][cw] = 0
while q:
    x, y = q.popleft()

    for dx, dy in ((0, 1), (1, 0), (0, -1), (-1, 0)):
        nx, ny = x + dx, y + dy
        if 0 <= nx < h and 0 <= ny < w and s[nx][ny] == '.' and score[x][y] < score[nx][ny]:
            score[nx][ny] = score[x][y]
            q.appendleft((nx, ny))
    
    for dx, dy in itertools.product(range(-2, 3), repeat=2):
        nx, ny = x + dx, y + dy
        if 0 <= nx < h and 0 <= ny < w and s[nx][ny] == '.' and score[x][y] + 1 < score[nx][ny]:
            score[nx][ny] = score[x][y] + 1
            q.append((nx, ny))

if score[dh][dw] == float('inf'):
    print(-1)
else:
    print(score[dh][dw])

### FIXED CODE ###

import collections, itertools

h, w = map(int, input().split())
ch, cw = tuple(int(s) - 1 for s in input().split())
dh, dw = tuple(int(s) - 1 for s in input().split())
s = [input() for _ in range(h)]

q = collections.deque()
q.append((ch, cw, 0))
score = [[float('inf')] * w for _ in range(h)]
score[ch][cw] = 0
while q:
    x, y, p = q.popleft()

    for dx, dy in ((0, 1), (1, 0), (0, -1), (-1, 0)):
        nx, ny = x + dx, y + dy
        if 0 <= nx < h and 0 <= ny < w and s[nx][ny] == '.' and p < score[nx][ny]:
            score[nx][ny] = p
            q.appendleft((nx, ny, p))
    
    for dx, dy in itertools.product(range(-2, 3), repeat=2):
        nx, ny = x + dx, y + dy
        if 0 <= nx < h and 0 <= ny < w and s[nx][ny] == '.' and p + 1 < score[nx][ny]:
            score[nx][ny] = p + 1
            q.append((nx, ny, p + 1))

if score[dh][dw] == float('inf'):
    print(-1)
else:
    print(score[dh][dw])
### BUGGY CODE ###

k, s = map(int, input().split())
cnt = 0
for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x + y + z == s:
                cnt += 1
print(cnt)

### FIXED CODE ###

#review

def solve(k, s):
    ans = 0
    for x in range(k+1):
        for y in range(k+1):
            z = s - x - y
            if 0 <= z <= k:
                ans += 1
            elif z < 0:
                break
    return ans
 
 
def main():
    k, s = map(int, input().split())
    ans = solve(k, s)
    print(ans)
 
 
if __name__ == '__main__':
    main()
### BUGGY CODE ###

sx, sy, tx, ty = map(int, input().split())
visited = [[0] * 4001 for _ in range(4001)]
ofs = 2000

stoij = {'U':[0, 1], 'D':[0,-1], 'L':[-1, 0], 'R':[1, 0]}

from collections import deque
def bfs(si, sj, gi, gj):
    q = deque([[si, sj, '']])
    visitedinbfs = [[0] * 4001 for _ in range(4001)]
    visitedinbfs[sj+ofs][si+ofs] = 1

    while q:
        i, j, s = q.popleft()
        if i == gi and j == gj:
            break

        for ns in ['U', 'D', 'L', 'R']:
            mi, mj = stoij[ns]
            ni, nj = i + mi, j + mj
            if visitedinbfs[nj+ofs][ni+ofs] == 1 or visited[nj+ofs][ni+ofs] == 1:
                continue
            visitedinbfs[nj+ofs][ni+ofs] = 1
            q.append([ni, nj, s+ns])

    for ss in s:
        mi, mj = stoij[ss]
        si += mi
        sj += mj
        if si == gi and sj == gj:
            break
        visited[sj+ofs][si+ofs] = 1
    
    return s

ans = bfs(sx, sy, tx, ty)
ans += bfs(tx, ty, sx, sy)
ans += bfs(sx, sy, tx, ty)
ans += bfs(tx, ty, sx, sy)
print(ans)


### FIXED CODE ###

sx, sy, tx, ty = map(int, input().split())
dy = ty - sy
dx = tx - sx
ans = dy*'U' + dx*'R' + dy*'D' + dx*'L'
ans += 'L' + (dy+1)*'U' + (dx+1)*'R' + 'D'
ans += 'R' + (dy+1)*'D' + (dx+1)*'L' + 'U'
print(ans)
### BUGGY CODE ###

N = int(input())
a = [""]
for i in range(N):
    a.append(int(input()))

button = 1
i = 0

while True:
    i += 1
    button = a[button]

    if button <= 2:
        if button == 1:
            print(-1)
        if button == 2:
            print(i)
        break


### FIXED CODE ###

N = int(input())
a = [""]
for i in range(N):
    a.append(int(input()))

button = 1
i = 0

for i in range(N):
    if button == 2:
        print(i)
        exit()
    button = a[button]
else:
    print(-1)
### BUGGY CODE ###

X,K,D = list(map(int, input().split()))
co = 0
ans = abs(X)
while abs(ans) > D/2 and (K - co) > 0:
    ans = abs(ans) - D
    co += 1
if (K - co) % 2 == 0:
    print(abs(ans))
else:
    ans = abs(ans) - D
    print(abs(ans))

### FIXED CODE ###

X,K,D = list(map(int, input().split()))
co,ans = divmod(abs(X),D)
if (K - co) > 0:
    if (K - co) % 2 == 0:
        pass
    else:
        ans = abs(ans) - D
else:
    ans = abs(X) - K*D

print(abs(ans))
### BUGGY CODE ###

from itertools import product
h, w, k = map(int, input().split())
CHOCO = [list(map(int, input())) for _ in range(h)]
INF = 10**5

it = ["01"]*(h-1)
ans = INF
for x in product(*it):
    cnt = sum(map(int, x))
    agg = [[0]*(w) for _ in range(cnt+1)]
    *ls, = map(int, x+('1',))
    for i in range(w):
        prev = c = 0
        for j, split in enumerate(ls):
            if split:
                agg[c][i] = prev+CHOCO[j][i]
                prev = 0
                c += 1
            else:
                prev += CHOCO[j][i]

    tmp = [0]*(cnt+1)
    cannot_split = False

    for xyz in zip(*agg):
        cannot_split = False
        can_continue = True
        for i, x in enumerate(xyz):
            if x > k:
                cannot_split = True
                break
            if x+tmp[i] > k:
                can_continue = False
                break

        if cannot_split:
            break

        if can_continue:
            for i, x in enumerate(xyz):
                tmp[i] += x
                continue
        else:
            for i, x in enumerate(xyz):
                tmp[i] = x
            cnt += 1

    if cannot_split:
        continue

    ans = min(ans, cnt)
print(ans)


### FIXED CODE ###

from itertools import product
h, w, k = map(int, input().split())
CHOCO = [list(map(int, input())) for _ in range(h)]
INF = 10**5

it = ["01"]*(h-1)
ans = INF
for x in product(*it):
    cnt = sum(map(int, x))
    agg = [[0]*(w) for _ in range(cnt+1)]
    *ls, = map(int, x+('1',))
    for i in range(w):
        prev = c = 0
        for j, split in enumerate(ls):
            if split:
                agg[c][i] = prev+CHOCO[j][i]
                prev = 0
                c += 1
            else:
                prev += CHOCO[j][i]

    tmp = [0]*(cnt+1)
    cannot_split = False

    for xyz in zip(*agg):
        cannot_split = False
        can_continue = True
        for i, x in enumerate(xyz):
            if x > k:
                cannot_split = True
                break
            if x+tmp[i] > k:
                can_continue = False
                break

        if cannot_split:
            break

        if can_continue:
            for i, x in enumerate(xyz):
                tmp[i] += x
                continue
        else:
            for i, x in enumerate(xyz):
                tmp[i] = x
            cnt += 1

    if cannot_split:
        continue

    ans = min(ans, cnt)
print(ans)
### BUGGY CODE ###

import numpy as np
N, X, Y = map(int, input().split())
dist = [0] * (N + 1)
cnt = [0] * (N + 1)

INF = 10**10 + 9
d = [[INF] * (N + 1) for _ in range(N + 1)]
for i in range(1, N + 1):
    for j in range(i, N + 1):
        d[i][j] = j - i
        d[j][i] = j - i
d[X][Y] = 1

n = N + 1
# print('d', d)


def warshall_floyd(d):
    #d[i][j]: iからjへの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j], d[i][k] + d[k][j])
    return d


d = warshall_floyd(d)
# print('d', d)

cnt = [0] * (N + 1)
for i in range(1, N + 1):
    for j in range(i, N + 1):
        cnt[d[i][j]] += 1
# print(cnt)

for i in cnt[1:-1]:
    print(i)


### FIXED CODE ###

N, X, Y = map(int, input().split())


def f(i, j):
    v1 = j - i
    v2 = abs(X - i) + 1 + abs(j - Y)
    v3 = abs(Y - i) + 1 + abs(j - X)
    return min(v1, v2, v3)


D = [0] * N
for i in range(1, N):
    for j in range(i + 1, N + 1):
        d = f(i, j)
        D[d] += 1

for d in D[1:]:
    print(d)
### BUGGY CODE ###

f = lambda : map(int,input().split())
n, q = f()
s = input()
for _ in range(q):
  l, r = f()
  ans = 0
  for i in range(l-1,r-1):
    if s[i:i+2] == 'AC':
      ans += 1
  print(ans)

### FIXED CODE ###

f = lambda : map(int,input().split())
n, q = f()
s = input()

cnt = 0
ln = [0]*n
for i in range(1,n):
  if s[i-1:i+1] == 'AC':
    cnt += 1
  ln[i] = cnt
for _ in range(q):
  l, r = f()
  print(ln[r-1]-ln[l-1])
### BUGGY CODE ###

N,M=map(int,input().split())
# N,M=3,3
A = list(map(int,input().split()))
A.append(-1)
# A=[2,13,8]

# print(N,M,A)
Val = sorted(A,reverse=True)
# print("割引前",Val)

#Ｍ枚の商品券を持っているため
for i in range(M):
    Val[0]= Val[0]//2
    if Val[0] < Val[1]:
        Val = sorted(Val,reverse=True)

# print("計算後",Val)
print(sum(Val)+1)

### FIXED CODE ###

import numpy as np

N,M=map(int,input().split())
# N,M=4,4
A = list(map(int,input().split()))
#dymmy
A.append(-1)
# A=[1,9,3,5]
# print(np.argmax(A))

# print(N,M,A)
Val = sorted(A,reverse=True)
# print("割引前",Val)

#Ｍ枚の商品券を持っているため
hoge =Val[0]

if N==1:
    print(Val[0]//(2**M))
    exit(0)
if M==1:
    Val[0]//=2
    print(sum(Val)+1)
    exit(0)
# for i in range(M):
#     # A[np.argmax(A)]= A[np.argmax(A)]//2
#     Val[0]//=2
#     for i in range(1,M):
#         if Val[0]<Val[i]:
#             Val[0],Val[i] = Val[i],Val[0]
#             break
#         else:
#             pass
i=0
while i<M:
    # A[np.argmax(A)]= A[np.argmax(A)]//2
    i+=1
    Val[0]//=2
    if i>=M:
        break
    for j in range(1,M):
        if i<M and Val[0]<Val[j]:
            Val[j]//=2
            i+=1
        else:
            Val = sorted(Val,reverse=True)
            break
    

# print(Val)
print(sum(Val)+1)
### BUGGY CODE ###

import sys
input=lambda:sys.stdin.readline().rstrip()
r,c,k=map(int,input().split())
dp=[[(c+1)*[0]for _ in range(r+1)]for _ in range(4)]
p=[c*[0]for _ in range(r)]
for _ in range(k):
  rr,cc,u=map(int,input().split())
  rr-=1
  cc-=1
  p[rr][cc]=u
ans=0
for j in range(1,r+1):
  for k in range(1,c+1):
    dp[0][j][k]=max(dp[0][j-1][k],dp[0][j][k-1])
    for i in range(1,4):
      dp[i][j][k]=max(dp[i][j][k],dp[0][j-1][k],dp[1][j-1][k],dp[2][j-1][k],dp[3][j-1][k],dp[i][j][k-1])
      if p[j-1][k-1]:
        dp[i][j][k]=max(dp[i][j][k],dp[i-1][j][k-1]+p[j-1][k-1],max(dp[0][j-1][k],dp[1][j-1][k],dp[2][j-1][k],dp[3][j-1][k])+p[j-1][k-1])
      ans=max(ans,dp[i][j][k])
print(ans)

### FIXED CODE ###

import sys
input = lambda: sys.stdin.readline().rstrip()
r,c,k=map(int,input().split())
dp=[[(c+1)*[0]for _ in range(r+1)]for _ in range(4)]
p=[c*[0]for _ in range(r)]
for _ in range(k):
  rr,cc,u=map(int,input().split())
  rr-=1
  cc-=1
  p[rr][cc]=u
ans=0
#for i in p:print(i)
for j in range(1,r+1):
  for k in range(1,c+1):
    dp[0][j][k]=max(dp[0][j-1][k],dp[0][j][k-1])
    for i in range(1,4):
      dp[i][j][k]=max(dp[i][j][k],dp[i][j-1][k],dp[i][j][k-1])
      if p[j-1][k-1]:
        dp[i][j][k]=max(dp[i][j][k],dp[i-1][j][k-1]+p[j-1][k-1],dp[i][j-1][k]+p[j-1][k-1])
    for i in range(1,4):
      dp[i][j][k]=max(dp[i][j][k],dp[i-1][j][k])
      ans=max(ans,dp[i][j][k])
  for k in range(1,c+1):
    t=max(dp[0][j][k],dp[1][j][k],dp[2][j][k],dp[3][j][k])
    dp[0][j][k]=dp[1][j][k]=dp[2][j][k]=dp[3][j][k]=t
print(ans)
#for i in dp:
#  print("---")
#  for j in i:print(j)
### BUGGY CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))
score = 1
for i in range(k):
    score *= a[i]
top = 0
for i in range(k, n):
    pre_score = score
    score /= a[top]
    top += 1
    score *= a[i]
    if score > pre_score:
        print("Yes")
    else:
        print("No")


### FIXED CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))
score = sum(a[:k])
top = 0
for i in range(k, n):
    if a[i] > a[top]:
        print("Yes")
    else:
        print("No")
    top += 1
### BUGGY CODE ###

x,y = map(int,input().split())

if x == y:
	print('-1')
	exit()

i =2

while x*i % y == 0:
	i = i + 1	

print(x*i)



### FIXED CODE ###

x,y = map(int,input().split())

if x == y:
	print(-1)
	exit()

i =2

if x < y :
	while x*i % y == 0:
		i = i + 1	
	print(x*i)
	
else:
	if x%y==0:
		print(-1)
	else:
		while x*i % y == 0:
			i = i + 1	
		print(x*i)