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

#coding=UTF-8

N=int(input())
a=[]

for idx in range(0,N,1):
    a.append(int(input())-1)

visited=[]
lit=0
length=0
ans=None
while ans==None:
    lit=a[lit] #press
    length+=1
    if lit == 2-1:
        ans=True
    elif lit in visited:
        #ethernal loop
        ans=False
        

    visited.append(lit)

if ans:
    print(length)
else:
    print(-1)


### FIXED CODE ###

#coding=UTF-8

N=int(input())
a=[]

for idx in range(0,N,1):
    a.append(int(input())-1)


lit=0
length=0
ans=None
for idx in range(0,N,1):
    lit=a[lit] #press
    length+=1
    if lit == 2-1:
        ans=True
        break
        



if ans:
    print(length)
else:
    print(-1)
### BUGGY CODE ###

h,w,m = map(int,input().split())
l = [list(map(int,input().split())) for _ in range(m)]
count_h = [0 for i in range(h)]
count_w = [0 for i in range(w)]
bit = list([0 for i in range(w)] for _ in range(h))
for j,k in l:
    count_h[j-1] += 1
    count_w[k-1] += 1
    bit[j-1][k-1] = 1
h_max = max(count_h)
w_max = max(count_w)
h_kouho = []
w_kouho = []
ans = h_max + w_max - 1
for i in range(h):
    if count_h[i]==h_max:
        h_kouho.append(i)
for j in range(w):
    if count_w[j]==w_max:
        w_kouho.append(j)

for i in w_kouho:
    for j in h_kouho:
        if bit[j][i] == 0:
            ans += 1
            print(ans)
            exit()
print(ans)

### FIXED CODE ###

h,w,m = map(int,input().split())
l = [list(map(int,input().split())) for _ in range(m)]
count_h = [0 for i in range(h)]
count_w = [0 for i in range(w)]

for j,k in l:
    count_h[j-1] += 1
    count_w[k-1] += 1

h_max = max(count_h)
w_max = max(count_w)
h_kouho = []
ko_hh = [0 for _ in range(h)]
ko_ww = [0 for _ in range(w)]
w_kouho = []
ans = h_max + w_max -1
for i in range(h):
    if count_h[i]==h_max:
        h_kouho.append(i)
        ko_hh[i] = 1
for j in range(w):
    if count_w[j]==w_max:
        w_kouho.append(j)
        ko_ww[j] = 1


ans_kouho = len(h_kouho) * len(w_kouho)
su = 0
for j,k in l:
    if ko_hh[j-1]==1 and ko_ww[k-1]==1:
        su += 1
if su==ans_kouho:
    print(ans)
else:
    print(ans+1)
### BUGGY CODE ###

s=input()
s=s[::-1] #並び替え
#print(s) 
n=len(s)
 
count=[0]*2019 
count[0]=1
num,d=0,1
 
for i in s:
  num+=int(i)*d #累積を求める
  a=num
  a=num%2019 #余りを求める
  d*=10
  count[a]+=1 #indexがmodの値
  
ans=0
for i in count: #何通りか
  ans+=i*(i-1)//2 # ex)3つあったら3通り、4つあったら6通り
  
print(ans)

### FIXED CODE ###

s=input()
s=s[::-1]
n=len(s)
 
count=[0]*2019
count[0]=1
num,d=0,1
 
for i in s:
  num+=int(i)*d
  num%=2019
  d*=10
  d%=2019
  count[num]+=1
 
ans=0
for i in count:
  ans+=i*(i-1)//2
  
print(ans)
### BUGGY CODE ###

import heapq
class pqheap:
    def __init__(self):
        self.p = list()
        self.q = list()
    def insert(self,x):
        heapq.heappush(self.p, x)
        return
    def erase(self,x):
        heapq.heappush(self.q, x)
        return
    def minimum(self):
        while self.q and self.p[0] == self.q[0]:
            heapq.heappop(self.p)
            heapq.heappop(self.q)
        return self.p[0]
n=int(input())
b=list(map(int,input().split()))
a=list(map(int,input().split()))
#print(a)
for i in range(n):
    if b[i]<=a[i]:
        pass
    else:
        print(-1)
        exit()
pq=pqheap()
[pq.insert([-x,i]) for i,x in enumerate(a)]
ans=0
while len(pq.p)>len(pq.q):
    m=pq.minimum()
    pq.erase(m)
    v,i=m
    v=-v
    vv=v
    v-=b[i]
    tmp=a[(i-1)%n]+a[(i+1)%n]
    ans+=v//tmp
    v%=tmp
    v+=b[i]
    a[i]=v
    if v==b[i]:continue
    elif vv<=v or v<b[i]:
        print(-1)
        exit()
    pq.insert([-v,i])
print(ans)

"""
3
1 1 1
1000 10000 100000
"""

### FIXED CODE ###

def main(n,a,b):
    ans=0
    while True:
        cnt=0
        for i in range(n):
            m=a[(i-1)%n]+a[(i+1)%n]
            if m<a[i] and b[i]<a[i]:
                a[i]-=b[i]
                cnt+=a[i]//m
                a[i]%=m
                a[i]+=b[i]
        if cnt==0:break
        ans+=cnt
    if a==b:
        print(ans)
    else:
        print(-1)
if __name__=='__main__':
    n=int(input())
    b=list(map(int,input().split()))
    a=list(map(int,input().split()))
    main(n,a,b)
### BUGGY CODE ###

N = int(input())
R = [tuple(map(int, input().split())) for _ in range(N)]
B = [tuple(map(int, input().split())) for _ in range(N)]


def solve(i, p):
    if i == N:
        return len(p)

    a, b = R[i]
    # ペアにならなかった
    s = [solve(i+1, p)]
    for c, d in B:
        # すでにペアを持つ要素は無視
        if (c, d) in p:
            continue
        # ペアになった
        if a < c and b < d:
            s.append(solve(i+1, p + [(c, d)]))
    return max(s)


print(solve(0, []))


### FIXED CODE ###

N = int(input())
R = [tuple(map(int, input().split())) for _ in range(N)]
B = [tuple(map(int, input().split())) for _ in range(N)]


R.sort(reverse=True, key=lambda k: k[1])
B.sort()

p = []
q = []
for c, d in B:
    for a, b in R:
        if (a, b) in p:
            continue
        if a < c and b < d:
            p.append((a, b))
            q.append((c, d))
            break

print(len(p))
### BUGGY CODE ###

import sys

I = list(map(int, input().split()))
P = list(map(int, input().split()))
P = [i for i in P if 1 <= i and i <= 10**3]
N = I[0] # サイコロ数
K = I[1]
if not 1 <= K <= N <= 2*10**5:
    sys.exit()

Q = []
for i in range(N):
    q = sum(range(1, P[i]+1)) / P[i]
    Q.append(q)
# print(Q)

r = 0
R = []
for i in range(N-K+1):
    r = sum(Q[i:i+K])
    R.append(r)
# print(R)
print(max(R))
# rangeの終端は+1

### FIXED CODE ###

import sys

N, K = list(map(int, input().split()))
P = list(map(int, input().split()))
P = [i for i in P if 1 <= i and i <= 10**3]
Q = [] # 期待値リスト
S = [] # 累積和
T = [] # 隣接するK個の期待値
s=0

if not 1 <= K <= N <= 2*10**5:
    sys.exit()

for i in range(N):
    # q = sum(range(1, P[i]+1)) / P[i]
    q = (1 + P[i]) / 2
    Q.append(q)
    s += q
    S.append(s)
    if i == K-1:
        T.append(S[i])
    if i > K-1:
        T.append(S[i]-S[i-K])
print(max(T))
### BUGGY CODE ###

class unionfind:
	def __init__(self, n):
		self.parent = list(range(n))
	def find(self, i):
		if self.parent[i] != i: self.parent[i] = self.find(self.parent[i])
		return self.parent[i]
	def unite(self, i, j):
		i = self.find(i)
		j = self.find(j)
		if i != j: self.parent[i] = j
	def issame(self, i, j):
		return self.find(i) == self.find(j)
	def groups(self):
		r = range(len(self.parent))
		return [[j for j in r if self.issame(j, i)] for i in r if i == self.parent[i]]
	@staticmethod
	def isconnected(l, u = None):
		nw, nh = len(l), len(l[0])
		rw, rh = range(nw), range(nh)
		if not u: u = unionfind(nw * nh)
		f = -1
		for i in rw:
			for j in rh:
				if not l[i][j]: continue
				if f < 0: f = i + j * nw
				if j > 0 and l[i][j] == l[i][j - 1]: u.unite(i + j * nw, i + j * nw - nw)
				if i > 0 and l[i][j] == l[i - 1][j]: u.unite(i + j * nw, i + j * nw - 1)
		return f >= 0 and all([u.issame(f, i + j * nw) for i in rw for j in rh if l[i][j]])
	@staticmethod
	def isconnectedlist(nw, nh, lst):
		l = [[False] * nw for j in range(nh)]
		for i, j in lst: l[i][j] = True
		return unionfind.isconnected(l)
 
def culc(x):
    return int(x * (x-1) //2)
 
N , M = map(int, input().split())
ans_lst = []
lst = []
for i in range(M):
    A , B = map( int , input().split())
    lst.append([A-1 , B-1] )
cu = unionfind(N)
maxroute = culc(N)
temp = maxroute
for ls  in  reversed(lst):
    if temp == 0 :
        ans_lst.append(temp)
        continue
    temp = maxroute
    for subg in cu.groups():
        if len(subg) > 1:
            temp -= culc(len(subg))
    ans_lst.append(temp)
    cu.unite(ls[0] , ls[1])

for y in reversed(ans_lst):
    print(y)

### FIXED CODE ###

#学習用
def root(x):
    # xが根であれば
    if x == p[x]:
        # xを返す
        return x
    # xが根でなければp[x]の根をp[x]に設定する
    p[x] = y = root(p[x])
    # p[x]の根を返却する
    return y
def unite(x, y):
    # xとyの根を取得する
    px = root(x); py = root(y)
    # xとyの根が同じならば
    if px == py:
        # 根が同じならば、0を返す
        return 0
    # yの根がxの根より大きければ、
    if px < py:
        # yの根の位置のp[]を、xの根にする
        p[py] = px
        # xの根の位置のサイズszを、yの根の位置のサイズだけ加算する
        sz[px] += sz[py]
    else:
    # yの根がxの根より小さければ
        # xの根の位置のp[]を、yの根を指すようにする
        p[px] = py
        sz[py] += sz[px]
    # 根が異なっていた＝結合した場合は、1を返却する
    return 1

N , M = map(int, input().split())
*p , = range(N)
sz = [1] * N
E = []
for i in range(M):
    a , b = map(int, input().split())
    E.append((a-1, b-1))

ans = [None] * M
E.reverse()
res = 0
ans[-1] = "%d\n" % (N*(N-1)//2)

for i , (a,b) in enumerate(E[:-1]):
    sa = sz[root(a)]; sb = sz[root(b)]
    if unite(a , b):
        sc = sz[root(a)]
        res += sc*(sc-1)//2 - sa*(sa-1)//2 - sb*(sb-1)//2
    ans[-2-i] = "%d\n" % (N*(N-1)//2 -res)
open(1, 'w').writelines(ans)
### BUGGY CODE ###

def solve(maze,H, W, S, G):
    next_set = set()
    next_set.add(S)
    seen = [[False]*W for _ in range(H)]
    n = 0
    while True:
        curr_ = list(next_set)
        next_set = set()
        for h, w in curr_:
            if (h, w) == G:
                return n
            if seen[h][w]:
                continue

            seen[h][w] == True
            for x in maze[h][w]:
                next_set.add(x)
        n += 1
    
    return print('error')

# 入力
H, W = list(map(int, input().split()))
maze = [[[] for _ in range(W)] for _ in range(H)]
for h in range(H):
    row = input()
    for w in range(W):
        if row[w] == '#':
            maze[h][w] = False


# mazeに移動可能移動可能なマスを記録
for h in range(H):
    for w in range(W):
        if maze[h][w] == False:
            continue
        for nh, nw in [(h+1, w), (h, w+1), (h-1, w), (h, w-1)]:
            if 0 <= nh < H and 0<= nw < W:
                if maze[nh][nw] != False:
                    maze[h][w].append((nh, nw))
        # print(maze)
# print(maze)
ans = 0
for i in range(H*W-1):
    for j in range(i+1, H*W):
        S = (i//W, i%W)
        G = (j//W, j%W)
        if maze[S[0]][S[1]] and maze[G[0]][G[1]]:
            ans = max(ans, solve(maze, H, W, S, G))

print(ans)

### FIXED CODE ###

def solve(maze,H, W, S):
    next_set = set()
    next_set.add(S)
    seen = [[False]*W for _ in range(H)]
    n = 0
    while next_set:
        n += 1
        curr_ = list(next_set)
        next_set = set()
        for h, w in curr_:
            if seen[h][w]:
                continue
            seen[h][w] = True
            for nh, nw in maze[h][w]:
                if seen[nh][nw] == False:
                    next_set.add((nh, nw))
    return n-1

# 入力
H, W = list(map(int, input().split()))
maze = [[[] for _ in range(W)] for _ in range(H)]
for h in range(H):
    row = input()
    for w in range(W):
        if row[w] == '#':
            maze[h][w] = False


# mazeに移動可能移動可能なマスを記録
for h in range(H):
    for w in range(W):
        if maze[h][w] == False:
            continue
        for nh, nw in [(h+1, w), (h, w+1), (h-1, w), (h, w-1)]:
            if 0 <= nh < H and 0<= nw < W:
                if maze[nh][nw] != False:
                    maze[h][w].append((nh, nw))
        # print(maze)
# print(maze)
ans = 0
for i in range(H*W-1):
        h = i//W
        w = i%W
        if maze[h][w]:
            ans = max(ans, solve(maze, H, W, (h, w)))

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

import math
n = int(input())

def main():
    for N in range(1,n+1):
        result = 0
        for x in range(1,int(math.sqrt(N))+1):
            tempx = x**2
            for y in range(1, int(math.sqrt(N-x**2))+1):
                tempy = y**2
                tempxy = x*y
                if N-tempx-tempy-tempxy < 0:
                    break
                else:
                    for z in range(1, int(math.sqrt(N-tempx-tempy-tempxy))+1):
                        if tempx + tempy + z**2 + tempxy + y*z + z*x == N:
                            result += 1
                        elif tempx + tempy + z**2 + tempxy + y*z + z*x > N:
                            break
        print(result)
main()

### FIXED CODE ###

import math
n = int(input())
mylist = [int(math.sqrt(i)) for i in range(1,n+1)]
mylist = [0]+mylist

def main():
    for N in range(1,n+1):
        result = 0
        for x in range(1,mylist[N//3]+1):
            tempx = x**2
            for y in range(x, mylist[(N-x**2)//2]+1):
                tempy = y**2
                tempxy = x*y
                tempxandy = (x+y)/2
                tempnum = N-tempx-tempy-tempxy+tempxandy**2
                if tempnum <= 0:
                    break
                else:
                    if math.sqrt(tempnum)*2 == int(math.sqrt(tempnum)*2):
                        z = math.sqrt(tempnum)-tempxandy
                        #print(x,y,z,N)
                        if z < y:
                            break
                        elif x != y and y != z:
                            result += 6
                        elif x == y and y == z:
                            result += 1
                        else:
                            result += 3
        print(result)
main()
### BUGGY CODE ###

# N, Sをinput
# Sの'R', 'G', 'B'のインデックスを、リストr, g, bに格納
# r, g, bをそれぞれループさせる
# r, g, bの各要素の差を比較し、r-g!=g-bの場合、countに加算

N = int(input())
S = input()

r = []
g = []
b = []
count = 0

for i in range(N):
  if S[i] == 'R':
    r.append(i)
  elif S[i] == 'G':
    g.append(i)
  elif S[i] == 'B':
    b.append(i)

for x in r:
  for y in g:
    for z in b:
      if x-y != y-z and x>y and y>z:
        count += 1
      if x-z != z-y and x>z and z>y:
        count += 1
      if y-x != x-z and y>x and x>z:
        count += 1
      if y-z != z-x and y>z and z>x:
        count += 1
      if z-x != x-y and z>x and x>y:
        count += 1
      if z-y != y-x and z>y and y>x:
        count += 1
        
print(count)

### FIXED CODE ###

def func1(x, y, z, a):
  if x == y:
    z.append(a)
    return 1 
  return 0

def func2(x, y):
  if x==y:
    return 1
  return 0

def func3(x, y, z, a):
  l = 0
  for i in x:
    for j in y:
      k = 2 * j - i
      if k <= N-1 and i < j:
        l += func2(z[k], a)
  return l

  
N = int(input())
S = input()
r, g, b, rgb, equal = 0, 0, 0, 0, 0
r0, g0, b0 = [], [], []

for i in range(N):
  r += func1(S[i], 'R', r0, i)
  g += func1(S[i], 'G', g0, i)
  b += func1(S[i], 'B', b0, i)

rgb = r * g * b

# R<G<B
equal += func3(r0, g0, S, 'B')
# R<B<G
equal += func3(r0, b0, S, 'G')
# G<R<B
equal += func3(g0, r0, S, 'B')
# G<B<R
equal += func3(g0, b0, S, 'R')
# B<R<G
equal += func3(b0, r0, S, 'G')
# B<G<R
equal += func3(b0, g0, S, 'R')

print(rgb - equal)
### BUGGY CODE ###

from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

N = I()
S = S()

def check(i, j, k):
    return j-i != k-j

chars = list(S)

cnt = 0

for i in range(N):
    for j in range(i+1, N):
        for k in range(j+1, N):
            if not check(i, j, k):
                continue
            if chars[i] != chars[j] and chars[i] != chars[k] and chars[j] != chars[k]:
                cnt += 1

print(cnt)

### FIXED CODE ###

from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

N = I()
S = S()


def check(i, j, k):
    return j-i != k-j

chars = list(S)
cnts = Counter(chars)

cnt = 0

for i in range(N):
    for j in range(i+1, N):
        k = j + j - i
        if k > N-1:
            continue
        if chars[i] != chars[j] and chars[i] != chars[k] and chars[j] != chars[k]:
                cnt += 1

print(cnts["R"] * cnts["G"] * cnts["B"] - cnt)
### BUGGY CODE ###

import sys
from collections import deque
input = sys.stdin.readline

n = int(input())
a = [deque([x for x in list(map(int, input().split()))]) for _ in range(n)]
nokori_games = n * (n - 1) / 2 
day = 1
r5000 = range(5000)
player_in_this_game = set()
rn = range(n)
for _ in r5000:
  for m in rn: #選手ごとに判定
    #整合性のある対戦組み合わせがあれば配列から消す
    #全員の判定が終わって試合が残っていたら1日増やす
    la = len(a[m])      
    if la: #選手に試合予定が残っている
      teki = a[m][0] #対戦相手
      jibun = m + 1 #自分
      teki_idx = teki - 1
      if m in player_in_this_game or teki_idx in player_in_this_game:
        #自分または相手に既に試合が組まれている
        pass
      elif a[teki_idx][0] == jibun: #対戦相手の予定も自分でかつ相手がこのターンで試合中ではない
        a[m].popleft() #自分の予定を消す
        a[teki_idx].popleft() #相手の予定を消す
        player_in_this_game.add(m) #自分を試合中にする
        player_in_this_game.add(teki_idx) #相手を試合中にする
        nokori_games -= 1 #残り試合予定を1つ減らす

  if nokori_games: #残り試合があるのに
    if not len(player_in_this_game): #今回対戦が組まれなければ残りの予定が不整合なのでエラー
      print(-1)
      sys.exit()
  else: #誰も残り試合予定がなければ終了
    print(day)
    sys.exit()
  day += 1
  player_in_this_game.clear()


### FIXED CODE ###

import sys
import time
from collections import deque

start = time.time()

input = sys.stdin.readline

n = int(input())
a = [deque([x for x in list(map(int, input().split()))]) for _ in range(n)]
nokori_games = n * (n - 1) / 2 
day = 1
r5000 = range(5000)
player_in_this_game = set()
rn = range(n)
for _ in r5000:
  for m in rn: #選手ごとに判定
    #整合性のある対戦組み合わせがあれば配列から消す
    #全員の判定が終わって試合が残っていたら1日増やす
    if m in player_in_this_game:
      #自分が既に試合が組まれている
      continue

    la = len(a[m])      
    if la: #選手に試合予定が残っている
      teki = a[m][0] #対戦相手
      jibun = m + 1 #自分
      teki_idx = teki - 1
      if teki_idx in player_in_this_game:
        #相手が既に試合に組まれている
        continue

      if a[teki_idx][0] == jibun: #対戦相手の予定も自分でかつ相手がこのターンで試合中ではない
        a[m].popleft() #自分の予定を消す
        a[teki_idx].popleft() #相手の予定を消す
        player_in_this_game.add(m) #自分を試合中にする
        player_in_this_game.add(teki_idx) #相手を試合中にする
        nokori_games -= 1 #残り試合予定を1つ減らす

  if nokori_games: #残り試合があるのに
    if not len(player_in_this_game): #今回対戦が組まれなければ残りの予定が不整合なのでエラー
      print(-1)
      sys.exit()
  else: #誰も残り試合予定がなければ終了
    print(day)
    sys.exit()
  day += 1
  player_in_this_game.clear()
  elapsed_time = time.time() - start
  if elapsed_time > 1:
    print(n*(n-1)//2)
    exit()
### BUGGY CODE ###

import queue
import numpy as np
n, x, y = map(int,input().split())
g = [[] for _ in range(n)] 
for i in range(n):
    if i == 0:
        g[i] = [i+1]
    elif i == n-1:
        g[i] = [i-1]
    else:
        g[i] = [i-1,i+1]
g[x-1].append(y-1)
g[y-1].append(x-1)

# if n%2==0:
#     ma = int(n/2)
# else:
#     ma = int((n+1)/2)
# print(ma)
d = []
ans = [0]*n
for i in range(n):
    start = i
    dist = [-1] * n
    dist[start] = 0
    que = queue.Queue()
    que.put(start)
    while not que.empty():
        v = que.get()
        for nv in g[v]:
            if dist[nv] != -1:
                continue
            dist[nv] = dist[v]+1
            que.put(nv)
    for i in dist:
        ans[i] += 1
    # d.append(dist)
# d = np.array(d).flatten()
for i in range(1,n):
    # print(int(np.count_nonzero(d==i)/2))
    print(int(ans[i]/2))


### FIXED CODE ###

def main():
    from collections import deque
    n,x,y=map(int,input().split())
    e=[[]for _ in range(n)]
    for i in range(n-1):
        e[i]+=i+1,
        e[i+1]+=i,
    e[x-1]+=y-1,
    e[y-1]+=x-1,
    a=[0]*n
    for s in range(n):
        d=[-1]*n
        d[s]=0
        q=deque([s])
        add,pop=q.append,q.popleft
        while q:
            v=pop()
            for w in e[v]:
                if d[w]<0:
                    d[w]=d[v]+1
                    add(w)
        for i in d:a[i]+=1
    print(' '.join(str(i//2)for i in a[1:]))
main()
### BUGGY CODE ###

n = int(input())
n_list = list(map(int, input().split()))
count = 0
for i in range(n):
    test = n_list[:i+1]
    if min(test) == n_list[i]:
        count+=1
print(count)

### FIXED CODE ###

n = int(input())
n_list = list(map(int, input().split()))
min_num = n
count = 0
for i in range(n):
    if min_num >= n_list[i]:
        min_num = n_list[i]
        count += 1
print(count)
### BUGGY CODE ###

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


for i in range(n):
	if a.count(a[i]) > 1 or a.count(a[-i]) > 1:
		print("NO")
		exit()

print("YES")

### FIXED CODE ###

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

if len(a) == len(set(a)):
	print("YES")
else:
	print("NO")
### BUGGY CODE ###

mod = 998244353
from itertools import groupby, accumulate, product, permutations, combinations
N, S = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
from collections import deque
cum = list(accumulate(A))[::-1]
A = A[::-1]
d = deque([(0,0,0)])
i = 0
lis = [0]*(N+1)
while len(d):
    a,cnt,i = d.popleft()
    if a+A[i]==S:
        lis[cnt+1] += 1
    elif a+cum[i]>=S and a+A[i]<S:
        d.append((a+A[i],cnt+1,i+1))
    if i<N-1 and cum[i+1]>=S-a:
        d.append((a,cnt,i+1))
ans = 0
for i in range(1,N+1):
    ans += lis[i]*pow(2,N-i,mod)
    ans %= mod
print(ans)

### FIXED CODE ###

mod = 998244353
N, S = map(int, input().split())
A = list(map(int, input().split()))
dp = [[0]*(S+1) for _ in range(N+1)]
dp[0][0] = 1
for i in range(1,N+1):
    dp[i][0] = dp[i-1][0]*2%mod

for i in range(1,N+1):
    for j in range(1,S+1):
        dp[i][j] = dp[i-1][j]*2%mod
        if j>=A[i-1]:
            dp[i][j] += dp[i-1][j-A[i-1]]

ans = dp[-1][-1]%mod
print(ans)
### BUGGY CODE ###

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

b.sort(reverse=True)
x=a[1]
y=a[0]
if x>=y:
	print(0)
else:
	for i in range(x):
		del b[0]
	print(sum(b))

### FIXED CODE ###

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

b.sort()
x=a[1]
y=a[0]
if x>=y:
	print(0)
else:
	z=y-x
	b=b[0:z]
	print(sum(b))
### BUGGY CODE ###

nums = int(input())
ary  = list(map(int,input().split()))
count =0
max_count = 0

for x in range(max(ary)+1):
    for i in range(nums):
        if ary[i] == x+1 or ary[i] == x or ary[i] == x-1:
            count += 1
    if count > max_count:
        max_count = count
    count = 0
print(max_count)

### FIXED CODE ###

nums = int(input())
ary  = list(map(int,input().split()))
count =0
max_count = 0
ary.sort()
ary_count = [0 for i in range(100005)]
ary_count.append(0)

for i in ary:
    ary_count[i] += 1

for i in range(1,100005):
    count += ary_count[i]
    count += ary_count[i+1]
    count += ary_count[i-1]
    if count > max_count:
        max_count = count
    count = 0
print(max_count)
### BUGGY CODE ###

k = int(input())

ans = 0
ai = 0

if k%2 == 0:
    print(-1)
    exit()

while True:
    ai = (ai*10 + 7)% k
    ans += 1
    if ai == 0:
        break
print(ans)


### FIXED CODE ###

K = int(input())

if K % 2 == 0 or K % 5 == 0:
    print(-1)
    exit()

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

import bisect

N = int(input())
L = [int(a) for a in input().split()]

L.sort()

num_triangles = 0
for i in range(0, N - 2): # 0, 1, ..., N - 3
    for j in range(i + 1, N - 1): # i+1, i+2, ..., N-2
        num_triangles += bisect.bisect_left(L[j + 1:N], L[i] + L[j])

print(num_triangles)


### FIXED CODE ###

import bisect

N = int(input())
L = [int(a) for a in input().split()]

L.sort()

num_triangles = 0
for i in range(0, N - 2): # 0, 1, ..., N - 3
    for j in range(i + 1, N - 1): # i+1, i+2, ..., N-2
        num_triangles += bisect.bisect_left(L[j + 1:N], L[i] + L[j])

print(num_triangles)