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

# -*- coding: utf-8 -*-

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

max_num = 10**18 // X

for i in range(max_num + 1):
    if i == 0:
        continue
    else:
        if (i * X) % Y != 0:
            print(i * X)
            break
        else:
            if i == (max_num + 1):
                print(-1)
            else:
                continue


### FIXED CODE ###

# -*- coding: utf-8 -*-

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

max_num = 10**18 // X


if X % Y == 0:
    print(-1)
else:
    for i in range(max_num + 1):
        if i == 0:
            continue
        else:
            if (i * X) % Y != 0:
                print(i * X)
                break
            else:
                continue
### BUGGY CODE ###

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

B.sort()
C.sort()


def binary_search(lst, value):
    l = 0
    r = N - 1
    while l <= r:
        mid = (l + r) // 2
        if lst[mid] < value:
            l = mid + 1
        elif lst[mid] > value:
            r = mid - 1
        else:
            return mid, 1
    return l, 0


def main():
    ans = 0
    for upper in A:
        i, is_in_B = binary_search(B, upper)
        i += is_in_B
        for middle in B[i:]:
            j, is_in_C = binary_search(C, middle)
            ans += N - j - is_in_C
    
    print(ans)
    

if __name__ == "__main__":
    main()

### FIXED CODE ###

#import generator


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

"""
with open('generator.txt', 'r') as f:
    read = f.read().split('\n')
    N = int(read[0])
    A = list(map(int, read[1].split()))
    B = list(map(int, read[2].split()))
    C = list(map(int, read[3].split()))
"""
A.sort()
C.sort()


def binary_search(lst, value, high):
    l = 0
    r = N - 1
    while l <= r:
        mid = (l + r) // 2
        if lst[mid] < value:
            l = mid + 1
        elif lst[mid] > value:
            r = mid - 1
        else:
            # lstの中にある場合
            if high:
                # 真に大きい
                return binary_search(lst, value + 0.5, high)
            else:
                # 真に小さい
                return binary_search(lst, value - 0.5, high)
    if high:
        return l
    else:
        return r


def main():
    ans = 0
    # Bの値でループしてそれより小さいA、大きいCの個数を求めて掛け合わせる
    for middle in B:
        lower = binary_search(A, middle, False) + 1 # 0-indexedで返るので+1する
        higher = N - binary_search(C, middle, True)
        ans += lower * higher
    print(ans)

    
# 愚直解
def main2():
    ans = 0
    for a in A:
        for b in B:
            for c in C:
                if a < b < c:
                    ans += 1
    print(ans)
    

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

INF = float('inf')
from bisect import bisect
N = int(input())
A = list(map(int,input().split()))
S = [0]*N
for i in range(N):
    S[i] = S[i-1]+A[i]

ans = INF
for i in range(2,N-1):
    l = S[:i]
    r = S[i:]
    j = bisect(l,l[-1]/2)
    k = bisect(r,(r[-1]+l[-1])/2)
    for p in {j-1,min(j,len(l)-2)}:
        for q in {k-1,min(k,len(r)-2)}:
            a,b,c,d = l[p],l[-1]-l[p],r[q]-l[-1],r[-1]-r[q]
            m = min(a,b,c,d)
            M = max(a,b,c,d)
            ans = min(ans,M-m)

print(ans)

### FIXED CODE ###

INF = float('inf')
from bisect import bisect
N = int(input())
A = list(map(int,input().split()))
S = [0]*N
for i in range(N):
    S[i] = S[i-1]+A[i]

ans = INF
for i in range(2,N-1):
    j = bisect(S,S[i-1]/2)
    k = bisect(S,(S[-1]+S[i-1])/2)
    for p in {j-1,min(j,i-2)}:
        for q in {k-1,i,min(k,N-2)}:
            a,b,c,d = S[p],S[i-1]-S[p],S[q]-S[i-1],S[-1]-S[q]
            m = min(a,b,c,d)
            M = max(a,b,c,d)
            ans = min(ans,M-m)

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

from itertools import permutations

n, m, R = map(int, input().split())
r = list(map(int, input().split()))

INF = 10 ** 9

d = [[INF for _ in range(n)] for _ in range(n)]
p = [[] for _ in range(n)]

for i in range(n):
    d[i][i] = 0

for i in range(R):
    r[i] -= 1

for _ in range(m):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    d[a][b] = c
    d[b][a] = c
    p[a].append(b)
    p[b].append(a)

#for q in d: print(q)

for k in range(n):
    for i in range(n):
        for j in range(n):
            if d[i][j] > d[i][k] + d[k][j]:
                d[i][j] = d[i][k] + d[k][j]

ans = INF
for x in permutations(r):
    temp = 0
    for i in range(R-1):
        temp += d[x[i]][x[i+1]]
    ans = min(temp, ans)

print(ans)





### FIXED CODE ###

from itertools import permutations

n, m, R = map(int, input().split())
r = list(map(int, input().split()))

INF = 10 ** 9

d = [[INF for _ in range(n)] for _ in range(n)]
p = [[] for _ in range(n)]

for i in range(n):
    d[i][i] = 0

for i in range(R):
    r[i] -= 1

for _ in range(m):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    d[a][b] = c
    d[b][a] = c
    p[a].append(b)
    p[b].append(a)

#for q in d: print(q)

for k in range(n):
    for i in range(n-1):
        for j in range(i+1, n):
            if d[i][j] > d[i][k] + d[k][j]:
                d[i][j] = d[i][k] + d[k][j]
                d[j][i] = d[i][j]

ans = INF
for x in permutations(r):
    temp = 0
    for i in range(R-1):
        temp += d[x[i]][x[i+1]]
    ans = min(temp, ans)

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

#
# abc067 c
#
import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """6
1 2 3 4 5 6"""
        output = """1"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """2
10 -10"""
        output = """20"""
        self.assertIO(input, output)


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

    ans = float("inf")
    if N == 2:
        ans = abs(A[0]-A[1])
    else:
        for i in range(1, N-1):
            ans = min(ans, abs(sum(A[:i])-sum(A[i:])))
    print(ans)


if __name__ == "__main__":
    # unittest.main()
	resolve()

### FIXED CODE ###

#
# abc067 c
#
import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """6
1 2 3 4 5 6"""
        output = """1"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """2
10 -10"""
        output = """20"""
        self.assertIO(input, output)


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

    ans = float("inf")
    S = sum(A)
    T = []
    T.append(A[0])
    for i in range(1, N):
        T.append(T[i-1]+A[i])

    if N == 2:
        ans = abs(A[0]-A[1])
    else:
        for i in range(1, N-1):
            ans = min(ans, abs(S-2*T[i]))
    print(ans)


if __name__ == "__main__":
    # unittest.main()
    resolve()
### 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))

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

from bisect import bisect_right
from operator import itemgetter

N,M,Q = II()
x = []
for _ in range(M):
    L,R = II()
    x.append((L-1, R-1))
query = []
for _ in range(Q):
    p0,q0 = II()
    query.append((p0-1,q0-1))

x.sort(key=itemgetter(1))

y = [[float('inf')]*M for _ in range(N)]
c = [0]*N
for i in range(M):
    for j in range(x[i][0]+1):
        y[j][c[j]] = x[i][1]
        c[j] += 1

ans = 0
for q in query:
    print(bisect_right(y[q[0]], q[1]))

### 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,M,Q = II()
x = []
for i in range(M):
    L,R = II()
    x.append([L-1, R-1])

p = [0]*Q
q = [0]*Q
for i in range(Q):
    p0,q0 = II()
    p[i] = p0-1
    q[i] = q0-1

a = [[0]*N for _ in range(N)]
for i in range(M):
    a[x[i][0]][x[i][1]] += 1

c = [[0]*N for _ in range(N)]
for i in range(N):
    for j in range(N):
        if j==0:
            temp = 0
        else:
            temp = c[i][j-1]
        c[i][j] = temp + a[i][j]

for i in range(Q):
    ans = 0
    for j in range(p[i],q[i]+1):
        ans += c[j][q[i]]
    print(ans)
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
ans = 1
for i in a:
    ans *= i
if ans > 10**18:
    print(-1)
else:
    print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
ans = 1
if a.count(0)>0:
    print(0)
    exit()
for i in a:
    ans *= i
    if ans>10**18:
        print(-1)
        break
else:
    print(ans)
### BUGGY CODE ###

N,A,B = [int(x) for x in input().split()]
n = 0
blue = 0
if A == 0:
    print(0)
else:
    for i in range(10**100):
        n = n + A
        blue = blue + A
        if n >= N:
            blue = blue - (n-N)
            break
        else:
            n = n + B
            if n >= N:
                break
    print(blue)

### FIXED CODE ###

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

a = N//(A+B)*A

if N%(A+B) <= A:
    print(a + N%(A+B))
else:
    print(a + A)
### BUGGY CODE ###

from collections import Counter
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N = int(input())
A = list(map(int,input().split()))
S = Counter(A)
B = [[0,0,0]]*N
all_sum = 0
#print(S)
for i in S.keys():
    n = A.count(i)
    a = n*(n-1)//2
    if a >= 0 and (n-1)*(n-2)//2 >= 0:
        B[i-1]=(i-1,a,(n-1)*(n-2)//2)#キー、Nの組合せ、N-1の組合せ
    else:
        B[i-1]=(i,a,0)
    all_sum += a
    #print(all_sum,"all")
#print(B)
for j in range(N):
    print(all_sum-B[A[j]-1][1]+B[A[j]-1][2])

### FIXED CODE ###

from collections import Counter
N = int(input())
A = list(map(int,input().split()))
B = Counter(A)
C = {key:(B[key]*(B[key]-1)//2) for key in B}
ans = sum(C.values())
#print(C,ans)
#print(C[3])
for i in A:
    if C[i] < 1:
        print(ans)
    else:
        print(ans - C[i] + (B[i]-1)*(B[i]-2)//2)
### BUGGY CODE ###

import math
k = int(input())
count = 0
before = 0

while True:
    if k % 2 == 0:
        print(-1)
        break
    seven = 10**count*7 + before
    #print(seven)
    if seven%k == 0:
        print(count+1)
        break
    else:
        before = seven
        count +=1
        #print(count)


### FIXED CODE ###

k = int(input())
count = 0
before = 0
if k % 2 == 0 or k % 5 == 0:
    print(-1)
    exit()

ai = 0
i = 0
while True:
    ai = (ai*10+7) % k
    i += 1
    if ai == 0:
        print(i)
        break
### BUGGY CODE ###

# My Answer -> TLE
N = int(input())
A = list(map(int, input().split()))

from itertools import permutations

lis = [0]*N
for i in range(N):
    lis[i] = i

scores = []
for i, v in enumerate(permutations(lis, N)):
    score = 0
    for j in range(N): 
        score += abs(v.index(j)-j) * A[j]
    scores.append(score)

print(max(scores))

### FIXED CODE ###

def solve(N, A):
    a = [(i, ai) for i, ai in enumerate(A)]
    a.sort(key=lambda x: x[1], reverse=True)

    # import numpy as np
    # dp = np.zeros((N+1, N+1), np.int8)

    dp = [[0] * (N + 1) for _ in range(N + 1)]

    dp[0][0] = 0
    for i, ai in enumerate(a):
        for l in range(i+1):
            r = i - l
            dp[i+1][l] = max(dp[i+1][l], dp[i][l] + ai[1] * ((N-1-r) - ai[0]))
            dp[i+1][l+1] = max(dp[i+1][l+1], dp[i][l] + ai[1] * (ai[0] - l))

    print(max(dp[N]))

N = int(input())
A = list(map(int, input().split()))
solve(N,A)
### BUGGY CODE ###

x,y=map(int,input().split())
xg=set()
yg=set()
for i in range(1,x+1):
    if x%i==0:
        xg.add(i)
for j in range(1,y+1):
    if y%j==0:
        yg.add(j)
gcd=xg & yg
print(max(gcd))


### FIXED CODE ###

if __name__ == '__main__':
    s = input().split()
    if s[0] < s[1]:
        tmp = s[0]
        s[0] = s[1]
        s[1] = tmp
    while True:
        x = int(s[0]) % int(s[1])
        if x==0:
            break
        s[0] = s[1]
        s[1] = x
 
    print (s[1])
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
L = len(format(max(a), 'b'))
x = [[0 for j in range(2)] for i in range(L)]
ans = 0
MOD = 10 ** 9 + 7
for i in a:
    i_str = list(format(i, '0' + str(L) + 'b'))[::-1]
    for j, s in enumerate(i_str):
        x[j][int(s)] += 1
for i, (x0, x1) in enumerate(x):
    ans += x0 * x1 * 2 ** i % MOD
    ans %= MOD
print(ans)


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
L = len(format(max(a), 'b'))
x = [0 for i in range(L)]
ans = 0
MOD = 10 ** 9 + 7
for i in a:
    i_str = list(format(i, '0' + str(L) + 'b'))[::-1]
    for j, s in enumerate(i_str):
        if s == '1':
            x[j] += 1
b = 1
for i, xi in enumerate(x):
    ans += xi * (n - xi) * b % MOD
    ans %= MOD
    b *= 2
    b %= MOD
print(ans)
### BUGGY CODE ###

import sys
N, M = (int(i) for i in input().split())
X = [int(i) for i in input().split()]
X.sort()

pos = [[0] * 2 for i in range(N)]
total = 0

if M <= N:
    print(0)
    sys.exit()

for i in range(N):
    pos[i][0] = i
    pos[i][1] = abs(X[i+1] - X[i])
    total = total + pos[i][1]

pos = sorted(pos, key=lambda x:(x[1]))

for j in range(N, M-1):
    dim = abs(X[j+1]-X[j])
    total = total + dim
    if pos[0][1] < dim:
        pos[0][0] = j
        pos[0][1] = dim
        pos = sorted(pos, key=lambda x:(x[1]))


for i in range(1, N):
    total = total - pos[i][1]

print(total)


### FIXED CODE ###

import sys
N, M = (int(i) for i in input().split())
X = [int(i) for i in input().split()]
X.sort()

L = []

for i in range(1, M):
    L.append(X[i]-X[i-1])

L = sorted(L, reverse=True)

print(X[M-1]-X[0]-sum(L[:N-1]))
### BUGGY CODE ###

from collections import deque

h,w = map(int, input().split())
A = [['*']*(w+2)] + [['*']+[s for s in input()]+['*'] for _ in range(h)] + [['*']*(w+2)]

dist_to_black = [[0]*w for _ in range(h)]

# # debug
# for a in A:
#     print(a)
# for a in dist_to_black:
#     print(a)

def bfs(sy,sx):
    dq = deque([(sy,sx,0)])
    while dq:
        y,x,n = dq.popleft()
        if A[y][x]=='#':
            return n
        elif A[y][x]=='.':
            dq.append([y+1,x,n+1])
            dq.append([y-1,x,n+1])
            dq.append([y,x+1,n+1])
            dq.append([y,x-1,n+1])

ans = -1
for i in range(h):
    for j in range(w):
        # dist_to_black[i][j] = bfs(i+1,j+1)
        ans = max(ans, bfs(i+1, j+1))

print(ans)


### FIXED CODE ###

from collections import deque

h,w = map(int, input().split())
A = [[s for s in input()] for _ in range(h)]

visited = [[-1]*(w) for _ in range(h)]
dq = deque()
directions = [[0,1],[1,0],[0,-1],[-1,0]]

# 初期配置の黒をキューに追加
for hi in range(h):
    for wi in range(w):
        if A[hi][wi] == '#':
            dq.append([hi,wi])
            visited[hi][wi] = 0

# キューが空になるまで
while dq:
    hi,wi = dq.popleft()
    for d in directions:
        nhi, nwi = hi+d[0],wi + d[1]
        # 場外ならスキップ
        if nhi<0 or nhi>=h or nwi<0 or nwi>=w: continue 
        # 「黒くしてない白マス」をキューに追加
        if visited[nhi][nwi] == -1 and A[nhi][nwi] == '.':
            dq.append([nhi,nwi])
            visited[nhi][nwi] = visited[hi][wi] + 1

ans = -1
for x in visited:
    ans = max(ans,max(x))
print(ans)
### BUGGY CODE ###

from collections import deque
import numpy as np
n,k = map(int,input().split())
a = list(map(int,input().split()))
roop_find = deque([0])
i = 0
count = 0
for _ in range(n):
    if a[i]-1 in roop_find:
        break
    else:
        roop_find.append(a[i]-1)
        i = a[i] - 1
        count += 1
b = roop_find.index(a[i]-1)

if k < b:
    print(list(roop_find)[k]+1)
else:
    k-=b
    e = k % (count+1-b)
    print(list(roop_find)[b+e]+1)


### FIXED CODE ###

n,k = map(int,input().split())
a = list(map(int,input().split()))
pos = 0
visit = [0] * n
move = []
loop = []
while visit[pos] != 2:
    if visit[pos] == 0:
        move.append(pos)
    else:
        loop.append(pos)
    visit[pos] += 1
    pos = a[pos] - 1
if len(move) > k:
    print(move[k]+1)
else:
    print(loop[(k-(len(move)-len(loop)))%len(loop)]+1)
### BUGGY CODE ###

def main():
    s = input()
    ans = 0
    for i in range(4, len(s) + 1, 1):
        for j in range(0, i - 3, 1):
            if j == 0:
                x = int(s[-i:]) % 2019
            else:
                x = int(s[-i:]) - int(s[-j:])
            if x % 2019 == 0:
                ans += 1

    print(ans)

if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    from collections import Counter
    s = input()

    n = 2019
    l = [0]
    t = 1
    for i, x in enumerate(s[::-1]):
        t = t * 10 % n
        y = (l[-1] + int(x) * t) % n
        l.append(y)

    c = Counter(l)
    ans = sum([v * (v - 1) // 2 for v in c.values()])
    print(ans)


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

S = input()
C = ["dream", "dreamer", "erase", "eraser"]
c = 0
flag = False
while len(S) > c:
    T = ([S.split(i) for i in C])
    for i in range(len(T)):
        if T[i][0] in C:
            S = S[len(T[i][0]):len(S)]
            flag = True
            break
        else:
            flag = False
    c+=1
if flag:
    print("YES")
else:
    print("NO")


### FIXED CODE ###

S = input()
S = S[::-1]
C = ['maerd', 'remaerd', 'esare', 'resare']
ans = False
s = 0
for i in range(len(S)+1):
    if S[s:i] in C:
        s = i
        ans = True
    else:
        ans = False
if ans:
    print("YES")
else:
    print("NO")
### BUGGY CODE ###

import itertools
n, m, r = map(int, input().split())
t = list(map(int, input().split()))
t.sort()
d = [[10 * 18]*n for j in range(n)]
for i in range(n):
    d[i][i] = 0

for i in range(m):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    d[a][b] = c
    d[b][a] = c

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])


ans = 10**18
for p in itertools.permutations(t):
    now = 0
    for i in range(r-1):
        now += d[p[i]-1][p[i + 1]-1]
    ans = min(ans, now)
print(ans)


### FIXED CODE ###

import itertools
n, m, r = map(int, input().split())
t = list(map(int, input().split()))
t.sort()
d = [[10 ** 18]*n for j in range(n)]
for i in range(n):
    d[i][i] = 0

for i in range(m):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    d[a][b] = c
    d[b][a] = c

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])


ans = 10**18
for p in itertools.permutations(t):
    now = 0
    for i in range(r-1):
        now += d[p[i]-1][p[i + 1]-1]
    ans = min(ans, now)
print(ans)
### BUGGY CODE ###

import heapq,sys
input = sys.stdin.readline
N,M,L = map(int,input().split())
ABC = [tuple(map(int,input().split())) for i in range(M)]
Q = int(input())
ST = [tuple(map(int,input().split())) for i in range(Q)]

es = [[] for i in range(N)]
for a,b,c in ABC:
    if c > L: continue
    a,b = a-1,b-1
    es[a].append((b,c))
    es[b].append((a,c))

INF = float('inf')
dist = [[INF]*N for i in range(N)]
for i in range(N):
    dist[i][i] = 0

for i in range(N):
    hq = [i]
    heapq.heapify(hq)
    while hq:
        v = heapq.heappop(hq)
        k,j = divmod(v,N)
        k,l = divmod(k,L)
        for to,c in es[j]:
            if l+c > L:
                newcost = (k+1)*L + c
            else:
                newcost = k*L + l + c
            if newcost < dist[i][to]:
                dist[i][to] = newcost
                heapq.heappush(hq, newcost*N + to)

ans = []
for s,t in ST:
    s,t = s-1,t-1
    if dist[s][t] == INF:
        ans.append(-1)
    else:
        ans.append((dist[s][t]-1)//L)
print(*ans, sep='\n')

### FIXED CODE ###

import sys
input = sys.stdin.readline
N,M,L = map(int,input().split())
ABC = [tuple(map(int,input().split())) for i in range(M)]
Q = int(input())
ST = [tuple(map(int,input().split())) for i in range(Q)]

INF = float('inf')
dist1 = [[INF]*N for i in range(N)]
dist2 = [[INF]*N for i in range(N)]
for a,b,c in ABC:
    if c > L: continue
    a,b = a-1,b-1
    dist1[a][b] = dist1[b][a] = c
for i in range(N):
    dist1[i][i] = 0
    dist2[i][i] = 0

for k in range(N):
    for i in range(N):
        for j in range(N):
            d = dist1[i][k] + dist1[k][j]
            if dist1[i][j] <= d: continue
            dist1[i][j] = d
for i in range(N):
    for j in range(N):
        if i==j: continue
        if dist1[i][j] <= L:
            dist2[i][j] = 1
for k in range(N):
    for i in range(N):
        for j in range(N):
            d = dist2[i][k] + dist2[k][j]
            if dist2[i][j] <= d: continue
            dist2[i][j] = d
ans = []
for s,t in ST:
    d = dist2[s-1][t-1]
    if d == INF:
        ans.append(-1)
    else:
        ans.append(d-1)
print(*ans, sep='\n')
### BUGGY CODE ###

S = input()[::-1]
import sys
sys.setrecursionlimit(1000)
c = ['maerd', 'remaerd', 'esare', 'resare']

def dfs(s):
    while 1:
        l = len(s)
        if l==0:
            return True
        if l<5:
            return False
        if s[:5] in c:
            s = s[5:]
        elif l>=6 and s[:6]=='resare':
            s = s[6:]
        elif l>=7 and s[:7]=='remaerd':
            s = s[7:]

if dfs(S):
    print('YES')
else:
    print('NO')
        

### FIXED CODE ###

S = input()[::-1]
import sys
sys.setrecursionlimit(1000)
c = ['maerd', 'remaerd', 'esare', 'resare']

def dfs(s):
    L = len(s)
    while 1:
        if L==0:
            return True
        if L<5:
            return False
        if s[:5] in c:
            s = s[5:]
            L -= 5
        elif L>=6 and s[:6]=='resare':
            s = s[6:]
            L -= 6
        elif L>=7 and s[:7]=='remaerd':
            s = s[7:]
            L -= 7
        else:
            return False

if dfs(S):
    print('YES')
else:
    print('NO')
### BUGGY CODE ###

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

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

print(count)

### FIXED CODE ###

a, b, x = map(int, input().split())
print(b // x - (a - 1) // x)
### BUGGY CODE ###

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


ACs=[]
WAs={}

AC=0
pena=0
for i in range(M):
  num, jud=input().split()
  if num in ACs:
    continue
  elif jud=="WA":
    if num not in WAs.keys():
      WAs[num]=1
    else:
      WAs[num]+=1
  else:
    ACs.append(num)
    AC+=1
    if num in WAs.keys():
      pena+=WAs[num]

print(AC, pena)

### FIXED CODE ###

N, M=map(int, input().split())
import numpy as np

pena=np.array([0]*N)
status=np.array([0]*N)


for i in range(M):
  p,s=tuple(input().split())
  p=int(p)
  if s=="WA":
    if status[p-1]!=1:
      pena[p-1]+=1
  if s=="AC":
    if status[p-1]!=1:
      status[p-1]=1
nac=sum(status)
npena=sum(pena*status)
print(nac, npena)
### BUGGY CODE ###

n = int(input())
abc = list(map(int, input().split()))
ans = 'YES'
for i in range(n):
  for j in range(i+1,n):
    if abc[i] == abc[j]:
      ans = 'NO'
      break
  if ans == 'NO':
    break

print(ans)

### FIXED CODE ###

n = int(input())
abc = list(map(int, input().split()))
ans = 'YES'
abc = sorted(abc)
for i in range(n-1):
  if abc[i] == abc[i+1]:
  	ans ='NO'

print(ans)