Harryxun/stf_run huggingface dataset:
tmp = list(map(int, input().split()))

N = tmp[0]
M = tmp[1]

i = list(map(int, input().split()))



i.reverse()

souwa = sum(i)

if i[M] < (souwa * (1/(4*M))):
    print("Yes")
else:
    print("No")
# print(i[0]) #出力：i_1
# print(i[1]) #出力：i_2



### FIXED CODE ###

import numpy as np

tmp = list(map(int, input().split()))

N = tmp[0]
M = tmp[1]

i = list(map(int, input().split()))

i = np.array(i)

i = np.sort(i)[::-1]

souwa = np.sum(i)

if i[M-1] < (souwa * (1/(4*M))):
    print("No")
else:
    print("Yes")
# print(i[0]) #出力：i_1
# print(i[1]) #出力：i_2
n=int(input())
k=int(input())
count=0
for i in range(10**(k-1),n+1):
  s=str(i)
  n=len(s)
  if n-s.count('0')==k:
    count+=1
print(count)

### FIXED CODE ###

N = int(input())
K = int(input())

strN = str(N)
maxD = len(strN)

dp = [[[0]*(K+1) for j in range(2)] for i in range(maxD+1)]
dp[0][0][0] = 1
for d, Nd in enumerate(strN):
    Nd = int(Nd)
    for isLeN in range(2):
        for m in range(K+1):
            x = 0
            if not isLeN and x > Nd: continue
            isLeN2 = isLeN or x < Nd
            dp[d+1][isLeN2][m] += dp[d][isLeN][m]
            for x in range(1, 10):
                if not isLeN and x > Nd: continue
                isLeN2 = isLeN or x < Nd
                m2 = m+1
                if m2 > K: continue
                dp[d+1][isLeN2][m2] += dp[d][isLeN][m]
#    print(d+1, Nd, dp[d+1])

#print(dp[-1])
print(dp[-1][0][K]+dp[-1][1][K])
A,B,K=(int(i) for i in input().split())
L=list(range(A,B+1))
a=B-A+1
if K>=a:
  for i in L:
    print(i)
else:
  S=list(set(L[:K]+L[a-K:a]))
  S.sort()
  for i in S:
    print(i)

### FIXED CODE ###

A,B,K=(int(i) for i in input().split())
a=B-A+1
if K>=a:
  for i in range(A,B+1):
    print(i)
else:
  L1=list(range(A,A+K))
  L2=list(range(B-K+1,B+1))
  S=list(set(L1+L2))
  S.sort()
  for i in S:
    print(i)
n,m,x=map(int,input().split())
a=[list(map(int,input().split()))]
ans=[]
for bit in range(1<<n):
  total=0
  skill=[0]*m
  for i in range(n):
    if bit & (1<<i):
      total+=a[i][0]
      for j in range(m):
        skill[j]+=a[i][j]
  if all([k>x for k in skill]):
    ans.append(total)
print(min(total) if len(ans)>=1 else -1)

### FIXED CODE ###

n,m,x=map(int,input().split())
a=[list(map(int,input().split()))for i in range(n)]
ans=[]
for bit in range(1<<n):
  total=0
  skill=[0]*m
  for i in range(n):
    if bit & (1<<i):
      total+=a[i][0]
      for j in range(m):
        skill[j]+=a[i][j+1]
  if all([k>=x for k in skill]):
    ans.append(total)
print(min(ans) if len(ans)!=0 else -1)
N=int(input())
nums = [int(i) for i in input().split()]

def gcd(x, y):
    if x < y:
        x = x ^ y
        y = x ^ y
        x = x ^ y
    div = x % y
    if (div == 0):
        return y
    while div != 0:
        div = x % y
        x = y
        y = div
    return x

memo = {}
memo[(0, 1)] = nums[0]
memo[(N-1, N)] = nums[N-1]

def solve(left, right):
    if (left, right) in memo:
        return memo[(left, right)]
    if left == 0:
        sol = gcd(nums[right - 1], solve(left, right - 1))
        memo[(left, right)] = sol
        return sol
    if right == N:
        sol = gcd(nums[left], solve(left+1, right))
        memo[(left, right)] = sol
        return sol

res = 1
for i in range(1, N-1):
    res = max(res, gcd(solve(0, i), solve(i+1, N)))

res = max(res, solve(0, N-1))
res = max(res, solve(1, N))

print(res)


### FIXED CODE ###

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

def gcd(x, y):
    if x < y:
        x = x ^ y
        y = x ^ y
        x = x ^ y
    div = x % y
    while div != 0:
        x = y
        y = div
        div = x % y
    return y

memo = {}
memo[(0, 1)] = nums[0]
memo[(N-1, N)] = nums[N-1]

for i in range(2, N+1):
    memo[(0, i)] = gcd(memo[(0, i - 1)], nums[i-1])
    # print("{} {} memo:{}".format(0, i, memo[(0,i)]))


for i in reversed(range(0, N-1)):
    memo[(i, N)] = gcd(memo[(i + 1, N)], nums[i])
    # print("{} {} memo:{}".format(i, N, memo[(i,N)]))

res = 1
for i in range(1, N-1):
    res = max(res, gcd(memo[(0, i)], memo[(i+1, N)]))
    # print("gcd:{}".format(gcd(memo[(0, i)], memo[(i+1, N)])))

res = max(res, memo[(0, N-1)])
res = max(res, memo[(1, N)])

print(res)
rt numpy as np
N = int(input())
a = [int(i) for i in input().split(" ")]
a = np.array(a,dtype='int')
def count(a):
    return [1 if i==1 or i== 0 or i == -1 else 0 for i in a]
if N == 1:
    print(1)
else:
    min_ = min(a)-1
    max_ = max(a)+1
    ans = -1
    for K in range(min_,max_):
        b = a - K
        tmp = sum(count(b))
        if ans < tmp:
            ans = tmp
    print(ans)

### FIXED CODE ###

from collections import defaultdict
N = int(input())
a = [int(i) for i in input().split(" ")]
dic_num=defaultdict(int)

for i in a:
    dic_num[i] += 1
ans = -1
for X in range(min(a),max(a)+1):
    tmp = (dic_num[X-1] + dic_num[X] + dic_num[X+1])
    if ans < tmp:
        ans = tmp
print(ans)
x=str(input())
l=len(s)
list=[s[0],l,s[l-1]]
print(''.join(list))

### FIXED CODE ###

s=str(input())
l=len(s)
li=str(l-2)
list=[s[0],li,s[l-1]]
print(''.join(list))
# coding=utf-8
a, b, x = map(int, input().split())
if a <= x and x<= a+b:
    print(“Yes”)
else:
    print(“No”)

### FIXED CODE ###

# coding=utf-8
a, b, x = map(int, input().split())
if a <= x and x<= a+b:
    print("YES")
else:
    print("NO")
import math
import copy
from copy import deepcopy
import sys
import fractions
import numpy as np
from functools import reduce
import statistics
import heapq


# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

data = getInputListInt()
N = data[0]
K = data[1]
MOD = 1000000000 + 7

# nCa
def choose(n, a):
    if n == 0 or a == 0 or n < a: return 1
    x = 1
    y = 1
    for i in range(a):
        x *= n-i
        y *= i+1
    return int(x / y)

for i in range(1, K+1, 1):
    blue = choose(K-1, i-1)
    red = choose(N-K-(i-1) +i, i)

    ans = (blue * red) % MOD
    print(int(ans))


### FIXED CODE ###

import sys

# import re
import math
import collections
# import decimal
# import bisect
# import itertools
import fractions
# import functools
import copy
import heapq
import decimal
# import statistics
import queue

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    def fast_pow(num, kata, mod):
        if kata == 0:
            return 0

        res = 1
        while kata > 0:
            if kata & 1 == 1:
                res = res * num % mod
            num = num * num % mod

            kata >>= 1
        return res

    # MODのCombination nがでかくても関係なくrに依存　r<10**6なら回せる
    MOD = 10 ** 9 + 7

    def choose(n, r):
        res = 1
        fac = 1
        for i in range(r):
            res *= n - i
            res %= MOD
            fac *= i + 1
            fac %= MOD
        return res * fast_pow(fac, MOD - 2, MOD) % MOD

    n, k = ns()

    for i in range(1, k + 1):
        blue_pair = choose(k - i + (i - 1), i - 1)
        red_pair = choose((n - k) + 1, i)
        print(blue_pair * red_pair % MOD)


if __name__ == '__main__':
    main()
Copy
a, b, c = map(int,input().split())
print(int(min(a*b/2,b*c/2,c*a/2)))

### FIXED CODE ###

a, b, c = map(int,input().split())
print(int(min(a*b/2,b*c/2,c*a/2)))
def swap(A,B):
    a = A
    A = B
    B = a
    return A,B
X,Y,Z = map(int,input().split())
X,Y = swap(X,Y)
X,Z = swap(X,Z)
print(f'{X} {Y} {Z}')

### FIXED CODE ###

def swap(A,B):
    a = A
    A = B
    B = a
    return A,B
X,Y,Z = map(int,input().split())
X,Y = swap(X,Y)
X,Z = swap(X,Z)
print(str(X)+' '+str(Y)+' '+str(Z))
import functools as ft
import logging
import unittest
from collections import (
    namedtuple,
    Counter,
)
from heapq import (
    heappush,
    heappop,
)

debug = logging.getLogger(__name__).debug


def input_ints():
    return list(map(int, input().strip().split()))


@ft.total_ordering
class PrioritizedItem(namedtuple('PrioritizedItem', 'priority, value')):
    def __lt__(self, other):
        return self.priority < other.priority


def a_star(succ, cost, heuristic, start):
    cost_dict = {start: (heuristic(start), 0)}
    prev_dict = {}
    close = set()
    q = [PrioritizedItem(cost_dict[start], start)]

    while q:
        cost_u, u = heappop(q)
        if u not in close and cost_u <= cost_dict[u]:
            close.add(u)

            yield u, prev_dict, cost_dict

            for v in succ(u):
                cost_uv = cost(u, v)
                heuristic_v = heuristic(v)

                cost_v_old = cost_dict.get(v)
                cost_v_new = (
                    cost_u[1] + cost_uv + heuristic_v,
                    cost_u[1] + cost_uv,
                )
                if cost_v_old is None or cost_v_new < cost_v_old:
                    cost_dict[v] = cost_v_new
                    prev_dict[v] = u
                    heappush(q, PrioritizedItem(cost_v_new, v))
                    try:
                        close.remove(v)
                    except KeyError:
                        pass


def _main():
    n, = input_ints()
    xy = [tuple(input_ints()) for _ in range(n)]

    pq = [
        (x1 - x2, y1 - y2)
        for (x1, y1) in xy
        for (x2, y2) in xy
        if not (x1 == x2 and y1 == y2)
    ]
    pq_counter = Counter(pq)

    ans = []
    for p, q in sorted(pq_counter, key=pq_counter.get)[::-1]:
        result = a_star(
            succ=lambda u: [u + (xy_,) for xy_ in xy],
            cost=lambda u, v: int(
                v[-1][0] - u[-1][0] != p
                or v[-1][1] - u[-1][1] != q
            ),
            heuristic=lambda u: 0,
            start=((float('inf'),) * 2,),
        )
        tail, prev_dict, cost_dict = (None,) * 3
        for tail, prev_dict, cost_dict in result:
            if len(tail) > len(xy):
                break
        ans.append(cost_dict[tail][0])
        debug([len(xy), pq_counter[p, q], ans[-1]])
        if len(xy) - pq_counter[p, q] == ans[-1]:
            break

    print(min(ans))


class Test(unittest.TestCase):
    def setUp(self):
        import run
        self._test = run

    def test_main(self):
        self._test.test_files(self, _main)


if __name__ == '__main__':
    _main()


### FIXED CODE ###

from collections import (
    Counter,
)


def input_ints():
    return list(map(int, input().strip().split()))


def _main():
    n = input_ints()[0]
    xy = [input_ints() for _ in range(n)]

    if len(xy) == 1:
        print(1)
        return

    (_, count), = Counter(
        (x1 - x2, y1 - y2)
        for (x1, y1) in xy
        for (x2, y2) in xy
        if not (x1 == x2 and y1 == y2)
    ).most_common(1)

    print(len(xy) - count)


if __name__ == '__main__':
    _main()
H, W = list(map(int, input().split()))
h, w = list(map(int, input().split()))

def whiecells(H, W, h, w):
	ans = H * W -(h*W + w*(H-h))
	return ans

print(ans)


### FIXED CODE ###

H, W = list(map(int, input().split()))
h, w = list(map(int, input().split()))

ans = H * W - (h*W + w*(H-h))
print(ans)
N,W = map(int,input().split())
WV = []
for i in range(N):
    WV.append(list(map(int,input().split())))
dp = [[] for i in range(N)]
dp[0].append((0,0))
for i in range(N):
    if i == 0:
        dp[i].append((0,0))
        if W >= WV[i][0]:
            dp[i].append((WV[i][0],WV[i][1]))
    else:
        dp[i].append((e1,e2))
        for e1,e2 in dp[i-1]:
            if W >= e1+WV[i][0]:
                dp[i].append((e1+WV[i][0],e2+WV[i][1]))
ans = 0
for e1,e2 in dp[-1]:
    ans = max(e2,ans)
print(ans)

### FIXED CODE ###

N,W = map(int,input().split())
WV = []
for i in range(N):
    WV.append(list(map(int,input().split())))
dp = [[float('inf') for j in range(100001)] for i in range(N)]
dp[0][0] = 0
for i in range(N):
    w,v = WV[i]
    if i == 0:
        dp[i][v] = w
    else:
        for j in range(100001):
            if j-v >= 0:
                dp[i][j] = min(dp[i-1][j-v]+w,dp[i-1][j])
            else:
                dp[i][j] = dp[i-1][j]

ans = 0
for i,e in enumerate(dp[-1]):
    if W >= e:
        ans = i
print(ans)
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)

#debug = True
debug = False

def dprint(*objects):
    if debug == True:
        print(*objects)

def solve():
    l = input()
    li = [int(l[i]) for i in range(len(l))]
    dprint(li)

    # 制約1 a+b は L 以下
    # 制約2 a と b で同じけたは 00 01 10 のいずれか

    mx = 10**9 + 7
    def next_digit_pat(subli, flag):
        ans = -1
        if len(subli) == 1:
            if subli[0] == 1:
                ans = 3
            else:
                if flag:
                    ans = 1
                else:
                    ans = 3
        else:
            if subli[0] == 1:
                ans = 1 * next_digit_pat(subli[1:], False) + 2 * next_digit_pat(subli[1:], True)
            else:
                ans = next_digit_pat(subli[1:], True)

        #dprint(subli, flag, ans)

        return ans
    print(next_digit_pat(li, True) % mx)

solve()

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)

#debug = True
debug = False

def dprint(*objects):
    if debug == True:
        print(*objects)

def solve():
    l = input().rstrip('\n')
    n = len(l)
    # 制約1 a+b は L 以下
    # 制約2 a と b で同じけたは 00 01 10 のいずれか

    mx = 10**9 + 7
    same = 1 # iまでの a+b が l と等しい（a+b <= L となるかは次の桁で気をつける必要あり）
    diff = 0 # iまでの a+b が l と異なっている（すでに a+b <= L が確定）

    for i in range(n):
        if l[i] == "1":
            same_tmp = same * 2
            diff_tmp = same * 1 + diff * 3
        else:
            same_tmp = same * 1
            # diff_tmp = same * 2 + diff * 3 ×sameで次の桁が0の場合、次の桁を1にはできない
            diff_tmp = diff * 3
        same = same_tmp % mx
        diff = diff_tmp % mx

        dprint(i, l[i], same, diff)

    print((same + diff) % mx)

solve()
def B():
    a = [list(map(int,input().split())) for i in range(3)]
    n = int(input())
    b = [list(int(input())) for i in range(n)]
    for bingo in b:
        for i in range(3):
            for j in range(3):
                if a[i][j] == bingo:
                    a[i][j] = 0
    if (a[0][0] == a[1][1] == a[2][2] == 0) or (a[0][2] == a[1][1] == a[2][0] == 0):
        print("Yes")
        return
    for i in range(3):
        if all(a[i][j] == 0 for j in range(3)) or all(a[j][i] == 0 for j in range(3)):
            print("Yes")
            return
    print("No")
B()

### FIXED CODE ###

def B():
    mat = [list(map(int,input().split())) for i in range(3)]
    n = int(input())
    #b = [list(map(int,input().split())) for i in range(n)]
    for bingo in  (int(input()) for _ in range(n)):
        for i in range(3):
            for j in range(3):
                if mat[i][j] == bingo:
                    mat[i][j] = 0
    for i in range(3):
        if all(mat[i][j] == 0 for j in range(3)):
            print('Yes')
            break
        if all(mat[j][i] == 0 for j in range(3)):
            print('Yes')
            break
    else:
        if mat[0][0] == mat[1][1] == mat[2][2] == 0 or\
                mat[0][2] == mat[1][1] == mat[2][0] == 0:
            print('Yes')
        else:
            print('No')
B()
def slove(n, k):
    a_list = [int(i) for i in k.split()]
    num = len([i for i in a_list if i % 4 == 0])
    tmp =  [i for i in a_list if i % 4 != 0]
    num2 = tmp.count(2) // 2
    return "Yes" if (num + num2)>= n // 2 else "No"

if __name__ == "__main__":
    input = sys.stdin.readline
    n = int(input())
    k = input()
    print(slove(n, k))


### FIXED CODE ###

import sys
def slove(n, k):
    a_list = [int(i) for i in k.split()]
    num = len([i for i in a_list if i % 4 == 0])
    tmp =  [i for i in a_list if i % 4 != 0]
    num2 = len([i for i in tmp if i % 2 == 0]) // 2
    return "Yes" if (num + num2)>= n // 2 else "No"

if __name__ == "__main__":
    input = sys.stdin.readline
    n = int(input())
    k = input()
    print(slove(n, k))
N,K = list(map(int, input().split()))
h = [int(input()) for i in range(N)]
first_flg = True
h.sort()
for i in range(N-K-1):
    tmp = h[i+K-1] - h[i]
    if first_flg or tmp < candidate:
        first_flg = False
        candidate = tmp
print(candidate)

### FIXED CODE ###

N,K = list(map(int, input().split()))
h = [int(input()) for i in range(N)]
candidate = None
h.sort()
for i in range(N-K+1):
    tmp = h[i+K-1] - h[i]
    if candidate == None or tmp < candidate:
        candidate = tmp
print(candidate)
N=list(input())
S=[int(t) for t in N]
T=sum(s)
if T%9==0:
  print("Yes")
else :
  print("No")

### FIXED CODE ###

N=list(input())
NN=[int(t) for t in N]
T=sum(NN)
if T%9==0:
    print("Yes")
else :
    print("No")
def main():
    pass
    N = int(input())
    A = list(map(int, input().split()))

    H = [0]*2*10**5
    for i in range(0,N):
        if i >= A[i]:
            H[i-A[i]] += 1

    ans = 0
    for k in range(0,N):
        Bk = k+A[k]
        if Bk <= 2*10**5:
            ans += H[Bk]

    print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###


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

    H = [0]*N
    for i in range(0,N):
        if i >= A[i]:
            H[i-A[i]] += 1

    ans = 0
    for k in range(0,N):
        Bk = k+A[k]
        if Bk < N:
            ans += H[Bk]

    print(ans)

if __name__ == '__main__':
    main()
list=[]
list.append(input())

While list!=[]:
    inp=input()
    if inp==0:
        print list[-1]
        del list[-1]
    else:
        list.append(inp)

### FIXED CODE ###

import sys
import sys

a = []
for line in sys.stdin:
    a.append(line)

lis=[]
for n in a:
    inp=int(n)
    if inp==0:
        print lis[-1]
        del lis[-1]
    else:
        lis.append(inp)
X, A = map(int,input().split())

if X < A:
    print(0)
else:
    pritnt(10)

### FIXED CODE ###

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

if X < A:
    print(0)
else:
    print(10)
n,k = map(int, input().split())
p = list(map(int, input().split()))

rsum  = [0]*n
for i in range(n):
    rsum[i] = (p[i]+1) / 2
    if(i != 0):
        rsum[i] = rsum[i] + rsum[i-1]

if(n == k):
    max = rsum[n]
else:
    for i in range(n-k):
        if(max < rsum[i+k] - rsum[i]):
            max = rsum[i+k] - rsum[i]
print(max)

### FIXED CODE ###

n,k = map(int, input().split())
p = list(map(int, input().split()))

rsum  = [0]*n
for i in range(n):
    rsum[i] = (p[i]+1) / 2
    if(i != 0):
        rsum[i] = rsum[i] + rsum[i-1]

result = 0
if(n == k):
    result = rsum[n-1]
else:
    for i in range(n-k):
        if(result < rsum[i+k] - rsum[i]):
            result = rsum[i+k] - rsum[i]
print(result)
# -*- coding: utf-8 -*-
# 整数の入力
a = int(input())
# スペース区切りの整数の入力
b = int(input())

# 出力
print(max([a+b, a-b, a*b]))

### FIXED CODE ###

# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
a, b = map(int, input().split())

# 出力
print(max([a+b, a-b, a*b]))
x, n = map(int, input().split())
p = list(map(int, input().split()))

p_all = set(range(0, 102)) - set(p)
# print(p_all)

mi = float('inf')
ans = 0
for i in p_all:
    if abs(x - i) < mi:
        mi = abs(x - i)
        ans = i

print(ans)


### FIXED CODE ###

import sys
import math

n = int(input())
a = list(map(int, input().split()))
a.sort()
limit = max(a)
dp = [True] * (limit + 1)
archives = set()
for i in a:
    if i in archives:
        dp[i] = False
        continue
    archives.add(i)
    n = 2
    while i * n <= limit:
        dp[i * n] = False
        n += 1

# print(dp)
ans = 0
for i in a:
    if dp[i] is True:
        ans += 1


print(ans)
l = ['SUN', 'MUN', 'TUE', 'WED', 'THU', 'FRI', 'SAT'];print(len(l) - l.index(input()))

### FIXED CODE ###

print(7 - ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT'].index(input()))
from sys import stdin
input = stdin.readline

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

A.sort()

is_ok = [False] * (10 ** 5 + 1)
is_exist = [False] * (10 ** 5 + 1)

for a in A:
    if is_exist[a]:
        is_ok[a] = False
    else:
        is_exist[a] = True
        is_ok[a] = True
        for i in range(1, 10 ** 5 // a + 1):
            if a * i <= 10 ** 5:
                is_exist[a * i] = True

print(is_ok.count(True))


### FIXED CODE ###

from sys import stdin
input = stdin.readline

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

A.sort()

is_ok = [False] * (10 ** 6 + 1)
is_exist = [False] * (10 ** 6 + 1)

for a in A:
    if is_exist[a]:
        is_ok[a] = False
    else:
        is_exist[a] = True
        is_ok[a] = True
        for i in range(1, 10 ** 6 // a + 1):
            if a * i <= 10 ** 6:
                is_exist[a * i] = True

print(is_ok.count(True))
N = int(input())
P = input().split()
P = [int(s) for s in P]
T = range(1, N+1)
count=[]
for i in range(N):
  if P[i] != T[i]:
    count.append(i)
if len(count) != 2 and len(count) != 0:
  print("NO")
else:
  P[count[0]], P[count[1]] = P[count[1]], P[count[0]]
  if list(T) == P:
    print("YES")
  else:
    print("NO")

### FIXED CODE ###

N = int(input())
P = input().split()
P = [int(s) for s in P]
T = range(1, N+1)
count=[]
for i in range(N):
  if P[i] != T[i]:
    count.append(i)
if len(count) != 2 and len(count) != 0:
  print("NO")
elif len(count) == 0:
  print("YES")
else:
  P[count[0]], P[count[1]] = P[count[1]], P[count[0]]
  if list(T) == P:
    print("YES")
  else:
    print("NO")
a,b=map(int,input().split())
if (a*b)%2 ==0:
print('Even')
else:
print('Odd')

### FIXED CODE ###

a,b=map(int,input().split())
if (a*b)%2 ==0:
  print('Even')
else:
  print('Odd')
a_,b_ = map(int, (raw_input().strip().split(" ")))

foo = []
for i,a in enumerate(range(a_)):
    foo = raw_input().strip().split(" ")
    for j in range(b_):
        if foo[j] == 'snuke':
            print('A'+ str(i + 1))

### FIXED CODE ###

a_,b_ = map(int, (raw_input().strip().split(" ")))
foo = []
for i,a in enumerate(range(a_)):
    foo = raw_input().strip().split(" ")
    for j in range(b_):
        if foo[j] == 'snuke':
            print(chr(65 + j) + str(i + 1))
x=int(input())

print(YES if x=7orx=5orx=3 else NO)

### FIXED CODE ###

x=int(input())
 
print("YES" if x==7 or x==5 or x==3 else "NO")