ZhenlongDai/ACPR huggingface dataset:
Problem: p04045
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,K=map(int,input().split())
D=list(map(int,input().split()))

while True:
  S=str(N)
  flag=True
  for x in S:
    if x in D:
      flag=False
  if flag==True:
    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=list(map(int,input().split()))

while True:
  S=str(N)
  flag=True
  for x in S:
    if int(x) in D:
      flag=False
  if flag==True:
    break;
  N+=1
print(N)

Problem: p04045
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, k = map(int,input().split())
x = n
d = set(map(str,input().split()))
can_use = {str(i) for i in range(10)} ^ d
s_can_use = sorted(list(can_use))

for i in range(10**6):
    if set(list(str(x))) | can_use == can_use:
        print(n)
        break
    else:
        n += 1
        x = n
print(n)

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

Expected output:
2000

Actual output:
2000
2000


Fixed submission (verdict: Accepted):
n, k = map(int,input().split())
x = n
d = set(map(str,input().split()))
can_use = {str(i) for i in range(10)} ^ d
s_can_use = sorted(list(can_use))

for i in range(10**6):
    if set(list(str(x))) | can_use == can_use:
        print(n)
        break
    else:
        n += 1
        x = n

Problem: p04045
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter


def ok(n, D):
    
    counter = Counter(str(n))
    for d in D:
        if counter[str(d)] > 0:
            return False
    return True


def main():
    N, K = list(map(int, input().split(' ')))
    D = list(map(int, input().split(' ')))
    print(ok(1334, [0, 1, 2, 4]))
    while not ok(N, D):
        N += 1
    print(N)



if __name__ == '__main__':
    main()

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

Expected output:
2000

Actual output:
False
2000


Fixed submission (verdict: Accepted):
from collections import Counter


def ok(n, D):
    
    counter = Counter(str(n))
    for d in D:
        if counter[str(d)] > 0:
            return False
    return True


def main():
    N, K = list(map(int, input().split(' ')))
    D = list(map(int, input().split(' ')))
    while not ok(N, D):
        N += 1
    print(N)



if __name__ == '__main__':
    main()

Problem: p04045
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k = map(int, input().split())
a = list(map(int, input().split()))
d=0
e=0
for i in range(100000):
  d=str(n+i)
  for j in range(k):
    e=e+d.count(str(a[j]))
  if e==0:
    print(d)
    break
  d=0

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

Expected output:
2000

Actual output:

Fixed submission (verdict: Accepted):
n,k = map(int, input().split())
a = list(map(int, input().split()))
d=""
e=0
for i in range(100000):
  d=str(n+i)
  for j in range(k):
    e=e+d.count(str(a[j]))
  if e==0:
    print(int(d))
    break
  e=0
Problem: p04045
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
cost, hate = map(int, input().split())
hate_num = list(map(int, input().split()))

hate_str = list(str(hate_num))
pay = cost
flag = True
while flag:
    pay_str = list(str(pay))
    for i in reversed(range(len(pay_str))):
        if set([pay_str[i]]) - set(hate_str) != set([pay_str[i]]):
            pay += 10**(len(pay_str)-1-i)
            print(pay)
            flag = True
            break
        else:
            flag = False
print(pay)

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

Expected output:
2000

Actual output:
2000
2000


Fixed submission (verdict: Accepted):
cost, hate = map(int, input().split())
hate_num = list(map(int, input().split()))

hate_str = list(str(hate_num))
pay = cost
flag = True
while flag:
    pay_str = list(str(pay))
    for i in range(len(pay_str)):
        if set([pay_str[i]]) - set(hate_str) != set([pay_str[i]]):
            pay += 1
            flag = True
            break
        else:
            flag = False
print(pay)

Problem: p04045
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,K = map(int, input().split())
l = list(map(int, input().split()))
num = [i for i in range(10) if i not in l]

print(l)
while True:    
    N_str = str(N)
    frag = 0
    for i in range(len(N_str)):
        if int(N_str[i]) in l:
            
            frag = 1
            break
    if frag == 0:
        break
    else:
        N += 1
print(N)


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())
l = list(map(int, input().split()))
num = [i for i in range(10) if i not in l]


while True:    
    N_str = str(N)
    frag = 0
    for i in range(len(N_str)):
        if int(N_str[i]) in l:
            
            frag = 1
            break
    if frag == 0:
        break
    else:
        N += 1
print(N)

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,10000):
    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 (Python (3.4.3), verdict: Wrong Answer):
N, K = map(int, input().split())
D = list(map(int, input().split()))

for i in range(N, 10000):
    elem = set()
    n = i
    for _ in range(4):
        e = n % 10
        elem.add(e)
        n 
    if len(set(D) & elem) == 0:
        print(i)
        break

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(map(str, input().split()))

for i in range(N, 10*N+1):
    sn = str(i)
    flg = True
    for c in sn:
        if c in D:
            flg = False
            break
    if flg:
        print(i)
        break

Problem: p04045
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k=map(int, input().split())
ds=list(map(str, input().split()))
while True:
  for i in ds:
    if i in str(n):
      n+=1
      continue
  break
print(str(n))

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

Expected output:
2000

Actual output:
1001


Fixed submission (verdict: Accepted):
n,k=map(int, input().split())
ds=list(map(str, input().split()))
while any(i in str(n) for i in ds):
  n+=1
print(str(n))

Problem: p04045
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, K = map(int, input().split())
D = set(map(int, input().split()))
f = True
while f:
    if set(str(N)) == set(str(N)) - D:
        print(N)
        f = False
    else:
        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):
N, K = map(int, input().split())
D = set(map(str, input().split()))
f = True
while f:
    if set(list(str(N))) == set(list(str(N))) - D:
        print(N)
        f = False
    else:
        N += 1

Problem: p04045
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
nk=list(map(int,input().split()))
d=list(map(int,input().split()))
i=nk[0]
ans=0
while ans==0:
  flag=0
  for j in range(len(str(i))):
    if str(i)[j] in d:
      flag=1
      break
  if flag==0:
    ans=i
  i+=1
print(ans)

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

Expected output:
2000

Actual output:
1000


Fixed submission (verdict: Accepted):
nk=list(map(int,input().split()))
d=list(map(int,input().split()))
i=nk[0]
ans=0
while ans==0:
  flag=0
  for j in range(len(str(i))):
    if int(str(i)[j]) in d:
      flag=1
      break
  if flag==0:
    ans=i
  i+=1
print(ans)

Problem: p04045
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k=map(int,input().split())
d=list(map(str,input().split()))
for i in range(n,10000):
  for j in list(str(i).replace(""," ").split()):
    if int(j) in d:
      break  
  print(i)
  break

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=list(map(str,input().split()))
for i in range(n,100000):
  for j in list(str(i).replace(""," ").split()):
    if j in d:
      break
  else:
    print(i)
    break
Problem: p04045
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k=map(int, input().split())
ds=list(map(str, input().split()))
while True:
  for i in ds:
    if i in str(n):
      n+=1
      break
  break
print(str(n))


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

Expected output:
2000

Actual output:
1001


Fixed submission (verdict: Accepted):
n,k=map(int, input().split())
ds=list(map(str, input().split()))
while any(i in str(n) for i in ds):
  n+=1
print(str(n))

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

for i in range(0,10):
  if i not in D:
    C.append(i)


for i in range(N,10**10):
  cnt=0
  for j in list(map(int,list(str(i)))):
    cnt+=1
  if len(str(i))==cnt:
    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=list(map(int,input().split()))
C=[]

for i in range(0,10):
  if i not in D:
    C.append(i)


for i in range(N,10**10):
  cnt=0
  for j in list(map(int,list(str(i)))):
    if j in C:
      cnt+=1
  if len(str(i))==cnt:
    print(i)
    exit()

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

while True:
    for i in str(ans):
        if i in d:
            break
    else:
        print(ans)
        exit()
    ans += 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):
n, k = map(int, input().split())
d = input().split()
ans = n

while True:
    for i in str(ans):
        if i in d:
            break
    else:
        print(ans)
        exit()
    ans += 1

Problem: p04045
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k=map(int,input().split())
d=set(map(int,input().split()))
i=n
a=[]
for j in range(len(str(n))):
	a.append(str(n)[j])
a=set(a)
while i<10**5+1:
	if len(a&d)==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(map(str,input().split()))
i=n
a=[]
for j in range(len(str(n))):
	a.append(str(n)[j])
a=set(a)
while i<10**5+1:
	if len(a&d)==0:
		print(i)
		exit()
	else:
		i+=1
		a=[]
		for j in range(len(str(i))):
			a.append(str(i)[j])
		a=set(a)

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(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:
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 (Python (3.4.3), verdict: Wrong Answer):
N, K = map(int, input().split())
dislikes = [i for i in input().split()]

ans = []
is_zero = False
for i in range(N, 10000):
    str_i = str(i)
    if all([d not in str_i for d in dislikes]):
        print(i)
        is_zero = True
        break
if is_zero:
    print(0)


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

Expected output:
2000

Actual output:
2000
0


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

for i in range(N, 100000):
    str_i = str(i)
    if any([d in str_i for d in dislikes]):
        continue
    print(i)
    break
Problem: p04045
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
a,b = map(int,input().split())

c = input().split()

while 1:
    f = 1
    s = str(a)
    for i in c:
        if i in s: f = 0
    if f : break
    a += 1
print(c)

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

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

c = input().split()

while 1:
    f = 1
    s = str(a)
    for i in c:
        if i in s: f = 0
    if f : break
    a += 1
print(a)

Problem: p04045
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, K = map(int,input().split())
D = list(map(int,input().split()))
a = 10 
b = 10
c = 10
d = 10
e = 10
ans = 100000
for i in range(N,100000):
    if i >= 10000:
        a = i
    if i >= 1000:
        b = i
    if i >= 100:
        c = i
    if i >= 10:
        d = i
    e = i
    S = D.count(a) + D.count(b) + D.count(c) + D.count(d) + D.count(e)
    if S == 0:
        if ans > i:
            ans = i
print(ans)

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 = list(map(int,input().split()))
a = 10 
b = 10
c = 10
d = 10
e = 10
ans = 100000
for i in range(N,100000):
    if i >= 10000:
        a = i
    if i >= 1000:
        b = (i
    if i >= 100:
        c = (i
    if i >= 10:
        d = (i
    e = i%10
    S = D.count(a) + D.count(b) + D.count(c) + D.count(d) + D.count(e)
    if S == 0:
        if ans > i:
            ans = i
print(ans)

Problem: p04045
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,K=map(int,(input().split()))
li=[]
m=set(input())
for j in range(N,10000):
    if m & set(str(j)) == False:
        print(j)
        break





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

Expected output:
2000

Actual output:

Fixed submission (verdict: Accepted):
N,K=map(int,(input().split()))
li=[]
m=set(input())
for j in range(N,100000):
    if len(set(m & set(str(j))))==0:
        print(j)
        break

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

for i in range(N,10*N+1):
    if set(str(i))&set(Dk) == set():
        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):
N , K = map(int, input().split())
Dk = input().split()

for i in range(N,10*N+1):
    if set(str(i))&set(Dk) == set():
        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()))

for i in range(N, 100000):
    elem = set()
    n = i
    for _ in range(4):
        e = n % 10
        elem.add(e)
        n 
    if len(set(D) & elem) == 0:
        print(i)
        break

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(map(str, input().split()))

for i in range(N, 10*N+1):
    sn = str(i)
    flg = True
    for c in sn:
        if c in D:
            flg = False
            break
    if flg:
        print(i)
        break

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

ans=0
for i in range (n,100000):
  s=str(i)
  pay=True
  for j in range(len(s)):
    if s[j] in d:
      pay = False
      break
    
    if pay:
      ans = i
      break
print(ans)
      

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

Expected output:
2000

Actual output:
29999


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

ans = 0
for i in range(n,100000):
    s = str(i)
    pay = True
    for j in range(len(s)):
        if s[j] in d:
            pay = False
            break
    if pay:
        ans = i
        break
print(ans)

Problem: p04045
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import sys
n,k=map(int,input().split())
d=list(map(int,input().split()))
allowed=set()
for i in range(10):
  allowed.add(i)
for i in d:
  allowed.remove(i)
for i in range(n,10**7):
  b=str(i)
  c=set()
  for j in range(len(b)):
    c.add(b[j])
  if allowed.intersection(c)==set():
    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
n,k=map(int,input().split())
d=list(map(int,input().split()))
allowed=set()
for i in d:
  allowed.add(i)
for i in range(n,10**7):
  b=str(i)
  c=set()
  for j in range(len(b)):
    c.add(int(b[j]))
  if allowed.intersection(c)==set():
    print(i)
    sys.exit()

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

for i in range(N, 10*N+1):
    elem = set()
    n = i
    for _ in range(4):
        e = n % 10
        elem.add(e)
        n 
    if len(set(D) & elem) == 0:
        print(i)
        break

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(map(str, input().split()))

for i in range(N, 10*N+1):
    sn = str(i)
    flg = True
    for c in sn:
        if c in D:
            flg = False
            break
    if flg:
        print(i)
        break
Problem: p04045
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k=map(int,input().split())
d=[i for i in input().split()]
print(d)
while True:
    f=True
    for i in d:
        if i in str(n):
            f=False
            break
    if f:
        break
    n+=1
print(n)

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=[i for i in input().split()]
while True:
    f=True
    for i in d:
        if i in str(n):
            f=False
            break
    if f:
        break
    n+=1
print(n)

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

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

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,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 (PyPy3 (2.4.0), verdict: Wrong Answer):
N, K = list(map(int, input().split()))
D = list(map(int, input().split()))

for i in range(N, 10**5):
	for c in str(i):
		if c in D:
			break
	else:
		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 = list(map(int, input().split()))
D = list(map(str, input().split()))

for i in range(N, 10**5):
	for c in str(i):
		if c in D:
			break
	else:
		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()))

d = set()
for i in range(K):
    d.add(str(D[i]))
print(d)

for i in range(N, 100000):
    s = str(i)
    li = list(s)
    nowset = set(li)
    if not nowset & d:
        print(i)
        exit()



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

Expected output:
2000

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


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

d = set()
for i in range(K):
    d.add(str(D[i]))


for i in range(N, 100000):
    s = str(i)
    li = list(s)
    nowset = set(li)
    if not nowset & d:
        print(i)
        exit()
Problem: p04045
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, k = map(int, input().split())
d = list(map(str, input().split()))

for i in range(n, 10*n+1):
    num = list(str(i))
    for j, n in enumerate(num):
        print(n)
        if n in d:
            break
        if j == len(num)-1:
            print(i)
            exit()


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

Expected output:
2000

Actual output:
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
0
0
0
2000


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

for i in range(n, 10*n+1):
    num = list(str(i))
    for j, n in enumerate(num):
        if n in d:
            break
        if j == len(num)-1:
            print(i)
            exit()
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', 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:
now 2
now 20
now 22
now 200
now 202
now 220
now 222
now 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.4.3), verdict: Wrong Answer):
N, K = map(int, input().split())
D = input().split()
i = 0
while i < 1:
  i = 1
  for n in str(N):
    if n in D:
      i = 0
  N += 1
print(N)

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

Expected output:
2000

Actual output:
2001


Fixed submission (verdict: Accepted):
N, K = map(int, input().split())
D = input().split()
i = 0
while i < 1:
  i = 1
  for n in str(N):
    if n in D:
      i = 0
  N += 1
print(N - 1)

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

i = N
while True:
  flg = True
  for j in str(i):
    if int(j) in D:
      flg = False
      break

  if flg == True:
    print(i)
    exit()

  i += 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):
N, K = map(int, input().split())
D = list(map(int, input().split()))

i = N
while True:
  flg = True
  for j in str(i):
    if int(j) in D:
      flg = False
      break

  if flg == True:
    print(i)
    exit()

  i += 1

Problem: p04045
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
def digit():
    N, K = [int(n) for n in input().split()]
    digit = [int(n) for n in input().split()]

    for i in range(N, N*10):
        b = i
        while b != 0:
            if (b % 10) in digit:
                break
            b /= 10
        if b == 0:
            print(i)
            break

digit()

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

Expected output:
2000

Actual output:
1002


Fixed submission (verdict: Accepted):
def has_no(s, digits):
    for ch in s:
        if ch in digits:
            return False
    return True

def digit():
    N, K = [int(n) for n in input().split()]
    digits = input().split()

    for i in range(N, N*10):
        s = str(i)
        if has_no(s, digits):
            print(s)
            break

digit()
Problem: p04045
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def c_IrohaObsession(N, K, D):
    d = [str(i) for i in D]
    i = N
    while True:
        for c in str(i):
            if c in d:
                break
        else:
            return i
        i += 1

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

Expected output:
2000

Actual output:

Fixed submission (verdict: Accepted):
def c_IrohaObsession(N, K, D):
    d = [str(i) for i in D]
    i = N
    while True:
        for c in str(i):
            if c in d:
                break
        else:
            return i
        i += 1
N,K = [int(i) for i in input().split()]
D = [int(i) for i in input().split()]
print(c_IrohaObsession(N, K, D))

Problem: p04045
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from itertools import product

N, K = map(int, input().split())
D = map(int, input().split())
like_num = set(range(10)) ^ set(D)
length = len(str(N))
print(like_num)
for i in range(length, length+2):
  for x in product(like_num,repeat=i):
        d=''.join(map(str,x))
        if int(d)>=N:
          print(d)
          exit()

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):
from itertools import product

N, K = map(int, input().split())
D = map(int, input().split())
like_num = set(range(10)) ^ set(D)
length = len(str(N))

for i in range(length, length+2):
  for x in product(like_num,repeat=i):
        d=''.join(map(str,x))
        if int(d)>=N:
          print(d)
          exit()

Problem: p04045
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
K, N = map(int, input().split())
D = list(map(int, input().split()))
D.sort()
flag = False
print(D)
while True:
  K_str = str(K)
  for i in range(len(K_str)):
    for j in range(len(D)):
      if K_str[len(K_str)-1-i]==str(D[j]):
        flag=False
        break
      if j==len(D)-1:
        flag = True

    if not flag:
      break

  if flag:
    break
  K+=1

print(K)

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):
K, N = map(int, input().split())
D = list(map(int, input().split()))
D.sort()
flag = False
while True:
  K_str = str(K)
  for i in range(len(K_str)):
    for j in range(len(D)):
      if K_str[len(K_str)-1-i]==str(D[j]):
        flag=False
        break
      if j==len(D)-1:
        flag = True

    if not flag:
      break

  if flag:
    break
  K+=1

print(K)

Problem: p04045
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
N, K = map(int, input().split())
D = list(input().split())
for i in range(N, 100 * N):
    for d in D:
        if d not in str(i):
            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
N, K = map(int, input().split())
D = list(input().split())
D = set(D)
for i in range(N, 100 * N):
    if D & set(str(i)):
        continue
    else:
        print(i)
        sys.exit()
Problem: p04045
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, K = map(int, input().split())
D = set(map(int, input().split()))
while True:
    if set(str(N)) == set(str(N)) - D:
        print(N)
        break
    else:
        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):
N, K = map(int, input().split())
D = set(map(str, input().split()))
f = True
while f:
    if set(list(str(N))) == set(list(str(N))) - D:
        print(N)
        f = False
    else:
        N += 1

Problem: p04045
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k=map(int,input().split())
d=list(map(int,input().split()))
for i in range(n,10**6):
  flag=True
  for j in str(i):
    if int(j) in d:
      flag=False
      break
  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=list(map(int,input().split()))
for i in range(n,10**6):
  flag=True
  for j in str(i):
    if int(j) in d:
      flag=False
      break
  if flag:
    print(i)
    exit()

Problem: p04045
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k=map(int,input().split())
m=list(map(int,input().split()))
for i in range(n,100000):
  k=1
  for a in str(i):
    if a in m:
      k=0
  if k:
    print(i)
    break

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())
m=list(map(int,input().split()))
for i in range(n,100000):
  k=1
  for a in str(i):
    if int(a) in m:
      k=0
  if k:
    print(i)
    break

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

for i in range(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


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

Expected output:
2000

Actual output:
0


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 = list(map(int, input().split()))

L = [i for i in range(10) if i not in D]

A = [i for i in L]

for i in L:
  for j in L:
    A.append(10*i+j)
for  i in L:
  for j in L:
    for k in L:
      A.append(100*i+10*j+k)
for i in L:
  for j in L:
    for k in L:
      for l in L:
        A.append(1000*i+100*j+10*k+l)

for i in A:
  if i >= N:
    print(N)
    break

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 = list(map(int, input().split()))
L = [i for i in range(10) if i not in D]
A = []
for i in L:
  A.append(i)
for i in L:
  for j in L:
    A.append(10*i+j)
for  i in L:
  for j in L:
    for k in L:
      A.append(100*i+10*j+k)
for i in L:
  for j in L:
    for k in L:
      for l in L:
        A.append(1000*i+100*j+10*k+l)

for i in L:
  for j in L:
    for k in L:
      for l in L:
        for m in L:
          A.append(\
10000*i+1000*j+100*k+10*l+m)

for i in A:
  if i >= N:
    print(i)
    break

Problem: p04045
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k=map(int, input().split())
l1=map(int,input().split())
l2=[0,1,2,3,4,5,6,7,8,9]
l3=set(l1)^set(l2)
m=str(n)
l4=map(int,set(m))
l4=set(l4)
def check(a,b):
    if (a|b)==a:
        return True
    else:
        return False
while check(l3,l4) is False:
    n=n+1
    m=str(n)
    l4=map(int,set(m))
    l4=set(l4)
print(n+1)

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

Expected output:
2000

Actual output:
2001


Fixed submission (verdict: Accepted):
n,k=map(int, input().split())
l1=map(int,input().split())
l2=[0,1,2,3,4,5,6,7,8,9]
l3=set(l1)^set(l2)
m=str(n)
l4=map(int,set(m))
l4=set(l4)
def check(a,b):
    if (a|b)==a:
        return True
    else:
        return False
while check(l3,l4) is False:
    n=n+1
    m=str(n)
    l4=map(int,set(m))
    l4=set(l4)
print(n)

Problem: p04045
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from itertools import product
n, k = input().split()
a = list(input().split())
l = set([str(i) for i in range(10)]).difference(a)
ni = int(n)
for j in range(len(n), len(n)+2):
    for i in product(l, repeat=j):
        t = ''.join(i)
        if int(t) >= ni:
            print(t)
            exit()

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

Expected output:
2000

Actual output:
2222


Fixed submission (verdict: Accepted):
from itertools import product
n, k = input().split()
a = list(input().split())
l = set([str(i) for i in range(10)]).difference(a)
ni = int(n)
ans = int('99'+n)
for j in range(len(n), len(n)+2):
    for i in product(l, repeat=j):
        t = int(''.join(i))
        if t >= ni:
            ans = min(t, ans)
print(ans)
Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()
nS = len(S)
white = ("01"*10000)[:nS]
black = ("10"*10000)[:nS]
sa_white = len([1 for x,y in zip(S, white) if x!=y])
sa_black = len([1 for x,y in zip(S, black) if x!=y])
print(max(sa_white, sa_black))


Failing test case input:
01110000

Expected output:
3


Actual output:
5


Fixed submission (verdict: Accepted):
S = input()
nS = len(S)
white = ("01"*100000)[:nS]
black = ("10"*100000)[:nS]
sa_white = len([1 for x,y in zip(S, white) if x!=y])
sa_black = len([1 for x,y in zip(S, black) if x!=y])
print(min(sa_white, sa_black))

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()

now_col = S[0]
ans = 0
if len(S)==1:
    print(ans)
if len(S)!=1:
    for i in range(1,len(S)):
        if now_col != int(S[i]):
            now_col = int(S[i])
            continue
        else:
            ans += 1
            if now_col == 1:
                now_col = 0
            else:
                now_col = 1

print(ans)


Failing test case input:
00010110

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):
S = input()

now_col = int(S[0])
ans = 0
if len(S)==1:
    print(ans)
if len(S)!=1:
    for i in range(1,len(S)):
        
        if now_col != int(S[i]):
            
            now_col = int(S[i])
            continue
        else:
            ans += 1
            if now_col == 1:
                now_col = 0
            else:
                now_col = 1
    print(ans)

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
l =[int(i) for i in list(str(input()))]
ans = 0
num =0
n = 0

if l[0] == 1:
    l=[abs(i-1) for i in l]
print(l)

for i in l:
    if num%2 ==0:
        if i == 1:
            ans = ans +1
    else:
        if i == 0:
            ans =ans +1
    num = num +1
print(ans)

Failing test case input:
10100001

Expected output:
3


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


Fixed submission (verdict: Accepted):
l =[int(i) for i in list(str(input()))]
ans = 0
num =0
n = 0

if l[0] == 1:
    l=[abs(i-1) for i in l]

for i in l:
    if num%2 ==0:
        if i == 1:
            ans = ans +1
    else:
        if i == 0:
            ans =ans +1
    num = num +1
print(ans)
Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = list(int(x) for x in input())
n = len(s)
ans = []

count = 0
for i in range(2, n):
  if s[0] == s[1]:
    count += 1
  if i%2 == 0 and s[i] != s[0]:
    count += 1
  elif i%2 == 1 and s[i] == s[0]:
    count += 1
ans.append(count)

count = 1
for i in range(2, n):
  if s[0] != s[1]:
    count += 1
  if i%2 == 0 and s[i] == s[0]:
    count += 1
  elif i%2 == 1 and s[i] != s[0]:
    count += 1
ans.append(count)
print(min(ans))

Failing test case input:
00011111

Expected output:
3


Actual output:
5


Fixed submission (verdict: Accepted):
s = list(int(x) for x in input())
n = len(s)
ans = []

count = 0
if n >= 3:
  if s[0] == s[1]:
    count += 1
for i in range(2, n):
  if i%2 == 0 and s[i] != s[0]:
    count += 1
  elif i%2 == 1 and s[i] == s[0]:
    count += 1
ans.append(count)

count = 1
if n >= 3:
  if s[0] != s[1]:
    count += 1
for i in range(2, n):
  if i%2 == 0 and s[i] == s[0]:
    count += 1
  elif i%2 == 1 and s[i] != s[0]:
    count += 1
ans.append(count)

if n == 1:
  print(0)
elif n == 2:
  if s[0] == s[1]:
    print(1)
  else:
    print(0)
else:
  print(min(ans))

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()
a=[]
for i in range(len(s)):
  if i%2==0:
    a.append(0)
  else:
    a.append(1)
b=[]
for j in range(len(s)):
  if j%2==0:
    b.append(1)
  else:
    b.append(0)
cnt=0
for k in range(len(s)):
  if s[k]!=a[k]:
    cnt+=1
ans=0
for l in range(len(s)):
  if s[l]!=b[l]:
    ans+=1
print(min(cnt,ans))

Failing test case input:
00110011

Expected output:
4


Actual output:
8


Fixed submission (verdict: Accepted):
s=input()
a=[]
for i in range(len(s)):
  if i%2==0:
    a.append('0')
  else:
    a.append('1')
b=[]
for j in range(len(s)):
  if j%2==0:
    b.append('1')
  else:
    b.append('0')
cnt=0
for k in range(len(s)):
  if s[k]!=a[k]:
    cnt+=1
ans=0
for l in range(len(s)):
  if s[l]!=b[l]:
    ans+=1
print(min(cnt,ans))

Problem: p03073
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
s=list(input())
c1 = 0
c2 = 0
for i in range(len(s)):
    if i%2 == "0":
        if s[i] == "0":
            c1 += 1
    else:
        if s[i] != "0":
            c1 += 1
    if i%2 != "0":
        if s[i] == "0":
            c2 += 1
    else:
        if s[i] != "0":
            c2 += 1
print(min(c1,c2))

Failing test case input:
11100010

Expected output:
2


Actual output:
4


Fixed submission (verdict: Accepted):
s=list(input())
c1 = 0
c2 = 0
for i in range(len(s)):
    if i%2 == 0:
        if s[i] == '0':
            c1 += 1
    else:
        if s[i] == '1':
            c1 += 1
    if i%2 != 0:
        if s[i] == '0':
            c2 += 1
    else:
        if s[i] == '1':
            c2 += 1
print(min(c1,c2))
Problem: p03073
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = input()

ans0 = 0
ans1 = 1
for i, s_i in enumerate(s):
    if i % 2 == 0:
        if s_i == '0':
            ans1 += 1
        else:
            ans0 += 1
    else:
        if s_i == '0':
            ans0 += 1
        else:
            ans1 += 1
print(min(ans0, ans1))


Failing test case input:
10100100

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):
s = input()

ans0 = 0
ans1 = 0
for i, s_i in enumerate(s):
    if i % 2 == 0:
        if s_i == '0':
            ans1 += 1
        else:
            ans0 += 1
    else:
        if s_i == '0':
            ans0 += 1
        else:
            ans1 += 1
print(min(ans0, ans1))

Problem: p03073
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import sys, math
input = sys.stdin.readline

S = list(input().replace('\n',''))
S = list(map(int, S))
prev = S[0]
ans = 0
for i in range(1, len(S)):
  cur = S[i]
  if prev ^ cur == 0:
    ans += 1
    if i == 1:
      if cur ^ S[i+1] == 1:
        prev = cur
      else:
        prev = 2 + ~cur
    else:
      prev = 2 + ~cur
  else:
    prev = cur

print(ans)

Failing test case input:
00110001

Expected output:
3


Actual output:
5


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

S = list(input().replace('\n',''))
S = list(map(int, S))
prev = S[0]
ans = 0
for i in range(1, len(S)):
  cur = S[i]
  if prev ^ cur == 0:
    ans += 1






    prev = 2 + ~cur
  else:
    prev = cur

print(ans)

Problem: p03073
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = input()
x = 0
y = 0
for i in range(len(s)):
  if i % 2 != int(s[i]):
    x += 1
for j in range(len(s)):
  if i % 2 == int(s[j]):
    y += 1
print(min(x, y))

Failing test case input:
10100110

Expected output:
2


Actual output:
4


Fixed submission (verdict: Accepted):
s = input()
x = 0
y = 0
for i in range(len(s)):
  if i % 2 != int(s[i]):
    x += 1
for j in range(len(s)):
  if j % 2 == int(s[j]):
    y += 1
print(min(x, y))
Problem: p03073
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
import math
from math import gcd
INF = float("inf")

import sys
input=sys.stdin.readline
sys.setrecursionlimit(500*500)
import itertools
from collections import Counter,deque

def main():
    s = input().rstrip()
    l = len(s)
    a = 0
    ans = 0

    t = 1
    for i in s:
        if t != i:
            a += 1
        t = 1-t
    ans = a
    t = 0
    for i in s:
        if t != i:
            a += 1
        t = 1-t
    ans = min(a,ans)
    print(ans)

if __name__=="__main__":
    main()


Failing test case input:
10110111

Expected output:
4


Actual output:
8


Fixed submission (verdict: Accepted):
import math
from math import gcd
INF = float("inf")

import sys
input=sys.stdin.readline
sys.setrecursionlimit(500*500)
import itertools
from collections import Counter,deque

def main():
    s = input().rstrip()
    l = len(s)
    a = 0
    ans = 0

    t = 1
    for i in s:
        if t != int(i):
            a += 1
        t = 1-t
    ans = a
    t = 0
    a = 0
    for i in s:
        if t != int(i):
            a += 1
        t = 1-t
    ans = min(a,ans)
    print(ans)

if __name__=="__main__":
    main()

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    s = input()
    n = len(s)
    a = 0
    b = 0
    for i in range(n):
        if i & 1:
            if s[i] == '1':
                a += 1
            else:
                b += 1
        else:
            if s[i] == '1':
                b += 1
            else:
                a += 1
        print(min(a, b))
    return 0
main()

Failing test case input:
01110011

Expected output:
3


Actual output:
0
0
1
1
1
2
3
3


Fixed submission (verdict: Accepted):
def main():
    s = input()
    n = len(s)
    a = 0
    b = 0
    for i in range(n):
        if i & 1:
            if s[i] == '1':
                a += 1
            else:
                b += 1
        else:
            if s[i] == '1':
                b += 1
            else:
                a += 1
    print(min(a, b))
    return 0
main()

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
a = 0
b = 0
for index, i in enumerate(s):
  if int(i) == index%2:
    a+=1
  else:
    b+=1

Failing test case input:
00100001

Expected output:
4


Actual output:

Fixed submission (verdict: Accepted):
s = input()
a = 0
b = 0
for index, i in enumerate(s):
  if int(i) == index%2:
    a+=1
  else:
    b+=1
    
print(min(a, b))

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()
cnt = [[0,0],[0,0]]
for i, s in enumerate(S):
    x = int(i) % 2
    y = int(s)
    cnt[x][y] += 1
print(cnt)
if cnt[0][0] >= cnt[1][0]:
    print(cnt[0][1] + cnt[1][0])
else:
    print(cnt[0][0] + cnt[1][1])

Failing test case input:
00011110

Expected output:
4


Actual output:
[[2, 2], [2, 2]]
4


Fixed submission (verdict: Accepted):
S = input()
cnt = [[0,0],[0,0]]
for i, s in enumerate(S):
    x = int(i) % 2
    y = int(s)
    cnt[x][y] += 1
if cnt[0][0] > cnt[1][0]:
    print(cnt[0][1] + cnt[1][0])
else:
    print(cnt[0][0] + cnt[1][1])
Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = list(map(int,input()))
count1 = 0
count2 = 0
if len(s) == 1:
    print(0) 
else:
    for i in range(len(s)):
        if i % 2 == 0 and s[i] != 0:
            count1 += 1
        elif i%2 !=0 and s[i] != 1:
            count1 += 1
    for i in range(len(s)):
        if i % 2 == 0 and s[i] != 2:
            count2 += 1
        elif i%2 !=0 and s[i] != 0:
            count2 += 1
    print(min(count1,count2))

Failing test case input:
11100010

Expected output:
2


Actual output:
5


Fixed submission (verdict: Accepted):
s = list(map(int,input()))
n = len(s)
count1 = 0
count2 = 0
if n == 1:
    print(0) 
else:
    for i in range(n):
        if i%2 == 0 and s[i] != 0:
            count1 += 1
        elif i%2 != 0 and s[i] != 1:
            count1 += 1
    for i in range(n):
        if i%2 == 0 and s[i] != 1:
            count2 += 1
        elif i%2 !=0 and s[i] != 0:
            count2 += 1
    print(min(count1,count2))

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S=input()
s=0
t=0
for i in range(len(S)):
  if i%2==0:
    if S[i]==0:
      s+=1
  else:
    if S[i]==1:
      s+=1
for j in range(len(S)):
  if j%2==0:
    if S[j]==1:
      t+=1
  else:
    if S[j]==0:
      t+=1
print(min(s,t))

Failing test case input:
01111011

Expected output:
4


Actual output:
0


Fixed submission (verdict: Accepted):
S=input()
s=0
t=0
for i in range(len(S)):
  if i%2==0 and S[i]=="0":
    s+=1
  elif i%2!=0 and S[i]=="1":
    s+=1
for j in range(len(S)):
  if j%2==0 and S[j]=="1":
    t+=1
  elif j%2!=0 and S[j]=="0":
    t+=1
print(min(s,t))

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = str(input())
li = list(S)

i=0
c=0
count=0

while len(li) > i :
    if int(li[i]) == c :
        count = count + 1
    c = c + 1
    c = c % 2
    i = i + 1
    
if (len(li) + 1)/ 2  >= count : 
    ans = len(li) - count
else :
    ans = count

print(ans)

Failing test case input:
11011010

Expected output:
3


Actual output:
5


Fixed submission (verdict: Accepted):
S = str(input())
li = list(S)

i=0
c=0
count=0

while len(li) > i :
    if int(li[i]) == c :
        count = count + 1
    c = c + 1
    c = c % 2
    i = i + 1
    
if len(li) / 2 < count : 
    ans = len(li) - count
else :
    ans = count

print(ans)