Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
inputs = [list(map(int,input().split())) for i in range(n-1)]
out = []
for station_st in range(n-1):
    spend_time = inputs[station_st][1]+inputs[station_st][0] #次の駅に着く時間

    for st_num_cur in range(station_st+1,n-1):
        train_leave_time = inputs[st_num_cur][1] 
        train_i = 0
        while(inputs[st_num_cur][1]+inputs[st_num_cur][2]*train_i < spend_time):
            train_i += 1
        train_leave_time = inputs[st_num_cur][1] + inputs[st_num_cur][2]*train_i
        spend_time = train_leave_time+inputs[st_num_cur][0] #次の駅で乗れる電車が出発する時間
    print(spend_time)
print(0)

Fixed submission:
n = int(input())
inputs = [list(map(int,input().split())) for i in range(n-1)]
out = []
for station_st in range(n-1):
    spend_time = inputs[station_st][1]+inputs[station_st][0] #次の駅に着く時間

    for st_num_cur in range(station_st+1,n-1):
        if spend_time < inputs[st_num_cur][1]:
            spend_time = inputs[st_num_cur][1]

        train_leave_time = inputs[st_num_cur][1] 
        train_i = 0
        wait_time = 0
        if (spend_time%inputs[st_num_cur][2])!=0:
            wait_time = inputs[st_num_cur][2] - (spend_time%inputs[st_num_cur][2])
        spend_time += wait_time + inputs[st_num_cur][0] #次の駅で乗れる電車が出発する時間
        #print("spend",wait_time,spend_time)
    print(spend_time)
print(0)
Buggy python submission (verdict: Time Limit Exceeded):

q = int(input())
query = [list(map(int,input().split())) for _ in range(q)]

N = int(1e+5)
max_num = int(N**0.5)
is_prime = [True]*(N+1)
is_prime[0] = False
is_prime[1] = False
for i in range(2,max_num+1):
    if not is_prime[i]:
        continue
    for j in range(i*2,N+1,i):
        is_prime[j] = False

ans = [False] * (N+1)
for i in range(3,N+1,2):
    b = (i+1)//2
    if is_prime[i] and is_prime[b]:
        ans[i] = True

for l,r in query:
    print(ans[l:r+1].count(True))

Fixed submission:

q = int(input())
query = [list(map(int,input().split())) for _ in range(q)]

N = int(1e+5)
max_num = int(N**0.5)
is_prime = [True]*(N+1)
is_prime[0] = False
is_prime[1] = False
for i in range(2,max_num+1):
    if not is_prime[i]:
        continue
    for j in range(i*2,N+1,i):
        is_prime[j] = False

ans = [False] * (N+1)
for i in range(3,N+1,2):
    b = (i+1)//2
    if is_prime[i] and is_prime[b]:
        ans[i] = True

comurative_ans = [0] * (N+1)
sum_true = 0
for i in range(N+1):
    if ans[i] :
        sum_true += 1
    comurative_ans[i] = sum_true
for l,r in query:
    print(comurative_ans[r+1]-comurative_ans[l-1])
Buggy python submission (verdict: Runtime Error):
N = int(input())
p = map(int, input().split())
count=0
for i in range(N):
    if p[i] == i:
        count+=1
if count<=2 : 
    print("YES")
else:
    print("NO")

Fixed submission:
N = int(input())
p =list( map( int,input().split() ) )
count=0
for i in range(N):
    if p[i] != (i+1):
        count+=1
if count<=2 : 
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
a, b = [int(e) for e in input().split()]
if (a+b)%2==0:
    return int((a+b)/2)
else:
    return 'IMPOSSIBLE'

Fixed submission:
a, b = [int(e) for e in input().split()]
if (a+b)%2==0:
    print(int((a+b)/2))
else:
    print('IMPOSSIBLE')
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input())
 
l=-1
r=10**6
 
for _ in range(m):
  il, ir=map(int,input())
  l=max(l,il)
  r=min(r,ir)
  
print(max(0,r-l+1))

Fixed submission:
n,m=map(int,input().split())
 
l=-1
r=10**6
 
for _ in range(m):
  il, ir=map(int,input().split())
  l=max(l,il)
  r=min(r,ir)
  
print(max(0,r-l+1))

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input())

l=-1
r=10**6

for _ in range(m):
  il, ir=map(int,input())
  l=max(l,il)
  r=min(r,ir)
  
print(r-l+1)

Fixed submission:
n,m=map(int,input().split())
 
l=-1
r=10**6
 
for _ in range(m):
  il, ir=map(int,input().split())
  l=max(l,il)
  r=min(r,ir)
  
print(max(0,r-l+1))
Buggy python submission (verdict: Runtime Error):
N = 0;
A = 0;
B = 0;

input(N);

if N == 1:
    print("Hello World")
    
else:
    input(A);
    input(B);
    print(A+B);

Fixed submission:
N = input()
N = int(N)

if N == 1:
    print("Hello World")
    
if N == 2:
    A = input()
    B = input()
    A = int(A)
    B = int(B)
    print(A+B);
Buggy python submission (verdict: Runtime Error):
N = int(input().strip('\n'))
lis = []
for i in range(N):
    lis.append(int(input().strip('\n')))
lis = np.sort(np.array(lis))
mx_n = lis[-1]
ms_n = lis[0]
lis = lis[1:-1]
point = mx_n-ms_n
while lis.shape[0]>=2:
    mx = lis[-1]
    ms = lis[0]
    point += (mx_n-ms+mx-ms_n)
    mx_n = mx
    ms_n = ms
    lis = lis[1:-1]
if lis.shape[0]==1:
    point += max(abs(mx_n-lis[0]),abs(ms_n-lis[0]))
print(point)

Fixed submission:
import numpy as np
N = int(input().strip('\n'))
lis = []
for i in range(N):
    lis.append(int(input().strip('\n')))
lis = np.sort(np.array(lis))
mx_n = lis[-1]
ms_n = lis[0]
lis = lis[1:-1]
point = mx_n-ms_n
while lis.shape[0]>=2:
    mx = lis[-1]
    ms = lis[0]
    point += (mx_n-ms+mx-ms_n)
    mx_n = mx
    ms_n = ms
    lis = lis[1:-1]
if lis.shape[0]==1:
    point += max(abs(mx_n-lis[0]),abs(ms_n-lis[0]))
print(point)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input().strip('\n'))
lis = []
for i in range(N):
    lis.append(int(input().strip('\n')))
lis.sort()
mx_n = lis[-1]
ms_n = lis[0]
lis = lis[1:-1]
point = mx_n-ms_n
while len(lis)>=2:
    mx = lis[-1]
    ms = lis[0]
    point += (mx_n-ms+mx-ms_n)
    mx_n = mx
    ms_n = ms
    lis = lis[1:-1]
if len(lis)==1:
    point += max(abs(mx_n-lis[0]),abs(ms_n-lis[0]))
print(point)

Fixed submission:
import numpy as np
N = int(input().strip('\n'))
lis = []
for i in range(N):
    lis.append(int(input().strip('\n')))
lis = np.sort(np.array(lis))
mx_n = lis[-1]
ms_n = lis[0]
lis = lis[1:-1]
point = mx_n-ms_n
while lis.shape[0]>=2:
    mx = lis[-1]
    ms = lis[0]
    point += (mx_n-ms+mx-ms_n)
    mx_n = mx
    ms_n = ms
    lis = lis[1:-1]
if lis.shape[0]==1:
    point += max(abs(mx_n-lis[0]),abs(ms_n-lis[0]))
print(point)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input().strip('\n'))
lis = []
for i in range(N):
    lis.append(int(input().strip('\n')))
mx_n = max(lis)
ms_n = min(lis)
lis.remove(mx_n)
lis.remove(ms_n)
point = mx_n-ms_n
while len(lis)>=2:
    mx = max(lis)
    ms = min(lis)
    point += mx_n-ms
    point += mx-ms_n
    mx_n = mx
    ms_n = ms
    lis.remove(mx)
    lis.remove(ms)
if len(lis)==1:
    point += max(abs(mx_n-lis[0]),abs(ms_n-lis[0]))
print(point)

Fixed submission:
import numpy as np
N = int(input().strip('\n'))
lis = []
for i in range(N):
    lis.append(int(input().strip('\n')))
lis = np.sort(np.array(lis))
mx_n = lis[-1]
ms_n = lis[0]
lis = lis[1:-1]
point = mx_n-ms_n
while lis.shape[0]>=2:
    mx = lis[-1]
    ms = lis[0]
    point += (mx_n-ms+mx-ms_n)
    mx_n = mx
    ms_n = ms
    lis = lis[1:-1]
if lis.shape[0]==1:
    point += max(abs(mx_n-lis[0]),abs(ms_n-lis[0]))
print(point)
Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input().strip('\n'))
k2 = 1+np.sqrt(1+8*N)
if k2%2==0:
    k=int(k2/2)
    print('Yes')
    print(k)
    yel = [1]
    red = [1]
    for i in range(1,k-1):
        yel.append(yel[i-1]+1+i)
        red.append(red[i-1]+i)
    yel = np.array(yel).astype('int16')
    red = np.array(red).astype('int16')
    print(k-1,*yel)
    print(k-1,*red)
    for i in range(1,k-1):
        fs = np.arange(red[i],red[i]+i).astype('int16')
        sc = red[i:]+i
        print(k-1,*fs,*sc)
else:
    print('No')

Fixed submission:
import numpy as np
N = int(input().strip('\n'))
k2 = 1+np.sqrt(1+8*N)
if k2%2==0:
    k=int(k2/2)
    print('Yes')
    print(k)
    yel = [1]
    red = [1]
    for i in range(1,k-1):
        yel.append(yel[i-1]+1+i)
        red.append(red[i-1]+i)
    yel = np.array(yel).astype('int32')
    red = np.array(red).astype('int32')
    print(k-1,*yel)
    print(k-1,*red)
    for i in range(1,k-1):
        fs = np.arange(red[i],red[i]+i).astype('int32')
        sc = red[i:]+i
        fs = np.concatenate((fs,sc))
        print(k-1,*fs)
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
import sys
N = int(input())
a = list(map(int, input()))

s = sorted(a, reverse=True)
m0 = s[0]
m1 = s[1]

for aa in a:
  if aa == m0:
    print(m1)
  else:
    print(m0)

Fixed submission:
import sys
N = int(input())
a = []
for line in sys.stdin.readlines():
  a.append(int(line.strip()))

s = sorted(a, reverse=True)
m0 = s[0]
m1 = s[1]

for aa in a:
  if aa == m0:
    print(m1)
  else:
    print(m0)

Buggy python submission (verdict: Runtime Error):
import sys
N = int(input())
a = list(map(int, input()))

s = sorted(a)
m0 = s[0]
m1 = s[1]

for aa in a:
  if aa == m0:
    print(m1)
  else:
    print(m0)

Fixed submission:
import sys
N = int(input())
a = []
for line in sys.stdin.readlines():
  a.append(int(line.strip()))

s = sorted(a, reverse=True)
m0 = s[0]
m1 = s[1]

for aa in a:
  if aa == m0:
    print(m1)
  else:
    print(m0)
Buggy python submission (verdict: Runtime Error):
N = int(input())
Nlist = [int(i) for i in input().split()]

sum = 0
cnt = 0
for i in range(N):
    if cnt > 2:
        break

    if Nlist[i] == (i + 1):
        continue
    else:
        sum += Nlist[i]
        cnt += 1

if cnt == 0 or sum == (N + 1):
    print("YES")
else:
    print("NO")

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

if a < b:
    A = a
    B = b
else:
    A = b
    B = a

if (B - A) % 2 != 0:
	print("IMPOSSIBLE")
else: 
	K = int(B - (B - A) / 2)
	print(str(K))

Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())

if (a + b) % 2 != 0:
    print("IMPOSSIBLE")
else:
    if a < b:
        A = a
        B = b
    else:
        A = b
        B = a

    K = int(B - (B - A) / 2)
    print(str(K))


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

if a < b:
    A = a
    B = b
else:
    A = b
    B = a

if (B - A) % 2 != 0:
	print("IMPOSSIBLE")
else: 
	K = int(B - (B - A) / 2)
	print(str(K))

Buggy python submission (verdict: Runtime Error):
import math
a, b = [int(i) for i in input().split()]
r = a - b if a > b else b - a
if r % 2 is 0:
  print(abs(int(r / 2)) + (a if a < b else b))
  else:
    print("IMPOSSIBLE")

Fixed submission:
import math
a, b = [int(i) for i in input().split()]
r = a - b if a > b else b - a
if r % 2 is 0:
  print(abs(int(r / 2)) + (a if a < b else b))
else:
  print("IMPOSSIBLE")
Buggy python submission (verdict: Runtime Error):
A, B = input().split(" ")
if A <= 8 and B <= 8:
    print("Yay!")
else:
    print(":(")

Fixed submission:
A, B = list(int(a) for a in input().split(" "))
if A <= 8 and B <= 8:
    print("Yay!")
else:
    print(":(")
Buggy python submission (verdict: Runtime Error):
ans = ""
for i in range(len(s)):
  if(i % 2 == 0):
    ans = ans + s[i]
print(ans)

Fixed submission:
s = input()
ans = ""
for i in range(len(s)):
  if(i % 2 == 0):
    ans = ans + s[i]
    
print(ans)

Buggy python submission (verdict: Runtime Error):
s = intpu()
ans = ""
for i in range(len(s)):
  if(i % 2 == 0):
    ans = ans + s[i]
print(ans)

Fixed submission:
s = input()
ans = ""
for i in range(len(s)):
  if(i % 2 == 0):
    ans = ans + s[i]
    
print(ans)
Buggy python submission (verdict: Runtime Error):
strs = input().split()
if strs[0][len(strs[0]) -1] == strs[1][0] and strs[1][len(strs[0]) -1] == strs[2][0]:
    print("YES")
else:
    print("NO")

Fixed submission:
strs = input().split()
if strs[0][len(strs[0]) -1] == strs[1][0] and strs[1][len(strs[1]) -1] == strs[2][0]:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
def alice(x, y):
    return turn(x, y)

def brown(x, y):
    return turn(x, y)

def turn(x, y):
    a = 0
    if x < y or x == y:
        a = y / 2
        y = y - a * 2
        x = x + a
    else:
        a = x / 2
        x = x - a * 2
        y = y + a
    if a == 0:
        return [False, x, y]
    return [True, x, y]

nums = input().split(" ")
x = int(nums[0])
y = int(nums[1])
while True:
    result, x, y = alice(x, y)
    if result == False:
        print('Brown')
        break
    result, x, y = brown(x, y)
    if result == False:
        print('Alice')
        break

Fixed submission:
str = input()
strs = str.split(" ")
ans = ""
for str in strs:
    ans = ans+str[0].upper()
print(ans)

Buggy python submission (verdict: Runtime Error):
x, y = input().split(" ")
while():
    if alice() == False:
        print('Brown')
        break
    if brown() == False:
        print('Alice')
        break


def turn():
    a = 0
    if x < y or x == y:
        a = y / 2
        y = y - a * 2
        x = x + a
    else:
        a = x / 2
        y = x - a * 2
        x = y + a
    if a == 0:
        return False
    return True

def alice():
    return turn()

def brown():
    return turn()

Fixed submission:
str = input()
strs = str.split(" ")
ans = ""
for str in strs:
    ans = ans+str[0].upper()
print(ans)
Buggy python submission (verdict: Runtime Error):
L,R = map(int,input().split())

ans = (L+R)/2

if ans.is_integer():
  return int(ans)
else:
  return "IMPOSSIBLE"

Fixed submission:
L,R = map(int,input().split())

ans = (L+R)/2

if ans.is_integer():
  print(int(ans))
else:
  print("IMPOSSIBLE")
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
import sys

n = int(row_input())

print n*(n+1)/2

Fixed submission:
# coding: utf-8
import sys
     
n = int(raw_input())
     
print n*(n+1)/2

Buggy python submission (verdict: Runtime Error):
# coding: utf-8

n = int(row_input())

print n*(n+1)/2

Fixed submission:
# coding: utf-8
import sys
     
n = int(raw_input())
     
print n*(n+1)/2
Buggy python submission (verdict: Runtime Error):
import sys
 
data = sys.stdin.readline()
 
a, b = data.strip().split()
 
if a == b:
    print(0)
else:
  k = (a + b) / 2
  if k.is_integer():
    print(k)
  else:
    print('IMPOSSIBLE')

Fixed submission:
a, b = (int(x) for x in input().split()) 
if a == b:
    print(0)
else:
  k = (a + b) / 2
  if k.is_integer():
    print(int(k))
  else:
    print('IMPOSSIBLE')

Buggy python submission (verdict: Runtime Error):
import sys

data = sys.stdin.readline()

a, b = data.strip().split()

if a == b:
  return 0
else:
  k = (a + b) / 2
  if k.is_integer():
    return k
  else:
    return 'IMPOSSIBLE'



Fixed submission:
a, b = (int(x) for x in input().split()) 
if a == b:
    print(0)
else:
  k = (a + b) / 2
  if k.is_integer():
    print(int(k))
  else:
    print('IMPOSSIBLE')
Buggy python submission (verdict: Runtime Error):
n = input()
s = input().split()
s=[int(i) for i in s]
count=-1
for i in range(int(n)//2):
   if s[i] + s[count] ==int(n)+1:
      count-=1
   	else:
      print("No")

if int(n) %2 ==0：
   print("YES")
else:
   if s[count]*2 == n :
    print("YES")
    else:
      print("NO")
  

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

count=0
for i in range(int(n)):
  if N[i] !=i+1:
    count+=1
if count > 2:
  print("NO")
else:
  print("YES")
Buggy python submission (verdict: Runtime Error):
if (a * b)%2 == 0:
  print('Even')
else:
  print('Odd')

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

if a*b%2 ==0:
  print('Even')
else:
  print('Odd')
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
a, b = map(int, input().split())
if isinstance((a + b) / 2):
    print((a + b) / 2)
else:
    print("IMPOSSIBLE")


Fixed submission:
# -*- coding: utf-8 -*-
a, b = map(int, input().split())
if (a + b) % 2 == 0:
    print((a + b) // 2)
else:
    print("IMPOSSIBLE")

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
if (a+b)%2==1:
  print("IMIMPOSSIBLE")
else:
  print(a+b)//2

Fixed submission:
a,b=map(int, input().split())
if (a+b)%2==1:
  print("IMPOSSIBLE")
else:
  print((a+b)//2)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input(''))

xs = []
for i in range(n):
    xs.append(int(input('')))

for i in range(n):
    print(max(xs[0:i] + xs[i+1:]))


Fixed submission:
n = int(input(''))

xs = []
for i in range(n):
    xs.append(int(input('')))

n1 = max(xs)
n2 = sorted(xs)[-2]

for x in xs:
    if x == n1:
        print(n2)
    else:
        print(n1)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input(''))

xs = []
for i in range(n):
    xs.append(int(input('')))

for i in range(n):
    print(max(xs[0:i] + xs[i+1:]))


Fixed submission:
n = int(input(''))

xs = []
for i in range(n):
    xs.append(int(input('')))

n1 = max(xs)
n2 = sorted(xs)[-2]

for x in xs:
    if x == n1:
        print(n2)
    else:
        print(n1)
Buggy python submission (verdict: Runtime Error):
nums = map(int,input().split())
multiple = nums[0]*nums[1]
if multiple % 2 == 0:
  print('Even')
else:
  print('Odd')

Fixed submission:
a,b = map(int,input().split())
multiple = a*b
if multiple % 2 == 0:
  print('Even')
else:
  print('Odd')

Buggy python submission (verdict: Runtime Error):
nums = map(int,input().split())
multiple = nums[0]*nums[1]
if multiple % 2 == 0:
  print('Even')
else
  print('Odd')

Fixed submission:
a,b = map(int,input().split())
multiple = a*b
if multiple % 2 == 0:
  print('Even')
else:
  print('Odd')
Buggy python submission (verdict: Runtime Error):
#!/bin/python3

a, b = input().split(" ")

if a % 2 == b % 2:
    print((a + b) / 2)
else:
    print("IMPOSSIBLE")


Fixed submission:
# -*- coding: utf-8 -*-

a, b = map(int, input().split(" "))
if a % 2 == b % 2:
    print(int((a + b) / 2))
else:
    print("IMPOSSIBLE")
Buggy python submission (verdict: Time Limit Exceeded):
import math
S = int(input())

x,y = 1,S

for i in range(2,1+int(math.sqrt(S))):
    if S%i == 0:
        x = i
        y = S//i
        if y <= 10**9:
            break
    
    
print("{} {} {} {} {} {}".format(0,0,0,x,y,x))


Fixed submission:
import math
S = int(input())

x,y = 1,S
ret = int(math.sqrt(S))
if(ret**2 == S):
    print("{} {} {} {} {} {}".format(0,0,0,ret,ret,ret))
else:
    print("{} {} {} {} {} {}".format(0,0,ret+1,(ret+1)**2-S,1,ret+1))

Buggy python submission (verdict: Runtime Error):
import math
S = int(input())

x,y = 1,S

for i in xrange(2,1+int(math.sqrt(S))):
    if S%i == 0:
        x = i
        y = S//i
        if y <= 10**9:
            break
    
    
print("{} {} {} {} {} {}".format(0,0,0,x,y,x))


Fixed submission:
import math
S = int(input())

x,y = 1,S
ret = int(math.sqrt(S))
if(ret**2 == S):
    print("{} {} {} {} {} {}".format(0,0,0,ret,ret,ret))
else:
    print("{} {} {} {} {} {}".format(0,0,ret+1,(ret+1)**2-S,1,ret+1))
Buggy python submission (verdict: Runtime Error):
a , b = map(int, input().split())
c= a*b 
c=c%2
if c==1:
  print(Odd)
else:
  print(Even)
  

Fixed submission:
a , b = map(int, input().split())
c= a*b 
c=c%2
if c==1:
  print("Odd")
else:
  print("Even")
Buggy python submission (verdict: Runtime Error):
import math
a,b= input().split()
d = math.sqrt(int(a+b))

//小数判定
if d%1==0:
  print("YES")
else:
  print("NO")

Fixed submission:
import math
a,b= input().split()
d = math.sqrt(int(a+b))


if d%1==0:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
 a, b = map(int, input().split())
 if (abs(a)+abs(b))%2 == 0:
     print(int((abs(a) + abs(b))/2))
 else:
     print("IMPOSSIBLE")

Fixed submission:
a, b = map(int, input().split())
if (abs(a)+abs(b))%2 == 0:
    print(int((abs(a) + abs(b))/2))
else:
    print("IMPOSSIBLE")

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
if a != b:
    c = (abs(a) + abs(b))/2
    if type(c) is int:
        print(c)
        return
if a == b:
    print(0)
    return
print("IMPOSSIBLE")


Fixed submission:
a, b = map(int, input().split())
if (abs(a)+abs(b))%2 == 0:
    print(int((abs(a) + abs(b))/2))
else:
    print("IMPOSSIBLE")
Buggy python submission (verdict: Runtime Error):
N = intpu()
seq = list(map(int, input().split()))

for i in range(len(seq)-1):
    if seq[i] <= min(seq[i+1:]):
        continue
    elif seq[i] > min(seq[i+1:]):
        j = seq.index(min(seq[i+1:]))
        if seq[i] > min(seq[i+1:j]+seq[j+1:]):
            print("NO")
            break
        seq[i], seq[j] = seq[j], seq[i]
else:
    print("YES")


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

is_switched = False
for i in range(len(seq)-1):
    if seq[i] <= min(seq[i+1:]):
        continue
    elif seq[i] > min(seq[i+1:]):
        if is_switched:
            print("NO")
            break
        j = seq.index(min(seq[i+1:]))
        seq[i], seq[j] = seq[j], seq[i]
        is_switched = True
else:
    print("YES")
Buggy python submission (verdict: Runtime Error):
 N = int(input())
 monstors = [int(i) for i in input().split()]
 heros = [int(i) for i in  input().split()]
 init_monstor = sum(monstors)

 for i in range(N):
     if monstors[i] >= heros[i]:
         monstors[i] -= heros[i]
         heros[i] = 0
     else:
         heros[i] -= monstors[i]
         monstors[i] = 0
     if monstors[i+1] >= heros[i]:
         monstors[i+1] -= heros[i]
         heros[i] = 0
     else:
         heros[i] -= monstors[i+1]
         monstors[i+1] = 0
 print(init_monstor - sum(monstors))

Fixed submission:
N = int(input())
monstors = [int(i) for i in input().split()]
heros = [int(i) for i in input().split()]
init_monstor = sum(monstors)

for i in range(N):
    if monstors[i] >= heros[i]:
        monstors[i] -= heros[i]
        heros[i] = 0
    else:
        heros[i] -= monstors[i]
        monstors[i] = 0
    if monstors[i+1] >= heros[i]:
        monstors[i+1] -= heros[i]
        heros[i] = 0
    else:
        heros[i] -= monstors[i+1]
        monstors[i+1] = 0
print("{}".format(init_monstor - sum(monstors)))
Buggy python submission (verdict: Runtime Error):
l = int(input())
s = input()
s_dict = {}
for i in range(0, len(s)):
    if not s[i] in s_dict:
        s_dict[s[i]] = 1
    else:
        s_dict[s[i]] += 1
ans = 2**l
for v in s_dict.values():
    if not v == 1:
        ans *= (v+1)/2**v

print(int(ans-1)%(10**9+7))


Fixed submission:
l = int(input())
s = input()
s_dict = {}
l = len(s)
for i in range(l):
    if not s[i] in s_dict:
        s_dict[s[i]] = 1
    else:
        s_dict[s[i]] += 1
ans = 1
for v in s_dict.values():
    if v == 1:
    	ans *= 2
    else:
        ans *= v+1

print(int(ans-1)%(10**9+7))

Buggy python submission (verdict: Runtime Error):
l = int(input())
s = input()
s_dict = {}

for i in range(0, len(s)):
    if not s[i] in s_dict:
        s_dict[s[i]] = 1
    else:
        s_dict[s[i]] += 1

ans = 2**l
for v in s_dict.values():
    if not v == 1:
        ans =ans* (1-1/2**v)

print(int(ans-1))


Fixed submission:
l = int(input())
s = input()
s_dict = {}
l = len(s)
for i in range(l):
    if not s[i] in s_dict:
        s_dict[s[i]] = 1
    else:
        s_dict[s[i]] += 1
ans = 1
for v in s_dict.values():
    if v == 1:
    	ans *= 2
    else:
        ans *= v+1

print(int(ans-1)%(10**9+7))

Buggy python submission (verdict: Runtime Error):
l = int(input())
s = input()
s_dict = {}

for i in range(0, len(s)):
    if not s[i] in s_dict:
        s_dict[s[i]] = 1
    else:
        s_dict[s[i]] += 1

ans = 2**l
for v in s_dict.values():
    if not v == 1:
        ans =ans* (1-1/2**v)

print(int(ans-1)%(10**9+7))


Fixed submission:
l = int(input())
s = input()
s_dict = {}
l = len(s)
for i in range(l):
    if not s[i] in s_dict:
        s_dict[s[i]] = 1
    else:
        s_dict[s[i]] += 1
ans = 1
for v in s_dict.values():
    if v == 1:
    	ans *= 2
    else:
        ans *= v+1

print(int(ans-1)%(10**9+7))

Buggy python submission (verdict: Runtime Error):

l = int(input())
s = input()
s_dict = {}

for i in range(0, len(s)):
    if not s[i] in s_dict:
        s_dict[s[i]] = 1
    else:
        s_dict[s[i]] += 1

ans = 2**l
for v in s_dict.values():
    if not v == 1:
        ans *= ((2**v-1)/2**v)

ans -= 1
print(int(ans%(10**9+7)))


Fixed submission:
l = int(input())
s = input()
s_dict = {}
l = len(s)
for i in range(l):
    if not s[i] in s_dict:
        s_dict[s[i]] = 1
    else:
        s_dict[s[i]] += 1
ans = 1
for v in s_dict.values():
    if v == 1:
    	ans *= 2
    else:
        ans *= v+1

print(int(ans-1)%(10**9+7))