Buggy python submission (verdict: Runtime Error):
n, m, x = map(int,input().split())
a = list(map(int,input().split()))
ans1 = 0
ans2 = 0
if x == 1 or x == n:
    print(0)
else:
    for i in range(1, x):
        if len(a) != 0:
            if a[0] == i:
                ans1 += 1
                a.pop(0)
    if len(a) != 0:
        for i in range(x, n):
            if a[0] == i:
                ans2 += 1
                a.pop(0)
    ans = min(ans1, ans2)
    print(ans)

Fixed submission:
n, m, x = map(int,input().split())
a = list(map(int,input().split()))
ans1 = 0
ans2 = 0
if x == 1 or x == n:
    print(0)
else:
    for i in range(1, x):
        if len(a) != 0:
            if a[0] == i:
                ans1 += 1
                a.pop(0)
    if len(a) != 0:
        for i in range(x, n):
            if len(a) != 0:
                if a[0] == i:
                    ans2 += 1
                    a.pop(0)
    ans = min(ans1, ans2)
    print(ans)

Buggy python submission (verdict: Runtime Error):
n, m, x = map(int,input().split())
a = list(map(int,input().split()))
ans1 = 0
ans2 = 0
if x == 1 or x == n or x == 2 or x == n-1:
    print(0)
else:
    for i in range(1, x):
        if a[0] == i:
            ans1 += 1
            a.pop(0)
    if len(a) != 0:
        for i in range(x, n):
            if a[0] == i:
                ans2 += 1
                a.pop(0)
    ans = min(ans1, ans2)
    print(ans)


Fixed submission:
n, m, x = map(int,input().split())
a = list(map(int,input().split()))
ans1 = 0
ans2 = 0
if x == 1 or x == n:
    print(0)
else:
    for i in range(1, x):
        if len(a) != 0:
            if a[0] == i:
                ans1 += 1
                a.pop(0)
    if len(a) != 0:
        for i in range(x, n):
            if len(a) != 0:
                if a[0] == i:
                    ans2 += 1
                    a.pop(0)
    ans = min(ans1, ans2)
    print(ans)

Buggy python submission (verdict: Runtime Error):
n, m, x = map(int,input().split())
a = list(map(int,input().split()))
ans1 = 0
ans2 = 0
aa = a
if x == 1 or x == n:
    print(0)
else:
    for i in range(1, x):
        if a[0] == i:
            ans1 += 1
            a.pop(0)
    if len(a) != 0:
        for i in range(x, n):
            if a[0] == i:
                ans2 += 1
                a.pop(0)
    ans = min(ans1, ans2)
    print(ans)

Fixed submission:
n, m, x = map(int,input().split())
a = list(map(int,input().split()))
ans1 = 0
ans2 = 0
if x == 1 or x == n:
    print(0)
else:
    for i in range(1, x):
        if len(a) != 0:
            if a[0] == i:
                ans1 += 1
                a.pop(0)
    if len(a) != 0:
        for i in range(x, n):
            if len(a) != 0:
                if a[0] == i:
                    ans2 += 1
                    a.pop(0)
    ans = min(ans1, ans2)
    print(ans)

Buggy python submission (verdict: Runtime Error):
n, m, x = map(int,input().split())
a = list(map(int,input().split()))
ans1 = 0
ans2 = 0
aa = a
for i in range(1, x):
    if a[0] == i:
        ans1 += 1
        a.pop(0)
if len(a) != 0:
    for i in range(x, n):
        if a[0] == i:
            ans2 += 1
            a.pop(0)
    

ans = min(ans1,ans2)
print(ans)

Fixed submission:
n, m, x = map(int,input().split())
a = list(map(int,input().split()))
ans1 = 0
ans2 = 0
if x == 1 or x == n:
    print(0)
else:
    for i in range(1, x):
        if len(a) != 0:
            if a[0] == i:
                ans1 += 1
                a.pop(0)
    if len(a) != 0:
        for i in range(x, n):
            if len(a) != 0:
                if a[0] == i:
                    ans2 += 1
                    a.pop(0)
    ans = min(ans1, ans2)
    print(ans)

Buggy python submission (verdict: Runtime Error):
n, m, x = map(int,input().split())
a = list(map(int,input().split()))
ans1 = 0
ans2 = 0
for i in range(x+1):
    if a[0] == i:
        ans1 += 1
        a.pop(0)
for i in range(x+1, n):
    if a[0] == i:
        ans2 += 1
        a.pop(0)
ans = min(ans1,ans2)
print(ans)




Fixed submission:
n, m, x = map(int,input().split())
a = list(map(int,input().split()))
ans1 = 0
ans2 = 0
if x == 1 or x == n:
    print(0)
else:
    for i in range(1, x):
        if len(a) != 0:
            if a[0] == i:
                ans1 += 1
                a.pop(0)
    if len(a) != 0:
        for i in range(x, n):
            if len(a) != 0:
                if a[0] == i:
                    ans2 += 1
                    a.pop(0)
    ans = min(ans1, ans2)
    print(ans)

Buggy python submission (verdict: Runtime Error):
n, m, x = map(int,input().split())
a = list(map(int,input().split()))
ans1 = 0
ans2 = 0
for i in range(x):
    if a[0] == i:
        ans1 += 1
        a.pop(0)
for i in range(x, n):
    if a[0] == i:
        ans2 += 1
        a.pop(0)
ans = min(ans1,ans2)
print(ans)

Fixed submission:
n, m, x = map(int,input().split())
a = list(map(int,input().split()))
ans1 = 0
ans2 = 0
if x == 1 or x == n:
    print(0)
else:
    for i in range(1, x):
        if len(a) != 0:
            if a[0] == i:
                ans1 += 1
                a.pop(0)
    if len(a) != 0:
        for i in range(x, n):
            if len(a) != 0:
                if a[0] == i:
                    ans2 += 1
                    a.pop(0)
    ans = min(ans1, ans2)
    print(ans)