ZhenlongDai/ACPR huggingface dataset:
Problem: p02641
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
sys.setrecursionlimit(10000000)

x,n = map(int,input().split())

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


if n == 0:print(x);exit()

l=[0] * 101

for i in p:
    l[i] =1

diff=1000
ans=0
for i in range(1,101):
    if l[i] == 0 and diff > abs(x-1):
        diff= abs(x-1)
        ans=i

print(ans)


Failing test case input:
6 5
3 7 10 6 5

Expected output:
4


Actual output:
1


Fixed submission (verdict: Accepted):
import sys
sys.setrecursionlimit(10000000)

x,n = map(int,input().split())

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


if n == 0:print(x);exit()

l=[0] * 102

for i in p:
    l[i] =1

diff=1000
ans=0
for i in range(0,102):
    if l[i] == 0 and diff > abs(x-i):
        diff= abs(x-i)
        ans=i

print(ans)

Problem: p02641
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys

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

if n == 0:
    print(x)
    sys.exit()

i = 1
while i < 102:
    left = x - i
    right = x + i
    if left not in p:
        print(left)
        sys.exit()
    elif right not in p:
        print(right)
        sys.exit()
    i += 1


Failing test case input:
12 1
2 5 3 16 11

Expected output:
12


Actual output:
13


Fixed submission (verdict: Accepted):
x, n = map(int, input().split())
p = set(map(int, input().split()))

i = 0
while True:
    left = x - i
    right = x + i
    if left not in p:
        print(left)
        break
    elif right not in p:
        print(right)
        break
    i += 1

Problem: p02641
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
X, N = map(int, input().split())
if N == 0:
    print(X)
else:
    P = list(map(int, input().split()))
    for i in range(1,102):
        if (X-i) not in P:
            print(X-i)
            break
        elif (X+i) not in P:
            print(X+i)
            break
    else:
        print(X)



Failing test case input:
10 3
4 7 3 6 5

Expected output:
10


Actual output:
9


Fixed submission (verdict: Accepted):
X, N = map(int, input().split())
if N == 0:
    print(X)
else:
    P = list(map(int, input().split()))
    for i in range(1000):
        if (X-i) not in P:
            print(X-i)
            break
        elif (X+i) not in P:
            print(X+i)
            break

Problem: p02641
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

X,N = map(int,input().split())
p = list(map(int, input().split()))
ans = 200
for i in range(-1,101):
    if i not in p:
        ans = [ans, i][abs(X-i) <= abs(X-ans)]
print(ans)

Failing test case input:
10 3
1 7 10 6 5

Expected output:
9


Actual output:
11


Fixed submission (verdict: Accepted):

X,N = map(int,input().split())
p = list(map(int, input().split()))
ans = 200
for i in range(-1,102):
    if i not in p:
        ans = [ans, i][abs(X-i) < abs(X-ans)]
print(ans)
Problem: p02641
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
X,N = map(int,input().split())
P = list(map(int,input().split()))
ans = 100000000
l = 1000000
for i in range(1,101):
    if P.count(i) == 0:
        
        if abs(i-X) < l:
            l = abs(i-X)
            ans = i
            
print(ans)

Failing test case input:
0 2
4 7 10 8 2

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
X,N = map(int,input().split())
P = list(map(int,input().split()))
ans = 100
l = 101
for i in range(0,102):
    if P.count(i) == 0:
        if abs(i-X) < l:
            
            l = abs(i-X)
            ans = i
print(ans)

Problem: p02641
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import bisect
X,N = map(int,input().split())

p = list(map(int,input().split()))
p = sorted(p,reverse = False)
p_x = []
if p == []:
    print(X)
else:
    for i in range(-1,200):
        if not(i in p):
            p_x.append(i)
    idx_x = bisect.bisect_left(p_x,X)
    if abs(X-p_x[idx_x-1]) < abs(X-p_x[idx_x]):
           print(p_x[idx_x-1])
    else:
           print(p_x[idx_x])

Failing test case input:
6 5
3 7 10 6 5

Expected output:
4


Actual output:
8


Fixed submission (verdict: Accepted):
import bisect
X,N = map(int,input().split())

p = list(map(int,input().split()))
p = sorted(p,reverse = False)
p_x = []
if p == []:
    print(X)
else:
    for i in range(200):
        if not(i in p):
            p_x.append(i)
    idx_x = bisect.bisect_left(p_x,X)
    if abs(X-p_x[idx_x-1]) < abs(X-p_x[idx_x]):
           print(p_x[idx_x-1])
    elif abs(X-p_x[idx_x-1]) > abs(X-p_x[idx_x]):
           print(p_x[idx_x])
    else:
        print(min(p_x[idx_x],p_x[idx_x-1]))

Problem: p02641
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
def main():
    x, n = map(int, input().split())
    p = set(map(int, input().split()))
    if not x in p:
        print(x)
    else:
        a = [abs(x-i) if not i in p else 1000 for i in range(-1, 102)]
        print(a)
        print(a.index(min(a))-1)

if __name__ == "__main__":
    main()

Failing test case input:
3 2
4 2 1 8 3

Expected output:
5


Actual output:
[4, 3, 1000, 1000, 1000, 1000, 2, 3, 4, 1000, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98]
5


Fixed submission (verdict: Accepted):
def main():
    x, n = map(int, input().split())
    p = set(map(int, input().split()))
    if not x in p:
        print(x)
    else:
        a = [abs(x-i) if not i in p else 1000 for i in range(-1, 102)]
        print(a.index(min(a))-1)

if __name__ == "__main__":
    main()
Problem: p02641
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from sys import stdin,stdout
LI=lambda:list(map(int,input().split()))
MAP=lambda:map(int,input().split())
IN=lambda:int(input())
S=lambda:input()
import math
from collections import Counter,defaultdict


x,n=MAP()
if n==0:
    print(x)
    exit()
a=LI()
l=-1;r=-1
for i in range(1,100):
    if x-i not in a:
        l=x-i
        break
for i in range(1,100):
    if x+i not in a:
        r=x+i
        break
if abs(r-x)>=abs(l-x):
    print(l)
else:
    print(r)


Failing test case input:
10 3
4 7 3 6 5

Expected output:
10


Actual output:
9


Fixed submission (verdict: Accepted):
from sys import stdin,stdout
LI=lambda:list(map(int,input().split()))
MAP=lambda:map(int,input().split())
IN=lambda:int(input())
S=lambda:input()
import math
from collections import Counter,defaultdict


x,n=MAP()
if n==0:
    print(x)
    exit()
a=LI()
l=-1;r=-1
for i in range(1000):
    if x-i not in a:
        l=x-i
        break
for i in range(1,101):
    if x+i not in a:
        r=x+i
        break
if abs(r-x)>=abs(l-x):
    print(l)
else:
    print(r)

Problem: p02641
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x, n = map(int, input().split())
if n == 0:
  print(x)
  exit()
p = set(map(int, input().split()))

i = 1
while True:
  if x - i not in p:
    print(x-i)
    break
  elif x + i not in p:
    print(x+i)
    break
  
  i += 1

Failing test case input:
10 3
4 7 9 6 5

Expected output:
10


Actual output:
11


Fixed submission (verdict: Accepted):
x, n = map(int, input().split())
if n == 0:
  print(x)
  exit()
p = set(map(int, input().split()))

i = 0
while True:
  if x - i not in p:
    print(x-i)
    break
  elif x + i not in p:
    print(x+i)
    break
  
  i += 1

Problem: p02641
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x,n = map(int,input().split())
p_d  = [x-int(i) for i in input().split()]
p_sorted = sorted(p_d,key= lambda x: (-x-0.1, x)[x > 0])

l = [x-k for k in range(1,101)]
l_sorted = sorted(l,key= lambda x: (-x-0.1, x)[x > 0])

for i in range(n):
    ans = l_sorted[i]
    if p_sorted[i] != ans:
        print(x+ans)
        break
if n == 0:
    print(x)


Failing test case input:
6 5
4 7 10 6 5

Expected output:
8

Actual output:
4


Fixed submission (verdict: Accepted):
x,n = map(int,input().split())
if n == 0:
    print(x)
else:
    l = [k for k in range(102)]
    for p in input().split():
        p = int(p)
        l[p] = 1000
    l_d = [x-k for k in l]
    l_sorted = sorted(l_d,key= lambda x: (-x+0.1, x)[x > 0])
    print(x-l_sorted[0])
Problem: p02641
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys

X, N = map(int, input().split())
p = list(map(int, input().split()))

if N == 0:
    print(X)
    sys.exit()

for i in range(N):
    if p.count(X - i) == 0:
        print(X - i)
        sys.exit()
    elif p.count(X + i) == 0:
        print(X + i)
        sys.exit()


Failing test case input:
3 2
4 2 1 8 3

Expected output:
5


Actual output:

Fixed submission (verdict: Accepted):
import sys

X, N = map(int, input().split())
p = list(map(int, input().split()))

if N == 0:
    print(X)
    sys.exit()

for i in range(N + 1):
    if p.count(X - i) == 0:
        print(X - i)
        sys.exit()
    elif p.count(X + i) == 0:
        print(X + i)
        sys.exit()

Problem: p02641
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
X, N = map(int, input().split())
P = list(map(int, input().split()))

abs_list = []

if N == 0:
    print(X)
    sys.exit()

for i in range(1,150):
    j,k = abs(X - i), X +i
    if j not in P:
        print(j)
        break
    if k not in P:
        print(k)
        break

Failing test case input:
2 1
4 5 1 4 0

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
import sys
X, N = map(int, input().split())
P = list(map(int, input().split()))

abs_list = []

if N == 0:
    print(X)
    sys.exit()

for i in range(0,150):
    j,k = abs(X - i), X +i
    if j not in P:
        print(j)
        break
    if k not in P:
        print(k)
        break

Problem: p02641
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x, n = map(int, input().split())
p = list(map(int, input().split()))

tmp = x
x_2 = x

if n == 0:
    print(x)
    exit()

if x not in p:
    print(x)
    exit()

else:
    x -= 1
    if (x_2 + 1) not in p:
        print(x+1)
        exit()

    else:
        x_2 += 1

while True:
    if(x - 1) not in p:
        print(x-1)
        exit()

    else:
        x -= 1
        if (x_2 + 1) not in p:
            print(x_2+1)
            exit()

        else:
            x_2 += 1


Failing test case input:
10 3
1 7 10 6 5

Expected output:
9


Actual output:
10


Fixed submission (verdict: Accepted):
x, n = map(int, input().split())
p = list(map(int, input().split()))

tmp = x
x_2 = x

if n == 0:
    print(x)
    exit()

if x not in p:
    print(x)
    exit()

else:
    x -= 1
    if x not in p:
        print(x)
        exit()
    if (x_2 + 1) not in p:
        print(x_2+1)
        exit()

    else:
        x_2 += 1

while True:
    if(x - 1) not in p:
        print(x-1)
        exit()

    else:
        x -= 1
        if (x_2 + 1) not in p:
            print(x_2+1)
            exit()

        else:
            x_2 += 1
Problem: p02641
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x,n = map(int,input().split())
if n == 0:
  print(x)
  exit()
nums = list(map(int,input().split()))
cnt =0
while True:
  cnt +=1
  if x-cnt not in nums:
    print(x-cnt)
    break
  if x+cnt not in nums:
    print(x+cnt)
    break

Failing test case input:
15 3
7 5 3 19 5

Expected output:
15


Actual output:
14


Fixed submission (verdict: Accepted):
x,n = map(int,input().split())
if n == 0:
  print(x)
  exit()
nums = list(map(int,input().split()))
cnt =0
while True:
  if x-cnt not in nums:
    print(x-cnt)
    break
  if x+cnt not in nums:
    print(x+cnt)
    break
  cnt +=1

Problem: p02641
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import collections
x,n=map(int,input().split())
if n!=0:
    l=list(map(int,input().split()))
    v=collections.Counter(l)
if n==0:
    print(x)
else:
    for i in  range(101):
        if x not in v:
            ans=x
            break
            
        if x+i not in v:
            ans=x+i
            break
        if x-i not in v:
            ans=x-i
            break
    print(ans)
        

        

Failing test case input:
10 3
1 7 10 6 5

Expected output:
9


Actual output:
11


Fixed submission (verdict: Accepted):
import collections
x,n=map(int,input().split())
if n!=0:
    l=list(map(int,input().split()))
    v=collections.Counter(l)
if n==0:
    print(x)
else:
    for i in  range(101):
        if x not in v:
            ans=x
            break
            
        if x-i not in v:
            ans=x-i
            break
        if x+i not in v:
            ans=x+i
            break
    print(ans)

Problem: p02641
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys

(x, n) = list(map(int, input().split()))
arr = list(map(int, input().split()))

if(len(arr) == 0):
    print(x)
    sys.exit()

i = 1
while True:
    if(not (x - i in arr)):
        print(x - i)
        sys.exit()
    
    if(not (x + i in arr)):
        print(x + i)
        sys.exit()
    i += 1


Failing test case input:
62 1
1 1 2 16 18

Expected output:
62


Actual output:
61


Fixed submission (verdict: Accepted):
import sys

(x, n) = list(map(int, input().split()))
arr = list(map(int, input().split()))

if(len(arr) == 0):
    print(x)
    sys.exit()

if(not(x in arr)):
    print(x)
    sys.exit()

i = 1
while True:
    if(not (x - i in arr)):
        print(x - i)
        sys.exit()
    
    if(not (x + i in arr)):
        print(x + i)
        sys.exit()
    i += 1
Problem: p02641
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
def main():
  X, N = map(int, input().split())
  if N == 0:
    print(X)
    return
  p = tuple(map(int, input().split()))  
  if X not in p:
    print(X)
  
  not_p = list(set([i for i in range(max(p)+2)]) - set(p))
  not_p_X = [abs(X - i) for i in not_p]
  print(not_p[not_p_X.index(min(not_p_X))])
    
main()


Failing test case input:
15 1
7 5 3 16 11

Expected output:
15


Actual output:
15
15


Fixed submission (verdict: Accepted):
def main():
  X, N = map(int, input().split())
  if N == 0:
    print(X)
    return
  p = tuple(map(int, input().split()))  
  if X not in p:
    print(X)
    return
  
  not_p = list(set([i for i in range(max(p)+2)]) - set(p))
  not_p_X = [abs(X - i) for i in not_p]
  print(not_p[not_p_X.index(min(not_p_X))])
    
main()

Problem: p02641
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x, n = map(int, input().split())
p = list(map(int, input().split()))

diff = 999
ans = 0

for i in range(-101, 101):
    if i not in p and i != x and diff > abs(x-i):
        diff = min(diff, abs(x-i))
        ans = i

print(ans)

Failing test case input:
12 1
2 2 3 16 4

Expected output:
12


Actual output:
11


Fixed submission (verdict: Accepted):
x, n = map(int, input().split())
p = list(map(int, input().split()))
n = list(i for i in range(-1, 110) if i not in p)

diff = 110
ans = 0

for i in n:
    if diff > abs(x-i):
        diff = abs(x-i)
        ans = i
        
print(ans)

Problem: p02641
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
X, N = map(int, input().split())
if (N==0):
    print(X)
    sys.exit()
elif(N==100):
    if(X<51):
        print(-1)
        sys.exit()
    else:
        print(101)
        sys.exit()
p = list(map(int, input().split()))

n_ans = 1
sa = 100
for k in range(1,101,1):
    if (k in p):
        continue
    if(abs(k-X) < sa):
        n_ans = k
        sa = abs(k-X)
    else:
        break
print(n_ans)

Failing test case input:
0 2
4 7 10 8 2

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
import sys
X, N = map(int, input().split())
if (N==0):
    print(X)
    sys.exit()
p = list(map(int, input().split()))

n_ans = 0
sa = 200
for k in range(0,102,1):
    if (k in p):
        continue
    if(abs(k-X) < sa):
        n_ans = k
        sa = abs(k-X)
    else:
        break
print(n_ans)

Problem: p02641
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x,n = map(int,input().split())
p = list(map(int,input().split()))
if n==0:
    print(x)
    exit()
a,b = x,x
while True:
    a+=1
    b-=1
    if b not in p:
        print(b)
        break
    elif a not in p:
        print(a)
        break

Failing test case input:
15 3
7 5 3 16 11

Expected output:
15


Actual output:
14


Fixed submission (verdict: Accepted):
x,n = map(int,input().split())
p = list(map(int,input().split()))
if x not in p:
    print(x)
    exit()
a,b = x,x
while True:
    a+=1
    b-=1
    if b not in p:
        print(b)
        break
    elif a not in p:
        print(a)
        break
Problem: p02641
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
X, N = map(int, input().split())
if N == 0:
    print(X)
    exit()
P = list(map(int, input(). split()))

for n in range(1, N + 1):
    mi = X - n
    if mi < 1:
        continue

    ma = X + n
    if ma > 100:
        continue

    if not (X - n) in P:
        print(X - n)
        exit()
    if not (X + n) in P:
        print(X + n)
        exit()
if min(P) - 1 < 0:
    print(max(P) + 1)
    exit()
print(min(P) - 1)

Failing test case input:
62 1
1 1 2 16 18

Expected output:
62


Actual output:
61


Fixed submission (verdict: Accepted):
X, N = map(int, input().split())
if N == 0:
    print(X)
    exit()
P = list(map(int, input(). split()))
if X not in P:
    print(X)
    exit()

for n in range(1, N + 1):    
    if not (X - n) in P:
        print(X - n)
        exit()
    if not (X + n) in P:
        print(X + n)
        exit()
print(min(P) - 1)

Problem: p02641
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
X,N = map(int,input().split())
if N==0:
  print(X)
else:
  P = list(map(int,input().split()))
  a = X+1
  b = X-1

  if X not in P:
    print(X)
  
  else:
    while a not in P:
      break
      a+=1
    while b not in P:
      break
      b-=1
      
    if abs(X-a)>abs(X-b):
      print(a)
    else:
      print(b)

Failing test case input:
6 2
4 7 10 6 5

Expected output:
8


Actual output:
5


Fixed submission (verdict: Accepted):
X,N = map(int,input().split())

if N==0:
  print(X)

else:
  P = list(map(int,input().split()))
  if X not in P:
    print(X)
  
  else:
      a = X+1
      b = X-1
      
      while a in P:
        a+=1
      while b in P:
        b-=1
      
      if abs(X-a)<abs(X-b):
        print(a)
      else:
        print(b)

Problem: p02641
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x,n = map(int,input().split())
p = list(map(int,input().split()))

p1 = [abs(i-x) for i in p]

p = set(p)
p1.sort()
if len(p1) ==0:
    print(x)
else:
    if p1[0] != 0:
        print(x)
    else:
        cnt = 1
        while(cnt < len(p1)):
            if p1[cnt] != 1+ int(cnt/2):
                break
            else:
                cnt +=1
        if x-cnt in p:
            print(x+cnt)
        else:
            print(x-cnt)

Failing test case input:
7 2
4 7 10 6 5

Expected output:
8


Actual output:
10


Fixed submission (verdict: Accepted):
x,n = map(int,input().split())
p = list(map(int,input().split()))

p1 = [abs(i-x) for i in p]

p = set(p)
p1.sort()
if len(p1) ==0:
    print(x)
else:
    if p1[0] != 0:
        print(x)
    else:
        cnt = 1
        while(cnt < len(p1)):
            
            
            
            if p1[cnt] != int((cnt+1)/2):
                break
            else:
                cnt +=1
        
        if x-int((cnt+1)/2) in p:
            print(x+int((cnt+1)/2))
        else:
            print(x-int((cnt+1)/2))
Problem: p02641
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x, n = map(int, input().split())
a = list(map(int, input().split()))

abs_min = int(1e5)
ans = -1
for i in range(0, 102):
    if abs(x - i) < abs_min:
        abs_min = abs(x - i)
        ans = i
print(ans)

Failing test case input:
3 2
4 2 1 8 3

Expected output:
5


Actual output:
3


Fixed submission (verdict: Accepted):
x, n = map(int, input().split())
a = list(map(int, input().split()))

abs_min = int(1e5)
ans = -1
for i in range(0, 102):
    if i in a:
        continue
    if abs(x - i) < abs_min:
        abs_min = abs(x - i)
        ans = i
print(ans)

Problem: p02641
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x,y=map(int,input().split())
if(y==0):
    print(x)
else:
    s=list(map(int,input().split()))
    i=1
    while(1):
        if((x-i) not in s):
            print(x-i)
            break
        if((x+i) not in s):
            print(x+i)
            break
        i+=1
            
            
        

Failing test case input:
62 1
1 1 2 16 18

Expected output:
62


Actual output:
61


Fixed submission (verdict: Accepted):
x,y=map(int,input().split())
if(y==0):
    print(x)
else:
    s=list(map(int,input().split()))
    i=0
    while(1):
        if(abs(x-i) not in s):
            print(abs(x-i))
            break
        if(abs(x+i) not in s):
            print(abs(x+i))
            break
        
        i+=1

Problem: p02641
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
X, N = map(int, input().split())

if N == 0:
  print(X)
else:
  ps = set(list(map(int, input().split())))

  i = 1
  while True:
    if X-i not in ps:
      print(X-i)
      break
    elif X+i not in ps:
      print(X+i)
      break
    i += 1

Failing test case input:
10 3
13 7 3 6 5

Expected output:
10


Actual output:
9


Fixed submission (verdict: Accepted):
X, N = map(int, input().split())

if N == 0:
  print(X)
else:
  ps = set(list(map(int, input().split())))

  i = 0
  while True:
    if X-i not in ps:
      print(X-i)
      break
    elif X+i not in ps:
      print(X+i)
      break
    i += 1

Problem: p02641
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x,n=map(int,input().split())

sett=set(map(int,input().split()))
arr=[i for i in range(1,101) if i not in sett]

min_=100000
num=0
for i in arr:
	if abs(x-i)<min_:
		min_=abs(x-i)
		num=i



print(num)


Failing test case input:
0 2
4 7 10 8 2

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
x,n=map(int,input().split())

sett=list(map(int,input().split()))
arr=[i for i in range(-5,151) if i not in sett]

min_=100000
num=0
for i in arr:
	if abs(x-i)<min_:
		min_=abs(x-i)
		num=i



print(num)
Problem: p02641
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x, n = map(int, input().split())
p = list(map(int, input().split()))

table = [0 for i in range(100)]
for i in p:
    table[i-1] = 1

mx = 10000
ans = mx
dis = mx
for i in range(len(table)):
    idx = 99-i
    if (table[idx] == 0) and (dis >= abs(idx+1-x)):
        ans = idx+1
        dis = abs(idx+1-x)
if ans == mx:
    print(0)
else:
    print(ans)


Failing test case input:
0 2
4 7 10 8 2

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
x, n = map(int, input().split())
p = list(map(int, input().split()))

table = [0 for i in range(102)]
for i in p:
    table[i] = 1

mx = 10000
ans = mx
dis = mx
for i in range(len(table)):
    idx = 101-i
    if (table[idx] == 0) and (dis >= abs(idx-x)):
        ans = idx
        dis = abs(idx-x)
print(ans)

Problem: p02641
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x,n=map(int,input().split())

if n==0:
  print(x)
  
else:
  a=list(map(int,input().split()))

  for i in range(100):
    if x-i not in a:
      ans=x-1
      break
    if x+i not in a:
      ans=x+i
      break
    
  print(ans)

Failing test case input:
2 1
4 5 0 16 4

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
x,n=map(int,input().split())

if n==0:
  print(x)
  
else:
  a=list(map(int,input().split()))

  for i in range(100):
    if x-i not in a:
      ans=x-i
      break
    elif x+i not in a:
      ans=x+i
      break
    
  print(ans)

Problem: p02641
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x, n = map(int, input().split(" "))
v = [i+1 for i in range(100)]
min_val = 100
ans_index = 0

if n != 0:
    p = list(map(int, input().split(" ")))    
    for index in p:
        v[index - 1] = 101


for v_val in v:
    if(min_val > abs(v_val - x)):
        ans_index = v_val
        min_val = min(min_val, abs(v_val - x))
    



print(ans_index)


Failing test case input:
0 2
4 7 10 8 2

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
x, n = map(int, input().split(" "))
v = [i for i in range(102)]
min_val = 100
ans_val = 0

if n != 0:
    p = list(map(int, input().split(" ")))    
    for index in p:
        v[index] = 101


for v_val in v:
    if(min_val > abs(v_val - x)):
        ans_val = v_val
        min_val = min(min_val, abs(v_val - x))
    



print(ans_val)

Problem: p02641
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x, n = map(int, input().split())
if n:
	p = list(map(int, input().split()))

	for i in range(n+1):
		if x - i in p:
			print(x-1)
			break
		if x + i in p:
			print(x+1)
			break
else:
	print(x)

Failing test case input:
12 1
4 5 0 16 3

Expected output:
12


Actual output:

Fixed submission (verdict: Accepted):
x, n = map(int, input().split())
if n:
	p = list(map(int, input().split()))
	for i in range(n+1):
		if not x - i in p:
			print(x-i)
			break
		if not x + i in p:
			print(x+i)
			break
else:
	print(x)
Problem: p02641
Buggy submission (Python (3.8.2), verdict: Wrong Answer):




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

    ans = X
    min_diff = float('inf')
    for d in range(1, 101):  
        if d in Ps:
            continue

        v = X - d
        
        if abs(v) < min_diff:
            min_diff = abs(v)
            ans = d

    print(ans)


if __name__ == '__main__':
    main()


Failing test case input:
0 2
4 7 10 8 2

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):




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

    ans = X
    min_diff = float('inf')
    for d in range(102):
        if d in Ps:
            continue

        v = abs(X - d)
        
        if v < min_diff:
            min_diff = v
            ans = d

    print(ans)


if __name__ == '__main__':
    main()

Problem: p02641
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
x, n = input().split()
x = int(x)
n = int(n)
m = list(map(int,input().split()))
sa = 999
ans = 0

if x in m == False:
    print(x)
    exit()
elif len(m) == 0:
    print(x)
    exit()

for k in range(1,x+1):
    if m.count((x - k)) == 0 and x - (x - k) < sa:
        sa =  x - (x - k)
        ans = x - k

for l in range(1,300):
    if m.count((x + l)) == 0 and (x+l) - x < sa:
        sa = (x+l) - x
        ans = x + l

print(ans)

Failing test case input:
17 2
4 4 11 1 10

Expected output:
17


Actual output:
16


Fixed submission (verdict: Accepted):
x, n = input().split()
x = int(x)
n = int(n)
m = list(map(int,input().split()))
sa = 999
ans = 0

if m.count(x) == 0 :
    print(x)
    exit()
elif len(m) == 0:
    print(x)
    exit()

for k in range(1,200):
    if m.count((x - k)) == 0 and x - (x - k) < sa:
        sa =  x - (x - k)
        ans = x - k

for l in range(1,200):
    if m.count((x + l)) == 0 and (x+l) - x < sa:
        sa = (x+l) - x
        ans = x + l

print(ans)

Problem: p02641
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
X, N = map(int, input().split())
p = list(map(int, input().split()))
tip = 0
for i in range(N):
    s = X - i
    t = X + i
    s_a = s not in p
    t_a = t not in p
    if tip == 0:
        if s_a:
            ans = s
            tip = 1
        elif t_a:
            ans = t
            tip = 1
if tip == 0:
    ans = X
print(ans)
            

Failing test case input:
6 2
4 7 10 6 5

Expected output:
8


Actual output:
6


Fixed submission (verdict: Accepted):
X, N = map(int, input().split())
p = list(map(int, input().split()))
tip = 0
for i in range(3 * N):
    s = X - i
    t = X + i
    s_a = s not in p
    t_a = t not in p
    if tip == 0:
        if s_a:
            ans = s
            tip = 1
        elif t_a:
            ans = t
            tip = 1
if tip == 0:
    ans = X
print(ans)
Problem: p02641
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
XN = list(map(int, input().split()))
 
if XN[1] == 0:
  print(XN[0])
else:
  p = list(map(int, input().split()))
  for d in range(1, XN[1] + 1):
    if not XN[0] - d in p:
      print(XN[0] - d)
    if not XN[0] + d in p:
      print(XN[0] + d)

Failing test case input:
12 1
4 5 0 16 4

Expected output:
12


Actual output:
11
13


Fixed submission (verdict: Accepted):
XN = list(map(int, input().split()))
 
if XN[1] == 0:
  print(XN[0])
else:
  p = list(map(int, input().split()))
  for d in range(XN[1] + 1):
    if not XN[0] - d in p:
      print(XN[0] - d)
      break
    if not XN[0] + d in p:
      print(XN[0] + d)
      break

Problem: p02641
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
def main():
    x,y = list(map(int, input().split()))

    if y == 0:
        print(x)
        exit()
    nums = list(map(int, input().split()))
    ans = 101
    for i in range(1, 200):
        if i not in nums:
            ans = ans if abs(ans-x) <= abs(i-x) else i
    print(ans)



if __name__ == '__main__':
    main()


Failing test case input:
0 2
4 7 10 8 2

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
def main():
    x,y = list(map(int, input().split()))

    if y == 0:
        print(x)
        exit()
    nums = list(map(int, input().split()))
    ans = 0
    for i in range(1, 200):
        if i not in nums:
            ans = ans if abs(ans-x) <= abs(i-x) else i
    print(ans)



if __name__ == '__main__':
    main()

Problem: p02641
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x, n = map(int, input().split())
if n == 0:
  print(x)
  exit()
p = list(map(int, input().split()))
unique = set(range(-100, 101)) - set(p)
ans = {}
ans2 = []
for i in unique:
  calc = abs(x-i)
  ans[calc] = i
  ans2.append(calc)
print(ans[min(ans2)])

Failing test case input:
10 3
1 7 10 6 5

Expected output:
9


Actual output:
11


Fixed submission (verdict: Accepted):
x, n = map(int, input().split())
if n == 0:
  print(x)
  exit()
p = list(map(int, input().split()))
unique = set(range(0, 102)) - set(p)
ans = {}
ans2 = []
for i in unique:
  calc = abs(x-i)
  if calc in ans.keys():
    ans[calc] = min(ans[calc], i)
  else:
    ans[calc] = i
  ans2.append(calc)
print(ans[min(ans2)])

Problem: p02641
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x, n = map(int, input().split())
if n==0:
  print(x)
else:
    l1 = list(map(int,input().split()))	
    l2 = list(range(1, 100))
    diff = set(l1) ^ set(l2)
    diff = list(diff)
    def sorting(numbers_array):
      return sorted(numbers_array, key=abs)
    sl = map(lambda a: a - x, diff)
    print(sorting(sl)[0])


Failing test case input:
30 1
1 8 3 16 11

Expected output:
30


Actual output:
0


Fixed submission (verdict: Accepted):
x, n = map(int, input().split())
if n==0:
  print(x)
else:
    l1 = list(map(int,input().split()))	
    l2 = list(range(-150, 200))
    diff = set(l1) ^ set(l2)
    diff = list(diff)
    def sorting(numbers_array):
      return sorted(numbers_array, key=abs)
    sl = map(lambda a: a - x, diff)
    print(sorting(sl)[0]+x)
Problem: p02641
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
X,N = map(int,input().split())
l=list(map(int,input().split()))
tmp1=X-1
tmp2=X+1
if N==0:
    print(X)
else:
    while True:
        if not tmp1 in l:
            print(tmp1)
            exit()
        else :
            tmp1-=1
        if not tmp2 in l:
            print(tmp2)
            exit()
        else:
            tmp2+=1


Failing test case input:
6 2
4 7 15 16 2

Expected output:
6


Actual output:
5


Fixed submission (verdict: Accepted):
X,N = map(int,input().split())
l=list(map(int,input().split()))
if N==0:
    print(X)
else:
    for i in range(101):
        if  X-i not in l:
            print(X-i)
            exit()
        elif X+i not in l:
            print(X+i)
            exit()

Problem: p02641
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x,n = map(int, input().split())

if n == 0:
    print(x)
    exit()

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

allList=[]

for i in range(-201,301):
    allList.append(i)

diff = set(allList) ^ set(p)



diff = list(diff)
diff.append(x)
diff = sorted(diff)



ind = diff.index(x)



    

a = diff[ind-1]
b = diff[ind+1]


ax = abs(x-a)
bx = abs(x-b)



if ax==bx:
    if a < b:
        print(a)
    else:
        print(b)

if ax > bx:
    print(b)
else:
    print(a)

Failing test case input:
6 5
3 7 10 6 5

Expected output:
4


Actual output:
4
4


Fixed submission (verdict: Accepted):
x,n = map(int, input().split())

if n == 0:
    print(x)
    exit()

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

allList=[]

for i in range(-201,301):
    allList.append(i)

diff = set(allList) ^ set(p)



diff = list(diff)
diff.append(x)
diff = sorted(diff)



ind = diff.index(x)



    

a = diff[ind-1]
b = diff[ind+1]


ax = abs(x-a)
bx = abs(x-b)



if ax==bx:
    if a < b:
        print(a)
        exit()
    else:
        print(b)
        exit()

if ax > bx:
    print(b)
else:
    print(a)

Problem: p02641
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a,b = map(int,input().split())
if(b != 0):
  c = list(map(int,input().split()))
else:
  print(a)
  exit()
ans = 0
for i in range(101):
  if(a+i not in c):
    if(a+i > 101):
      break
    else:
      ans = a+i
      break
for i in range(101):
  if(a-i not in c):
    if(a-i < 0):
      break
    else:
      if(abs(ans-(a-i)) < abs(a-ans)):
        ans = a-i
      elif(abs(ans-(a-i)) == abs(a-ans)):
        ans = min(a-i,ans)
      break
print(ans)

Failing test case input:
6 5
3 7 10 6 5

Expected output:
4


Actual output:
8


Fixed submission (verdict: Accepted):
a,b = map(int,input().split())
if(b != 0):
  c = list(map(int,input().split()))
else:
  print(a)
  exit()
ans = 0
for i in range(101):
  if(a+i not in c):
    if(a+i > 101):
      break
    else:
      ans = a+i
      break
for i in range(101):
  if(a-i not in c):
    if(a-i < 0):
      break
    else:
      if(i < abs(a-ans)):
        ans = a-i
      elif(i == abs(a-ans)):
        ans = min(a-i,ans)
      break
print(ans)
Problem: p02641
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x, n = map(int, input().split())

if n == 0:
    print(100)
    exit()
    
else:
    p = list(map(int, input().split()))
    li = [i for i in range(1, 101) if i not in p]
    li.sort(reverse = True)

    tmp1 = float('inf')
    ans = float('inf')

    for i in li:
        if abs(i - x) <= tmp1:
            if i < ans:
                ans = i
                tmp1 = abs(i - x)

    print(ans)


Failing test case input:
0 2
4 7 10 8 2

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
x, n = map(int, input().split())

if n == 0:
    print(x)
    exit()

else:
    p = list(map(int, input().split()))
    li = [i for i in range(-101, 102) if i not in p]
    li.sort(reverse = True)

    tmp1 = float('inf')
    ans = float('inf')

    for i in li:
        if abs(i - x) <= tmp1:
            if i < ans:
                ans = i
                tmp1 = abs(i - x)

    print(ans)

Problem: p02641
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a = list(map(int,input().split()))
b = list(map(int,input().split()))
x = a[0]

retu = []
for i in range(1,101) :
    retu.append(i)
for i in b :
    if i in retu :
        retu.remove(i)
k = 1000
ans = i
for i in range(0,len(retu)) :
    y = abs(retu[i] - x)
    if y < k :
        k = y
        ans = retu[i]

print(ans)

Failing test case input:
0 2
4 7 10 8 2

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
a = list(map(int,input().split()))
x = a[0]
if a[1] == 0 :
    print(x)
else :
    b = list(map(int,input().split()))
    retu = []
    for i in range(0,102) :
        retu.append(i)
    for i in b :
        if i in retu :
            retu.remove(i)
    k = 1000
    ans = 0
    for i in retu :
        y = abs(i - x)
        if y < k :
            k = y
            ans = i
    print(ans)

Problem: p02641
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):



def main():
    X, N = map(int, input().split())
    if (N > 0):
        P = list(map(int, input().split()))
        ans = 0
        abs_temp = 101

        for pi in range(0, 102):
            n = abs(pi - X)
            if n < abs_temp and pi != X and not pi in P:
                ans = pi
                abs_temp = n
            elif n == abs_temp and pi != X and not pi in P and pi < ans:
                ans = pi
                abs_temp = n

        print(ans)

    else:
        print(X)


if __name__ == "__main__":
    main()


Failing test case input:
6 2
4 3 15 16 2

Expected output:
6


Actual output:
5


Fixed submission (verdict: Accepted):



def main():
    X, N = map(int, input().split())
    if (N > 0):
        P = list(map(int, input().split()))
        ans = 0
        abs_temp = 101

        for pi in range(0, 102):
            n = abs(pi - X)
            if n < abs_temp  and not pi in P:
                ans = pi
                abs_temp = n
            elif n == abs_temp  and not pi in P and pi < ans:
                ans = pi
                abs_temp = n

        print(ans)

    else:
        print(X)


if __name__ == "__main__":
    main()
Problem: p02641
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
X, N = [int(i) for i in input().split(" ")]

if N == 0:
    print(X)
    exit()

p = {int(i) for i in input().split(" ")}

all_p = {i for i in range(max(p) + 1)}
ranges = all_p - p

print(ranges)

diff = 1e9
ans = 0
for i in ranges:
    if diff > abs(i - X):
        diff = abs(i - X)
        ans = i

print(ans)

Failing test case input:
26 10
1 -2 23 23 1

Expected output:
26


Actual output:
{0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22}
22


Fixed submission (verdict: Accepted):
X, N = [int(i) for i in input().split(" ")]

if N == 0:
    print(X)
    exit()

p = {int(i) for i in input().split(" ")}

all_p = {i for i in range(1000)}
ranges = all_p - p

diff = 1e9
for i in ranges:
    if diff > abs(i - X):
        diff = abs(i - X)

ans_1 = X + diff
ans_2 = X - diff

for i in ranges:
    if i == ans_2:
        print(ans_2)
        break
else:
    print(ans_1)

Problem: p02641
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x, n = map(int, input().split())
lst = list(map(int, input().split()))
a = 100
b = 0

for i in range(1, 102):
  if i in lst:
    continue

  if a > abs(x-i):
    a = abs(x-i)
    b = i

print(i)

Failing test case input:
2 1
4 5 1 1 0

Expected output:
2


Actual output:
101


Fixed submission (verdict: Accepted):
x, n = map(int, input().split())
lst = []
if n > 0:
  lst = list(map(int, input().split()))
a = 100
b = 0

for i in range(0, 102):
  if i in lst:
    continue

  if a > abs(x-i):
    a = abs(x-i)
    b = i

print(b)

Problem: p02641
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x,n= map(int, input().split())
if n!=0:
    p = list(map(int, input().split()))
else:
  p=[]
def func(x,n,p):
    if n==0:
        print(x)
        return
    current = x
    for d in range(1,101,1):
        if current-d not in p:
            print(current-d)
            return
        elif current+d not in p:
            print(current+d)
            return
func(x,n,p)

Failing test case input:
15 1
7 5 3 16 11

Expected output:
15


Actual output:
14


Fixed submission (verdict: Accepted):
x,n= map(int, input().split())
if n!=0:
    p = list(map(int, input().split()))
else:
    p=[]
def func(x,n,p):
    if n==0:
        print(x)
        return
    if x not in p:
        print(x)
        return
    current = x
    for d in range(1,101,1):
        if current-d not in p:
            print(current-d)
            return
        elif current+d not in p:
            print(current+d)
            return
    print(x-101)
    return
func(x,n,p)
Problem: p03435
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
lst=[]
for i in range(3):
  a,b,c=map(int,input().split())
  lst.append([a,b,c])
for i in range(3):
  if (lst[i][1]-lst[i][0])!=(lst[i][2]-lst[i][1]) or (lst[1][i]-lst[0][i])!=(lst[2][i]-lst[1][i]):
    print('No')
    sys.exit()
print('Yes')

Failing test case input:
1 0 1
2 1 2
1 0 1

Expected output:
Yes

Actual output:
No


Fixed submission (verdict: Accepted):
import sys
lst=[]
for i in range(3):
  a,b,c=map(int,input().split())
  lst.append([a,b,c])
for i in range(2):
  for j in range(2):
    if (lst[i][j+1]-lst[i][j])!=(lst[i+1][j+1]-lst[i+1][j]) or (lst[j+1][i]-lst[j][i])!=(lst[j+1][i+1]-lst[j][i+1]):
      print('No')
      sys.exit()
print('Yes')

Problem: p03435
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
nums =  [list(map(int,input().split())) for i in range(3)]
a1 = 0
b1,b2,b3 = map(int,nums[0])
a2 = nums[1][0] -b2
a3 = nums[2][0] -b3
print(a2,a3)
print(nums)
if nums[1][1] == a2+b2 and nums[1][2] == a2+b3 and nums[2][1] == a3+b2 and nums[2][2] == a3+b3:
    print("Yes")
else:print("No")


Failing test case input:
2 3 2
0 1 0
1 2 2

Expected output:
No


Actual output:
-3 -1
[[2, 3, 2], [0, 1, 0], [1, 2, 2]]
No


Fixed submission (verdict: Accepted):
nums =  [list(map(int,input().split())) for i in range(3)]
a1 = 0
b1,b2,b3 = map(int,nums[0])
a2 = nums[1][0] -b1
a3 = nums[2][0] -b1
if nums[1][1] == a2+b2 and nums[1][2] == a2+b3 and nums[2][1] == a3+b2 and nums[2][2] == a3+b3:
    print("Yes")
else:print("No")

Problem: p03435
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
y1_list = list(map(int,input().split()))
y2_list = list(map(int,input().split()))
y3_list = list(map(int,input().split()))
 
a1 = list()
a2 = list()

for i in range(3):
    a1.append(y1_list[i] - y2_list[i])
    a2.append(y2_list[i] - y3_list[i])
    
if a1[0] == a1[1] and a1[2] == a1[0]:
    if a2[0] == a1[1] and a2[2] == a1[0]:
        print("Yes")
        
    else:
        print("No")
else:
    print("Mo")

Failing test case input:
4 2 0
0 1 7
1 1 1

Expected output:
No


Actual output:
Mo


Fixed submission (verdict: Accepted):
y1_list = list(map(int,input().split()))
y2_list = list(map(int,input().split()))
y3_list = list(map(int,input().split()))
L = [y1_list,y2_list,y3_list]
 
a1 = list()
a2 = list()
b1 = list()
b2 = list()
 
for i in range(3):
    a1.append(y1_list[i] - y2_list[i])
    a2.append(y2_list[i] - y3_list[i])
    b1.append(L[i][0] - L[i][1])
    b2.append(L[i][1] - L[i][2])
 
 
if (a1[0] == a1[1] and a1[2] == a1[0])and(b1[0] == b1[1] and b1[2] == b1[0]):
    if (a2[0] == a2[1] and a2[2] == a2[0])and(b2[0] == b2[1] and b2[2] == b2[0]):
        print("Yes")
        
    else:
        print("No")
else:
    print("No")
Problem: p03435
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
C=[list(map(int,input().split())) for i in range(3)]
print(C)
print(C[1][0])
if C[0][1]-C[0][0]==C[1][1]-C[1][0] and C[1][1]-C[1][0]==C[2][1]-C[2][0]:
  print('Yes')
else:
  print('No')

Failing test case input:
4 2 -1
0 0 3
1 1 1

Expected output:
No


Actual output:
[[4, 2, -1], [0, 0, 3], [1, 1, 1]]
0
No


Fixed submission (verdict: Accepted):
C=[list(map(int,input().split())) for i in range(3)]
for n in range(0,2):
  x=C[0][2]-C[0][n]
  y=C[1][2]-C[1][n]
  z=C[2][2]-C[2][n]
  if x!=y or y!=z :
    print('No')
    exit()
else:
  print('Yes')

Problem: p03435
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
c11, c12, c13 = map(int, input().split())
c21, c22, c23 = map(int, input().split())
c31, c32, c33 = map(int, input().split())

ans = 'No'





for i in range(c11):
  a1 = i
  b1 = c11 - a1
  a2 = c21 - b1
  b2 = c12 - a1
  a3 = c31 - b1
  b3 = c13 - a1
  
  if (a2+b2 == c22) and (a2+b3 == c23) and (a3+b2 == c32) and (a3+b3 == c33):
    ans = 'Yes'
    break
print(ans)
  

Failing test case input:
0 8 8
0 8 8
0 8 8

Expected output:
Yes

Actual output:
No


Fixed submission (verdict: Accepted):
c11, c12, c13 = map(int, input().split())
c21, c22, c23 = map(int, input().split())
c31, c32, c33 = map(int, input().split())

ans = 'No'





for i in range(c11+1):
  a1 = i
  b1 = c11 - a1
  a2 = c21 - b1
  b2 = c12 - a1
  a3 = c31 - b1
  b3 = c13 - a1
  
  
  
  if (a2+b2 == c22) and (a2+b3 == c23) and (a3+b2 == c32) and (a3+b3 == c33):
    ans = 'Yes'
    break
print(ans)

Problem: p03435
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
a = [list(map(int,input().split()))for i in range(3)]
x = [10,0,0]
y = [0,0,0]

for i in range(3):
    y[i] = a[0][i]-x[0]

for i in range(3):
    x[i] = a[i][0]-y[0]

flag = True
print(y)
print(x)
for i in range(3):
    for j in range(3):
        if a[i][j] != x[i]+y[j]:
            flag=False

if flag:
    print("Yes")
else:
    print("No")

Failing test case input:
2 2 -2
0 1 3
1 1 1

Expected output:
No


Actual output:
[-8, -8, -12]
[10, 8, 9]
No


Fixed submission (verdict: Accepted):
a = [list(map(int,input().split()))for i in range(3)]
x = [10,0,0]
y = [0,0,0]

for i in range(3):
    y[i] = a[0][i]-x[0]

for i in range(3):
    x[i] = a[i][0]-y[0]

flag = True

for i in range(3):
    for j in range(3):
        if a[i][j] != x[i]+y[j]:
            flag=False

if flag:
    print("Yes")
else:
    print("No")

Problem: p03435
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
c = [list(map(int, input().split())) for i in range(3)]
a = [0, 0, 0]
count = 0
for i in range(2):
    for j in range(3):
        a[j] = c[i][j] - c[i + 1][j]
        count += 1 if a[0] == a[1] == a[2] else 0
print("Yes" if count == 2 else "No")

Failing test case input:
0 8 2
0 8 8
0 0 8

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
c = [list(map(int, input().split())) for i in range(3)]
a = [0, 0, 0]
count = 0
for i in range(2):
    for j in range(3):
        a[j] = c[i][j] - c[i + 1][j]
    count += 1 if a[0] == a[1] == a[2] else 0
print("Yes" if count == 2 else "No")