Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03471 (python)

Fixed submission:
def solve(N, Y):
    for x in range(N+1):
        for y in range(N+1):
            z = N - x - y
            if z < 0:
                continue
            elif 10000 * x + 5000 * y + 1000 * z == Y:
                return x, y, z
    return -1, -1, -1

N, Y = list(map(int, input().split()))
x, y, z = solve(N, Y)
print('{} {} {}'.format(x, y, z))

Buggy submission (verdict: Runtime Error):
def solve(N, Y):
    for x in range(N + 1):
        for y in range(0, N - x + 1):
            z = N - x - y
            elif 10000 * x + 5000 * y + 1000 * z == Y:
                return x, y, z
    return -1, -1, -1
 
 
N, Y = list(map(int, input().split()))
x, y, z = solve(N, Y)
print('{} {} {}'.format(x, y, z))
Problem p02760 (python)

Fixed submission:
A = [list(map(int, input().split())) for i in range(3)]
N = int(input())

val = 0
flag = False

for i in range(N):
    b = int(input())
    for j in range(3):
        for k in range(3):
            if A[j][k] == b:
                A[j][k] = 0

val = 0
for i in range(3):
    val += A[i][i]
if val == 0:
    flag = True

val = A[0][2] + A[1][1] + A[2][0]
if val == 0:
    flag = True

for i in range(3):
    if sum(A[i]) == 0:
        flag = True
    
    val = 0
    for j in range(3):
        val += A[j][i]
    if val == 0:
        flag = True

if flag == True:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
A = [list(map(int, input().split())) for i in range(3)]
N = int(input())

val = 0
flag = False

for i in range(N):
    b = int(input())
    for j in range(3):
        for k in range(3):
            if A[j][k] == b:
                A[j][k] = 0

val = 0
for i in range(3):
    val += A[i]
if val == 0:
    flag = True

val = A[0][2] + A[1][1] + A[2][0]
if val == 0:
    flag = True

for i in range(3):
    if sum(A[i]) == 0:
        flag = True
    
    val = 0
    for j in range(3):
        val += A[j][i]
    if val == 0:
        flag = True

if flag == True:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
A = [list(map(int, input().split())) for i in range(3)]
N = int(input())

val = 0
flag = False

for i in range(N):
    b = int(input())
    for j in range(3):
        for k in range(3):
            if A[j][k] == b:
                A[j][k] = 0

val = 0
for i in range(3):
    val += A[i]
if val == 0:
    flag True

val = A[0][2] + A[1][1] + A[2][0]
if val == 0:
    flag = True

for i in range(3):
    if sum(A[i]) == 0:
        flag = True
    
    val = 0
    for j in range(3):
        val += A[j][i]
    if val == 0:
        flag = True

if flag == True:
    print('Yes')
else:
    print('No')
Problem p03254 (python)

Fixed submission:
N, x = map(int, input().split())
a = sorted(map(int, input().split()))
cnt = 0

for i in range(N):
    x -= a[i]
    if x < 0:
        break
    else:
        cnt += 1

print(cnt if x <= 0 else cnt-1)

Buggy submission (verdict: Runtime Error):
N, x = map(int, input().split())
a = sorted(map(int, input().split()))
cnt = 0

for i in range(N):
    x -= a[i]
    if x < 0:
        break
    else:
        s += 1

print(cnt if x <= 0 else cnt-1)
Problem p02999 (python)

Fixed submission:
X, A = map(int, input().split())
if X < A:
  print(0)
else:
  print(10)

Buggy submission (verdict: Runtime Error):
if X < A:
  print(0)
else:
  print(10)
Problem p03000 (python)

Fixed submission:
N, X = map(int, input().split())
L = list(map(int, input().split()))

count = 1
position = 0

while L and position <= X:
    position += L.pop(0)
    if position <= X:
        count += 1

print(count)

Buggy submission (verdict: Runtime Error):
N, X = map(int, input().split())
L = list(map(int, input().split()))

count = 1
position = 0

while position <= X:
    position += L.pop(0)
    if position <= X:
        count += 1

print(count)
Problem p03006 (python)

Fixed submission:
N = int(input())

ball_position = []
for _ in range(N):
    i, j = map(int, input().split())
    ball_position.append((i, j))

    
def tup2_diff(a, b):
    ai, aj = a
    bi, bj = b
    return ((ai - bi, aj - bj))
  
calculation_list = []
for i in range(len(ball_position)):
    for j in range(len(ball_position)):
        if i == j:
            continue
        else:
            x , y = tup2_diff(ball_position[i], ball_position[j])
            if x > 0 or (x == 0 and y > 0):
                calculation_list.append((x, y))
           
import collections

c = collections.Counter(calculation_list).most_common(1)
if N == 1:
    print(1)
else:
    print(N - calculation_list.count(c[0][0]))

Buggy submission (verdict: Runtime Error):
N = int(input())

ball_position = []
for _ in range(N):
    i, j = map(int, input().split())
    ball_position.append((i, j))

def tuple_inverse(a):
    ai, aj = a
    if ai < 0:
        return (-ai, -aj)
    return(ai, aj)

def tup2_diff(a, b):
    ai, aj = a
    bi, bj = b
    return tuple_inverse((ai - bi , aj - bj))

calculation_list = []
for i in range(len(ball_position)):
    for j in range(i + 1, len(ball_position)):
        calculation_list.append(tup2_diff(ball_position[i], ball_position[j]))
        
import collections
c = collections.Counter(calculation_list).most_common(1)

print(N - calculation_list.count(c[0][0]))
Problem p04043 (python)

Fixed submission:
a, b, c = map(int,input().split(" "))

count_5 = 0
count_7 = 0

#aについて
if a == 5:
	count_5 += 1
elif a == 7:
	count_7 += 1

#bについて
if b == 5:
	count_5 += 1
elif b == 7:
	count_7 += 1

#cについて
if c == 5:
	count_5 += 1
elif c == 7:
	count_7 += 1

if count_5 == 2 and count_7 == 1:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
import itertools

white_num_list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
 
N, K = map(int, input().split())
black_num_list = list(map(int, input().split()))
 
white_num_list = list(set(white_num_list).difference(set(black_num_list)))
num_combination = list(itertools.combinations_with_replacement(white_num_list, len(str(N))))
 
num_list = []
for num in num_combination:
    if num[0] == 0:
        continue
    num_list.append(int(''.join(map(str, num))))
 
num_list = sorted(num_list)
 
def price(N, num_list, white_num_list):
    for num in num_list:
        if num >= N:
            return num
    
    if 0 in white_num_list:
        white_num_list.remove(0)
    placeholder = str(min(white_num_list))
    return int(placeholder * (len(str(N)) + 1))
  
print(price(N, num_list, white_num_list))
Problem p04045 (python)

Fixed submission:
import itertools
 
white_num_list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
N, K = map(int, input().split())
black_num_list = list(map(int, input().split()))
 
white_num_list = list(set(white_num_list).difference(set(black_num_list)))
num_combination = list(itertools.product(white_num_list, repeat = len(str(N))))
 
num_list = []
for num in num_combination:
    if num[0] == 0:
        continue
    num_list.append(int(''.join(map(str, num))))
    
num_list = sorted(num_list)
 
def price(N, num_list, white_num_list):
    for num in num_list:
        if num >= N:
            return num
    
    placeholder = str(min(white_num_list)) * (len(str(N)) + 1)
    if placeholder[0] == '0':
        white_num_list.remove(0)
        placeholder = str(min(white_num_list)) + placeholder[1:]
    return int(placeholder)
      
print(price(N, num_list, white_num_list))

Buggy submission (verdict: Runtime Error):
white_num_list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

N, K = map(int, input().split())
black_num_list = list(map(int, input().split()))

white_num_list = list(set(white_num_list).difference(set(black_num_list)))
num_combination = list(itertools.combinations_with_replacement(white_num_list, len(str(N))))

num_list = []
for num in num_combination:
    if num[0] == 0:
        continue
    num_list.append(int(''.join(map(str, num))))

num_list = sorted(num_list)

def price(N, num_list, white_num_list):
    for num in num_list:
        if num >= N:
            return num
    
    if 0 in white_num_list:
        white_num_list.remove(0)
    placeholder = str(min(white_num_list))
    return int(placeholder * (len(str(N)) + 1))
  
print(price(N, num_list, white_num_list))
Problem p03076 (python)

Fixed submission:
times = [int(input()) for _ in range(5)]

total_time = 0
while times:
    if len(times) != 1:
        for i in range(len(times)):
            if times[i] % 10 == 0:
                total_time += times[i]
                times.remove(times[i])
                break
        else:
            rem = 0
            re_time = 0
            for time in times:
                if time % 10 > rem:
                    rem = time % 10
                    re_time = time
            total_time += re_time + (10 - rem)
            times.remove(re_time)
    else:
        total_time += times.pop()
        
print(total_time)

Buggy submission (verdict: Runtime Error):
times = [int(input()) for _ in range(5)]

rem = float("inf")
last = 0
for time in times:
    if time % 10 < rem and time % 10 != 0:
        rem = time % 10
        last = time
times.remove(last)

total_time = 0
for time in times:
    if time % 10 == 0:
        total_time += time
    else:
        total_time += time + (10 - time % 10)
total_time += last

print(total_time)

Buggy submission (verdict: Runtime Error):
times = [int(input()) for _ in range(5)]

rem = float("inf")
last = 0
for time in times:
    if time % 10 < rem and time % 10 != 0:
        rem = time % 10
        last = time
times.remove(last)

total_time = 0
for time in times:
    if time % 10 == 0:
        total_time += time
    else:
        total_time += time + (10 - time % 10)
total_time += last

print(total_time)
Problem p03545 (python)

Fixed submission:
nums = list(map(int, list(input())))

flag = 7
while flag >= 0:
    S = []
    total = nums[0]
    bin_str = format(flag, "03b")
    for i, bit in enumerate(bin_str, 1):
        if int(bit):
            total += nums[i]
            S.append("+")
        else:
            total -= nums[i]
            S.append("-")
    if total == 7:
        break
    
    flag -= 1
print(f"{nums[0]}{S[0]}{nums[1]}{S[1]}{nums[2]}{S[2]}{nums[3]}=7")

Buggy submission (verdict: Runtime Error):
nums = list(map(int, list(input())))

flag = 7
while flag >= 0:
    S = []
    total = nums[0]
    for i, bit in enumerate(bin(flag)[2:], 1):
        if int(bit):
            total += nums[i]
            S.append("+")
        else:
            total -= nums[i]
            S.append("-")
    if total == 7:
        break
    
    flag -= 1

print(f"{nums[0]}{S[0]}{nums[1]}{S[1]}{nums[2]}{S[2]}{nums[3]}=7")

Buggy submission (verdict: Runtime Error):
A, B, C, D = map(int, list(input()))


def check():
    for i in [1, 0]:
        total = A
        if i:
            total += B
        else:
            total -= B
        for j in [1, 0]:
            if j:
                total += C
            else:
                total -= C
            for k in [1, 0]:
                if k:
                    total += D
                else:
                    total -= D
    
                if total == 7:
                    return [i, j, k]

S = []
for s in check():
    if s:
        S.append("+")
    else:
        S.append("-")

print(f"{A}{S[0]}{B}{S[1]}{C}{S[2]}{D}=7")
Problem p02767 (python)

Fixed submission:
N= int(input())
input_data = [int(x) for x in input().split()]
mini = min(input_data)
length=max(input_data)-mini
zahyo = [n-mini for n in input_data]
energy=[0 for i in range(length+1)]
for i in range(length+1):
    for j in range(N):
        energy[i]=energy[i]+(i-zahyo[j])**2
print(min(energy))

Buggy submission (verdict: Runtime Error):
input_data = list(map(int,input().split()))
mini = min(input_data[1:])
length=max(input_data[1:])-mini
zahyo = [n-mini for n in input_data[1:]]
energy=[0 for i in range(length+1)]
for i in range(length+1):
    for j in range(input_data[0]):
        energy[i]=energy[i]+(i-zahyo[j])**2
print(min(energy))

Buggy submission (verdict: Runtime Error):
input_data = list(map(int,input().split()))
mini = min(input_data[1:])
length=max(input_data[1:])-mini
zahyo = [n-mini for n in input_data[1:]]
energy=[0 for i in range(length+1)]
for i in range(length+1):
    for j in range(input_data[0]):
        energy[i]=energy[i]+(i-zahyo[j])**2
print(min(energy))

Buggy submission (verdict: Runtime Error):
input_data = list(map(int,input().split()))
import sys

sys.setrecursionlimit(10**10)
mini = min(input_data[1:])
length=max(input_data[1:])-mini
zahyo = [n-mini for n in input_data[1:]]
energy=[0 for i in range(length+1)]
for i in range(length+1):
    for j in range(input_data[0]):
        energy[i]=energy[i]+(i-zahyo[j])**2
print(min(energy))

Buggy submission (verdict: Runtime Error):
input_data = list(map(int,input().split()))
import sys

sys.setrecursionlimit(10**6)
mini = min(input_data[1:])
length=max(input_data[1:])-mini
zahyo = [n-mini for n in input_data[1:]]
energy=[0 for i in range(length+1)]
for i in range(length+1):
    for j in range(input_data[0]):
        energy[i]=energy[i]+(i-zahyo[j])**2
print(min(energy))

Buggy submission (verdict: Runtime Error):
input_data = list(map(int,input().split()))
mini = min(input_data[1:])
length=max(input_data[1:])-mini
zahyo = [n-mini for n in input_data[1:]]
energy=[0 for i in range(length+1)]
for i in range(length+1):
  for j in range(input_data[0]):
    energy[i]=energy[i]+(i-zahyo[j])**2
print(min(energy))

Buggy submission (verdict: Runtime Error):
input_data = list(map(int,input().split()))
mini = min(input_data[1:])
length=max(input_data[1:])-mini
zahyo = [n-mini for n in input_data[1:]]
energy=[0 for i in range(length+1)]
for i in range(length+1):
    for j in range(input_data[0]):
        energy[i]=energy[i]+(i-zahyo[j])**2
print(min(energy))

Buggy submission (verdict: Runtime Error):
input_data = list(map(int,input().split()))
mini = min(input_data[1:])
length=max(input_data[1:])-mini
zahyo = [n-mini for n in input_data[1:]]
energy=[0 for i in range(length+1)]
for i in range(length+1):
    for j in range(input_data[0]):
        energy[i]=energy[i]+(i-zahyo[j])**2
print(min(energy))
Problem p02922 (python)

Fixed submission:
A,B=input().split()
import math
print(math.ceil((int(B)-1)/(int(A)-1)))

Buggy submission (verdict: Runtime Error):
A,B=input().split()
import math
print(math.ceil((B-1)/A))

Buggy submission (verdict: Runtime Error):
A,B=input().split()
import math
print(math.ceil(B-1)/A)

Buggy submission (verdict: Runtime Error):
import math
print(math.ceil((B-1)/A))

Buggy submission (verdict: Runtime Error):
import math
math.ceil((B-1)/A)

Buggy submission (verdict: Runtime Error):
math.ceil((B-1)/A)
Problem p03076 (python)

Fixed submission:
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
X=[A%10,B%10,C%10,D%10,E%10]
minimum=100
for i in range(5):
  if X[i]!=0:
    minimum=min(minimum,X[i])
Y=[A,B,C,D,E]
if minimum==100:
  minimum=0
last=X.index(minimum)
time=0
import math
for i in range(5):
  if i!=last:
    time =time+10*math.ceil(Y[i]/10)
if X==[0,0,0,0,0]:
  print(sum(Y))
else:
  print(time+Y[last])

Buggy submission (verdict: Runtime Error):
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
X=[A%10,B%10,C%10,D%10,E%10]
minimum=100
for i in range(5):
  if X[i]!=0:
    minimum=min(minimum,X[i])
Y=[A,B,C,D,E]
last=X.index(minimum)
time=0
import math
for i in range(5):
  if i!=last:
    time =time+10*math.ceil(Y[i]/10)
if X==[0,0,0,0,0]:
  print(sum(Y))
else:
  print(time+Y[last])

Buggy submission (verdict: Runtime Error):
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
X=[A%10,B%10,C%10,D%10,E%10]
minimum=100
for i in range(5):
  if X[i]!=0:
    minimum=min(minimum,X[i])
Y=[A,B,C,D,E]
last=X.index(minimum)
time=0
import math
for i in range(5):
  if i!=last:
    time =time+10*math.ceil(Y[i]/10)
print(time+Y[last])
Problem p03161 (python)

Fixed submission:
import numpy as np
import sys
input = sys.stdin.readline
[N,K]=[int(x) for x in input().split()]
h=[int(x) for x in input().split()]
h=np.array(h)
dp=np.zeros(N,dtype=int)
 
for i in range(1,N):
  last=min(K,i)+N-i
  dp[N-i-1]=min(dp[N-i:last]+np.abs(h[N-i:last]-h[N-i-1]))
print(dp[0])

Buggy submission (verdict: Runtime Error):
import numpy as np
[N,K]=[int(x) for x in input().split()]
h=[int(x) for x in input().split()]

dp=[0 for i in range(N)]

for i in range(1,N):
  dp[N-1-i]=dp[N-i]+np.abs(h[N-i-1]-h[N-i])
  for j in range(2,np.min(K+1,i+1)):
    dp[N-i-1]=np.min(dp[N-i-1+j]+np.abs(h[N-i-1]-h[N-1-i+j]),dp[N-i-1])
print(dp[0])
Problem p03163 (python)

Fixed submission:
import numpy as np
[N,W]=[int(x) for x in input().split()]
dp=np.zeros([N+1,W+1],dtype=int)
for i in range(1,N+1):
  w, v=map(int,input().split())
  dp[i][:w]=dp[i-1][:w]
  dp[i][w:]=np.maximum(dp[i-1][w:],dp[i-1][:W-w+1]+v)
print(dp[N][W])

Buggy submission (verdict: Runtime Error):
[N,W]=[int(x) for x in input().split()]
wv=[[0,0]]
for i in range(N):
  wv.append([int(x) for x in input().split()]) 
dp=np.zeros([N+1,W+i],dtype=int)
for i in range(1,N+1):
  dp[i][:w]=dp[i-1][:w]
  dp[i][w:]=max(dp[i-1][w:],dp[i-1][w-wv[i][0]:]+wv[i][1])

print(dp[N][W])
Problem p04033 (python)

Fixed submission:
a,b=map(int,input().split())
if a*b<=0:
  print('Zero')
elif a>0:
  print('Positive')
elif b<0:
  if (b-a+1)%2==0:
    print('Positive')
  else:
    print('Negative')

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if ab<=0:
  print('Zero')
elif a>0:
  print('Positive')
elif b<0:
  if (b-a+1)%2==0:
    print('Positive')
  else:
    print('Negative')
Problem p02882 (python)

Fixed submission:
import math
words = lambda t : list(map(t, input().split()))
a,b,x = words(int)

k = x / (a*a)
if k == b:
    print(0)
elif k*2 == b:
    print(45)
elif k*2 < b:
    print(90 - math.degrees(math.atan(2*x/(a*b*b))))
else:
    p = ((a*b)- (x/a)) / (a/2)
    print(90 - math.degrees(math.atan(a/p)))

Buggy submission (verdict: Runtime Error):
import math
words = lambda t : list(map(t, input().split()))
a,b,x = words(int)

k = x / (a*a)
if k*2 == b:
    print(45)
elif k*2 < b:
    print(90 - math.degrees(math.atan(2*x/(a*b*b))))
else:
    p = ((a*b)- (x/a)) / (a/2)
    print(90 - math.degrees(math.atan(a/p)))

Buggy submission (verdict: Runtime Error):
import math
words = lambda t : list(map(t, input().split()))
a,b,x = words(int)

k = x / (a*a)
print(k)
if k*2 == b:
    print(45)
elif k*2 < b:
    print(90 - math.degrees(math.atan(2*x/(a*b*b))))
else:
    p = ((a*b)- (x/a)) / (a/2)
    print(90 - math.degrees(math.atan(a/p)))

Buggy submission (verdict: Runtime Error):
import math
words = lambda t : list(map(t, input().split()))
a,b,x = words(int)

k = x / (a*a)
print(k)
if k*2 == b:
    print(45)
elif k*2 < b:
    print(90 - math.degrees(math.atan(2*x/(a*b*b))))
else:
    p = ((a*b)- (x/a)) / (a/2)
    print(90 - math.degrees(math.atan(a/p)))
Problem p02910 (python)

Fixed submission:
s = input()
 
res = True
for i in range(len(s)):
  if i % 2 == 0 and s[i] == 'L':
    res = False
    break
  if i % 2 == 1 and s[i] == 'R':
    res = False
    break
 
if res:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
s = input()

res = True
for i in range(lens(s)):
  if i % 2 == 0 and s[i] == 'L':
    res = False
    break
  if i % 2 == 1 and s[i] == 'R':
    res = False
    break

if res:
  print("Yes")
else:
  print("No")
Problem p02941 (python)

Fixed submission:
words = lambda t : list(map(t, input().split()))



n = int(input())
a = words(int)
b = words(int)

def getNext(i):
    if i == n-1:
        return 0
    else:
        return i+1

def getPrev(i):
    if i == 0:
        return n-1
    else:
        return i-1

from collections import deque
q = deque()

def verify(i):
    if b[i] != a[i] and b[i] - (b[getNext(i)] + b[getPrev(i)]) >= a[i]:
        return True
    else:
        return False

for i in range(len(b)):
    if b[i] >= a[i] and verify(i):
        q.append(i)

ans = 0
succeed = True
while not len(q) == 0:
    i = q.popleft()
    ni = getNext(i)
    pi = getPrev(i)
    #print(i, b)
    d = b[ni] + b[pi]
    if b[i] % d == a[i] % d:
        ans += b[i] // d - (a[i] // d)
        b[i] = a[i]
    else:
        ans += b[i] // d
        b[i] %= d
    if b[i] < a[i]:
        succeed = False
        break
    if verify(ni):
        q.append(ni)
    if verify(pi):
        q.append(pi)

for i in range(len(b)):
    if a[i] != b[i]:
        succeed = False
        break

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

Buggy submission (verdict: Runtime Error):
words = lambda t : list(map(t, input().split()))

def getNext(xs, i):
    if i == len(xs)-1:
        return 0
    else:
        return i+1

def getPrev(xs, i):
    if i == 0:
        return len(xs)-1
    else:
        return i-1

n = int(input())
a = words(int)
b = words(int)

import queue
q = queue.Queue()

def verify(i):
    if b[i] - (b[getNext(b,i)] + b[getPrev(b,i)]) >= a[i]:
        return True
    else:
        return False

for i in range(len(b)):
    if verify(i):
        q.put(i)

ans = 0
while not q.empty():
    i = q.get()
    ans += b[i] // (b[getNext(b,i)] + b[getPrev(b,i)])
    b[i] = b[i] % (b[getNext(b,i)] + b[getPrev(b,i)])
    if verify(getNext(b,i)):
        q.put(getNext(b,i))
    if verify(getPrev(b,i)):
        q.put(getPrev(b,i))

succeed = True
for i in range(len(b)):
    if a[i] != b[i]:
        succeed = False
        break

if succeed:
    print(ans)
else:
    print(-1)
Problem p02958 (python)

Fixed submission:
words = lambda t : list(map(t, input().split()))
n = int(input())
xs = words(int)

s_xs = sorted(xs)
ans = False
if s_xs == xs:
    ans = True
else:
    for i in range(n-1):
        for j in range(i,n):
            f_xs = xs.copy()
            tmp = f_xs[i]
            f_xs[i] = f_xs[j]
            f_xs[j] = tmp
            if s_xs == f_xs:
                ans = True
                break
        if ans == True:
            break
if ans == True:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
words = lambda t : list(map(t, input().split()))
n = int(input())
xs = words(int)

s_xs = sorted(xs)
ans = False
if s_xs == xs:
    ans = True
else:
    for i in range(n-1):
        for j in range(i,n):
            f_xs = xs.copy()
            tmp = f_xs[i]
            f_xs[i] = f_xs[j]
            f_xs[j] = tmp
            if s_xs == f_xs:
                ans = True
                break
        if ans == True:
            break
if ans == True:
    print("YES")
else:
    print("NO")