Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
s = input()

if s[2] == s[3]:
    if s[4] == s[5]:
        print('Yes)
    else:
      print('No')
else:
    print("No")


Fixed submission:
s = input()

if s[2] == s[3]:
    if s[4] == s[5]:
        print('Yes')
    else:
      print('No')
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
P = list(map(int, input().split()))

# print( (max(sum(P[i:i+K]) for i in range(0, N-K+1)) + K)/2 )

result = 0
for i in range(0, N-K+1):
    tmp = sum(P[i:i+K])
    if (tmp > result):
        result = tmp

print((result+K)/2)

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

# print( (max(sum(P[i:i+K]) for i in range(0, N-K+1)) + K)/2 )

tmp = sum(P[0:K])
result = tmp

for i in range(1, N-K+1):
    tmp += (P[i+K-1] - P[i-1])
    if (tmp > result):
        result = tmp

print((result+K)/2)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
P = list(map(int, input().split()))

print( (max(sum(P[i:i+K]) for i in range(0, N-K+1)) + K)/2 )


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

# print( (max(sum(P[i:i+K]) for i in range(0, N-K+1)) + K)/2 )

tmp = sum(P[0:K])
result = tmp

for i in range(1, N-K+1):
    tmp += (P[i+K-1] - P[i-1])
    if (tmp > result):
        result = tmp

print((result+K)/2)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
H = [int(x) for x in input().split()]
# print(N,H)
result = "Yes"

for i in range(len(H)-1):
    if (H[i]-1 > min(H[i+1:])):
        result = "No"
        break

print(result)

Fixed submission:
N = int(input())
H = [int(x) for x in input().split()]
# print(N,H)
result = "Yes"
top = 0
for i in range(len(H)):
    if (H[i] < top-1 ):
        result = "No"
        break
    top = max(top, H[i])

print(result)
Buggy python submission (verdict: Runtime Error):
import math
A, B, C, D = map(int, input().split())


#     {x | A <= x <= B and x % C != 0 and x % D != 0}
# =             {x | 1 <= x <= B and x % C != 0 and x % D != 0}
#           -   {x | 1 <= x <= A-1 and x % C != 0 and x % D != 0}
# =   {x | 1 <= x <= B} - {x | 1 <= x <= B and x % C = 0} - {x | 1 <= x <= B and x % D = 0} + - {x | 1 <= x <= B and x % C = 0 and x % D = 0}
#     (略)

def func(x,y):
    # print(x,y,math.floor((x/y)))
    return math.floor((x/y))

# print(func(100,10))

lcm = C * D /math.gcd(C, D)
print( (B - (func(B, C) + func(B, D) - func(B, lcm))) -
       (A-1 - (func(A-1, C) + func(A-1, D) - func(A-1, lcm))) )

Fixed submission:
import fractions
A, B, C, D = map(int, input().split())


def func(x,y):
    if(x<0):
        assert()
    if(y<=0):
        assert()
    # print(x,y,int(x/y))
    # return int((x/y))
    # print(x,y,x//y)
    return int((x//y))

# print(func(100,10))


lcm = int((C * D) / int(fractions.gcd(C, D)))
print(int( B - func(B, C) - func(B, D) + func(B, lcm) - A + 1 + func(A-1, C) + func(A-1, D) - func(A-1, lcm)))
Buggy python submission (verdict: Runtime Error):
import math

N = int(input())

A = [int(x) for x in input().split()]

ret = A[0]
for i in range(1,N):
	ret = math.gcd(ret,A[i])

print(ret)


Fixed submission:
import fractions

N = int(input())

A = [int(x) for x in input().split()]

ret = A[0]
for i in range(1,N):
	ret = fractions.gcd(ret,A[i])

print(ret)
Buggy python submission (verdict: Runtime Error):
S = input()

# print(S)
# print(len(S))


t_sub = ["dreamer", "dream", "eraser", "erase"]
i = 0


def check_1(S, i, t_sub):
    # print("check_1(",S,", ",i,")")
    for t in t_sub:
        # print("check ",t)
        if (S.find(t, i) == i):
            # print("hit " ,t,"at ",i)
            if (i+len(t) == len(S)):
                return "YES"
            else:
                if(check_1(S, i + len(t), t_sub) == "YES"):
                    return "YES"

    # print("cant find ",i )                
    return "NO"


print(check_1(S, i, t_sub))


Fixed submission:
S = input()
S = S[::-1]
# print(S)
# print(len(S))


# t_sub = ["dreamer", "dream", "eraser", "erase"]
t_sub = ["remaerd", "maerd", "resare", "esare"]

def func():
    i = 0
    while True:
        flag = False
        for t in t_sub:
            ret = (S.find(t, i) == i)
            # print(S,".find(",t,", ",i,") == ",i, "ret=", ret)
            if ret ==True:
                if (i+len(t) == len(S)):
                    return "YES"
                else:
                    i += len(t)
                    flag = True
                    break
        if flag != True:
            return "NO"

print(func())
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python

def main():
    A, B = map(float, input().split())
    print(int((A * B) / /1))

if __name__ == '__main__':
    main()

Fixed submission:
from decimal import *
A, B = map(Decimal, input().split())
print(int(A * B // 1))
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python

def main():
    N, M, X = map(int, input().split())
    mat = [list(map(int, input().split())) for _ in range(N)]

    ans = 12 * (10 ** 5) +1
    for i in range(1<<N):
        tmp = [0] * (M+1)
        for j in range(N):
            if (i>>j)&1:
                tmp = [x+y for x, y in zip(tmp, mat[j])]
        if all(tmp[i] >= X for i in range(1, M):
                ans = min(ans, tmp[0])

    print('-1') if ans == 12 * (10 ** 5) +1 else print(ans)
            
if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python

def main():
    N, M, X = map(int, input().split())
    mat = [list(map(int, input().split())) for _ in range(N)]

    flag = False
    ans = 10 ** 18

    for i in range(1<<N):
        tmp = [0] * (M+1)
        mflag = True
        for j in range(N):
            if (i>>j)&1:
                tmp = [x+y for x, y in zip(tmp, mat[j])]
        for k in range(M):
            if tmp[1+k] < X:
                mflag = False
                break
        if mflag and tmp[0] < ans:
            ans = tmp[0]
            flag = True
    print(ans) if flag else print('-1')

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
k = int(input())
a, b = map(int, input().split())

flag = False
for i in range(a, b+1):
	if i % k == 0:
    	flag = True

print("OK") if flag else print("NG")

Fixed submission:
k = int(input())
a, b = map(int, input().split())
 
flag = False
for i in range(a, b+1):
    if i % k == 0:
        flag = True
 
print("OK") if flag else print("NG")
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
import sys
from collections import Counter
from itertools import permutations, combinations_with_replacement
from fractions import gcd
from math import ceil, floor
sys.setrecursionlimit(10 ** 6)

def input():
    return sys.stdin.readline()[:-1]

def main():
    n = int(input())
    ans = 0
    for c in combinations_with_replacement(list(range(1, n+1)), 3):
        if c[0] == c[1] and c[1] == c[2]:
            ans += gcd(gcd(c[0], c[1]), c[2])
        elif c[0] != c[1] and c[1] != c[2]:
            ans += gcd(gcd(c[0], c[1]), c[2]) * 6
        else:
            ans += gcd(gcd(c[0], c[1]), c[2]) * 3
    print(ans)

if __name__ == '__main__':
    main()

Fixed submission:
#!/usr/bin/env python
import sys
from collections import Counter
from itertools import permutations, combinations
from math import gcd
from math import ceil, floor
sys.setrecursionlimit(10 ** 6)

def input():
    return sys.stdin.readline()[:-1]

def main():
    n = int(input())
    ans = 0
    for a in range(1, n+1):
        for b in range(1, n+1):
            tmp = gcd(a, b)
            for c in range(1, n+1):
                ans += gcd(tmp, c)
    print(ans)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
import sys
from collections import Counter
from itertools import permutations, combinations
from fractions import gcd
from math import ceil, floor
sys.setrecursionlimit(10 ** 6)

def input():
    return sys.stdin.readline()[:-1]

def main():
    n = int(input())
    ans = 0
    for i in range(1, n+1):
        for j in range(1, n+1):
            for k in range(1, n+1):
                ans += gcd(gcd(i, j), k)
    print(ans)

if __name__ == '__main__':
    main()

Fixed submission:
#!/usr/bin/env python
import sys
from collections import Counter
from itertools import permutations, combinations
from math import gcd
from math import ceil, floor
sys.setrecursionlimit(10 ** 6)

def input():
    return sys.stdin.readline()[:-1]

def main():
    n = int(input())
    ans = 0
    for a in range(1, n+1):
        for b in range(1, n+1):
            tmp = gcd(a, b)
            for c in range(1, n+1):
                ans += gcd(tmp, c)
    print(ans)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
import sys
from collections import Counter
from itertools import permutations, combinations
from fractions import gcd
from math import ceil, floor
sys.setrecursionlimit(10 ** 6)

def input():
    return sys.stdin.readline()[:-1]

def main():
    n = int(input())
    s = input()
    ans = 0
    for idx1, letter1 in enumerate(s):
        for idx2, letter2 in enumerate(s[idx1+1:]):
            if letter1 != letter2:
                for idx3, letter3 in enumerate(s[idx2+idx1+2:]):
                    if letter1 != letter3 and letter2 != letter3 and idx2 != idx3:
                        ans += 1
    print(ans)

if __name__ == '__main__':
    main()

Fixed submission:
#!/usr/bin/env python
import sys
from collections import Counter
from itertools import permutations, combinations
from math import ceil, floor, gcd
sys.setrecursionlimit(10 ** 6)

def input():
    return sys.stdin.readline()[:-1]

def main():
    N = int(input())
    S = input()

    c = Counter(S)
    r_c = c['R']
    g_c = c['G']
    b_c = c['B']
    ans = r_c * g_c * b_c

    for i in range(N):
        for j in range(i+1, N):
            k = 2 * j - i
            if k > N-1:
                break
            elif i < j < k and S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
                ans -= 1
    print(ans)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
import sys
from collections import Counter
from itertools import permutations, combinations
#from fractions import gcd
from math import gcd
from math import ceil, floor
import bisect
sys.setrecursionlimit(10 ** 6)
inf = float("inf")

def input():
    return sys.stdin.readline()[:-1]

def main():
    x, y, z = map(int, input().split())
    print(z, x, y) 


if __name__ == '__main__':
    main()

Fixed submission:
#!/usr/bin/env python
import sys
from collections import Counter
from itertools import permutations, combinations
#from fractions import gcd
from math import ceil, floor
import bisect
sys.setrecursionlimit(10 ** 6)
inf = float("inf")

def input():
    return sys.stdin.readline()[:-1]

def main():
    x, y, z = map(int, input().split())
    print(z, x, y) 


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
import sys
from collections import Counter
from itertools import permutations, combinations
#from fractions import gcd
from math import gcd
from math import ceil, floor
import bisect
sys.setrecursionlimit(10 ** 6)
inf = float("inf")

def input():
    return sys.stdin.readline()[:-1]

def main():
    n, m = map(int, input().split())
    A = tuple(map(int, input().split()))
    ans = 0
    total = sum(A)
    for a in A:
        if a >= total/(4*m):
            ans += 1
    print("Yes") if ans >= m else print("No")

if __name__ == '__main__':
    main()



Fixed submission:
#!/usr/bin/env python
import sys
from collections import Counter
from itertools import permutations, combinations
#from fractions import gcd
from math import ceil, floor
import bisect
sys.setrecursionlimit(10 ** 6)
inf = float("inf")

def input():
    return sys.stdin.readline()[:-1]

def main():
    n, m = map(int, input().split())
    A = tuple(map(int, input().split()))
    ans = 0
    total = sum(A)
    for a in A:
        if a >= total/(4*m):
            ans += 1
    print("Yes") if ans >= m else print("No")

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
def input():
    return sys.stdin.readline()[:-1]

def main():
    K, N = map(int, input().split())
    A = tuple(map(int, input().split()))
    tmp = 0
    for i in range(N-1):
        tmp = max(tmp, A[i+1] - A[i])

    tmp = max(tmp, (K-A[N-1]+A[0]))
    print(K-tmp)

if __name__ == '__main__':
    main()

Fixed submission:
#!/usr/bin/env python
import sys
def input():
    return sys.stdin.readline()[:-1]

def main():
    K, N = map(int, input().split())
    A = tuple(map(int, input().split()))
    tmp = 0
    for i in range(N-1):
        tmp = max(tmp, A[i+1] - A[i])

    tmp = max(tmp, (K-A[N-1]+A[0]))
    print(K-tmp)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
from collections import Counter
import sys
from functools import lru_cache

input = sys.stdin.readline

@lru_cache(maxsize=None)
def main():
    n = int(input().rstrip())
    l = list(input().rstrip().split())

    c = Counter(l)
    for item in l:
        ans = 0
        for key in c:
            tmp = c[key]
            if key == item:
                tmp -= 1
            ans += tmp * (tmp - 1) // 2
        print(ans)
    
if __name__ == '__main__':
    main()

Fixed submission:
#!/usr/bin/env python
from collections import Counter
import sys

input = sys.stdin.readline

def main():
    n = int(input().rstrip())
    l = list(input().rstrip().split())

    c = Counter(l)
    total = 0
    for key in c:
        total += c[key] * (c[key] -1) // 2
    for item in l:
        print(total - (c[item] -1))
    
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
from collections import Counter
import sys

input = sys.stdin.readline

def main():
    n = int(input().rstrip())
    l = list(input().rstrip().split())

    c = Counter(l)
    for item in l:
        ans = 0
        for key in c:
            tmp = c[key]
            if key == item:
                tmp -= 1
            ans += tmp * (tmp - 1) // 2
        print(ans)
    
if __name__ == '__main__':
    main()

Fixed submission:
#!/usr/bin/env python
from collections import Counter
import sys

input = sys.stdin.readline

def main():
    n = int(input().rstrip())
    l = list(input().rstrip().split())

    c = Counter(l)
    total = 0
    for key in c:
        total += c[key] * (c[key] -1) // 2
    for item in l:
        print(total - (c[item] -1))
    
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python

def input():
    return sys.stdin.readline()[:-1]

def main():
    n, a, b = map(int, input().split())
    print(n // (a+b) * a + min(n % (a+b), a))

if __name__ == '__main__':
    main()

Fixed submission:
#!/usr/bin/env python

def main():
    n, a, b = map(int, input().split())
    print(n // (a+b) * a + min(n % (a+b), a))

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python

main():
    N = int(input())
    A = tuple(map(int, input().split()))
    s = set()
    for a in A:
        if a in s:
            print("NO")
            exit()
        else:
            s.add(a)
    print("YES")

if __name__ == '__main__':
    main()

Fixed submission:
#!/usr/bin/env python

def main():
    N = int(input())
    A = tuple(map(int, input().split()))
    s = set()
    for a in A:
        if a in s:
            print("NO")
            exit()
        else:
            s.add(a)
    print("YES")

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python

def main():
    N, M = map(int, input().split())
    # [AC, WA]
    cnt = [[0, 0] for _ in range(2)]
    for _ in range(M):
        num, status = input().split()
        num = int(num) -1
        if status == "AC":
            if cnt[num][0] == 0:
                cnt[num][0] += 1
        if status == "WA":
            if cnt[num][0] == 0:
                cnt[num][1] += 1

    ac_cnt, wa_cnt = 0, 0
    for i in range(N):
        ac_cnt += cnt[i][0]
        wa_cnt += cnt[i][1]

    print(ac_cnt, wa_cnt, sep=" ")

if __name__ == '__main__':
    main()

Fixed submission:
#!/usr/bin/env python

def main():
    N, M = map(int, input().split())
    # [AC, WA]
    cnt = [[0, 0] for _ in range(N)]
    for _ in range(M):
        num, status = input().split()
        num = int(num) -1
        if status == "AC":
            if cnt[num][0] == 0:
                cnt[num][0] += 1
        if status == "WA":
            if cnt[num][0] == 0:
                cnt[num][1] += 1

    ac_cnt, wa_cnt = 0, 0
    for i in range(N):
        if cnt[i][0] == 1:
            ac_cnt += cnt[i][0]
            wa_cnt += cnt[i][1]

    print(ac_cnt, wa_cnt, sep=" ")

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
import sys
from collections import Counter
from itertools import permutations, combinations
from math import ceil, floor, gcd
sys.setrecursionlimit(10 ** 6)

def input():
    return sys.stdin.readline()[:-1]

def main():
    n = int(input())
    p = tuple(map(int, input().split()))
    q = tuple(map(int, input().split()))
    l = permutations(list(range(1, n+1)))
    if p == q:
        print(0)
    else:
        for idx, item in enumerate(l):
            if item == p:
                idp = idx
            elif item == q:
                idq = idx
        print(abs(idp - idq))

if __name__ == '__main__':
    main()

Fixed submission:
#!/usr/bin/env python
import sys
from collections import Counter
from itertools import permutations, combinations
from fractions import gcd
from math import ceil, floor
sys.setrecursionlimit(10 ** 6)

def input():
    return sys.stdin.readline()[:-1]

def main():
    n = int(input())
    p = tuple(map(int, input().split()))
    q = tuple(map(int, input().split()))
    l = permutations(list(range(1, n+1)))
    if p == q:
        print(0)
    else:
        for idx, item in enumerate(l):
            if item == p:
                idp = idx
            elif item == q:
                idq = idx
        print(abs(idp - idq))

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
import sys
from collections import Counter
from itertools import permutations, combinations
from math import ceil, floor, gcd
sys.setrecursionlimit(10 ** 6)

def input():
    return sys.stdin.readline()[:-1]

def main():
    n = int(input())
    p = tuple(map(int, input().split()))
    q = tuple(map(int, input().split()))
    l = permutations(list(range(1, n+1)))
    if p == q:
        print(0)
        exit()
    for idx, item in enumerate(l):
        if item == p:
            idp = idx
        elif item == q:
            idq = idx
    print(abs(idp - idq))

if __name__ == '__main__':
    main()

Fixed submission:
#!/usr/bin/env python
import sys
from collections import Counter
from itertools import permutations, combinations
from fractions import gcd
from math import ceil, floor
sys.setrecursionlimit(10 ** 6)

def input():
    return sys.stdin.readline()[:-1]

def main():
    n = int(input())
    p = tuple(map(int, input().split()))
    q = tuple(map(int, input().split()))
    l = permutations(list(range(1, n+1)))
    if p == q:
        print(0)
    else:
        for idx, item in enumerate(l):
            if item == p:
                idp = idx
            elif item == q:
                idq = idx
        print(abs(idp - idq))

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python

def main(N, H):
    ans = 'Yes'

    min_val = H[0] -1
    for i in range(1, N):
        if min_val <= H[i] -1:
            min_val = H[i] -1
        elif min_val <= H[i]:
            min_val = H[i]
        else:
            ans = 'No'
            break
    return ans

if __name__ == '__main__':
    N = int(input())
    H = list(map(int, input().split()))
    print(main(N, H))


Fixed submission:
#!/usr/bin/env python

def main(A, B, C):
    ans = C - (A - B)
    if ans > 0:
        return ans
    else:
        return 0

if __name__ == '__main__':
    A, B, C = list(map(int, input().split()))
    print(main(A, B, C))
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python

def main(N, H):
    ans = 'Yes'

    min_val = H[0] -1
    for i in range(1, N):
        if min_val <= H[i] -1:
            min_val = H[i] -1
        elif min_val <= H[i]:
            min_val = h[i]
        else:
            ans = 'No'
            break
    return ans

if __name__ == '__main__':
    N = int(input())
    H = list(map(int, input().split()))
    print(main(N, H))


Fixed submission:
#!/usr/bin/env python

def main(N, H):
    ans = 'Yes'

    min_val = H[0] -1
    for i in range(1, N):
        if min_val <= H[i] -1:
            min_val = H[i] -1
        elif min_val <= H[i]:
            min_val = H[i]
        else:
            ans = 'No'
            break
    return ans

if __name__ == '__main__':
    N = int(input())
    H = list(map(int, input().split()))
    print(main(N, H))
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
import numpy as np

def main():
    S = input()
    
    lenS = len(S)
    N = 13
    DP = np.zeros(N, dtype=np.int64)
    DP[0] = 1
    
    mod = 10 ** 9 + 7
    mul = 1
    for i in reversed(range(lenS)):
        nextDP = np.zeros(N, dtype=np.int64)
        c = S[i]
        if c == '?':
            for k in range(10):
                for j in range(N):
                    nextDP[(k * mul + j) %N] += DP[j]
                    nextDP[(k * mul + j) %N] %= mod

        else:
            k = int(S[i])
            for j in range(N):
                nextDP[(k * mul + j) %N] += DP[j]
                nextDP[(k * mul + j) %N] %= mod

        mul *= 10
        mul %= N
        DP = nextDP

    return DP[5]

if __name__ == '__main__':
    print(main())



Fixed submission:
#!/usr/bin/env python
def main():
    A, B = list(map(int, input().split()))
    tmp = B
    if A > B:
        B = A
        A = tmp
    
    tmp = (B - A) / 2 + A
    if round(tmp) == tmp:
        return int(tmp)
    else:
        return 'IMPOSSIBLE'

if __name__ == '__main__':
    print(main())
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
import itertools

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

    compArr = list(range(1, N+1))
    arr = list(range(N))
    combs = list(itertools.combinations(arr, 2))

    ans = 'NO' 
    if p == compArr:
        ans = 'YES'
    for c in combs:
        tmpArr = compArr.copy()
        tmpArr[c[0]], tmpArr[c[1]] = tmpArr[c[1]], tmpArr[c[0]]
        if p == tmpArr:
            ans = 'YES'

    return ans

if __name__ == '__main__':
    print(main())


Fixed submission:
#!/usr/bin/env python
import itertools

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

    compArr = list(range(1, N+1))
    arr = list(range(N))
    combs = list(itertools.combinations(arr, 2))

    ans = 'NO' 
    if p == compArr:
        ans = 'YES'
    for c in combs:
        tmpArr = compArr.copy()
        tmpArr[c[0]], tmpArr[c[1]] = tmpArr[c[1]], tmpArr[c[0]]
        if p == tmpArr:
            ans = 'YES'

    return ans

if __name__ == '__main__':
    print(main())