Harryxun/stf_run huggingface dataset:
import sys
N = int(input())
D = list(map(int,input().split()))
M = max(D)
countlist=[0] * M
ans=1

for i in D:
    countlist[i]+=1

if countlist[0]!=1 :
    print(0)
    sys.exit()

if D[0]!=0 :
    print(0)
    sys.exit()

for i in range(2,M+1):
    ans *= countlist[i-1]**countlist[i]

print(ans%998244353) 

### FIXED CODE ###

def main():
    N = input()
    D_list = list(map(int, input().split()))

    if D_list[0] != 0:
        ans = 0
    
    else:
        maxD = max(D_list)
        count_ele_Dlist = [0] * (maxD + 1)

        for i in D_list:
            count_ele_Dlist[i] = count_ele_Dlist[i] + 1

        if count_ele_Dlist[0] == 1:
            ans = 1
            for i in range(1, maxD + 1):
                ans = (ans * count_ele_Dlist[i - 1] ** count_ele_Dlist[i]) % 998244353
        else:
            ans = 0
        
    print(ans)

if __name__ == "__main__":
    main()
import collections
import random
n=int(input())
a=list(map(int,input().split()))
if len(set(a))==1 and a[0]==0:
  print('Yes')
elif n%3!=0:
  print('No')
elif len(set(a))!=3:
  x=random.randint(1,2)
  if x%2==0:
    print('No')
  if n%3!=0
    print('No')
  else:
    print('Yes')
else:
  a=list(set(a))
  for i in range(len(a)):
    a[i]=format(a[i],'020b')
  l=[0 for i in range(20)]
  for i in range(len(a)):
    for j in range(20):
      if a[i][j]=='1':
        l[j]+=1
  ct=0
  for j in range(20):
    if l[j]==2 or l[j]==0:ct+=1
  if ct==20:
    print('Yes')
  else:
    print('No')

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
for i in range(n):
  a[i]=format(a[i],'030b')
l=[0 for i in range(30)]
for i in range(n):
  for j in range(30):
    if a[i][j]=='1':
      l[j]+=1
for j in range(30):
  l[j]=l[j]%2
 
if 1 in l:
  print('No')
else:
  print('Yes')
import math

a, b = map(int, input().split())
print(round(avg(a, b)))

### FIXED CODE ###

a, b = map(int, input().split())
print((a + b + 1) // 2)
h,w=map(int,input().split())
lst=list(input() for i in range(h))
for a in lst:
    if a=="."*w:
        h-=1
        lst.remove(a)
for i in range(w):
    T=True
    if i>w:
        break
    for b in range(h):
        if lst[b][i]!="." :
            T=False
            break
    if T==True:
        for b in range(h):
            lst[b]="".join(list(lst[b]).pop(i))
            w-=1
for b in range(h):
    print(lst[b])

### FIXED CODE ###

h,w=map(int,input().split())
lst=list(input() for i in range(h))
n_h=h
for i in range(len(lst)):
    if "#" not in lst[h-i-1]:
        n_h-=1
        lst.pop(h-i-1)
h=n_h
n_w=w
lst=list(map(list,lst))
for i in range(w):
    T=True
    for b in range(h):
        if lst[b][w-i-1]=="#":
            T=False
            break
    if T:
        for b in range(h):
            lst[b].pop(w-i-1)
            n_w-=1
for b in range(h):
    print("".join(lst[b]))
def main():
    from heapq import heappush, heappop
    import sys
    sys.setrecursionlimit(10 ** 7)
    read = sys.stdin.buffer.read
    readline = sys.stdin.buffer.readline
    readlines = sys.stdin.buffer.readlines


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

    stx=[[int(x) for x in readline().split()] for _ in range(n)]
    event=[]
    for s,t,x in stx:
        event.append((s-x,1,x))
        event.append((t-x,-1,x))

    for i in range(q):
        event.append((int(input()),2,i))
    event.sort()

    ans=[0]*q

    stop=set()
    hq=[]
    for t,op,x in event:
        if op==1:
            heappush(hq,x)
            stop.add(x)
        elif op==-1:
            stop.remove(x)

        else:
            while hq and hq[0] not in stop:
                heappop(hq) 
            ans[x]=hq[0] if hq else -1
        
    for x in ans:
        print(x)

main()

### FIXED CODE ###

def main():
    from heapq import heappush, heappop
    import sys
    sys.setrecursionlimit(10 ** 7)

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

    event=[]
    for _ in range(n):
        s,t,x=map(int,input().split())
        event.append((s-x,1,x))
        event.append((t-x,-1,x))

    for i in range(q):
        event.append((int(input()),2,i))
    event.sort()

    ans=[0]*q

    stop=set()
    hq=[]
    for t,op,x in event:
        if op==1:
            heappush(hq,x)
            stop.add(x)
        elif op==-1:
            stop.remove(x)

        else:
            while hq and hq[0] not in stop:
                heappop(hq) 
            ans[x]=hq[0] if hq else -1
        
    for x in ans:
        print(x)

main()
x = int(input())
s = x * 360/ gcd(x,360)
print(s/x)

### FIXED CODE ###

import math
x = int(input())
s =  x * 360 / math.gcd(x, 360)
print(int(s//x))
n,m=map(int,input().split())
x=list(map(int,input().split()))
n=[]
ans=0
if n>=m:
  print(0)
else:
  x.sort()
  for i in range(n-1):
    n.append(x[i+1]-x[i])
  n.sort(reverse=True)
  for j in range(n-1):
    ans+=n[i]
print(ans)

### FIXED CODE ###

n,m=map(int,input().split())
x=list(map(int,input().split()))
l=[]
ans=0
if n<m:
  x.sort()
  for i in range(m-1):
    l.append(x[i+1]-x[i])
  l.sort()
  for j in range(m-n):
    ans+=l[j]
print(ans)
import itertools
N, M, Q = map(int, input().split())
l = []
for _ in range(Q):
    l.append(tuple(map(int, input().split())))
    
c = itertools.combinations_with_replacement(list(range(1, M+1)), N)

m = 0
for i in c:
    flag = True
    sum = 0
    for j in l:
        if c[i[1]-1] - c[i[0]-1] == i[2]:
            sum += i[3]
    m = max(m, sum)
        
print(m)

### FIXED CODE ###

import itertools
N, M, Q = map(int, input().split())
l = []
for _ in range(Q):
    l.append(tuple(map(int, input().split())))
    
c = list(itertools.combinations_with_replacement(list(range(1, M+1)), N))

m = 0
for i in c:
    flag = True
    sum = 0
    for j in l:
        if i[j[1]-1] - i[j[0]-1] == j[2]:
            sum += j[3]
    m = max(m, sum)
        
print(m)
s=input()
bf='01'*(len(s)//2)+('0'*(len(s)&1))
wf='10'*(len(s)//2)+('1'*(len(s)&1))
ans=min(len([x!=y if x,y in zip(s,bf)]),len([x!=y if x,y in zip(s,wf)]))
print(ans)

### FIXED CODE ###

#!/usr/bin/env python3
S = input()
bf = '01' * (len(S) // 2) + '0' * (len(S) & 1)
wf = '10' * (len(S) // 2) + '1' * (len(S) & 1)
ans = 10**5
ans = min(ans, [x != y for x, y in zip(S, bf)].count(True))
ans = min(ans, [x != y for x, y in zip(S, wf)].count(True))
print(ans)
from itertools import accumulate
N, W = map(int, input().split())
w_0, v_0 = map(int, input().split())
v_list = [[] for _ in range(4)]
v_list[0].append(v_0)

for _ in range(n - 1):
    w_in, v_in = map(int, input().split())
    v_list[w_in - w_0].append(v_in)
v_list = [[0] + list(accumulate(sorted(v, reverse=True))) for v in v_list]
ans = 0

#print(v_list)

for i in range(len(v_list[0])):
    for j in range(len(v_list[1])):
        for k in range(len(v_list[2])):
            for l in range(len(v_list[3])):
                if (i * w_0) + (j * (w_0 + 1)) + (k * (w_0 + 2)) + (l * (w_0 + 3)) <= W:
                    ans = max(ans, v_list[0][i] + v_list[1][j] + v_list[2][k] + v_list[3][l])
                else:
                    break
print(ans)



### FIXED CODE ###

from itertools import accumulate
N, W = map(int, input().split())
w_0, v_0 = map(int, input().split())
v_list = [[] for _ in range(4)]
v_list[0].append(v_0)

for _ in range(N - 1):
    w_in, v_in = map(int, input().split())
    v_list[w_in - w_0].append(v_in)
v_list = [[0] + list(accumulate(sorted(v, reverse=True))) for v in v_list]
ans = 0

#print(v_list)

for i in range(len(v_list[0])):
    for j in range(len(v_list[1])):
        for k in range(len(v_list[2])):
            for l in range(len(v_list[3])):
                if (i * w_0) + (j * (w_0 + 1)) + (k * (w_0 + 2)) + (l * (w_0 + 3)) <= W:
                    ans = max(ans, v_list[0][i] + v_list[1][j] + v_list[2][k] + v_list[3][l])
                else:
                    break
print(ans)
import fractions
def lcm(a, b):
    y = a*b / fractions.gcd(a, b)
    return int(y)
N=int(input())
T = [int(input()) for i in range(N)]
t=lcm(T[0],T[1])
for i in range(1,N):
    t=lcm(t,T[i])
print(t)

### FIXED CODE ###

import fractions
def lcm(a, b):
    y = a*b // fractions.gcd(a, b)
    return (y)
N=int(input())
T = [int(input()) for i in range(N)]
if N==1:
    t=T[0]
else:
    t=lcm(T[0],T[1])
    if N>2:
        for i in range(1,N):
            t=lcm(t,T[i])
print(t)
s = int(input())

print(int(x*x))

### FIXED CODE ###

s = int(input())

print(s*s)
import sys
import os
import math
import bisect
import collections
import itertools
import heapq
import re
import queue
from functools import gcd

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

# lcm = lambda x, y: x * y / math.gcd(x, y)
lcm = lambda x, y: x * y / gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    A, B, C, D = il()
    E = B - A + 1
    cnt = 0

    cnt += B // C
    cnt += B // D
    cnt -= A // C
    cnt -= A // D

    cnt -= B // lcm(C, D)
    cnt += A // lcm(C, D)
    print(E - int(cnt))


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
import os
import fractions

MOD = 10 ** 9 + 7


def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    A, B, C, D = list(map(int, sys.stdin.readline().split()))
    E = B - A + 1

    ret = 0
    ret += B // C
    ret += B // D
    ret -= (A - 1) // C
    ret -= (A - 1) // D
    ret -= B // lcm(C, D)
    ret += (A-1) // lcm(C, D)
    print(E - ret)


if __name__ == '__main__':
    main()
n = int(input())

flg = True
t_ = 0
x_ = 0
y_ = 0
for i in range(n):
  t, x, y = map(int, input().split())
  t_ -= t
  x_ -= x
  y_ -= y
  
  if (t_ - x_ - y_) % 2 != 0:
  	print('No')
  	flg = False
    break

if flg:
  print('Yes')

### FIXED CODE ###

n = int(input())
 
flg = True
t_ = 0
x_ = 0
y_ = 0

for i in range(n):
  t, x, y = map(int, input().split())
  t_ = abs(t - t_)
  x_ = abs(x - x_)
  y_ = abs(y - y_)
  
  if t_ - x_ - y_ < 0:
    print('No')
    flg = False
    break
  elif (t_ - x_ - y_) % 2 != 0:
    print('No')
    flg = False
    break
  t_ = t
  x_ = x
  y_ = y
 
if flg:
  print('Yes')
while True:
    line = input()
    if not line:
        break
    a, b = map(int, line.rstrip().split())
    print(len(str(a + b)))



### FIXED CODE ###

while True:
    try:
        a, b = map(int, input().rstrip().split())
        print(len(str(a + b)))
    except Exception:
        break
from fractions import gcd
N=int(input())
list=[int(i) for i in input().split()]
print(gcd(list))

### FIXED CODE ###

from fractions import gcd
N = int(input())
list = [int(i) for i in input().split()]
gcd1 = list[0]
for i in list:
    gcd1 = gcd(i, gcd1)
print(gcd1)
n=int(input())
l=list(map(int,input().split()))
d=l.copy()
ans=-float("INF")
for i in range(1,n-1):
    if 0>=d[i]+d[i+1]:
        if d[i]<0:
            d[i]*=-1
            d[i+1]*=-1
        

ans=max(ans,sum(d))
l[0]*=-1
l[1]*=-1
for i in range(1,n-1):
    if 0>=l[i]+l[i+1]:
        if l[i]<0:
            l[i]*=-1
            l[i+1]*=-1
print(max(ans,sum(l)))

### FIXED CODE ###

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

    # 要素の絶対値
B = list(map(abs, A))

    # 負の要素の個数
C = [a for a in A if a < 0]
if len(C) % 2 == 0:
  print(sum(B))
else:
        # 最小値を負として計算する
  print(sum(B) - min(B)*2)
import sys
def input(): return sys.stdin.readline().rstrip()
from collections import Counter
def main():
    n=int(input())
    A=list(map(int,input().split()))
    X,Y=[0]*n,[0]*n
    for i in range(n):
        X[i]=i+A[i]
        Y[i]=i-A[i]
    set_x=set(X)
    yc=Counter(Y)
    xc=Counter(X)
    ans=0
    for x in set_x:
        ans+=xc[x]*yc[x]
    print(ans)

if __name__=='__main__':
    main()

### FIXED CODE ###

import sys
def input(): return sys.stdin.readline().rstrip()
import numpy as np
def main():
    h,n=map(int,input().split())
    lis=np.array([list(map(int,input().split())) for _ in range(n)])
    dp=np.zeros(10**4+1,int)
    dp[0]=0
    for l in lis:
        dp[1:l[0]+1]=np.minimum(dp[1:l[0]+1],l[1])
    for i in range(1,h+1):
        dp[i]=np.min(dp[i-lis[:,0]]+lis[:,1])
    print(dp[h])

if __name__=='__main__':
    main()
po=list(map(int,input().split()))
A=po[0]
B=po[1]
C=po[0]-1
ans=1
if B == 1:
    ans=0
    break
else:
    while A < B:
        ans=ans+1
        A=A+C
print(ans)
print(A)

### FIXED CODE ###

po=list(map(int,input().split()))
A=po[0]
B=po[1]
C=po[0]-1
ans=1
if B == 1:
    ans=0
else:
    while A < B:
        ans=ans+1
        A=A+C
print(ans)
import sys
s = input()
t = input()
l = len(t)
if t in s:
    print(s.replace('?', 'a'))
    sys.exit()
for i in range(len(s) - l + 1):
    m = -1
    f = True
    for j in range(l):
        if s[i:i+l][j] == '?' or s[i:i+l][j] == t[j]:
            pass
        else:
            f = False
    if f:
        m = i
if m < 0:
    print('UNRESTORABLE')
else:
    print((s[0:m] + t + s[m+l:]).replace('?', 'a'))


### FIXED CODE ###

import sys
s = input()
t = input()
l = len(t)
if t in s:
    print(s.replace('?', 'a'))
    sys.exit()
m = -1
for i in range(len(s) - l + 1):
    f = True
    for j in range(l):
        if s[i:i+l][j] == '?' or s[i:i+l][j] == t[j]:
            pass
        else:
            f = False
    if f:
        m = i
if m < 0:
    print('UNRESTORABLE')
else:
    print((s[0:m] + t + s[m+l:]).replace('?', 'a'))
n = int(input())
M = [[0] * n for i in range???(n)]
for i in range(n):
    u = list(map(int, input().split()))
    v = u[0]
    for j in u[2:]:
        M[v - 1][j - 1] = 1

for i in M:
    print(*i)

### FIXED CODE ###

n = int(input())
M = [[0] * n for i in range (n)]
for i in range(n):
    u = list(map(int, input().split()))
    v = u[0]
    for j in u[2:]:
        M[v - 1][j - 1] = 1

for i in M:
    print(*i)
x, y = map(int, input().split())
print(round(x*y))

### FIXED CODE ###

S = input().split()
import decimal
x = decimal.Decimal(S[0])
y = decimal.Decimal(S[1])

print(int(x*y))
def ABC158D(txt):
    txt2 = txt.split("\n")
    s = txt2[0]
    q = int(txt2[1])
    for i in range(2, len(txt2)):
        txt3 = txt2[i].split()
        if txt3[0] == '1':
            s = s[::-1]
        else:
            if txt3[1] == '1':
                s = txt3[2] + s
            else:
                s = s + txt3[2]
    print(s)
                
ABC158D(txt)


### FIXED CODE ###


s = input()
q = int(input())
ht = 1
head = ''
tail = ''
count = 0
for i in range(q):
    txt3 = input().split()
    if txt3[0] == '1':
        ht = 3 - ht
        count += 1
    else:
        if int(txt3[1]) == ht:
            head = txt3[2] + head
        else:
            tail = tail + txt3[2]
s = head + s + tail
if count % 2 == 1:
    s = s[::-1]
print(s)
x=int(input())
beki=[]
for i in range(1,33):
    for j in range(2,10):
        beki.append(i**j)
beki.sort()
for i in range(256):
    if (beki[i] < x):
        ans=beki[i]
    else:
        break
print(ans)

### FIXED CODE ###

x=int(input())
beki=[]
for i in range(1,33):
    for j in range(2,10):
        if (i**j<=x):
            beki.append(i**j)
print(max(beki))
a,b =input（）.split（）
c=int（a+b）
i=1
while True:
  if i *i ==c:
    print（"Yes"）
    exit（）
  elif i*i >c:
    print（"No"）
    exit（）
  else:
    i += 1
a,b = list（input（）.split（））
c=int（a+b）
i=1
while True:
  if i *i ==c:
    print（"Yes"）
    exit（）
  elif i*i >c:
    print（"No"）
    exit（）
  else:
    i += 1


### FIXED CODE ###

a,b = list(input().split())
c=int(a+b)
i=1
while True:
  if i *i ==c:
    print("Yes")
    exit()
  elif i*i >c:
    print("No")
    exit()
  else:
    i += 1
a,b = list(input().split())
c=int(a+b)
i=1
while True:
  if i *i ==c:
    print("Yes")
    exit()
  elif i*i >c:
    print("No")
    exit()
  else:
    i += 1
a,b = map(int,input().split())
go = [0 for i in range(20)]
ad = [0 for i in range(101)]
bd = [0 for i in range(101)]
o = 10
for i in range(100):
  for k in range(o,1010):    
    if(k//12.5 == i+1):      
      ad[i+1] = k
      o = k
      break

o = 10
for i in range(101):
  for k in range(o,1010):    
    if(k//10 == i+1):      
      bd[i+1] = k
      o = k
      break
cnt = 0
if(ad[a]>bd[b+1]):
  print(-1)
  exit()
elif(ad[a+1]<bd[b]):
  print(-1)
  exit()
elif(ad[a]>=bd[b]):
  print(bd[b])
  exit()
elif(ad[a]<=bd[b]):
  print(ad[a])
  exit()

### FIXED CODE ###

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

for i in range(1,1024):
  if i//12.5 == a and i//10 == b:
    print(i)
    exit()
print(-1)
#C Bugged
import numpy as np
a = int(input())
k   = []
k10 = []
s = 0

for j in range(a):
    i = int(input())
    if i % 10 == 0:
        k10.append(i)
        s += i
    else:
        k.append(i)
k.sort()
c = np.array(k)
l = c.sum()
if l%10==0 and len(k) !=0:
    l = l - c[0]
    s = s + l
elif:l == 0
    s = 0
else:
    s = s + l
print(s)

### FIXED CODE ###

#C Bugged
import numpy as np
a = int(input())
k   = []
k10 = []
s = 0

for j in range(a):
    i = int(input())
    if i % 10 == 0:
        k10.append(i)
        s += i
    else:
        k.append(i)
k.sort()
c = np.array(k)
l = c.sum()
if l%10==0 and len(k) !=0:
    l = l - c[0]
    s = s + l
elif len(k) == 0:
    s = 0
else:
    s = s + l
print(s)
n,k,q = map(int, list(input().split()))
a = [int(input()) for i in range(q)]

point=[k]*n
for i in range(q):
	point[a[i-1]]+=1
for i in range(n):
    if point[i]==max(point):
        print("Yes")
    else:
        print("No")

### FIXED CODE ###

n,k,q = map(int, list(input().split()))
point=[k]*n
a=[]
	
for i in range(q):
	a.append(int(input()))
	point[a[i]-1]+=1
for i in range(n):
    if point[i]-q>0:
        print("Yes")
    else:
        print("No")
# coding: utf-8
# Your code here!

words= list(input())
target = list(input())
i=len(words)-len(target)
while(0<=i):
    flag = True
    for j in range(len(target)):
        if not(words[i+j] == target[j] or words[i+j] == '?'):
            flag = False
    if flag is True:
        words[i:i+len(target)] = target
        for i,word in enumerate(words):
            if word == '?':
                words[i]='a'
        break
    i-=1

if flag is True:
    print(''.join(words))
else:
    print("UNRESTORABLE")


### FIXED CODE ###

# coding: utf-8
# Your code here!

words= list(input())
target = list(input())
i=len(words)-len(target)
flag=False
while(0<=i):
    flag = True
    for j in range(len(target)):
        if not(words[i+j] == target[j] or words[i+j] == '?'):
            flag = False
            break
    if flag is True:
        words[i:i+len(target)] = target
        for k,word in enumerate(words):
            if word == '?':
                words[k]='a'
        break
    i-=1

if flag is True:
    print(''.join(words))
else:
    print("UNRESTORABLE")
from fractions import gcd
import math
import numpy as np
N = list(map(int, input().split()))
g = gcd(N[0], N[1])
primes = np.ones(g+2)
primes[0:2] = 0
for i in range(2, int(math.sqrt(g))+1+1):
  if primes[i]:
    primes[i*2::i] = 0

count = 0
for i in range(2,g+1):
  if primes[i] and g%i == 0:
    count += 1
print(count + 1)


### FIXED CODE ###

from fractions import gcd
import math
import numpy as np
N = list(map(int, input().split()))
g = gcd(N[0], N[1])

def factorize(g):
  factor = []
  for i in range(2, int(np.sqrt(g))+2):
    if g % i != 0:
      continue
    while g % i == 0:
      g //= i
    factor.append(i)
  if g != 1:
    factor.append(g)
  return factor
print(len(factorize(g))+1)
mport numpy as np
def F(x,y):
    count = 1
    if x<=y:
        while y >= 10:
            y = y/10
            count += 1
    if x>y:
        while x >= 10:
            x = x/10
            count += 1
    return count
#print F(1,13)
N = input()
min = 10**10
for i in range(np.sqrt(N).astype(np.int32)):
    if N%(i+1) == 0:
       if min > F(i+1,N/(i+1)):
           min = F(i+1,N/(i+1))
       print i+1

print min

### FIXED CODE ###

import numpy as np
def F(x,y):
    count = 1
    if x<=y:
        while y >= 10:
            y = y/10
            count += 1
        return count
    else :
        while x >= 10:
            x = x/10
            count += 1
        return count
#print F(1,13)
N = input()
min = 10**10
index = np.zeros(2)
for i in range(np.sqrt(N).astype(np.int32)):
    if N%(i+1) == 0:
       if min > F(i+1,N/(i+1)):
           min = F(i+1,N/(i+1))
           index[0] = i+1
           index[1] = N/(i+1)
       #print i+1, N/(i+1),F(i+1,N/(i+1)), min

print min
#2d plane 2n points
n=int(input())
cnt=0
red=[]
blue=[]
for _ in range(n):
    x,y=map(int,input().split())
    red.append((x,y))
for _ in range(n):
    x,y=map(int,input().split())
    blue.append((x,y))
red=sorted(red,key=lambda x:x[0])
blue=sorted(blue,key=lambda x:x[0])
blue=blue[::-1]
for i in range(n-1,-1,-1):
    x,y=red[i][0],red[i][1]
    d=[]
    for some in blue:
        X,Y=some[0],some[1]
        if X>x:
            d.append((X,Y))
    if d:
        d=sorted(d,key=lambda x:x[1])
        node=-1
        for some in d:
            if some[1]>y:
                node=some
                cnt+=1
                break
        blue.remove(node)
print(cnt) 

### FIXED CODE ###

#2d plane 2n points
n=int(input())
cnt=0
red=[]
blue=[]
for _ in range(n):
    x,y=map(int,input().split())
    red.append((x,y))
for _ in range(n):
    x,y=map(int,input().split())
    blue.append((x,y))
red=sorted(red,key=lambda x:x[0])
blue=sorted(blue,key=lambda x:x[0])
blue=blue[::-1]
for i in range(n-1,-1,-1):
    x,y=red[i][0],red[i][1]
    d=[]
    for some in blue:
        X,Y=some[0],some[1]
        if X>x:
            d.append((X,Y))
    if d:
        d=sorted(d,key=lambda x:x[1])
        node=0
        for some in d:
            if some[1]>y:
                node=some
                cnt+=1
                break
        if node!=0:
            blue.remove(node)
print(cnt)
n,k = map(int,input().split())
li = [int(x) for x in input().split()]

dp = [10**8] * n

for i in range(n):
    if i == 0:
        dp[0] = 0
    elif i < k-1:
        temp = []
        for j in range(i):
            s = abs(li[i] - li[i-j-1]) + dp[i-j-1]
            temp.append(s)
        else:
            dp[i] = min(temp)
    elif i >= k-1:
        temp = []
        for j in range(k):
            s = abs(li[i] - li[i-j-1]) + dp[i-j-1]
            temp.append(s)
        else:
            dp[i] = min(temp)
            
print(dp[-1])


### FIXED CODE ###

n = int(input())
li = list(map(int,input().split()))

dp = [10**8] * n

for i in range(n):
    if i == 0:
        dp[i] = 0
    elif i == 1:
        dp[i] = abs(li[i] - li[i-1])
    else:
        dp[i] = min(abs(li[i] - li[i-1]) + dp[i-1], abs(li[i] - li[i-2]) + dp[i-2])

print(dp[-1])
n = int(input())
a = list(map(int, input().split()))
 
if 0 in a:
  print(0)
  exit()
total = 1 
for i in range(n):
  total * = a[i]
  if total > 10 ** 18:
    print(-1)
    break
  
print(total)

### FIXED CODE ###

n = int(input())
l = list(map(int, input().split()))
if 0 in l:
  print(0)
  exit()
ans = 1
for i in range(n):
  ans *= l[i]
  if ans > 10**18:
    ans = -1
    break
print(ans)
a = int(input())

def factorization(n):
    arr = []
    tmp = n

    for i in range(2, int(n**0.5//1)+1):
        if tmp%i==0:
            cnt = 0
            while tmp%i==0:
                cnt+=1
                tmp//=i
            arr.append([i,cnt])
    if tmp!=1:
        arr.append([tmp,1])
    if arr==[]:
        arr.append([n,1])
    return arr

while True:
  arr = factorization(a)
  if (len(arr)==1) & (arr[1]==1):
    print(a)
    break
  a+=1

### FIXED CODE ###

a = int(input())

def factorization(n):
    arr = []
    tmp = n

    for i in range(2, int(n**0.5//1)+1):
        if tmp%i==0:
            cnt = 0
            while tmp%i==0:
                cnt+=1
                tmp//=i
            arr.append([i,cnt])
    if tmp!=1:
        arr.append([tmp,1])
    if arr==[]:
        arr.append([n,1])
    return arr

while True:
  arr = factorization(a)
  if (len(arr)==1) & (arr[0][1]==1):
    print(a)
    break
  a+=1