ZhenlongDai/ACPR huggingface dataset:
Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
import sys


def main():
    while True:
        x, y = [int(i) for i in sys.stdin.readline().split(' ')]
        if x == 0 & y == 0:
            break
        if x <= y:
            print(x, y)
        else:
            print(y, x)
    return


if __name__ == '__main__':
    main()



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

Expected output:
0 1
2 2
3 9


Actual output:

Fixed submission (verdict: Accepted):
import sys


def main():
    while True:
        x, y = [int(i) for i in sys.stdin.readline().split(' ')]
        if x == 0 and y == 0:
            break
        elif x <= y:
            print(x, y)
        else:
            print(y, x)


if __name__ == '__main__':
    main()

Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
import sys

while 1:
  str = sys.stdin.readline().strip()
  if str=="0 0":
    break

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

Expected output:
1 3
0 1


Actual output:

Fixed submission (verdict: Accepted):
import sys

while 1:
  str = sys.stdin.readline().strip()
  if str=="0 0":
    break
  print(" ".join(sorted(str.split(" "), key=int)))

Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
while True:
    a,b = map(int,input().split())
    if a == 0 and b == 0:
        break

    if a > b:
        print(a, b)
    else :
        print(b, a)

        

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

Expected output:
1 3
-1 2
0 1


Actual output:
3 1
2 -1
1 0


Fixed submission (verdict: Accepted):
while True:
    a,b = map(int,input().split())
    if a == 0 and b == 0:
        break

    if a > b:
        print(b, a)
    else :
        print(a, b)

Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
while True:
    x,y = map(int, input().split())
    if x == 0 and y == 0:
          break
if x > y:
    print(y, x)
else:
    print(x, y)


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

Expected output:
1 3
0 2
0 9


Actual output:
0 0


Fixed submission (verdict: Accepted):
while True:
    x,y = map(int, input().split())
    if x == 0 and y == 0:break
    if x > y:
       print(y, x)
    else:
       print(x, y)

Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
while True:
    a,b = map(int,input().split())
    if a==0:
        break
    print(b,a)

Failing test case input:
0 3
3 6
5 6
0 0

Expected output:
0 3
3 6
5 6


Actual output:

Fixed submission (verdict: Accepted):
while True:
    a = list(map(int,input().split()))
    a.sort()
    if a[1]==0:
        break
    print(a[0],a[1])
Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
a=[]
while True:
    m,n=input().split()
    if m==n=="0":
        break
    else:
        a.append(sorted([int(m),int(n)]))
print(a)
for i in range(len(a)):
    print("{0} {1}".format(a[i][0],a[i][1]))

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

Expected output:
1 3
0 1
0 1


Actual output:
[[1, 3], [0, 1], [0, 1]]
1 3
0 1
0 1


Fixed submission (verdict: Accepted):
a=[]
while True:
    m,n=input().split()
    if m==n=="0":
        break
    else:
        a.append(sorted([int(m),int(n)]))
for i in range(len(a)):
    print("{0} {1}".format(a[i][0],a[i][1]))

Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
while True:
    c = input().split()
    x, y = int(c[0]), int(c[1])
    if x == y == 0:
        break
    if y < x:
        x, y = y, x
    print("%d %d" % (y, x))



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

Expected output:
1 2
1 2
2 3


Actual output:
2 1
2 1
3 2


Fixed submission (verdict: Accepted):
while True:
    c = input().split()
    x, y = int(c[0]), int(c[1])
    if x == y == 0:
        break
    if y < x:
        x, y = y, x
    print("%d %d" % (x, y))

Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
import sys
while True :
    a, b = input().split()
    if a == b == "0" : break
    elif a >= b :
        print(b, a)
    else : print(a,b)

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

Expected output:
0 3
0 2
3 15


Actual output:
0 3
0 2
15 3


Fixed submission (verdict: Accepted):
while True :
    a, b = [int(i) for i in input().split()]
    if a == b == 0 : break
    elif a >= b :
        print(b, a)
    else : print(a,b)

Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
x=1
y=1
while x!=0 and y!=0 :
	x,y=map(int, input().split(" "))
	if y<x :
		k=x
		x=y
		y=k
	print(x,y)

Failing test case input:
3 2
2 3
5 6
0 0

Expected output:
2 3
2 3
5 6


Actual output:
2 3
2 3
5 6
0 0


Fixed submission (verdict: Accepted):
x=1
y=1
while True :
	x,y=map(int, input().split(" "))
	if x==0 and y==0 :
		break
	if y<x :
		k=x
		x=y
		y=k
	print(x,y)

Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
while True:
    a,b=map(int,input().split())
    if a==0 and b==0:
        break
    print(b,a)

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

Expected output:
1 3
2 3
3 9


Actual output:
1 3
3 2
3 9


Fixed submission (verdict: Accepted):
while True:
    a=sorted(map(int,input().split()))
    if a==[0,0]:
        quit()
    print(*a)

Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
while True:
    a = input()
    b = a.split(' ')
    b.sort()
    if int(b[0]) == 0 and int(b[1]) == 0:
        break
    print('%s %s' % (b[0],b[1]))

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

Expected output:
0 3
0 2
3 27


Actual output:
0 3
0 2
27 3


Fixed submission (verdict: Accepted):
while True:
    a = input()
    b = a.split(' ')
    b.sort(key=int)
    if int(b[0]) == 0 and int(b[1]) == 0:
        break
    print('%s %s' % (b[0],b[1]))
Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
while True:
    x,y = map(int, input().split())
    if x == 0 and y == 0:
         break
if x > y:
    print(y, x)
else:
    print(x, y)


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

Expected output:
2 3
-1 2
0 1


Actual output:
0 0


Fixed submission (verdict: Accepted):
while True:
    x,y = map(int, input().split())
    if x == 0 and y == 0:break
    if x > y:
       print(y, x)
    else:
       print(x, y)

Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
while 1:
	a, b = map(int, input().split())
	if b < a:
		print(b, a)
	else:
		print(a, b)
	if a == 0 and b == 0:
		break

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

Expected output:
2 3
-1 4
0 1


Actual output:
2 3
-1 4
0 1
0 0


Fixed submission (verdict: Accepted):
while 1:
	a, b = map(int, input().split())
	if a == 0 and b == 0:
		break
		
	if b < a:
		print(b, a)
	else:
		print(a, b)

Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
result = []
while True:
    my_value = input()
    my_value_list = []
    my_value_list = ([int(x) for x in my_value.split()])
    my_value_list.sort()
    result.append(my_value_list)
    if my_value_list[0] == 0 and my_value_list[1] == 0:
        break

for i in range(0, len(result)):
    print("{} {}".format(result[i][0], result[i][1]))

Failing test case input:
3 2
2 5
5 6
0 0

Expected output:
2 3
2 5
5 6


Actual output:
2 3
2 5
5 6
0 0


Fixed submission (verdict: Accepted):
result = []
while True:
    my_value = input()
    my_value_list = []
    my_value_list = ([int(x) for x in my_value.split()])
    my_value_list.sort()
    result.append(my_value_list)
    if my_value_list[0] == 0 and my_value_list[1] == 0:
        result.pop()
        break

for i in range(0, len(result)):
    print("{} {}".format(result[i][0], result[i][1]))

Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
while True:
    a, b = map(int, input().split())
    if a == 0 and b == 0:
        break
    if a > b:
        print(f"b a")
    else:
        print(f"a b")



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

Expected output:
1 3
1 2
5 9


Actual output:
b a
a b
b a


Fixed submission (verdict: Accepted):
while True:
    a, b = map(int, input().split())
    if a == 0 and b == 0:
        break
    elif a > b:
        print(f'{b} {a}')
    else:
        print(f'{a} {b}')

Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
while True:
    l = input().split()
    b = int(l[0])
    c = int(l[1])
    if b == 0 and c == 0:
        break
    print(str(b) + " " + str(c))

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

Expected output:
1 2
2 3
3 14


Actual output:
2 1
2 3
14 3


Fixed submission (verdict: Accepted):
while True:
    l = input().split()
    b = int(l[0])
    c = int(l[1])
    if b == 0 and c == 0:
        break
    if b < c:
        print(b, c)
    else:
        print(c, b)
Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
while True:
    x,y = map(int, input().split())
    if( x == 0 and y == 0):
        break
    print(f'{y} {x}')



Failing test case input:
3 3
2 5
5 6
0 0

Expected output:
3 3
2 5
5 6


Actual output:
3 3
5 2
6 5


Fixed submission (verdict: Accepted):
while True:
    x,y = map(int, input().split())
    if( x == 0 and y == 0):
        break
    if( x < y):
        print(f'{x} {y}')
    else:
        print(f'{y} {x}')

Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
while True:
    a,b = map(int,input().split())
    if a == 0 and b == 0:
        break
    else:
        if a < b:
            print("{} {}".format(a,b))
        elif a > b:
            print("{} {}".format(b,a))


Failing test case input:
7 0
1 1
1 6
0 0

Expected output:
0 7
1 1
1 6


Actual output:
0 7
1 6


Fixed submission (verdict: Accepted):
while True:
    x, y = map(int, input().split())
    if x == y == 0:
        break
    else:
        if x > y:
            print(y, x)
        else:
            print(x, y)

Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
while(1):
    a,b = [int(i) for i in input().split()]
    if a == 0 and b == 0:
        break
    print(b,a)


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

Expected output:
0 3
-1 4
0 1


Actual output:
0 3
4 -1
1 0


Fixed submission (verdict: Accepted):
while(1):
    a,b = [int(i) for i in input().split()]
    if a == 0 and b == 0:
        break
    c = [a,b]
    c.sort()
    print(*c,sep=" ")

Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
import sys


def main():
    while True:
        x, y = [int(i) for i in sys.stdin.readline().split(' ')]
        if x == 0 & y == 0:
            break
        elif x >= y:
            print(x, y)
        else:
            print(y, x)
    return


if __name__ == '__main__':
    main()



Failing test case input:
3 3
2 5
5 6
0 0

Expected output:
3 3
2 5
5 6


Actual output:
3 3
5 2
6 5


Fixed submission (verdict: Accepted):
import sys


def main():
    while True:
        x, y = [int(i) for i in sys.stdin.readline().split(' ')]
        if x == 0 and y == 0:
            break
        elif x <= y:
            print(x, y)
        else:
            print(y, x)


if __name__ == '__main__':
    main()

Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
for i in range(3000):
  x,y=map(int,input().split())
  if x == 0 and y == 0:
    break
  print('{0} {1}'.format(y,x))

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

Expected output:
0 1
1 2
3 9


Actual output:
1 0
1 2
3 9


Fixed submission (verdict: Accepted):
for i in range(3000):
  x,y=map(int,input().split())
  if x == 0 and y == 0:
    break
  print('{0} {1}'.format(min(x,y),max(x,y)))
Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
while True:
    l = input().split()
    b = int(l[0])
    c = int(l[1])
    if b == 0 and c == 0:
        break
    print(b,c)

Failing test case input:
4 0
0 2
15 0
0 0

Expected output:
0 4
0 2
0 15


Actual output:
4 0
0 2
15 0


Fixed submission (verdict: Accepted):
while True:
    l = input().split()
    b = int(l[0])
    c = int(l[1])
    if b == 0 and c == 0:
        break
    if b < c:
        print(b, c)
    else:
        print(c, b)

Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
x,y=input().split()
while (x!='0'and y!='0'):
    if(x>y):print("{} {}".format(y,x))
    else:print("{} {}".format(x,y))
    x,y=input().split()

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

Expected output:
2 3
-1 4
0 1


Actual output:
2 3
-1 4


Fixed submission (verdict: Accepted):
x,y=input().split()
while (x!='0'or y!='0'):
    if(int(x)>int(y)):print("{} {}".format(y,x))
    else:print("{} {}".format(x,y))
    x,y=input().split()

Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
if __name__ == "__main__":
    while True:
        x,y = map(int,input().split())
        if x is not 0 and y is not 0 :
            if x > y:
                tmp = x
                x = y
                y = tmp
            print("%d %d"%(x,y))
        else:
            break

Failing test case input:
4 0
0 2
15 0
0 0

Expected output:
0 4
0 2
0 15


Actual output:

Fixed submission (verdict: Accepted):
if __name__ == "__main__":
    while True:
        x,y = map(int,input().split())
        if x is not 0 or y is not 0 :
            if x > y:
                tmp = x
                x = y
                y = tmp
            print("%d %d"%(x,y))
        else:
            break

Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
while True:
    x, y = map(int, input().split())
    if x == y == 0:
        break
    print(y, x)

Failing test case input:
3 3
2 3
5 6
0 0

Expected output:
3 3
2 3
5 6


Actual output:
3 3
3 2
6 5


Fixed submission (verdict: Accepted):
while True:
    x = list(map(int, input().split()))
    if x[0] == x[1] == 0:
        break
    print(min(x), max(x))

Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
def ex(x, y):
    if x < y:
        tmp = x
        x = y
        y = tmp
    return x, y

def ex2num():
    tmp = input().split(" ")
    while ('0' != tmp[0]) or ('0' != tmp[1]):
        r1, r2 = ex(tmp[0], tmp[1])
        print(r1, r2)
        tmp = input().split(" ")

    return 0

if __name__ == "__main__":
    ret = ex2num()


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

Expected output:
1 3
1 2
5 9


Actual output:
3 1
2 1
9 5


Fixed submission (verdict: Accepted):
def ex(x, y):
    if x > y:
        tmp = x
        x = y
        y = tmp

    return x, y

def ex2num():
    r1, r2 = input().split(" ")
    r1 = int(r1)
    r2 = int(r2)
    while (0 != r1) or (0 != r2):
        r1, r2 = ex(r1, r2)
        print(r1, r2)
        r1, r2 = input().split(" ")
        r1 = int(r1)
        r2 = int(r2)

    return 0

if __name__ == "__main__":
    ret = ex2num()
Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
from sys import stdin

while True:
    x, y = (int(n) for n in stdin.readline().rstrip().split())

    if x == y == 0:
        break

    print(y, x)



Failing test case input:
4 3
3 5
-1 6
0 0

Expected output:
3 4
3 5
-1 6


Actual output:
3 4
5 3
6 -1


Fixed submission (verdict: Accepted):
from sys import stdin

while True:
    arr = [int(n) for n in stdin.readline().rstrip().split()]

    if arr[0] == arr[1] == 0:
        break

    arr.sort()
    print(arr[0], arr[1])

Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
import fileinput

for line in fileinput.input():
    tokens = list(map(int, line.strip().split()))
    tokens.sort()
    a, b = tokens[0], tokens[1] 
    if a == 0 and b == b:
        break
    else:
        print(a, b)

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

Expected output:
0 3
-1 1
5 5


Actual output:

Fixed submission (verdict: Accepted):
import fileinput

for line in fileinput.input():
    tokens = list(map(int, line.strip().split()))
    tokens.sort()
    a, b = tokens[0], tokens[1] 
    if a == 0 and b == 0:
        break
    else:
        print(a, b)

Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
while True:
    a, b = map(int, input().split())
    if a == 0 and b == 0:
        break
    elif a > b:
        print(a, b)
    elif a < b:
        print(b, a)

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

Expected output:
1 3
-1 2
0 1


Actual output:
3 1
2 -1
1 0


Fixed submission (verdict: Accepted):
while True:
    a, b = map(int, input().split())
    if a == 0 and b == 0:
        break
    elif a > b or a == b:
        print(b, a)
    elif a < b:
        print(a, b)

Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
str_num = input()
while str_num != "0 0":
    num = sorted(str_num.split(" "))
    print("{} {}".format(num[0],num[1]))
    str_num = input()

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

Expected output:
1 2
2 3
3 14


Actual output:
1 2
2 3
14 3


Fixed submission (verdict: Accepted):
str_num = input()
while str_num != "0 0":
    num = sorted([int(x) for x in str_num.split(" ")])
    print("{} {}".format(num[0],num[1]))
    str_num = input()

Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
x = input().split()

while True :
    if x[0] == x[1] == '0' :
        break
    x.sort()
    print('{} {}'.format(int(x[0]), int(x[1])))
    x = input().split()

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

Expected output:
-1 4
1 2
5 18


Actual output:
-1 4
1 2
18 5


Fixed submission (verdict: Accepted):
while True :
    x, y = input().split()

    if x == y == '0' :
        break
    x = int(x)
    y = int(y)
    if x < y : print(x, y)
    else     : print(y, x)
Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
while True:
 a,b=map(int,input().split())
 if a==0 and b==0:
    break
 if a<b:
   print(b,a)
 else:
    print(a,b)
  

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

Expected output:
0 3
-1 2
3 15


Actual output:
3 0
2 -1
15 3


Fixed submission (verdict: Accepted):
while True:
 a,b=map(int,input().split())
 if a==0 and b==0:
    break
 if a <= b:
   print(a,b)
 else:
    print(b,a)

Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
while True:
    a,b = list(map(int,input().split()))
    if a==0 and b==0:
        break
    else:
        a,b = b,a
        print(a,b)

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

Expected output:
-1 4
0 2
3 27


Actual output:
-1 4
2 0
3 27


Fixed submission (verdict: Accepted):
while True:
    a,b = list(map(int,input().split()))
    if a==0 and b==0:
        break
    elif a<=b:
        print(a,b)
    else:
        a,b = b,a
        print(a,b)

Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
num = []
while True:
    n = input()
    a, b = [int(x) for x in n.split()]
    if a == 0 and b == 0:
        break
    num.append([a, b])

for ls in num:
    ls.sort()
    print(ls)

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

Expected output:
2 4
0 1
0 6


Actual output:
[2, 4]
[0, 1]
[0, 6]


Fixed submission (verdict: Accepted):
num = []
while True:
    n = input()
    a, b = [int(x) for x in n.split()]
    if a == 0 and b == 0:
        break
    num.append([a, b])

for ls in num:
    ls.sort()
    print('{} {}'.format(ls[0], ls[1]))

Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
while True:
    a,b = list(map(int,input().split()))
    if a==0 and b==0:
        break
    else:
        a,b = b,a
        print("{} {}".format(a,b))

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

Expected output:
1 2
2 3
3 4


Actual output:
1 2
3 2
3 4


Fixed submission (verdict: Accepted):
while True:
    a,b = list(map(int,input().split()))
    if a==0 and b==0:
        break
    elif a<=b:
        print(a,b)
    else:
        a,b = b,a
        print(a,b)

Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
x = []
y = []

i = 0

while True:
    indata = input().split()
    x.append(indata[0])
    y.append(indata[1])
    if int(x[i]) == int(y[i]) == 0:
        break
    i += 1

for j in range(len(x)):
    if int(x[j]) != 0 and int(y[j]) != 0:
        if int(x[j]) < int(x[j]):
            print("{0} {1}".format(x[j],y[j]))
        else:
            print("{0} {1}".format(y[j],x[j]))

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

Expected output:
1 3
0 2
0 9


Actual output:
1 3


Fixed submission (verdict: Accepted):
x = []
y = []

i = 0

while True:
    indata = input().split()
    x.append(indata[0])
    y.append(indata[1])
    if int(x[i]) == 0 and int(y[i]) == 0:
        break
    i += 1

for j in range(len(x)):
    if int(x[j]) == 0 and int(y[j]) == 0:
        pass
    else:
        if int(x[j]) < int(y[j]):
            print("{0} {1}".format(x[j],y[j]))
        else:
            print("{0} {1}".format(y[j],x[j]))
Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
while True:
    x=input().split()
    y=[int(x[0]),int(x[1])]
    if y[0]==0 and y[1]==0:
        break
    elif y[0]<y[1]:
        print("{} {}".format(y[0],y[1]))
    elif y[0]>y[1]:
        print("{} {}".format(y[1],y[0]))


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

Expected output:
0 3
-1 2
5 5


Actual output:
0 3
-1 2


Fixed submission (verdict: Accepted):
while True:
    x=input().split()
    y=[int(x[0]),int(x[1])]
    if y[0]==0 and y[1]==0:
        break
    elif y[0]<y[1]:
        print("{} {}".format(y[0],y[1]))
    elif y[0]>y[1]:
        print("{} {}".format(y[1],y[0]))
    else:
        print("{} {}".format(y[0],y[1]))

Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
v = 0
i = 0
a = []
b = []
while v == 0:
    x = input().split()
    if 0 == int(x[0]):
        if 0 == int(x[1]):
            v = 1
    else:
        a.append(int(x[0]))
        b.append(int(x[1]))
        i = int(i) + 1
for j in range(int(i)):
    if a[j] < b[j]:
        pass
    else:
        c = a[j]
        a[j] = b[j]
        b[j] = c

for j in range(int(i)):
    print('%d %d' % (int(a[j]),int(b[j])))


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

Expected output:
0 1
0 3


Actual output:
0 1


Fixed submission (verdict: Accepted):
v = 0
i = 0
a = []
b = []
while v == 0:
    x = input().split()
    if 0 == int(x[0]):
        if 0 == int(x[1]):
            v = 1
        else:
            a.append(int(x[0]))
            b.append(int(x[1]))
            i = int(i) + 1
        
    else:
        a.append(int(x[0]))
        b.append(int(x[1]))
        i = int(i) + 1
for j in range(int(i)):
    if a[j] < b[j]:
        pass
    else:
        c = a[j]
        a[j] = b[j]
        b[j] = c

for j in range(int(i)):
    print('%d %d' % (int(a[j]),int(b[j])))

Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
while 1:
    a, b = map(int, input().split())
    if a == 0 and b == 0: break
    print("{} {}".format(b, a))

Failing test case input:
0 3
3 6
5 1
0 0

Expected output:
0 3
3 6
1 5


Actual output:
3 0
6 3
1 5


Fixed submission (verdict: Accepted):
while 1:
    x, y = map(int, input().split())
    if x == y == 0: break
    print("{} {}".format(min(x,y), max(x,y)))

Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
while True:
    c = input().split()
    x, y = int(c[0]), int(c[1])
    if x == y == 0:
        break
    if y < x:
        x, y = y, x
    print("%s %s" % (y, x))



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

Expected output:
2 3
2 2
3 5

Actual output:
3 2
2 2
5 3


Fixed submission (verdict: Accepted):
while True:
    c = input().split()
    x, y = int(c[0]), int(c[1])
    if x == y == 0:
        break
    if y < x:
        x, y = y, x
    print("%d %d" % (x, y))
Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
for i in range(3000):
    k=input().split()
    a=int(k[0])
    b=int(k[0])
    if a==0 and b==0:
        break
    else:
        if a<b:
            print(str(a)+" "+str(b))
        else:
            print(str(b)+" "+str(a))


Failing test case input:
0 3
3 6
5 1
0 0

Expected output:
0 3
3 6
1 5


Actual output:

Fixed submission (verdict: Accepted):
for i in range(3000):
    k=input().split()
    a=int(k[0])
    b=int(k[1])
    if a==0 and b==0:
        break
    else:
        if a<b:
            print(str(a)+" "+str(b))
        else:
            print(str(b)+" "+str(a))

Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
input_data = []
m=0
while 1:
	a,b = input().split()

	if int(a) == 0 and int(b) == 0:
		break
	

	elif a <= b :
		m+=1
		input_data.append(a)
		input_data.append(b)
	else :
		m+=1
		input_data.append(b)
		input_data.append(a)

n=0
			
for i in range(m):
	print(input_data[n],input_data[n+1])
	n+=2

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

Expected output:
0 3
-1 2
3 15


Actual output:
0 3
-1 2
15 3


Fixed submission (verdict: Accepted):
input_data = []
m=0
while 1:
	a,b = input().split()

	if int(a) == 0 and int(b) == 0:
		break
	

	elif int(a) <= int(b) :
		m+=1
		input_data.extend([a,b])
	else :
		m+=1
		input_data.extend([b,a])

n=0
			
for i in range(m):
	print(input_data[n],input_data[n+1])
	n+=2

Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
import sys
import math
for i in sys.stdin.readlines():
    i = i.rstrip()
    i = i.split()
    if i[0] == "0" and i[1] == "0":
        break
    print(str(min(i))+" "+str(max(i)))

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

Expected output:
0 3
0 2
3 15


Actual output:
0 3
0 2
15 3


Fixed submission (verdict: Accepted):
import sys
import math
for i in sys.stdin.readlines():
    i = i.rstrip()
    i = i.split()
    x = int(i[0])
    y = int(i[1])
    if x == 0 and y == 0:
        break
    print(str(min(x,y))+" "+str(max(x,y)))

Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
import sys


def main():
    while True:
        x, y = [int(i) for i in sys.stdin.readline().split(' ')]
        if x == 0 & y == 0:
            break
        elif x > y:
            print('{0} {1}'.format(y, x))
        else:
            print('{0} {1}'.format(x, y))
    return


if __name__ == '__main__':
    main()



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

Expected output:
1 3
-1 1
0 1


Actual output:
1 3
-1 1


Fixed submission (verdict: Accepted):
import sys


def main():
    while True:
        x, y = [int(i) for i in sys.stdin.readline().split(' ')]
        if x == 0 and y == 0:
            break
        elif x <= y:
            print(x, y)
        else:
            print(y, x)


if __name__ == '__main__':
    main()
Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
while True:
    a, b = map(int, input().split())
    if a > b:
        print(a, b)
    elif a < b:
        print(b, a)
    elif a == 0 and b == 0:
        print(a, b)
        break

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

Expected output:
0 3
0 2
3 27


Actual output:
3 0
2 0
27 3
0 0


Fixed submission (verdict: Accepted):
while True:
    a, b = map(int, input().split())
    if a == 0 and b == 0:
        break
    elif a > b or a == b:
        print(b, a)
    elif a < b:
        print(a, b)

Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
a, b = map(int, input().split())

while 1:
    if a == 0 and b == 0:
        break
    else:
        print("%d %d" % (b, a))
        a, b = map(int, input().split())

Failing test case input:
0 2
2 3
5 6
0 0

Expected output:
0 2
2 3
5 6


Actual output:
2 0
3 2
6 5


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

while 1:
    if a == 0 and b == 0:
        break
    else:
        if b < a:
            a, b = b, a
        print("%d %d" % (a, b))
        a, b = map(int, input().split())

Problem: p02397
Buggy submission (Python3, verdict: Wrong Answer):
while True:
    a, b = [int(x) for x in input().split()]
    if a == 0 and b == 0:
        break
    print(a, b)



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

Expected output:
0 1
1 2
3 9


Actual output:
0 1
2 1
9 3


Fixed submission (verdict: Accepted):
while True:
    a, b = [int(x) for x in input().split()]
    if a == 0 and b == 0:
        break
    if a < b:
        print(a, b)
    else:
        print(b, a)
Problem: p04045
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


import itertools
N, K = input().split()
P = input().split()


a= sorted(set([str(i) for i in range(10)])-set(P))

b1 = itertools.product(a, repeat=len(N))

b2 = itertools.product(a, repeat=len(N)+1)
ans=str()
cnt=0
for i in b1:
  
  ans = "".join(i)
  if N <= ans:
    print(ans)
    cnt=1
    break
if cnt==1:
  for i in b2:
    ans = "".join(i)
    if N <= ans:
      print(ans)
      break

Failing test case input:
1000 8
1 3 4 5 6 7 8 9

Expected output:
2000

Actual output:
2000
20000


Fixed submission (verdict: Accepted):


import itertools
N, K = input().split()
P = input().split()


a= sorted(set([str(i) for i in range(10)])-set(P))

b1 = itertools.product(a, repeat=len(N))

b2 = itertools.product(a, repeat=len(N)+1)
ans=str()
cnt=0
for i in b1:
  
  ans = "".join(i)
  if N <= ans:
    print(ans)
    cnt=1
    break
if cnt==0:
  for i in b2:
    ans = "".join(i)
    
    if "0"+N <= ans:
      print(ans)
      break

Problem: p04045
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
price, num = input().split(" ")
dislike = input().split(" ")
for i in range(int(price), 10001):
    if set(dislike) & set(str(i)):
        continue
    else:
        print(i)

Failing test case input:
1000 8
1 3 4 5 6 7 8 9

Expected output:
2000

Actual output:
2000
2002
2020
2022
2200
2202
2220
2222


Fixed submission (verdict: Accepted):
price, num = input().split(" ")
dislike = input().split(" ")
for i in range(int(price), 100000):
    if set(dislike) & set(str(i)):
        continue
    else:
        print(i)
        break

Problem: p04045
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k=map(int,input().split())
d=list(map(int,input().split()))
print(d)

for i in range(n,10001):
     for x in d:
         if str(x) in str(i):
             break
     else:
         print(i)
         break

Failing test case input:
1000 8
1 3 4 5 6 7 8 9

Expected output:
2000

Actual output:
[1, 3, 4, 5, 6, 7, 8, 9]
2000


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

for i in range(n,n*10+1):
     for x in d:
         if str(x) in str(i):
             break
     else:
         print(i)
         break

Problem: p04045
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, K = map(int, input().split())
D = set(list(map(int, input().split())))
D.add(0)
for i in range(N, 10000):
    int_i = [int(s) for s in list(str(i))]
    set_i = set(int_i)
    if not D & set_i:
        print(i)
        break
    i += 1


Failing test case input:
1000 8
1 3 4 5 6 7 8 9

Expected output:
2000

Actual output:
2222


Fixed submission (verdict: Accepted):
N, K = map(int, input().split())
D = set(list(map(int, input().split())))
while True:
    int_i = [int(s) for s in list(str(N))]
    set_i = set(int_i)
    if not D & set_i:
        print(N)
        break
    N += 1
Problem: p04045
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
input = sys.stdin.readline

N, K = [int(x) for x in input().split()]
D = [str(x) for x in input().rstrip()]
D = set(D)
for i in range(N, N + 10 ** 4):
    i_list = list(str(i))
    for j in i_list:
        if j in D:
            break
    print(i)
    sys.exit()
    

Failing test case input:
1000 8
1 3 4 5 6 7 8 9

Expected output:
2000

Actual output:
1000


Fixed submission (verdict: Accepted):
import sys
input = sys.stdin.readline

N, K = [int(x) for x in input().split()]
D = [str(x) for x in input().rstrip().split()]
D = set(D)
for i in range(N, N + 10 ** 6):
    i_list = list(str(i))
    flag = 1
    for j in i_list:
        if j in D:
            flag = 0
            break
    if flag:
        print(i)
        sys.exit()

Problem: p04045
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, K = list(map(int, input().split()))
D = set(input().split())
num = {str(i) for i in range(10)} - D

while True:
    print(set(str(N)))
    if set(str(N)) >= num:
        ans = N
        break
    else:
        N += 1
print(ans)

Failing test case input:
1000 8
1 3 4 5 6 7 8 9

Expected output:
2000

Actual output:
{'0', '1'}
{'0', '1'}
{'0', '2', '1'}
1002


Fixed submission (verdict: Accepted):
N, K = list(map(int, input().split()))
D = set(input().split())
num = {str(i) for i in range(10)} - D

while True:
    if set(str(N)) <= num:
        ans = N
        break
    else:
        N += 1
print(ans)

Problem: p04045
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, K = map(int,input().split())
D = list(map(int,input().split()))

while True:
  for n in str(N):
    if(n in D):
      break
  else:
    break
  N += 1
print(N)

Failing test case input:
1000 8
1 3 4 5 6 7 8 9

Expected output:
2000

Actual output:
1000


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

while True:
  for n in str(N):
    if(n in D):
      break
  else:
    break
  N += 1
print(N)

Problem: p04045
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


N=9999 
M=1

T=[]
L=[]
for i in range(10):
    if(not T.count(i)):
        L.append(i)

l=len(str(N))+1
MIN=10**10

def calc(st):
    global MIN
    st=str(st)
    if(len(st)>l):return 0
    for num in L:
        t=calc(st+str(num))
        if(int(t)>=N):
            MIN=min(MIN,int(t))
    if(st!=""):
        if(int(st)>=N):
            MIN=min(int(st),MIN)
    return (MIN)

print(calc(str()))







Failing test case input:
1000 8
1 3 4 5 6 7 8 9

Expected output:
2000

Actual output:
9999


Fixed submission (verdict: Accepted):
N,M=map(int,input().split())
T=list(map(int,input().split()))




L=[]
for i in range(10):
    if(not T.count(i)):
        L.append(i)

l=len(str(N))+1
MIN=10**10

def calc(st):
    global MIN
    st=str(st)
    if(len(st)>l):return 0
    for num in L:
        t=calc(st+str(num))
        if(int(t)>=N):
            MIN=min(MIN,int(t))
    if(st!=""):
        if(int(st)>=N):
            MIN=min(int(st),MIN)
    return (MIN)

print(calc(str()))
Problem: p04045
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, K = map(int,input().split())

D = list(map(int,input().split()))
OK = []
for i in range(10):
  if i not in D:
    OK.append(str(i))
print(OK)
sn = str(N)
l = len(sn)

ans = N*1
Flag = 0
while Flag == 0:
  sans = str(ans)
  if all(sans[i] in OK for i in range(len(sans))):
    Flag = 1
  else:
    ans += 1
print(ans)
      
    

Failing test case input:
1000 8
1 3 4 5 6 7 8 9

Expected output:
2000

Actual output:
['0', '2']
2000


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

D = list(map(int,input().split()))
OK = []
for i in range(10):
  if i not in D:
    OK.append(str(i))

sn = str(N)
l = len(sn)

ans = N*1
Flag = 0
while Flag == 0:
  sans = str(ans)
  if all(sans[i] in OK for i in range(len(sans))):
    Flag = 1
  else:
    ans += 1
print(ans)

Problem: p04045
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys

def hantei(array,n):
  s = str(n)
  for i in range(len(s)):
    if s[i] in array:
      return False
  
  return True

n,k = map(int,input().split())
d = list(map(int,input().split()))

while True:
  if hantei(d,n):
    print(n)
    sys.exit()
    
  n += 1

Failing test case input:
1000 8
1 3 4 5 6 7 8 9

Expected output:
2000

Actual output:
1000


Fixed submission (verdict: Accepted):
import sys

def hantei(array,n):
  s = str(n)
  for i in range(len(s)):
    if int(s[i]) in array:
      return False
  
  return True

n,k = map(int,input().split())
d = list(map(int,input().split()))

while True:
  if hantei(d,n):
    print(n)
    sys.exit()
    
  n += 1

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


def main():


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

    print(D)

    numList = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

    num = set()
        
    for i in numList:
        if i not in D:
            num.add(i)
    
    

    for i in range(N, N * 10 + 1):
        setI = set(int(x) for x in list(str(i)))
        if len(num | setI) <= len(num):
            ans = i
            break
                
    print(ans)
    

if __name__ == "__main__":
    main()

Failing test case input:
1000 8
1 3 4 5 6 7 8 9

Expected output:
2000

Actual output:
[1, 3, 4, 5, 6, 7, 8, 9]
2000


Fixed submission (verdict: Accepted):


def main():


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

    numList = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

    num = set()
        
    for i in numList:
        if i not in D:
            num.add(i)
    

    for i in range(N, N * 10 + 1):
        setI = set(int(x) for x in list(str(i)))
        if len(num | setI) <= len(num):
            ans = i
            break
                
    print(ans)


if __name__ == "__main__":
    main()
Problem: p04045
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import itertools
N,K=map(int,input().split())
D=set(list(map(str,input().split())))
U=list({'0','1','2','3','4','5','6','7','8','9'}^D)
U.sort()

PRD1 = list(itertools.product(U, repeat=len(str(N))))
PRD2 = list(itertools.product(U, repeat=len(str(N))+1))

import sys
for i in range(len(PRD1)):
    T=int(''.join(PRD1[i]))
    if T>=N:
        print('ans='+str(T))
        sys.exit()

for i in PRD2:
    T=int(''.join(i))
    if T>=N:
        print(T)
        sys.exit()

Failing test case input:
1000 8
1 3 4 5 6 7 8 9

Expected output:
2000

Actual output:
ans=2000


Fixed submission (verdict: Accepted):
import itertools
N,K=map(int,input().split())
D=set(list(map(str,input().split())))
U=list({'0','1','2','3','4','5','6','7','8','9'}^D)
U.sort()

PRD1 = list(itertools.product(U, repeat=len(str(N))))
PRD2 = list(itertools.product(U, repeat=len(str(N))+1))

import sys
for i in range(len(PRD1)):
    T=int(''.join(PRD1[i]))
    if T>=N:
        print(T)
        sys.exit()

for i in PRD2:
    T=int(''.join(i))
    if T>=N:
        print(T)
        sys.exit()

Problem: p04045
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input().split()
money,num=int(s[0]),int(s[1])
no_list=input().split()
flag=0
for i in range(money,100000):
    for money_element in list(str(i)):
        if money_element in no_list:
            flag=1
            break
    if flag==0:
        print(i)
        break












Failing test case input:
1000 8
1 3 4 5 6 7 8 9

Expected output:
2000

Actual output:

Fixed submission (verdict: Accepted):
s=input().split()
money,num=int(s[0]),int(s[1])
no_list=input().split()
for i in range(money,100000):
    flag=0
    for money_element in list(str(i)):
        if money_element in no_list:
            flag=1
            break
    if flag==0:
        print(i)
        break

Problem: p04045
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n,k=map(int,input().split())
d=set(list(map(int,input().split())))

for i in range(n,100*n):
    flag=0
    sn=str(n)
    for j in sn:
        if j in d:
            flag=1
    if flag==0:
        print(i)
        exit()









Failing test case input:
1000 8
1 3 4 5 6 7 8 9

Expected output:
2000

Actual output:
1000


Fixed submission (verdict: Accepted):
n,k=map(int,input().split())
d=set(list(map(str,input().split())))

for i in range(n,10*n):
    flag=0
    sn=str(i)
    for j in sn:
        if j in d:
            flag=1
    if flag==0:
        print(i)
        exit()

Problem: p04045
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n,k=list(map(int,input().split()))
d = list(map(int,input().split()))

i =1
while True:
  if 10**(i-1)>n:
    break
  
  tmp = (n%(10**i))
  if tmp not in d:
    i+= 1
    continue
  else:
    n+=10**(i-1)
print(n)

Failing test case input:
1000 8
1 3 4 5 6 7 8 9

Expected output:
2000

Actual output:
1000


Fixed submission (verdict: Accepted):

def ok():
  for i in str(n):
    if int(i) in d:
      return False
  return True

n,k=list(map(int,input().split()))
d = list(map(int,input().split()))

while True:
  if ok():
    break
  n+=1

print(n)
Problem: p04045
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import deque
n, k = map(int, input().split())
D = list(map(int, input().split()))
ok_lst = [x for x in range(0, 10) if x not in D]
stack = deque([x for x in ok_lst if x != 0])
while len(stack) > 0:
    now_num = stack.popleft()
    print(now_num)
    if now_num >= n:
        break
    for x in ok_lst:
        next_num = str(now_num) + str(x)
        stack.append(int(next_num))

Failing test case input:
1000 8
1 3 4 5 6 7 8 9

Expected output:
2000

Actual output:
2
20
22
200
202
220
222
2000


Fixed submission (verdict: Accepted):
from collections import deque
n, k = map(int, input().split())
D = list(map(int, input().split()))
ok_lst = [x for x in range(0, 10) if x not in D]
stack = deque([x for x in ok_lst if x != 0])
while len(stack) > 0:
    now_num = stack.popleft()
    if now_num >= n:
        print(now_num)
        break
    for x in ok_lst:
        next_num = str(now_num) + str(x)
        stack.append(int(next_num))

Problem: p04045
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, k= input().split()
l = list(map(int,input().split()))
checkNum=[i for i in range(11)]

def find(x):
    while x!=checkNum[x]:
        checkNum[x]=checkNum[checkNum[x]]
        x=checkNum[x]
    return x

for i in l:
    checkNum[find(i)]=checkNum[find(i+1)]

fin=""
for i in range(len(n)):
    first=int(n[i])
    k=find(first)
    if k==first:
        fin+=str(k)
    else:
        if k!=10:
            fin+=str(k)
            i+=1
        else:
            fin=str(find(1))+str(find(0))*len(n)

        break

print(fin)


Failing test case input:
1000 8
1 3 4 5 6 7 8 9

Expected output:
2000

Actual output:
2


Fixed submission (verdict: Accepted):
n, k= input().split()
l = list(map(int,input().split()))
checkNum=[i for i in range(11)]

def find(x):
    while x!=checkNum[x]:
        checkNum[x]=checkNum[checkNum[x]]
        x=checkNum[x]
    return x

for i in l:
    checkNum[find(i)]=checkNum[find(i+1)]

fin=""
for i in range(len(n)):
    first=int(n[i])
    k=find(first)
    if k==first:
        fin+=str(k)
    else:
        if k!=10:
            fin=str(k)+str(find(0))*(len(n)-i-1)
        else:
            fin=str(find(1))+str(find(0))*len(n)
        break

print(fin)

Problem: p04045
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n,k=map(int,input().split())
d=set(list(map(str,input().split())))
print(d)
for i in range(n,10*n):
    flag=0
    sn=str(i)
    for j in sn:
        if j in d:
            flag=1
    if flag==0:
        print(i)
        exit()









Failing test case input:
1000 8
1 3 4 5 6 7 8 9

Expected output:
2000

Actual output:
{'7', '8', '9', '1', '3', '6', '5', '4'}
2000


Fixed submission (verdict: Accepted):
n,k=map(int,input().split())
d=set(list(map(str,input().split())))

for i in range(n,10*n):
    flag=0
    sn=str(i)
    for j in sn:
        if j in d:
            flag=1
    if flag==0:
        print(i)
        exit()
Problem: p04045
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,k=map(int,input().split())
d = list(map(int,input().split()))
print(d)
for i in range(n,10000):
    count=0
    for j in range(k):
        u = d[j]
        if(str(i).count(str(u))!=0):
            count+=1
    if(count== 0):
        break
print(i)

Failing test case input:
1000 8
1 3 4 5 6 7 8 9

Expected output:
2000

Actual output:
[1, 3, 4, 5, 6, 7, 8, 9]
2000


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

for i in range(n,10**5):
    count=0
    for j in range(k):
        u = str(d[j])
        if(str(i).count(u)==0):
            count+=1
    
    if(count==k):
        print(i)
        break

Problem: p04045
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,K = map(int,input().split())
D  = {int(n) for n in input().split()}
a = {i for i in range(10)}
N_hate = a.difference(D)
for j in range(10001):
    if N <= j:
        L = {int(result) for result in str(j)}
        if N_hate != L:
            N_love = j
            break

print(N_love)


Failing test case input:
1000 8
1 3 4 5 6 7 8 9

Expected output:
2000

Actual output:
1000


Fixed submission (verdict: Accepted):
N,K = map(int,input().split())
D  = {int(n) for n in input().split()}
for j in range(N,N*10):
    if N <= j:
        L = {int(result) for result in str(j)}
        if D.isdisjoint(L):
            D_love = j
            break    
print(D_love)

Problem: p04045
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,K = map(int,input().split())
use = [0,1,2,3,4,5,6,7,8,9]
useless = list(map(int,input().split()))
for i in range(K):
  use.remove(useless[i])
k = 10 - K
time = [0]
def suc(time):
  now = 0
  while True:
    if now >= len(time):
      time.append(0)
      break
    elif time[now] != k-1:
      time[now] += 1
      break
    else:
      time[now] = 0
      now += 1
  return time



while True:
  pay = 0
  for j in range(len(time)):
    pay += use[time[j]] * 10 ** j
  if pay >= n:
    print(pay,time)
    break
  time = suc(time)

Failing test case input:
1000 8
1 3 4 5 6 7 8 9

Expected output:
2000

Actual output:
2000 [0, 0, 0, 1]


Fixed submission (verdict: Accepted):
n,K = map(int,input().split())
use = [0,1,2,3,4,5,6,7,8,9]
useless = list(map(int,input().split()))
for i in range(K):
  use.remove(useless[i])
k = 10 - K
time = [0]
def suc(time):
  now = 0
  while True:
    if now >= len(time):
      time.append(0)
      break
    elif time[now] != k-1:
      time[now] += 1
      break
    else:
      time[now] = 0
      now += 1
  return time



while True:
  pay = 0
  for j in range(len(time)):
    pay += use[time[j]] * 10 ** j
  if pay >= n:
    print(pay)
    break
  time = suc(time)
Problem: p04045
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k = map(int,input().split()) 
a = list(map(int,input().split())) 
b = {0,1,2,3,4,5,6,7,8,9}-set(a) 
print(set([int(i) for i in list(str(n))])-b)
while set([int(i) for i in list(str(n))])-b !=set() : 
    n += 1
print(n)

Failing test case input:
1000 8
1 3 4 5 6 7 8 9

Expected output:
2000

Actual output:
{1}
2000


Fixed submission (verdict: Accepted):
n,k = map(int,input().split()) 
a = list(map(int,input().split())) 
b = {0,1,2,3,4,5,6,7,8,9}-set(a) 
while set([int(i) for i in list(str(n))])-b !=set() : 
    n += 1
print(n)

Problem: p04045
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import deque
n,k = map(int,input().split())
d = set(list(map(int,input().split())))
a = list({0,1,2,3,4,5,6,7,8,9} - d)
a.sort()
que = deque()
que.append(0)

while que:
    ans = que.popleft()
    if ans >= n:
        print(ans)
        exit()
    for i in a:
        que.append(ans*10 + i)
        print(ans*10 + i)

Failing test case input:
1000 8
1 3 4 5 6 7 8 9

Expected output:
2000

Actual output:
0
2
0
2
20
22
0
2
20
22
200
202
220
222
0
2
20
22
200
202
220
222
2000
2002
2020
2022
2200
2202
2220
2222
0
2
20
22
200
202
220
222
2000
2002
2020
2022
2200
2202
2220
2222
2000


Fixed submission (verdict: Accepted):
from collections import deque
n,k = map(int,input().split())
d = set(list(map(int,input().split())))
a = list({0,1,2,3,4,5,6,7,8,9} - d)
a.sort()
que = deque()
que.append(0)

while que:
    ans = que.popleft()
    if ans >= n:
        print(ans)
        exit()
    for i in a:
        que.append(ans*10 + i)
Problem: p04045
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
inp=input().split(" ")
N=int(inp[0])
K=int(inp[1])
dislike=input().split(" ")
like=[]
for i in range(0,10):
    if str(i) not in dislike:
        like.append(str(i))
def search_min(n,like):
    n=str(n)
    if n<="9":
        for i in like:
            if i>=n:
                return i
    else:
        if n[0] in like:
            if n[1]<=like[-1]:
                return n[0]+search_min(n[1:],like)
            else:
                j=like.index(n[0])
                return like[j+1]+like[0]*(len(n)-1)
        else:
            for i in like:
                if i>n[0]:
                    return i+like[0]*(len(n)-1)
search_min(N,like)

Failing test case input:
1000 8
1 3 4 5 6 7 8 9

Expected output:
2000

Actual output:

Fixed submission (verdict: Accepted):
inp=input().split(" ")
N=int(inp[0])
K=int(inp[1])
dislike=input().split(" ")
like=[]
for i in range(0,10):
    if str(i) not in dislike:
        like.append(str(i))
def search_min(n,like):
    n=str(n)
    if len(n)==1:
        for i in like:
            if i>=n:
                return i
    else:
        if n[0] in like:
            if n[1]<=like[-1]:
                try:
                    return n[0]+search_min(n[1:],like)
                except TypeError:
                    return None
            else:
                j=like.index(n[0])
                if j+1<len(like):
                    return like[j+1]+like[0]*(len(n)-1)
        else:
            for i in like:
                if i>n[0]:
                    return i+like[0]*(len(n)-1)
if search_min(N,like)==None:
    n=len(str(N))
    k="1"+"0"*n
    print(search_min(k,like))
else:
    print(search_min(N,like))