Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
cnt = 0
while True:
    idx = s.find("01")
    if idx != -1:
        cnt += 2
        s = s[:idx] + s[idx+2:]
    idxx = s.find("10")
    if idxx != -1:
        cnt += 2
        s = s[:idxx] + s[idxx+2:]
    if idx == -1 and idxx == -1:
        break
print(cnt)

Fixed submission:
s = input()
cntB = s.count("0")
cntR = s.count("1")
print(min(cntR, cntB)*2)
Buggy python submission (verdict: Runtime Error):
t, x = map(int, input())
print(t/x)

Fixed submission:
t, x = map(int, input().split())
print(t/x)
Buggy python submission (verdict: Runtime Error):
s=input()
if s.sorted() == 'abc':
  print('Yes')
else:
  print('No')

Fixed submission:
s=input()
if 'a' in s and 'b' in s and 'c' in s:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
s=input()
if s.sort() == 'abc':
  print('Yes')
else:
  print('No')

Fixed submission:
s=input()
if 'a' in s and 'b' in s and 'c' in s:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
x=int(input())
a=int(input())
b=int(input())
ans=x-a
print(ans>=b):
  ans-=b
print('ans')

Fixed submission:
x=int(input())
a=int(input())
b=int(input())
ans=x-a
while ans>=b:
  ans-=b
print(ans)
Buggy python submission (verdict: Runtime Error):
a=input()
print(a.replace('2017/','2018/')


Fixed submission:
a=input()
print(a.replace('2017/','2018/'))

Buggy python submission (verdict: Runtime Error):
a=input()
a[3]='8'
print(a)

Fixed submission:
a=input()
print(a.replace('2017/','2018/'))

Buggy python submission (verdict: Runtime Error):
a=imput()
a[3]='8'
print(a)

Fixed submission:
a=input()
print(a.replace('2017/','2018/'))
Buggy python submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
ans = 0

for num in range(1, n+1):
  bits = list()
  while num > 0:
    tmp = num % 10
    bits.append(tmp)
    num -= tmp
    num /= 10
  if a <= bits.sum() <= b:
    ans += 1

print(ans)

Fixed submission:
n, a, b = map(int, input().split())
ans = 0

for num in range(1, n+1):
  bits = list()
  numm = num
  while num > 0:
    tmp = num % 10
    bits.append(tmp)
    num -= tmp
    num /= 10
  if a <= sum(bits) <= b:
    ans += numm

print(ans)

Buggy python submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
ans = 0

for num in range(1, n+1):
  bits = list()
  while num > 0:
    tmp = num % 10
    bits.append(tmp)
    num //= 10
  if a <= bits.sum() <= b:
    ans += 1

print(ans)

Fixed submission:
n, a, b = map(int, input().split())
ans = 0

for num in range(1, n+1):
  bits = list()
  numm = num
  while num > 0:
    tmp = num % 10
    bits.append(tmp)
    num -= tmp
    num /= 10
  if a <= sum(bits) <= b:
    ans += numm

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
ans = 0

for num in a:
  tmp = 0
  while num % 2 == 0:
    num /= 2
    tmp += 1
  	ans = min(tmp, ans)

print(ans)

Fixed submission:
import sys
n = int(input())
a = list(map(int, input().split()))
ans = sys.maxsize

for num in a:
  tmp = 0
  while num % 2 == 0:
    num /= 2
    tmp += 1
  ans = min(tmp, ans)

print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
ans = 0

for num in a:
  tmp = 0
  while num % 2 == 0:
    num /= 2
    tmp　+= 1
  	ans = min(tmp, ans)

print(ans)

Fixed submission:
import sys
n = int(input())
a = list(map(int, input().split()))
ans = sys.maxsize

for num in a:
  tmp = 0
  while num % 2 == 0:
    num /= 2
    tmp += 1
  ans = min(tmp, ans)

print(ans)
Buggy python submission (verdict: Runtime Error):
g,r=map(int,input().split())
print(2*g-r)

Fixed submission:
r=int(input())
g=int(input())
print(2*g-r)
Buggy python submission (verdict: Runtime Error):
h,w=map(int,input().split())
s=[list(input()) for _ in range(h)]

for i in range(h):
  for j in range(w):
    if s[i][j]=='#':
      continue
    cnt=0
    for dx in [-1,0,1]:
      for dy in [-1,0,1]:
        if not(0<=dx+i<=h and 0<=dy+j<=w):
          continue
        if s[i+dx][j+dy]=='#':
          cnt+=1
    s[i][j]=str(cnt)
for m in s:
  print(''.join(m))

Fixed submission:
h,w=map(int,input().split())
s=[list(input()) for _ in range(h)]

for i in range(h):
  for j in range(w):
    if s[i][j]=='#':
      continue
    cnt=0
    for dx in [-1,0,1]:
      for dy in [-1,0,1]:
        if not(0<=dx+i<=h-1 and 0<=dy+j<=w-1):
          continue
        if s[i+dx][j+dy]=='#':
          cnt+=1
    s[i][j]=str(cnt)
for m in s:
  print(''.join(m))
Buggy python submission (verdict: Runtime Error):
a,b,c=input().split()
ans=a.upper[0]+b.upper[0]+c.upper[0]
print(ans)


Fixed submission:
a,b,c=input().split()
ans=a.upper()[0]+b.upper()[0]+c.upper()[0]
print(ans)

Buggy python submission (verdict: Runtime Error):
a,b,c=input().split
ans=a.upper[0]+b.upper[0]+c.upper[0]
print(ans)

Fixed submission:
a,b,c=input().split()
ans=a.upper()[0]+b.upper()[0]+c.upper()[0]
print(ans)
Buggy python submission (verdict: Runtime Error):
import sympy
N = int(input())

div = sympy.divisors(N)
ans = 100

for i in range(len(div)):
    a = div[i]
    b = N // a
    ans = min(ans, max(len(str(a)), len(str(b))))
print(ans)


Fixed submission:
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

N = int(input())

div = make_divisors(N)
ans = 100

for d in div:
    a = d
    b = N // a
    ans = min(ans, max(len(str(a)), len(str(b))))
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b,c=input().split()
a=int(a)
c=int(c)
if b=='+':
  print(a+b)
else:
  print(a-b)

Fixed submission:
a,b,c=input().split()
a=int(a)
c=int(c)
if b=='+':
  print(a+c)
else:
  print(a-c)
Buggy python submission (verdict: Runtime Error):
//words = ['dream', 'dreamer', 'erase', 'eraser']
words = ['dream', 'erase', 'aser*', 'er', 'as']
s = input()
for word in words:
  s = s.replace(word, '*')
s = s.replace('*', '')
if len(s) == 0:
  print('YES')
else:
  print('NO')



Fixed submission:
er = ["dreamer", "eraser"]
noter = ["dream", "erase"]
words = er + noter
s = input()
while len(s) > 0:
  flag = True
  for word in words:
    if s.endswith(word):
      s = s[:-len(word)]
      flag = False
  if flag:
    print("NO")
    exit()
print("YES")
Buggy python submission (verdict: Runtime Error):
import sys

readline = sys.stdin.readline
readlines = sys.stdin.readlines
ns = lambda: readline().rstrip() # input string
ni = lambda: int(readline().rstrip()) # input int
nm = lambda: map(int, readline().split()) # input multiple int 
nl = lambda: list(map(int, readline().split())) # input multiple int to list

n = ni()
l = nl()
ans = 0

for i, usa in enumerate(l):
    if l[usa] - 1 == i:
        ans += 1
print(ans // 2)

Fixed submission:
import sys

readline = sys.stdin.readline
readlines = sys.stdin.readlines
ns = lambda: readline().rstrip() # input string
ni = lambda: int(readline().rstrip()) # input int
nm = lambda: map(int, readline().split()) # input multiple int 
nl = lambda: list(map(int, readline().split())) # input multiple int to list

n = ni()
l = nl()
ans = 0

for i, usa in enumerate(l):
    if l[usa - 1] == i + 1:
        ans += 1
print(ans // 2)
Buggy python submission (verdict: Runtime Error):
N, x = map(int, input().split())
a = list(map(int, input().split()))
if sum(a) == x:
  print(N)
else:
  while sum(a) > x:
    a.remove(max(a))
  print(len(l))


Fixed submission:
N, x = map(int, input().split())
a = list(map(int, input().split()))
if sum(a) == x:
  print(N)
else:
  while sum(a) > x:
    a.remove(max(a))
  l = len(a)
  if l == N:
    print(l - 1)
  else:
    print(l)

Buggy python submission (verdict: Runtime Error):
N, x = map(int, input().split())
a = list(map(int, input().split()))
if sum(a) == x:
  print(N)
else:
  sort(a)
  while sum(a) > x:
    a.remove(max(a))
  print(len(l))


Fixed submission:
N, x = map(int, input().split())
a = list(map(int, input().split()))
if sum(a) == x:
  print(N)
else:
  while sum(a) > x:
    a.remove(max(a))
  l = len(a)
  if l == N:
    print(l - 1)
  else:
    print(l)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
if a * b mod 2 == 1:
  print('Odd')
else:
  print('Even')

Fixed submission:
a, b = map(int, input().split())
if a * b % 2 == 1:
  print('Odd')
else:
  print('Even')
Buggy python submission (verdict: Runtime Error):
import math
 
a, b = map(str, input().split())
input = int(a + b)

for i in range(1000):
  if input == i**2 :
  	print('Yes')
    break

print('No')

Fixed submission:
import math, sys
 
a, b = map(str, input().split())
input = int(a + b)

for i in range(1000):
  if input == i**2 :
    print('Yes')
    sys.exit(0)

print('No')

Buggy python submission (verdict: Runtime Error):
import math
 
a, b = map(str, input().split())
input = int(a + b)

for i in range(1000):
  if input == i**2 :
  	print('Yes')
    break   

print('No')

Fixed submission:
import math, sys
 
a, b = map(str, input().split())
input = int(a + b)

for i in range(1000):
  if input == i**2 :
    print('Yes')
    sys.exit(0)

print('No')

Buggy python submission (verdict: Runtime Error):
import math

a, b = map(input().split())
input = int(a + b)

if input == math.sqrt(input)**2 :
  print('Yes')
else: 
  print('No')


Fixed submission:
import math, sys
 
a, b = map(str, input().split())
input = int(a + b)

for i in range(1000):
  if input == i**2 :
    print('Yes')
    sys.exit(0)

print('No')
Buggy python submission (verdict: Time Limit Exceeded):
import collections

N, K = map(int, input().split())
A = map(int, input().split())
counter = 0
collection = collections.Counter(A)
k = len(collection)
if k > K:
  change_n = k - K
  for i in range(change_n):
    min_k = collection.most_common()[-1-i][1]
    counter += min_k

print(counter)

Fixed submission:
N, K = map(int, input().split())
A = map(int, input().split())
counter = 0
dic = {}

for a in A:
  if a in dic.keys():
    dic[a] += 1
  else:
    dic[a] = 1

k = len(dic)
v = sorted(dic.values())
if k > K:
  change_n = k -K
  for i in range(change_n):
    min_k = v[i]
    counter += min_k

print(counter)

Buggy python submission (verdict: Time Limit Exceeded):
import collections

N, K = map(int, input().split())
A = map(int, input().split())
counter = 0
collection = collections.Counter(A)
k = len(collection)
if k > K:
  change_n = k -K
  for i in range(change_n):
    min_k = collection.most_common()[-1-i][1]
    counter += min_k

print(counter)

Fixed submission:
N, K = map(int, input().split())
A = map(int, input().split())
counter = 0
dic = {}

for a in A:
  if a in dic.keys():
    dic[a] += 1
  else:
    dic[a] = 1

k = len(dic)
v = sorted(dic.values())
if k > K:
  change_n = k -K
  for i in range(change_n):
    min_k = v[i]
    counter += min_k

print(counter)
Buggy python submission (verdict: Time Limit Exceeded):
def lucas(i):
  if i == 0:
    return 2
  elif i == 1:
    return 1
  else:
    return lucas(i-1) + lucas(i-2)
  
N = int(input())
print(lucas(N))

Fixed submission:
N = int(input())
L = [2, 1]
for i in range(2, N+1):
  L.append(L[i-1]+L[i-2])
print(L[N])
Buggy python submission (verdict: Runtime Error):
import copy
Sd = list(input())
T = list(input())
S = copy.deepcopy(Sd)
flag = 0
for i in range(len(Sd)-len(T)+1):
    if flag == 1:
        break
    for j in range(len(T)):
        if Sd[i+j] != '?' and Sd[i+j] != T[j]:
            Sd = S
            flag = 0
            break
        elif Sd[i+j] == '?':
            Sd[i+j] = T[j]
        if j == len(T)-1:
            flag = 1
if flag == 1:
    l = ['a' if i =='?' else i for i in Sd]
    print(''.join(l))
else:
    print('UNRESTORABLE')
import copy
Sd = list(input())
T = list(input())
S = copy.deepcopy(Sd)
flag = 0
for i in range(len(Sd)-len(T)+1):
    if flag == 1:
        break
    for j in range(len(T)):
        if Sd[i+j] != '?' and Sd[i+j] != T[j]:
            Sd = S
            flag = 0
            break
        elif Sd[i+j] == '?':
            Sd[i+j] = T[j]
        if j == len(T)-1:
            flag = 1
if flag == 1:
    l = ['a' if i =='?' else i for i in Sd]
    print(''.join(l))
else:
    print('UNRESTORABLE')

Fixed submission:
import copy
Sd = list(input())
T = list(input())
S = copy.deepcopy(Sd)
ans = []
for i in range(len(Sd)-len(T)+1):
    for j in range(len(T)):
        if Sd[i+j] != '?' and Sd[i+j] != T[j]:
            Sd = copy.deepcopy(S)
            break
        elif Sd[i+j] == '?':
            Sd[i+j] = T[j]
        if j == len(T)-1:
            l = ['a' if i =='?' else i for i in Sd]
            ans.append(''.join(l))
            Sd = copy.deepcopy(S)
if len(ans) == 0:
    print('UNRESTORABLE')
else:
    print(min(ans))
Buggy python submission (verdict: Runtime Error):
x, a, b = map(int, input().split())
if abs(a-x) < abs(b-x):
  print('A')
elif:
  print('B')

Fixed submission:
x, a, b = map(int, input().split())
if abs(a-x) < abs(b-x):
  print('A')
else:
  print('B')
Buggy python submission (verdict: Runtime Error):
S = input()
alpha = [chr(ord('a') + i) for i in range(26)]
n=0
c=0
while c == 0 or n < 26:
  if alpha[n] in S:
    c = n
  n+=1
if c == 0:
  print('None')
else:
  print(alpha[n])

Fixed submission:
S = input()
alpha = [chr(ord('a') + i) for i in range(26)]
n=0
c=-1
while c == -1 and n < 26:
  if not alpha[n] in S:
    c = n
    break
  n+=1
if c == -1:
  print('None')
else:
  print(alpha[n])
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
a = []
b = []
for i in range(M):
    ai, bi = map(int, input().split())
    a.append(ai)
    b.append(bi)

for i in range(N):
    r = 0
    r += a.count(i+1)
    r += b.count(i+1)
	print(r)

Fixed submission:
N, M = map(int, input().split())
a = []
b = []
for i in range(M):
    ai, bi = map(int, input().split())
    a.append(ai)
    b.append(bi)

for i in range(N):
    r = 0
    r += a.count(i+1)
    r += b.count(i+1)
    print(r)
Buggy python submission (verdict: Runtime Error):
O = input()
E = input()

ans = ''
for i in range(len(O)+len(E)):
  if i%2 == 0:
    ans+=O[i/2]
  else:
    ans+=E[i/2]
print(ans)

Fixed submission:
O = input()
E = input()

ans = ''
for i in range(len(O)+len(E)):
  if i%2 == 0:
    ans+=O[int(i/2)]
  else:
    ans+=E[int(i/2)]
print(ans)
Buggy python submission (verdict: Runtime Error):
A, op, B = map(str, input().split())
if op == '+':
  print(int(A)+int(b))
else:
  print(int(A)-int(b))


Fixed submission:
A, op, B = map(str, input().split())
if op == '+':
  print(int(A)+int(B))
else:
  print(int(A)-int(B))
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
import sys
from collections import defaultdict


def solve(H: int, W: int, M: int, h: "List[int]", w: "List[int]"):
    hDict = defaultdict(int)
    wDict = defaultdict(int)
    points = set()
    for i in range(M):
        hDict[h[i]]+=1
        wDict[w[i]]+=1
        points.add((h[i],w[i]))
    hArr = []
    wArr = []
    for hd in hDict:
        he = hDict[hd]
        hArr.append((-he,he,hd))
    for wd in wDict:
        he = wDict[wd]
        wArr.append((-he,he,wd))
    hArr.sort()
    wArr.sort()
    m = 0
    for h in hArr:
        for w in wArr:
            c = h[1] + w[1]
            if (h[2],w[2]) in points:
                c -= 1
            m = max(m,c)
    print(m)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    h = [int()] * (M)  # type: "List[int]"
    w = [int()] * (M)  # type: "List[int]"
    for i in range(M):
        h[i] = int(next(tokens))
        w[i] = int(next(tokens))
    solve(H, W, M, h, w)

if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python3
import sys
from collections import defaultdict


def solve(H: int, W: int, M: int, h: "List[int]", w: "List[int]"):
    hDict = defaultdict(int)
    wDict = defaultdict(int)
    points = set()
    for i in range(M):
        hDict[h[i]]+=1
        wDict[w[i]]+=1
        points.add((h[i],w[i]))
    hArr = []
    wArr = []
    for hd in hDict:
        he = hDict[hd]
        hArr.append((-he,he,hd))
    for wd in wDict:
        he = wDict[wd]
        wArr.append((-he,he,wd))
    hArr.sort()
    wArr.sort()
    m = 0
    hm = hArr[0][1]
    wm = wArr[0][1]
    # hm+wm or hm+wm -1
    for h in hArr:
        if h[1] < hm:
            break
        for w in wArr:
            if w[1] < wm:
                break
            c = h[1] + w[1]
            if (h[2],w[2]) in points:
                c -= 1
            else:
                print(c)
                return
            m = max(m,c)
    print(m)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    h = [int()] * (M)  # type: "List[int]"
    w = [int()] * (M)  # type: "List[int]"
    for i in range(M):
        h[i] = int(next(tokens))
        w[i] = int(next(tokens))
    solve(H, W, M, h, w)

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

def solve(N: int):
    alphabet = string.ascii_lowercase
    digits = []
    nextDigits = []
    last = 0
    for i in range(10):
        nd = 26**i + last
        last = nd
        if nd <= N:
            digits.append(nd)
            nextDigits.append(26**i)
        else:
            break
    # print(digits)
    s = ""
    # print(digits)
    for i in range(len(digits)-1,-1,-1):
        isFirstDigit = i == len(digits)-1
        if isFirstDigit:
            currentBaseNum = digits[i]
            index = (N-currentBaseNum)//nextDigits[i]
            s += alphabet[index]
            N = N - currentBaseNum - index * nextDigits[i]
        else:
            index = N //nextDigits[i]
            s+= alphabet[index]
            N = N - index * nextDigits[i]
    return s

# print(solve(26))
# s = ""
# for i in range(1000):
#     s += " " +solve(i)
# print(s)
# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    print(solve(N))

if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python3
import sys
import string

def solve(N: int):
    alphabet = string.ascii_lowercase
    digits = []
    nextDigits = []
    last = 0
    for i in range(1000):
        nd = 26**i + last
        last = nd
        if nd <= N:
            digits.append(nd)
            nextDigits.append(26**i)
        else:
            break
    # print(digits)
    s = ""
    # print(digits)
    for i in range(len(digits)-1,-1,-1):
        isFirstDigit = i == len(digits)-1
        if isFirstDigit:
            currentBaseNum = digits[i]
            index = (N-currentBaseNum)//nextDigits[i]
            s += alphabet[index]
            N = N - currentBaseNum - index * nextDigits[i]
        else:
            index = N //nextDigits[i]
            s+= alphabet[index]
            N = N - index * nextDigits[i]
    return s

# print(solve(26))
# s = ""
# for i in range(100000):
#     s += " " +solve(i)
# print(s)
# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    print(solve(N))

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


def solve(A: int, B: int):
    r = str(A*B)
    if len(r) > 3:
        print(r[:len(r)-2])
    else:
        print(0)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = next(tokens)
    startWithZero = True
    l = 0
    bstr = ""
    for c in B:
        if c==".":
            continue
        if c == "0":
            l += 1
            if startWithZero:
                pass
            else:
                bstr += "0"
        else:
            l += 1
            startWithZero = False
            bstr += c
    for i in range(3-l):
        bstr+= "0"
    solve(A, int(bstr))
#
if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python3
import math
import sys


def solve(A: int, B: int):
    r = str(A*B)
    if len(r) > 3:
        print(r[:len(r)-2])
    else:
        print(0)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = next(tokens)
    startWithZero = True
    everyZero =True
    l = 0
    bstr = ""
    for c in B:
        if c==".":
            continue
        if c == "0":
            l += 1
            if startWithZero:
                pass
            else:
                bstr += "0"
        else:
            everyZero = False
            l += 1
            startWithZero = False
            bstr += c
    for i in range(3-l):
        bstr+= "0"
    if everyZero:
        print(0)
        exit()
    solve(A, int(bstr))
#
if __name__ == '__main__':
    main()