s_id string | p_id string | u_id string | date string | language string | original_language string | filename_ext string | status string | cpu_time string | memory string | code_size string | code string | error string | stdout string |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s754224685 | p04045 | u013629972 | 1568061969 | Python | PyPy3 (2.4.0) | py | Runtime Error | 363 | 77420 | 1316 | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools,pdb
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def _I(): return int(sys.stdin.readline())
def _F(): return float(sys.stdin.readline())
def _pf(s): return print(s, flush=True)
N, K = LI()
D = LI()
nums = [i for i in range(0, 10) if i not in D]
"""
使える数字の中で一番低いものから試していく
見つかったら各桁試していく
"""
if len(nums) == 1:
print(str(nums[0])*len(str(N)))
exit()
N = str(N)
ans = []
is_done = False
for n in N:
if is_done:
break
for num in nums:
if int(n) <= num:
# このnumを使用する
ans.append(num)
break
else:
# 超える数字がなかった
ans = [n + 1, nums[0], nums[0], nums[0], nums[0]]
is_done = True
for a in ans:
print(a, end = '')
| Traceback (most recent call last):
File "/tmp/tmp6hkqlkmc/tmp0w10z6jh.py", line 16, in <module>
N, K = LI()
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s624036803 | p04045 | u013629972 | 1568061785 | Python | PyPy3 (2.4.0) | py | Runtime Error | 368 | 78188 | 1250 | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools,pdb
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def _I(): return int(sys.stdin.readline())
def _F(): return float(sys.stdin.readline())
def _pf(s): return print(s, flush=True)
N, K = LI()
D = LI()
nums = [i for i in range(0, 10) if i not in D]
"""
使える数字の中で一番低いものから試していく
見つかったら各桁試していく
"""
N = str(N)
ans = []
is_done = False
for n in N:
if is_done:
break
for num in nums:
if int(n) <= num:
# このnumを使用する
ans.append(num)
break
else:
# 超える数字がなかった
ans = [n + 1, nums[0], nums[0], nums[0], nums[0]]
is_done = True
for a in ans:
print(a, end = '')
| Traceback (most recent call last):
File "/tmp/tmpap68cltj/tmp7zk4465y.py", line 16, in <module>
N, K = LI()
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s732189337 | p04045 | u266874640 | 1567706616 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 493 | import itertools
N, K = map(int,input().split())
D = list(map(int,input().split()))
N = str(N)
d = []
d_min = 10
for i in range(10):
if i in D:
continue
else:
if i != 0:
d_min = min(d_min, i)
d.append(str(i))
if '0' in d:
ans = str(d_min) + '0' * len(N)
else:
ans = str(d_min) * len(N+1)
ans = int(ans)
for s in itertools.product(d, repeat=len(N)):
s = ''.join(s)
s = int(s)
if s >= int(N):
ans = min(ans, s)
print(ans)
| Traceback (most recent call last):
File "/tmp/tmpkmzsqq_3/tmph_stph6d.py", line 3, in <module>
N, K = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s994877272 | p04045 | u378328623 | 1567620909 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 686 | N, K = map(int, input().split())
Dlist = list(map(int, input().split()))
alist = list(set([0,1,2,3,4,5,6,7,8,9]) - set(Dlist))
if sum(x==0 for x in alist) == 0:
b = min(alist)
else:
b = min(list(set(alist)-set([0])))
strN = str(N)
c = ""
ans = ""
flag = True
for i in range(len(strN)):
iN = int(strN[i])
if sum(x>=iN for x in alist) == 0:
ans = b + str(min(alist))*len(strN)
flag = False
break
elif sum(x==iN for x in alist) == 0:
ans = c + str(min([a for a in alist if a>iN])) + str(min(alist))*(len(strN)-1-i)
flag = False
break
else:
c = c + str(iN)
if flag:
print(N)
else:
print(int(ans)) | Traceback (most recent call last):
File "/tmp/tmphczkvkss/tmpb9detpue.py", line 1, in <module>
N, K = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s977552451 | p04045 | u365375535 | 1567570681 | Python | Python (3.4.3) | py | Runtime Error | 20 | 3444 | 659 | def add(ans_list, word_list):
new_ans_list = []
for ans in ans_list:
for word in word_list:
new_ans_list.append(ans+str(word))
return new_ans_list
def run():
N, K = map(int, input().split())
len_N = len(str(N))
d_list = set(map(int, input().split()))
all_list = set([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
use_list = sorted(list(all_list - d_list))
ans_list = ['']
for n in range(len_N):
ans_list = add(ans_list, use_list)
for ans in ans_list:
if N <= int(ans): print(ans); break
else:
if use_list[0] == 0: print(str(use_list[1])+0*len_N)
else: print(str(use_list[0])*(len_N+1))
run() | Traceback (most recent call last):
File "/tmp/tmpm7agyotj/tmp9_e0g7aa.py", line 24, in <module>
run()
File "/tmp/tmpm7agyotj/tmp9_e0g7aa.py", line 9, in run
N, K = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s213258070 | p04045 | u270144704 | 1567266274 | Python | Python (3.4.3) | py | Runtime Error | 92 | 2940 | 290 | s=input().split()
money,num=int(s[0]),int(s[1])
no_list=input().split()
while True:
flag=0
for money_element in list(str(money)):
if money_element in no_list:
flag=1
money+=1
break
if flag==0:
print(i)
break
| Traceback (most recent call last):
File "/tmp/tmp54_j7zvl/tmpiwc19ucz.py", line 1, in <module>
s=input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s031533652 | p04045 | u270144704 | 1567266197 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 290 | s=input().split()
money,num=int(s[0]),int(s[1])
no_list=input().split()
while true:
flag=0
for money_element in list(str(money)):
if money_element in no_list:
flag=1
money+=1
break
if flag==0:
print(i)
break
| Traceback (most recent call last):
File "/tmp/tmppdmj10d8/tmp22ng54rm.py", line 1, in <module>
s=input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s737027722 | p04045 | u270144704 | 1567265182 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 282 | 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
| File "/tmp/tmp9ramn7p4/tmp0_v5hg8l.py", line 6
for money_element in list(str(i)):
^
IndentationError: unindent does not match any outer indentation level
| |
s911968004 | p04045 | u288500098 | 1567229615 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 315 | N,K = map(int, input().split())
kirai = [int(i) for i in input().split()]
usable_num = [1,2,3,4,5,6,7,8,9]
for x in kirai:
usable_num.remove(x)
ketasu = len(str(N))
#print(ketasu)
s = 0
for d in range(ketasu):
s += min(usable_num) * 10 ** d
if s >= N:
print(s)
else:
print(N+min(usable_num)) | Traceback (most recent call last):
File "/tmp/tmpvsjlmu2s/tmpzqhun2fn.py", line 1, in <module>
N,K = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s081694585 | p04045 | u288500098 | 1567229461 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 281 | N,K = map(int, input().split())
kirai = [int(i) for i in input().split()]
usable_num = [1,2,3,4,5,6,7,8,9]
for x in kirai:
usable_num.remove(x)
ketasu = len(str(N))
s = 0
for d in range(ketasu):
s += min(usable_num) * 10 ** d
if s >= N:
print(s)
else:
pass | Traceback (most recent call last):
File "/tmp/tmpd84a4w5_/tmpfaahcd2z.py", line 1, in <module>
N,K = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s547241277 | p04045 | u090729464 | 1567164669 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 529 | l = list(range(10)) # LIST10桁の数字を生成
n, k = map(int, input().split()) # n=値段,10000以下 k=嫌いな個数
lis = list(map(int, input().split())) # 嫌いな数字入力
[l.remove(x) for x in lis] # 10桁の数字から嫌いな数字を削除
h = n / 10 ** (len(str(n))-1) # 値段の一番左の数字を取得するための計算
temp = []
for x in l:
if h < x:
temp.append(x)
ans = []
ans.append(temp[0])
for x in range(len(str(n))-1):
ans.append(l[0])
print(int("".join(map(str, ans)))) | Traceback (most recent call last):
File "/tmp/tmpla9yiek8/tmpkmnqcfbd.py", line 2, in <module>
n, k = map(int, input().split()) # n=値段,10000以下 k=嫌いな個数
^^^^^^^
EOFError: EOF when reading a line
| |
s486299145 | p04045 | u460737328 | 1567024508 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 392 | n, k = input().split()
ds = list(map(int, input().split()))
nums = []
for x in range(10):
if x in ds:
nums.append(1)
else:
nums.append(0)
for x in range(n, n*10):
ys = list(map(int,list(str(x))))
flag = False
for y in ys:
if nums[y]:
flag = True
break
if flag:
continue
else:
print(x)
exit | Traceback (most recent call last):
File "/tmp/tmp08sbie4u/tmpyg0mas1u.py", line 1, in <module>
n, k = input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s478679260 | p04045 | u270144704 | 1566514246 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 314 | no_list=[]
s=input().split()
money,num=int(s[0]),int(s[1])
for i in range(num):
no_list.append(input())
for i in range(money,10000):
origin=i
flag=0
while i!=0:
if str(i%10) in no_list:
flag=1
break
i//=10
if flag==0:
print(origin)
break
| Traceback (most recent call last):
File "/tmp/tmpycrrdgbs/tmpe0quirex.py", line 2, in <module>
s=input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s738924710 | p04045 | u797550216 | 1566441405 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 461 | n,k = map(int,input().split())
keta = len(str(n))
d = list(map(int,input().split()))
ans = []
for i in range(1,10):
if not i in d:
ans.append(i)
break
k = 9
for i in range(0,10):
if (not i in d) and (i < k):
k = i
for i in range(keta-1):
ans.append(k)
for i in range(len(ans)):
ans[i] = str(ans[i])
if n <= int(''.join(ans)):
print(int(''.join(ans)))
else:
ans.append(k)
print(int(''.join(ans)))
| Traceback (most recent call last):
File "/tmp/tmp4pgh676y/tmp2ycdjzo1.py", line 1, in <module>
n,k = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s781277947 | p04045 | u771405286 | 1566312370 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 914 | 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(num)
digit = []
while N>0:
digit.append(N%10)
N = N//10
digit.reverse()
#print(digit)
retval = []
#print(digit)
#print(num)
if digit[0] > num[-1]:
if num[0] == 0:
retval.append(num[1])
for i in range(N):
retval.append(num[0])
else:
for i in range(N+1):
retval.append(num[0])
else:
for i in range(len(digit)):
m = 10000000
for j in num:
if j < m and j >= digit[i]:
m = j
break
retval.append(str(m))
#print(digit[i])
#print(m)
if digit[i] == m:
#print("yes")
for k in range(len(digit)-i-1):
retval.append(str(num[0]))
break
else: continue
#print(retval)
print("".join(retval))
| Traceback (most recent call last):
File "/tmp/tmpo2wxhazp/tmphhssfz_w.py", line 1, in <module>
N,K = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s521652337 | p04045 | u771405286 | 1566311696 | Python | Python (3.4.3) | py | Runtime Error | 20 | 3188 | 795 | 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(num)
digit = []
while N>0:
digit.append(N%10)
N = N//10
digit.reverse()
#print(digit)
retval = []
if digit[0] > num[-1]:
if num[0] == 0:
retval.append(num[1])
for i in range(N):
retval.append(num[0])
else:
for i in range(N+1):
retval.append(num[0])
else:
for i in range(len(digit)):
m = 10000000
for j in num:
if j < m and j >= digit[i]:
m = j
break
retval.append(str(m))
if digit[i] != m:
for k in range(len(digit)-i-1):
digit.append(num[0])
else: continue
#print(retval)
print("".join(retval))
| Traceback (most recent call last):
File "/tmp/tmp0cv88vxs/tmpj89mn8ob.py", line 1, in <module>
N,K = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s921384143 | p04045 | u771405286 | 1566311165 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 645 | 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(num)
digit = []
while N>0:
digit.append(N%10)
N = N//10
digit.reverse()
#print(digit)
retval = []
if digit[0] > num[-1]:
if num[0] == 0:
retval.append(num[1])
for i in range(N):
retval.append(num[0])
else:
for i in range(N+1):
retval.append(num[0])
else:
for i in digit:
m = 10000000
for j in num:
if j < m and j >= i:
m = j
break
retval.append(str(m))
#print(retval)
print("".join(retval))
| Traceback (most recent call last):
File "/tmp/tmpn09zj_kw/tmpz9ea0xwv.py", line 1, in <module>
N,K = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s752632025 | p04045 | u771405286 | 1566311106 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 623 | 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(num)
digit = []
while N>0:
digit.append(N%10)
N = N//10
digit.reverse()
#print(digit)
retval = []
if digit[0] > num[-1]:
if num[0] == 0:
retval.append(num[1])
for i in range(N):
retval.append(num[0])
else:
for i in range(N+1):
retval.append(num[0])
else:
for i in digit:
m = 10000000
for j in num:
if j < m and j >= i:
m = j
retval.append(str(m))
#print(retval)
print("".join(retval))
| Traceback (most recent call last):
File "/tmp/tmpeo6qua3a/tmpr4w7_tmx.py", line 1, in <module>
N,K = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s076586776 | p04045 | u136090046 | 1565977987 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 746 | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n, k;
cin >> n >> k;
vector<int>d_vec(k, 0);
for (int i = 0; i < k; ++i) {
cin >> d_vec[i];
}
int price = n;
while (true){
bool isValid = true;
int digit_cnt = floor(log10(price));
int now = price;
for (int digit = 0; digit < digit_cnt+1; ++digit) {
int tmp = now % 10;
auto iter = find(d_vec.begin(), d_vec.end(), tmp);
if (iter != d_vec.end()){
isValid = false;
break;
}
now /= 10;
}
if (isValid){
cout << price << endl;
break;
}
price++;
}
return 0;
| File "/tmp/tmprwuk0vng/tmpy2en6mee.py", line 2
using namespace std;
^^^^^^^^^
SyntaxError: invalid syntax
| |
s043775020 | p04045 | u736153993 | 1565966585 | Python | Python (3.4.3) | py | Runtime Error | 20 | 2940 | 255 | n, k = map(int, input().split())
dlist = list(map(int, input().split()))
for i in range(n, 10000):
flg: bool = True
for s in str(i):
if int(s) in dlist:
flg = False
break
if flg:
print(i)
break
| Traceback (most recent call last):
File "/tmp/tmpq9v9h02s/tmp9yaqx5o5.py", line 1, in <module>
n, k = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s392625426 | p04045 | u247922466 | 1565882443 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 1061 | def C_IrohasObsession():
N, K = map(int, input().split())
D = list(map(int, input().split()))
D_tmp = []
for x in range(10):
if x not in D:
D_tmp.append(x)
for x in range(len(D_tmp)):
ans = D_tmp[-1] * (10**(x))
if N > ans:
ans = D_tmp[1] * (10 ** (len(str(N))-1))
else:
ans = 0
for i_1 in D_tmp:
if ans > N: break
ans = i_1
if len(str(N)) <= len(str(ans)): continue
for i_10 in D_tmp:
if ans > N: break
ans = i_10 * 10 + i_1
if len(str(N)) <= len(str(ans)): continue
for i_100 in D_tmp:
if ans > N: break
ans = i_100 * 100 + i_10 * 10 + i_1
if len(str(N)) <= len(str(ans)): continue
for i_1000 in D_tmp:
if ans > N: break
ans = i_1000 * 1000 + i_100 * 100 + i_10 * 10 + i_1
print(ans)
if __name__ == "__main__":
C_IrohasObsession() | Traceback (most recent call last):
File "/tmp/tmpqz_tdztk/tmpkvuuf_us.py", line 32, in <module>
C_IrohasObsession()
File "/tmp/tmpqz_tdztk/tmpkvuuf_us.py", line 2, in C_IrohasObsession
N, K = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s309939584 | p04045 | u247922466 | 1565882278 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 1061 | def C_IrohasObsession():
N, K = map(int, input().split())
D = list(map(int, input().split()))
D_tmp = []
for x in range(10):
if x not in D:
D_tmp.append(x)
for x in range(len(D_tmp)):
ans = D_tmp[-1] * (10**(x+1))
if N > ans:
ans = D_tmp[1] * (10 ** len(str(N-1)))
else:
ans = 0
for i_1 in D_tmp:
if ans > N: break
ans = i_1
if len(str(N)) <= len(str(ans)): continue
for i_10 in D_tmp:
if ans > N: break
ans = i_10 * 10 + i_1
if len(str(N)) <= len(str(ans)): continue
for i_100 in D_tmp:
if ans > N: break
ans = i_100 * 100 + i_10 * 10 + i_1
if len(str(N)) <= len(str(ans)): continue
for i_1000 in D_tmp:
if ans > N: break
ans = i_1000 * 1000 + i_100 * 100 + i_10 * 10 + i_1
print(ans)
if __name__ == "__main__":
C_IrohasObsession() | Traceback (most recent call last):
File "/tmp/tmpkzd69o93/tmpnds5f9eq.py", line 32, in <module>
C_IrohasObsession()
File "/tmp/tmpkzd69o93/tmpnds5f9eq.py", line 2, in C_IrohasObsession
N, K = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s870022236 | p04045 | u842689614 | 1565846374 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 723 | N_str, K=input().split()
N_digit=list(map(int,list(N_str)))
D=sorted(list(map(int,input().split())))
l_digit=[n>D[-1] for n in N_digit]
if any(l_digit):
N_n=l_digit.index(True)
if not any([n<D[-1] for n in N_digit[0:N_n]]):
out=list(str(D[1] if D[0]==0 else D[0]))
out+=[str(D[0]) for i in range(len(N_digit))]
else:
out=[str(D[[n<=D[j] for j in range(int(K))].index(True)]) for n in N_digit[0:N_n]] + [str(D[0]) for n in N_digit[N_n:]]
for k in range(N_n-1,-1,-1):
if N_digit[k]<D[-1]:
out[k]=str(D[[N_digit[k]<D[j] for j in range(int(K))].index(True)])
break
else:
out=[str(D[[n<=D[j] for j in range(int(K))].index(True)]) for n in N_digit]
print(int("".join(out)))
| Traceback (most recent call last):
File "/tmp/tmpq1jij9fx/tmp1fnbv2ka.py", line 1, in <module>
N_str, K=input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s444782995 | p04045 | u111365362 | 1565759474 | Python | Python (3.4.3) | py | Runtime Error | 31 | 3064 | 588 | 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(1)
break
elif time[now] != k-1:
time[now] += 1
break
else:
time[now] = 0
now += 1
return time
#print(suc([0]))
#print(suc([1,1,1,1]))
#print(suc([1,0,1,1]))
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) | Traceback (most recent call last):
File "/tmp/tmp5npvx093/tmp5ohi8ik9.py", line 1, in <module>
n,K = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s356334836 | p04045 | u111365362 | 1565759195 | Python | Python (3.4.3) | py | Runtime Error | 31 | 3064 | 588 | 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(1)
break
elif time[now] != k-1:
time[now] += 1
break
else:
time[now] = 0
now += 1
return time
#print(suc([0]))
#print(suc([1,1,1,1]))
#print(suc([1,0,1,1]))
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) | Traceback (most recent call last):
File "/tmp/tmprq6t58fi/tmp1yqry0a3.py", line 1, in <module>
n,K = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s932004165 | p04045 | u229959388 | 1565107851 | Python | PyPy2 (5.6.0) | py | Runtime Error | 34 | 27500 | 219 | n, k = map(int, input().split())
a = input().split()
for i in range(10*n - n):
c = str(n+i)
for j in a:
if j in c:
break
else:
ans = c
break
print(ans) | Traceback (most recent call last):
File "/tmp/tmp3oqrtchd/tmp4dszabkg.py", line 1, in <module>
n, k = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s917205130 | p04045 | u631307974 | 1565054972 | Python | Python (2.7.6) | py | Runtime Error | 11 | 2692 | 546 | import bisect
#find set of numbers iroha like
tmp = raw_input("").split(' ')
n = int(tmp[0])
k = int(tmp[1])
tmp = raw_input("")
exclude_set = map(int, tmp.split(' '))
include_set = []
for i in range(0, 10):
if i not in exclude_set:
include_set.append(i)
#print include_set
n_digits = []
while n > 0:
n_digits.append(n%10)
n = int(n/10)
out = []
j = 0
#print include_set
while j < len(n_digits):
tmp = bisect.bisect_left(include_set, n_digits[j])
#print tmp
out.append(str(include_set[tmp]))
j += 1
print int(''.join(out)[::-1]) | File "/tmp/tmptep353tw/tmp_xpk0b1o.py", line 25
print int(''.join(out)[::-1])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s716111242 | p04045 | u268291479 | 1565049495 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 627 | N, K = map(int, input().split())
D = list(map(int, input().split()))
D_ALL = [0,1,2,3,4,5,6,7,8,9]
# 使える値
like = sorted(list(set(D_ALL) - set(D)))
small = like[0]
is_inc = False
out = ""
for i, s in enumerate(str(N)):
num = int(s)
for i2, like_num in enumerate(like):
if is_inc:
out += str(small)
break
if like_num >= num:
out += str(like_num)
if like_num > num:
is_inc = True
break
if i2 == len(like) - 1 and i == 0:
out = 1
out += str(small)
is_inc = True
print(out) | Traceback (most recent call last):
File "/tmp/tmpovfheq7v/tmpxq8hlp2h.py", line 1, in <module>
N, K = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s690688724 | p04045 | u268291479 | 1565047994 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 434 | is_inc = False
out = ""
for i, s in enumerate(str(N)):
num = int(s)
for i2, like_num in enumerate(like):
if is_inc:
out += str(small)
break
if like_num >= num:
out += str(like_num)
if like_num > num:
is_inc = True
break
if i2 == len(like) - 1 and i == 0:
out = str(small) + str(small)
is_inc = True | Traceback (most recent call last):
File "/tmp/tmpoz4s3qt5/tmprf493k0r.py", line 3, in <module>
for i, s in enumerate(str(N)):
^
NameError: name 'N' is not defined
| |
s592879098 | p04045 | u229959388 | 1565033098 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3060 | 220 | n, k = input().split()
a = input().split()
n = int(n)
for i in range(10000-n):
c = str(n+i)
for j in a:
if j in c:
break
else:
ans = c
break
print(ans) | Traceback (most recent call last):
File "/tmp/tmps4a3hn1n/tmp7dra7e0b.py", line 1, in <module>
n, k = input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s709085808 | p04045 | u457554982 | 1564941029 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 853 | n,k=[s for s in input().split()]
hate=[]
like=[]
for i in range(k): #hate取得
hate.extend(input().split())
for i in range(1,10): #like取得
if i in hate:
like.append(i)
pointer=0
for ichi in like: #1桁の場合
if ichi>=n:
kane=ichi
pointer=1
break
if pointer==0: #2桁の場合
for ju in like:
for ichi in like:
if ju*10+ichi>=n:
kane=ju*10+ichi
pointer=1
break
if pointer==0: #3桁の場合
for hyaku in like:
for ju in like:
for ichi in like:
if hyaku*100+ju*10+ichi>=n:
kane=hyaku*100+ju*10+ichi
pointer=1
break
if pointer==0: #4桁の場合
for sen in like:
for hyaku in like:
for ju in like:
for ichi in like:
if sen*1000+hyaku*100+ju*10+ichi>=n:
kane=sen*1000+hyaku*100+ju*10+ichi
pointer=1
break
if pointer==1:
print(kane)
else:
print("Error!!") | Traceback (most recent call last):
File "/tmp/tmpf4gt2_73/tmprq_tctra.py", line 1, in <module>
n,k=[s for s in input().split()]
^^^^^^^
EOFError: EOF when reading a line
| |
s459505948 | p04045 | u820047642 | 1564530750 | Python | Python (3.4.3) | py | Runtime Error | 20 | 3064 | 1218 | import sys
def main():
input=sys.stdin.readline
N,K=map(int,input().split())
D=list(map(int,input().split()))
L=[]
for i in range(10):
if i not in D:
L.append(i)
for p in L:
if len(str(N))==1:
if p>=N:
print(p)
return
else:
for q in L:
if len(str(N))==2:
pay=p*10+q
if pay>=N:
print(pay)
return
else:
for r in L:
if len(str(N))==3:
pay=p*100+q*10+r
if pay>=N:
print(pay)
return
else:
for s in L:
pay=p*1000+q*100+r*10+s
if pay>=N:
print(pay)
return
if L[0]==0:
print(L[1]*10**len(str(N)))
else:
print("".join([L[0] for _ in range(len(str(N)))]))
return
if __name__=="__main__":
main() | Traceback (most recent call last):
File "/tmp/tmp25mwd7es/tmp6cdkrk_4.py", line 43, in <module>
main()
File "/tmp/tmp25mwd7es/tmp6cdkrk_4.py", line 4, in main
N,K=map(int,input().split())
^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s339589510 | p04045 | u820047642 | 1564530728 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 1207 | def main():
input=sys.stdin.readline
N,K=map(int,input().split())
D=list(map(int,input().split()))
L=[]
for i in range(10):
if i not in D:
L.append(i)
for p in L:
if len(str(N))==1:
if p>=N:
print(p)
return
else:
for q in L:
if len(str(N))==2:
pay=p*10+q
if pay>=N:
print(pay)
return
else:
for r in L:
if len(str(N))==3:
pay=p*100+q*10+r
if pay>=N:
print(pay)
return
else:
for s in L:
pay=p*1000+q*100+r*10+s
if pay>=N:
print(pay)
return
if L[0]==0:
print(L[1]*10**len(str(N)))
else:
print("".join([L[0] for _ in range(len(str(N)))]))
return
if __name__=="__main__":
main() | Traceback (most recent call last):
File "/tmp/tmp5mlcj7t1/tmpzb4793zt.py", line 42, in <module>
main()
File "/tmp/tmp5mlcj7t1/tmpzb4793zt.py", line 2, in main
input=sys.stdin.readline
^^^
NameError: name 'sys' is not defined
| |
s125984197 | p04045 | u814715203 | 1564487690 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3056 | 240 | def UnlikeNum(nums,price):
for num in nums:
if(str(num) in str(price)):
return True
return False
N, K = map(int,input().split())
D = [int(input()) for k in range(K)]
while(UnlikeNum(D,N)):
N+=1
print(N) | Traceback (most recent call last):
File "/tmp/tmpjodx_u8g/tmpaedldu3o.py", line 8, in <module>
N, K = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s145477488 | p04045 | u087129172 | 1563443241 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3316 | 340 | # -*- coding: utf-8 -*-
price, K = map(int, input().split())
kirai_data =list(input().split())
#print(set(data))
lst = list(range(price,10001))
for min in lst:
shugo = set(data) & set(list(str(min)))
if len(shugo) != 0 :
continue
else:
#print(price)
print(min)
break | Traceback (most recent call last):
File "/tmp/tmpgksmzvqx/tmpp4bnhycd.py", line 2, in <module>
price, K = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s225604396 | p04045 | u201234972 | 1563242152 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3064 | 510 | #import sys
#input = sys.stdin.readline
from itertools import product
def main():
N, K = map( int, input().split())
D = list( map( int, input().split()))
NN = list( map( int, str(N)))
A = [ i for i in range(10) if i not in D]
for i in range(1,6):
for p in product(A, repeat = i):
now = 0
for j in range(i):
now = now*10+p[j]
if now >= N:
ANS.append(now)
print( min(ANS))
if __name__ == '__main__':
main()
| Traceback (most recent call last):
File "/tmp/tmpv6h8b_02/tmpx1dv5_57.py", line 19, in <module>
main()
File "/tmp/tmpv6h8b_02/tmpx1dv5_57.py", line 5, in main
N, K = map( int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s005501175 | p04045 | u201234972 | 1563241293 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 714 | #import sys
#input = sys.stdin.readline
def main():
N, K = map( int, input().split())
D = list( map( int, input().split()))
NN = list( map( int, str(N)))
A = [ i for i in range(10) if i not in D]
l = len(NN)
ANS = []
now = 0
MIN = [0, A[0], A[0]*11, A[0]*111, A[0]*1111]
check = 0
for i in range(l):
for a in A:
if a > NN[0]:
ANS.append(now*10**(l-i)+a*10**(l-1-i) + MIN[l-1-i])
now = now*10+a
break
elif a == NN[0]:
now = now*10+NN[0]
check += 1
if check == l:
ANS.append(now)
print( min(ANS))
if __name__ == '__main__':
main()
| Traceback (most recent call last):
File "/tmp/tmpk7em3jrl/tmp6n7dixbp.py", line 27, in <module>
main()
File "/tmp/tmpk7em3jrl/tmp6n7dixbp.py", line 4, in main
N, K = map( int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s021360089 | p04045 | u502389123 | 1562639534 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 524 | N, K = map(int, input().split())
D = list(map(int, input().split()))
A = [i for i in range(10)]
A = set(A) - set(D)
A = list(A)
A.sort()
S = str(N)
s = ''
for i in range(len(S)):
for j in range(len(A)):
if int(S[i]) <= A[j]:
s += str(A[j])
break
if len(s) == len(S):
print(s)
else:
if A[0] == 0:
s = str(A[1])
for i in range(len(S)):
s += str(A[0])
else:
s = str(A[0])
for i in range(len(S)):
s += str(A[1])
print(s) | Traceback (most recent call last):
File "/tmp/tmp4m7ixz43/tmp9f6kvgeu.py", line 1, in <module>
N, K = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s122915718 | p04045 | u502389123 | 1562639405 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 504 | N, K = map(int, input().split())
D = list(map(int, input().split()))
A = [i for i in range(10)]
A = set(A) - set(D)
A = list(A)
A.sort()
S = str(N)
s = ''
for i in range(len(S)):
for j in range(len(A)):
if int(S[i]) <= A[j]:
s += str(A[j])
break
if len(s) == len(S):
print(s)
else:
if A[0] == 0:
s = A[1]
for i in range(len(S)):
s += A[0]
else:
s = A[0]
for i in range(len(S)):
s += A[1]
print(s) | Traceback (most recent call last):
File "/tmp/tmpm38xvdhc/tmptfpz47ji.py", line 1, in <module>
N, K = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s164706537 | p04045 | u471212175 | 1561447785 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3188 | 1065 | N,K = map(int,input().split())
D = set(map(int,input().split()))
A = {1,2,3,4,5,6,7,8,9,0}
N_list = [int(c) for c in str(N)]
use = sorted(list(A - D))
ans = [max(use) for i in range(len(N_list))]
mapans = map(str,ans)
x = int(''.join(mapans))
if N == x:
print(x)
elif N > x:
if use[0]!= 0:
ans = [use[0] for i in range(len(N_list)+1)]
else:
ans = [use[0] for i in range(len(N_list))+1]
ans[0] = use[1]
mapans = map(str,ans)
x = int(''.join(mapans))
else:
if use[0]!= 0:
ans = [use[0] for i in range(len(N_list))]
else:
ans = [use[0] for i in range(len(N_list))]
ans[0] = use[1]
mapans = map(str,ans)
x = int(''.join(mapans))
j = 0
i = 0
while x < N:
if ans[j] > N_list[j]:
for k in range(len(ans)-j-1):
ans[k] = min(use)
elif ans[j] == N_list[j]:
i = 0
j+=1
else:
i += 1
ans[j] = use[i]
mapans = map(str,ans)
x = int(''.join(mapans))
print(x)
| Traceback (most recent call last):
File "/tmp/tmpfp8c1ymw/tmph2p1tcjv.py", line 1, in <module>
N,K = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s768629878 | p04045 | u471212175 | 1561447608 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3188 | 1057 | N,K = map(int,input().split())
D = set(map(int,input().split()))
A = {1,2,3,4,5,6,7,8,9,0}
N_list = [int(c) for c in str(N)]
use = sorted(list(A - D))
ans = [max(use) for i in range(len(N_list))]
mapans = map(str,ans)
x = int(''.join(mapans))
if N == x:
print(x)
elif N > x:
if use[0]!= 0:
ans = [use[0] for i in range(len(N_list)+1)]
else:
ans = [use[0] for i in range(len(N_list))+1]
ans[0] = use[1]
mapans = map(str,ans)
x = int(''.join(mapans))
else:
if use[0]!= 0:
ans = [use[0] for i in range(len(N_list))]
else:
ans = [use[0] for i in range(len(N_list))]
ans[0] = use[1]
mapans = map(str,ans)
x = int(''.join(mapans))
j = 0
i = 0
while x < N:
if ans[j] > N_list[j]:
for k in range(len(ans)-j-1):
ans[k] = min(use)
elif ans[j] == N_list[j]:
i = 0
j+=1
else:
ans[j] = use[i]
i += 1
mapans = map(str,ans)
x = int(''.join(mapans))
print(x)
| Traceback (most recent call last):
File "/tmp/tmpl8m9ozjx/tmpjhgchkoj.py", line 1, in <module>
N,K = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s420134180 | p04045 | u471212175 | 1561447558 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3188 | 1070 | N,K = map(int,input().split())
D = set(map(int,input().split()))
A = {1,2,3,4,5,6,7,8,9,0}
N_list = [int(c) for c in str(N)]
use = sorted(list(A - D))
ans = [max(use) for i in range(len(N_list))]
mapans = map(str,ans)
x = int(''.join(mapans))
if N == x:
print(x)
elif N > x:
if use[0]!= 0:
ans = [use[0] for i in range(len(N_list)+1)]
else:
ans = [use[0] for i in range(len(N_list))+1]
ans[0] = use[1]
mapans = map(str,ans)
x = int(''.join(mapans))
else:
if use[0]!= 0:
ans = [use[0] for i in range(len(N_list))]
else:
ans = [use[0] for i in range(len(N_list))]
ans[0] = use[1]
mapans = map(str,ans)
x = int(''.join(mapans))
j = 0
i = 0
print(x)
while x < N:
if ans[j] > N_list[j]:
for k in range(len(ans)-j-1):
ans[k] = min(use)
elif ans[j] == N_list[j]:
i = 0
j+=1
else:
ans[j] = use[i]
i += 1
mapans = map(str,ans)
x = int(''.join(mapans))
print(x)
| Traceback (most recent call last):
File "/tmp/tmp87iwq3w8/tmpns9cpuah.py", line 1, in <module>
N,K = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s187322920 | p04045 | u471212175 | 1561447465 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 3188 | 1125 | N,K = map(int,input().split())
D = set(map(int,input().split()))
A = {1,2,3,4,5,6,7,8,9,0}
N_list = [int(c) for c in str(N)]
use = sorted(list(A - D))
ans = [max(use) for i in range(len(N_list))]
mapans = map(str,ans)
x = int(''.join(mapans))
if N == x:
print(x)
elif N > x:
if use[0]!= 0:
ans = [use[0] for i in range(len(N_list)+1)]
else:
ans = [use[0] for i in range(len(N_list))+1]
ans[0] = use[1]
mapans = map(str,ans)
x = int(''.join(mapans))
else:
if use[0]!= 0:
ans = [use[0] for i in range(len(N_list))]
else:
ans = [use[0] for i in range(len(N_list))]
ans[0] = use[1]
mapans = map(str,ans)
x = int(''.join(mapans))
j = 0
i = 0
print(x)
while x < N:
if ans[j] > N_list[j]:
for k in range(len(ans)-j-1):
ans[k] = min(use)
elif ans[j] == N_list[j]:
i = 0
j+=1
else:
ans[j] = use[i]
# i += 1
# print(use)
# print(ans[j])
mapans = map(str,ans)
x = int(''.join(mapans))
print(x)
| Traceback (most recent call last):
File "/tmp/tmp6sd_kwj7/tmpgrx4zymd.py", line 1, in <module>
N,K = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s252731859 | p04045 | u471212175 | 1561446552 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3188 | 1082 | N,K = map(int,input().split())
D = set(map(int,input().split()))
A = {1,2,3,4,5,6,7,8,9,0}
N_list = [int(c) for c in str(N)]
use = sorted(list(A - D))
ans = [max(use) for i in range(len(N_list))]
mapans = map(str,ans)
x = int(''.join(mapans))
if N == x:
print(x)
elif N > x:
if use[0]!= 0:
ans = [use[0] for i in range(len(N_list)+1)]
else:
ans.append(use[1])
ans = [use[0] for i in range(len(N_list))]
mapans = map(str,ans)
x = int(''.join(mapans))
print(x)
else:
if use[0]!= 0:
ans = [use[0] for i in range(len(N_list))]
else:
ans.append(use[1])
ans = [use[0] for i in range(len(N_list)-1)]
mapans = map(str,ans)
x = int(''.join(mapans))
j = 0
i = 0
while x < N:
if ans[j] > N_list[j]:
for k in range(len(ans)-j-1):
ans[k] = min(use)
elif ans[j] == N_list[j]:
i = 0
j+=1
else:
ans[j] = use[i]
i += 1
mapans = map(str,ans)
x = int(''.join(mapans))
print(x)
| Traceback (most recent call last):
File "/tmp/tmpovo0gxea/tmp12fipyrj.py", line 1, in <module>
N,K = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s454240637 | p04045 | u196697332 | 1560722589 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3064 | 557 | N, K = map(int, input().split())
num_exclude = list(map(int, input().split()))
dec_num = [i for i in range(0, 10)]
able_use_num_lis = list(map(str, set(dec_num) - set(num_exclude)))
num_len = len(str(N))
output_list = []
def dfs(cur, num, able_use_num_lis):
if num != '':
if int(num) >= N:
output_list.append(int(num))
if len(str(N)) == cur:
return
for add_num in able_use_num_lis:
ret = dfs(cur + 1, num + add_num, able_use_num_lis)
return output_list
print(min(dfs(0, '', able_use_num_lis))) | Traceback (most recent call last):
File "/tmp/tmplsidqw6h/tmpykrsbqzr.py", line 1, in <module>
N, K = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s752835320 | p04045 | u744563031 | 1560407358 | Python | Python (3.4.3) | py | Runtime Error | 21 | 3316 | 406 | n,k=map(int,input().split())
D=list(map(int, input().split()))
num=[0,1,2,3,4,5,6,7,8,9]
M=[]
N=list(str(n))
for i in D:
num.remove(int(i))
for k in num:
if k>=int(N[0]) and k!=0:
M.append(str(k))
N.pop(0)
for j in N:
m=[]
for l in num:
if l>=int(j):
m.append(l)
M.append(str(min(m)))
print("".join(M)) | Traceback (most recent call last):
File "/tmp/tmpxvek2zum/tmpjtawlwpq.py", line 1, in <module>
n,k=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s426861214 | p04045 | u399721252 | 1560223822 | Python | PyPy3 (2.4.0) | py | Runtime Error | 168 | 38384 | 182 |
n, m = [ int(v) for v in input().split() ]
num_list = [ v for v in input().split() ]
t = n
while:
if all([ ( v not in num_list ) for v in list(str(i))]):
print(i)
break
t += 1 | File "/tmp/tmpdo9whax6/tmp3dmfc67l.py", line 5
while:
^
SyntaxError: invalid syntax
| |
s453114080 | p04045 | u203597140 | 1560045077 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3188 | 1282 | def equal(n, available):
return n in available
def less(n, available):
return n < sorted(available)[0]
def greater(n, available):
return n > sorted(available, reverse=True)[0]
#less(n, available) == True であること
def upper_next(n, available):
for v in sorted(available):
if n < v:
return v
return 1/0
n_str, _ = [v for v in input().split()]
n_s = [0]
n_s.extend([int(n_str[i:i+1]) for i in range(len(n_str))])
d_s = [int(v) for v in input().split()]
available = set(list(range(10))) - set(d_s)
#print("n", n_s, "d", d_s, "u", available)
min_available = sorted(available)[0]
ans = [0]
ans.extend([min_available] * (len(n_s) - 1))
eq = True
for i in range(1, len(n_s)):
if eq:
if equal(n_s[i], available):
ans[i] = n_s[i]
continue
else:
eq = False
if less(n_s[i], available):
ans[i] = upper_next(n_s[i], available)
#残りは最小値詰め
break
else:
for j in range(i - 1, -1, -1):
if greater(ans[j], available):
ans[j] = min_available
else:
ans[j] = upper_next(ans[j], available)
break
break
begin = 0
if ans[0] == 0:
begin = 1
ans_val = "".join(map(lambda x:str(x), ans[begin:]))
print(ans_val) | Traceback (most recent call last):
File "/tmp/tmpp2ia0a1l/tmpgqstd2vy.py", line 19, in <module>
n_str, _ = [v for v in input().split()]
^^^^^^^
EOFError: EOF when reading a line
| |
s651105844 | p04045 | u518042385 | 1559877881 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 216 | n,m=map(int,input().split())
l=list(map(int,input().split()))
b=True
while b:
b1=False
l1=list(str(n))
for i in l1:
if i in l:
b1=True
if b1=False:
b=True
print(n)
break
else:
n+=1 | File "/tmp/tmpetljppdt/tmpm6fywn3t.py", line 10
if b1=False:
^^^^^^^^
SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
| |
s461871435 | p04045 | u115284827 | 1559765999 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 513 | N, K = input().split()
D = [i for i in input().split()]
NUM = '0123456789'
num = [i for i in NUM if i not in D]
ans = ''
for j in range(len(N)):
if int(N[j]) > int(max(num)):
ans = ''
ans += num[1]
ans = int(ans.ljust(len(N)+1, min(num)))
break
for i in range(len(num)):
if int(N[j]) <= int(num[i]):
ans += num[i]
break
if int(ans.ljust(len(N), min(num))) > int(N):
ans = int(ans.ljust(len(N), min(num)))
break
print(ans) | Traceback (most recent call last):
File "/tmp/tmphqpqx2ye/tmphfaf1qfi.py", line 1, in <module>
N, K = input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s591391516 | p04045 | u115284827 | 1559763048 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 514 | N, K = input().split()
D = [i for i in input().split()]
NUM = '0123456789'
num = [i for i in NUM if i not in D]
ans = ''
for j in range(len(N)):
if int(ans.ljust(len(N), min(num))) > int(N):
ans = int(ans.ljust(len(N), min(num)))
break
elif int(N[j]) <= int(max(num)):
ans += num[1]
ans = int(ans.ljust(len(N)+1, min(num)))
break
for i in range(len(num)):
if int(N[j]) <= int(num[i]):
ans += num[i]
break
print(ans)
print(ans) | Traceback (most recent call last):
File "/tmp/tmpmvp99q3q/tmp232uhpav.py", line 1, in <module>
N, K = input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s581589483 | p04045 | u115284827 | 1559762995 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 537 | N, K = input().split()
D = [i for i in input().split()]
NUM = '0123456789'
num = [i for i in NUM if i not in D]
ans = ''
for j in range(len(N)):
if int(ans.ljust(len(N), min(num))) > int(N):
ans = int(ans.ljust(len(N), min(num)))
break
elif int(N[j]) <= int(max(num)):
ans += num[1]
ans = int(ans.ljust(len(N)+1, min(num)))
break
for i in range(len(num)):
if int(N[j]) <= int(num[i]):
ans += num[i]
print(ans)
break
print(ans)
print(ans) | Traceback (most recent call last):
File "/tmp/tmp7h4n2fhp/tmpkrnkf9ba.py", line 1, in <module>
N, K = input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s179882572 | p04045 | u115284827 | 1559762984 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 548 | N, K = input().split()
D = [i for i in input().split()]
NUM = '0123456789'
num = [i for i in NUM if i not in D]
ans = ''
print(num)
for j in range(len(N)):
if int(ans.ljust(len(N), min(num))) > int(N):
ans = int(ans.ljust(len(N), min(num)))
break
elif int(N[j]) <= int(max(num)):
ans += num[1]
ans = int(ans.ljust(len(N)+1, min(num)))
break
for i in range(len(num)):
if int(N[j]) <= int(num[i]):
ans += num[i]
print(ans)
break
print(ans)
print(ans) | Traceback (most recent call last):
File "/tmp/tmpdajdvv6f/tmp669abjj7.py", line 1, in <module>
N, K = input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s131929278 | p04045 | u115284827 | 1559750165 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 555 | N, K = input().split()
D = [i for i in input().split()]
NUM = '0123456789'
num = [i for i in NUM if i not in D]
ans = ''
a = []
for j in range(len(N)):
for i in range(len(num)):
if int(N[j]) <= int(num[i]):
ans += num[i]
break
a.append(int(ans))
ans = ''
for j in range(len(N)):
if j == 0:
for i in range(len(num)):
if int(N[j]) <= int(num[i]):
ans += num[i]
break
else:
ans += min(num)
a.append(int(ans))
print(min(a) if min(a) >= int(N) else max(a)) | Traceback (most recent call last):
File "/tmp/tmpyj6m_m_f/tmp9l9xfgie.py", line 1, in <module>
N, K = input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s843317532 | p04045 | u305052967 | 1559523694 | Python | Python (3.4.3) | py | Runtime Error | 21 | 3316 | 657 | N,K = map(str, input().split())
D = set(map(int,input().split()))
E = {0,1,2,3,4,5,6,7,8,9}
F = E - D
f = max(F)
swith = 0
if 0 in F:
g =str(list(F)[1])
else:
g = str(min(F))
list = N.split()
length = len(N)
for n in range(length):
if int(N[n]) in D:
swith = 1
for l in range(n+1,length):
list[l] = str(min(F))
if int(N[n]) >= f:
list[n] = str(min(F))
if n == 0:
list.insert(0,str(g))
else:
H = {}
H = set(range(int(N[n]) + 1))
list[n] = str(min(F - H))
if swith == 1:
break
print(''.join(list)) | Traceback (most recent call last):
File "/tmp/tmp2ieeer0x/tmpz1dfmvcw.py", line 1, in <module>
N,K = map(str, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s104791800 | p04045 | u133886644 | 1558584493 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 429 | import sys
input = sys.stdin.readline
N, K = map(int, input().split())
L = [int(v) for v in input().split()]
no = [v for v in range(10) if v not in L]
s = list(map(int, str(N)))
for i in range(len(s)):
if i == 0:
if s[i] in L:
s[i] = min([v for v in no if v != 0 and v > s[i]])
else:
if s[i] in L:
s[i] = min([v for v in no if v > s[i]])
print("".join(map(str, s))) | Traceback (most recent call last):
File "/tmp/tmp0zgidugh/tmp81rc1ktl.py", line 4, in <module>
N, K = map(int, input().split())
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s768871058 | p04045 | u938161258 | 1557972869 | Python | Python (3.4.3) | py | Runtime Error | 29 | 3572 | 575 | import itertools
D=[]
DN=[]
the_string = input()
N, K = the_string.split()
K= int(K)
for x in range(K):
D.append(input())
for x in range(10):
if(str(x) in D):
continue
else:
DN.append(x)
DList=list(itertools.product(DN,repeat=len(N)))
res=0
for x in DList:
num1=int(''.join(map(str, x)))
if num1>=int(N):
res=num1
break
if(res<int(N)):
DList=list(itertools.product(DN,repeat=len(N)+1))
res=0
for x in DList:
num1=int(''.join(map(str, x)))
if num1>=int(N):
res=num1
break
print(res) | Traceback (most recent call last):
File "/tmp/tmpesh_gd6_/tmpun0mym2u.py", line 4, in <module>
the_string = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s209159597 | p04045 | u938161258 | 1557972592 | Python | Python (3.4.3) | py | Runtime Error | 185 | 106148 | 543 | import itertools
D=[]
DN=[]
N= input()
K= int(input())
for x in range(K):
D.append(input())
for x in range(10):
if(str(x) in D):
continue
else:
DN.append(x)
DList=list(itertools.product(DN,repeat=len(N)))
res=0
for x in DList:
num1=int(''.join(map(str, x)))
if num1>=int(N):
res=num1
break
if(res<int(N)):
DList=list(itertools.product(DN,repeat=len(N)+1))
res=0
for x in DList:
num1=int(''.join(map(str, x)))
if num1>=int(N):
res=num1
break
print(res) | Traceback (most recent call last):
File "/tmp/tmpx1dk_phl/tmp94qwr7gg.py", line 4, in <module>
N= input()
^^^^^^^
EOFError: EOF when reading a line
| |
s230869025 | p04045 | u379959788 | 1557792734 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 548 | #C問題
N, K = map(int, input().split())
D = []
D = list(map(int, input().split()))
num = []
for i in range(10):
if i not in D:
num.append(i)
N_num = []
while True:
if N ==0:
break
N_num.append(N%10)
N = N//10
N_num.sort(reverse = True)
ans = []
for i in N_num:
for k in range(len(num)):
if num[k] >= i:
ans.append(num[k])
break
elif k == len(num):
ans.append(k)
ans[k-1] = num[k+1]
map(str, ans)
ans = int("".join(map(str, ans)))
print(ans)
| Traceback (most recent call last):
File "/tmp/tmpmcctgsv6/tmp1myq9bjp.py", line 2, in <module>
N, K = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s112188184 | p04045 | u379959788 | 1557790827 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 431 | N, K = map(int, input().split())
D = []
D = list(map(int, input().split()))
num = []
for i in range(10):
if i not in D:
num.append(i)
N_num = []
while True:
if N ==0:
break
N_num.append(N%10)
N = N//10
N_num.sort(reverse = True)
ans = []
for i in N_num:
for k in num:
if k >= i:
ans.append(k)
break
map(str, ans)
ans = int("".join(map(str, ans)))
print(ans)
| Traceback (most recent call last):
File "/tmp/tmpe2fqvo_e/tmp5ryqtq91.py", line 1, in <module>
N, K = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s271677643 | p04045 | u521696407 | 1557697532 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 310 | def pay_by_iroha(price, dislike_digits):
for n in range(10000):
if n >= price and len(set(int(i) for i in str(n))&dislike_digits)==0:
return n
def main():
n, _ = (int(i) for i in input().split())
dgs = set(int(i) for i input().split())
print(pay_by_iroha(n, dgs))
main() | File "/tmp/tmpk_381kqy/tmpykntrz93.py", line 9
dgs = set(int(i) for i input().split())
^^^^^^^^^^^^^^^^^
SyntaxError: invalid syntax. Perhaps you forgot a comma?
| |
s446076742 | p04045 | u172386990 | 1557461339 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 769 | white_num_list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
N, K = map(int, input().split())
black_num_list = list(map(int, input().split()))
white_num_list = list(set(white_num_list).difference(set(black_num_list)))
num_combination = list(itertools.combinations_with_replacement(white_num_list, len(str(N))))
num_list = []
for num in num_combination:
if num[0] == 0:
continue
num_list.append(int(''.join(map(str, num))))
num_list = sorted(num_list)
def price(N, num_list, white_num_list):
for num in num_list:
if num >= N:
return num
if 0 in white_num_list:
white_num_list.remove(0)
placeholder = str(min(white_num_list))
return int(placeholder * (len(str(N)) + 1))
print(price(N, num_list, white_num_list)) | Traceback (most recent call last):
File "/tmp/tmpja4s85x6/tmpwhj8hb61.py", line 3, in <module>
N, K = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s946728388 | p04045 | u180528413 | 1557211397 | Python | Python (3.4.3) | py | Runtime Error | 38 | 2940 | 465 | import os
N, K = map(int, input().split(' '))
d_list = input().split(' ')
for i in range(10):
for j in range(10):
for k in range(10):
for l in range(10):
number = i * 1000 + j * 100 + k * 10 + l
result = set(list(str(number)))
if set(d_list) & result != set():
continue
if number >= N:
print(number)
os._exit(1)
| Traceback (most recent call last):
File "/tmp/tmpl6nq1za5/tmptf8qhmzw.py", line 3, in <module>
N, K = map(int, input().split(' '))
^^^^^^^
EOFError: EOF when reading a line
| |
s917734765 | p04045 | u091051505 | 1556387970 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 206 | n, k = map(int, input().split())
d = set([str(i) for i in input().split()])
c = 0
for i in range(1, 11):
c += n
t = set(list(str(c)))
if len(d & t) == 0:
ans = c
break
print(ans) | Traceback (most recent call last):
File "/tmp/tmpid4ow9z6/tmpgp_5jhs5.py", line 1, in <module>
n, k = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s786946420 | p04045 | u091051505 | 1556386639 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 206 | n, k = map(int, input().split())
d = set([str(i) for i in input().split()])
c = 0
for i in range(1, 10):
c += n
t = set(list(str(c)))
if len(t & d) == 0:
ans = c
break
print(ans) | Traceback (most recent call last):
File "/tmp/tmprggjow5f/tmp0uc07bvh.py", line 1, in <module>
n, k = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s811749332 | p04045 | u682730715 | 1556352273 | Python | Python (3.4.3) | py | Runtime Error | 49 | 6344 | 567 | # coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *
n, k = map(str, input().split())
a = list(map(int, input().split()))
p = []
for i in range(0, 10):
if i in a:
pass
else:
p.append(i)
p.sort()
count = 0
for i in list(n):
count *= 10
j = bisect.bisect_left(p, int(i))
if p[j] < int(i):
count += p[j + 1]
else:
count += p[j]
print(count)
| Traceback (most recent call last):
File "/tmp/tmpuv7ooqxq/tmp3xbm1k5o.py", line 14, in <module>
n, k = map(str, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s044894074 | p04045 | u859897687 | 1556281738 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 306 | n,k=map(int,input().split())
a=list(map(int,input().split()))
m=[]
for i in range(10):
if i not in a:
m.append(i)
k=0
for a in m:
for b in m:
for c in m:
for d in m:
for e in m:
num=a*10000+b*1000+c*100+d*10+e
if k==0 and num>=n:
print(num)
k=1 | File "/tmp/tmpzgik127v/tmpyha__q4t.py", line 13
num=a*10000+b*1000+c*100+d*10+e
^
IndentationError: expected an indented block after 'for' statement on line 12
| |
s543854287 | p04045 | u859897687 | 1556281174 | Python | Python (3.4.3) | py | Runtime Error | 20 | 3064 | 286 | n,k=map(int,input().split())
a=list(map(int,input().split()))
m=[]
for i in range(10):
if i not in a:
m.append(i)
k=0
for a in m:
for b in m:
for c in m:
for d in m:
num=a*1000+b*100+c*10+d
if k==0 and num>=n:
ans=num
k=1
print(ans) | Traceback (most recent call last):
File "/tmp/tmphrkwta0f/tmpejbha81x.py", line 1, in <module>
n,k=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s966245080 | p04045 | u859897687 | 1556281035 | Python | Python (3.4.3) | py | Runtime Error | 25 | 3064 | 298 | n,k=map(int,input().split())
a=list(map(int,input().split()))
m=[]
for i in [0,1,2,3,4,5.6,7,8,9]:
if i not in a:
m.append(i)
k=0
for a in m:
for b in m:
for c in m:
for d in m:
num=a*1000+b*100+c*10+d
if k==0 and num>=n:
ans=num
k=1
print(ans) | Traceback (most recent call last):
File "/tmp/tmphnqurfsd/tmpo3uylc9q.py", line 1, in <module>
n,k=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s911867288 | p04045 | u859897687 | 1556280629 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 319 | n,k=map(int,input().split())
a=list(map(int,input().split()))
m=[]
for i in [0,1,2,3,4,5.6,7,8,9]:
if i not in a:
m.append(i)
k=0
for a in m:
for b in m:
for c in m:
for d in m:
if k:
break
num=a*1000+b*100+c*10+d
if num>=n:
ans=num
k=1
print(ans) | Traceback (most recent call last):
File "/tmp/tmp69v4_ui4/tmpm7jfa854.py", line 1, in <module>
n,k=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s898222592 | p04045 | u641406334 | 1556163268 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 251 | N,K = map(str,input().split())
D = list(map(int,input().split()))
nums = [x for x in range(10)]
nots = [i for i in nums if i not in D]
ans = ""
for j in range(len(N)):
for k in nots:
if int(N[j])<=k:
ans+=str(k)
break
print(int(ans)) | Traceback (most recent call last):
File "/tmp/tmpytx3b5a8/tmpty2oejjc.py", line 1, in <module>
N,K = map(str,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s583710153 | p04045 | u619458041 | 1556163160 | Python | Python (3.4.3) | py | Runtime Error | 31 | 3572 | 690 | import sys
from itertools import product
def main():
input = sys.stdin.readline
N, K = map(str, input().split())
D = list(map(str, input().split()))
nums = set([str(i) for i in range(10)])
safe = sorted(list(nums - set(D)))
digit = len(str(N))
safe_num = list(product(safe, repeat=digit))
ans = 10**5
for n in safe_num:
m = int(''.join(n))
l = int(safe[0] + ''.join(n))
s = int(safe[1] + ''.join(n))
if m >= int(N):
ans = min(ans, m)
if l >= int(N):
ans = min(ans, l)
if s >= int(N):
ans = min(ans, s)
return ans
if __name__ == '__main__':
print(main())
| Traceback (most recent call last):
File "/tmp/tmpa2a1y8ez/tmp827a_d_r.py", line 32, in <module>
print(main())
^^^^^^
File "/tmp/tmpa2a1y8ez/tmp827a_d_r.py", line 6, in main
N, K = map(str, input().split())
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s205901468 | p04045 | u619458041 | 1556160892 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 601 | import sys
def main():
input = sys.stdin.readline
N, K = map(int, input().split())
D = list(map(int, input().split()))
safe = list(set(range(10)) - set(D))
safe = sorted(safe)
n = [c for c in str(N)]
for i in range(len(n)):
if int(n[i]) in safe:
continue
for s in safe:
if s > int(n[i]):
n[i] = str(s)
replaced = i
break
break
for i in range(replaced+1, len(n)):
n[i] = str(safe[0])
return ''.join(n)
if __name__ == '__main__':
print(main())
| Traceback (most recent call last):
File "/tmp/tmpx19fw7v_/tmp4db2uhrk.py", line 29, in <module>
print(main())
^^^^^^
File "/tmp/tmpx19fw7v_/tmp4db2uhrk.py", line 5, in main
N, K = map(int, input().split())
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s191074333 | p04045 | u798129018 | 1556160839 | Python | PyPy3 (2.4.0) | py | Runtime Error | 170 | 38512 | 483 | num =set([0,1,2,3,4,5,6,7,8,9])
n,k = input().split()
d = list(map(int,input().split()))
a = list(num - set(d))
a.sort()
ans =[]
for i in range(len(n)):
for j in a:
if int(n[i]) <= j:
ans.append(a[i])
break
if a[-1] < int(n[i]):
ans.append(a[0])
l = map(str,ans)
b = "".join(l)
if int(b) < int(n):
if a[0] != 0:
print(a[0]*(10**(len(n)))+int(b))
else:
print(a[1]*(10**(len(n))) + int(b))
else:
print(int(b)) | Traceback (most recent call last):
File "/tmp/tmp64r8tdyl/tmpp4rsf4r8.py", line 2, in <module>
n,k = input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s740333544 | p04045 | u193598069 | 1555902558 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 227 | N, K = map(int, input().split())
dislike = list(map(int, input().split()))
for i in range(N, 10*N+1):
num = list(map(int,str(i)))
match = list(set(i) & set(dislike))
if len(match)==0:
print(i)
break | Traceback (most recent call last):
File "/tmp/tmpqx6y08lv/tmpel4j0uy5.py", line 1, in <module>
N, K = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s461079728 | p04045 | u222138979 | 1555558891 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 323 | n, k = (int(_) for _ in input().split())
a = [int(_) for _ in input().split()]
like = [i for i in range(10)]
pay = []
for i in str(n):
while int(i)%10 in a:
i = int(i) + 1
pay.append(str(i%10))
total = ''
for i in pay:
total += i
if n > int(total):
total += str(like[0])
print(int(total)) | Traceback (most recent call last):
File "/tmp/tmpi8t3l4io/tmpfpxkrclw.py", line 1, in <module>
n, k = (int(_) for _ in input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s326719303 | p04045 | u222138979 | 1555558404 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 368 | n, k = (int(_) for _ in input().split())
a = [int(_) for _ in input().split()]
like = [i for i in range(10)]
pay = []
for i in a:
like.remove(i)
print(like)
for i in str(n):
while int(i)%10 in a:
i = int(i) + 1
pay.append(str(i%10))
total = ''
for i in pay:
total += i
if n > int(total):
total += str(like[0])
print(int(total)) | Traceback (most recent call last):
File "/tmp/tmpki7yqtrb/tmpy7ltax25.py", line 1, in <module>
n, k = (int(_) for _ in input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s732108355 | p04045 | u145889196 | 1555537645 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 141 | N,K=input().split()
D=list(map(int,input().split()))
for i in N:
if int(i) in D:
N[i]+=1
else:
pass
print(''.join(N)) | Traceback (most recent call last):
File "/tmp/tmp3y930f7_/tmpcwzj7iw6.py", line 1, in <module>
N,K=input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s373136369 | p04045 | u145889196 | 1555536983 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 371 | N,K=map(int,input().split())
D=list(map(int,input().split()))
NL=len(str(N))
ans=[]
allnum=list(range(10))
use=list(set(allnum)^set(D))
for i in range(NL):
a=int(str(N)[i])
for j in use:
if a<=j:
ans.append(j)
break
else:
continue
if ans[0]==0:
ans[0]=use[1]
else:
pass
print(int(''.join(map(str,ans)))) | Traceback (most recent call last):
File "/tmp/tmpr4yjgp9a/tmp5nxjq8fa.py", line 1, in <module>
N,K=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s141680875 | p04045 | u941753895 | 1555277064 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3188 | 1276 | # 0〜9
l=list(range(10))
# 入力
N,K=map(str,input().split())
l2=list(map(int,input().split()))
ans=''
f=False
# 使用可能な数字を求める
for x in l2:
l.remove(x)
# Nと桁数が一致する場合
if int(N[0])<l[-1]:
for i in range(len(N)):
for x in l:
if f:
ans+=str(x)
break
elif int(N[i])<x:
f=True
ans+=str(x)
break
elif int(N[i])==x:
ans+=str(x)
break
# Nと桁数が一致する可能性がある場合
elif int(N[0])==l[-1]:
l3=list(N[1:])
l3=list(map(int,set(l3)))
l3.sort()
# Nと桁数が一致しない
if l3[-1]>l[-1]:
# 最上位は0以外の最小の数にする
if l[0]==0:
ans+=str(l[1])
ans+='0'*len(N)
else:
ans+=str(l[0])*(len(N)+1)
# Nと桁数が一致する
else:
for i in range(len(N)):
for x in l:
if f:
ans+=str(x)
break
elif int(N[i])<x:
f=True
ans+=str(x)
break
elif int(N[i])==x:
ans+=str(x)
break
# Nと桁数が一致しない場合
else:
# 最上位は0以外の最小の数にする
if l[0]==0:
ans+=str(l[1])
ans+='0'*len(N)
else:
ans+=str(l[0])*(len(N)+1)
# 出力
print(ans) | Traceback (most recent call last):
File "/tmp/tmptnrsem97/tmp9kb2vh2f.py", line 5, in <module>
N,K=map(str,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s948232026 | p04045 | u941753895 | 1555230859 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 1266 | # 0〜9
l=list(range(10))
# 入力
N,K=map(str,input().split())
l2=list(map(int,input().split()))
ans=''
f=False
# 使用可能な数字を求める
for x in l2:
l.remove(x)
# Nと桁数が一致する場合
if int(N[0])<l[-1]:
for i in range(len(N)):
for x in l:
if f:
ans+=str(x)
break
elif int(N[i])<x:
f=True
ans+=str(x)
break
elif int(N[i])==x:
ans+=str(x)
break
# Nと桁数が一致する可能性がある場合
elif int(N[0])==l[-1]:
l3=list(N[1:])
l3=list(map(int,set(l3)))
l3.sort()
# Nと桁数が一致しない
if l3[-1]>l[-1]:
# 最上位は0以外の最小の数にする
if l[0]==0:
ans+=str(l[1])
ans+='0'*int(N)
else:
ans+=str(l[0])*(N+1)
# Nと桁数が一致する
else:
for i in range(len(N)):
for x in l:
if f:
ans+=str(x)
break
elif int(N[i])<x:
f=True
ans+=str(x)
break
elif int(N[i])==x:
ans+=str(x)
break
# Nと桁数が一致しない場合
else:
# 最上位は0以外の最小の数にする
if l[0]==0:
ans+=str(l[1])
ans+='0'*int(N)
else:
ans+=str(l[0])*(N+1)
# 出力
print(ans) | Traceback (most recent call last):
File "/tmp/tmpof7noljt/tmpopwb37x_.py", line 5, in <module>
N,K=map(str,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s478840158 | p04045 | u103341055 | 1555187616 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 222 | Num = [int(n) for n in input().rstrip().split()]
D = [int(n) for n in input().rstrip().split()]
for i in rang:e(Num[0],10000):
if len(set([str(n) for n in D]) & set(str(i))) == 0:
print(int(i))
break
| File "/tmp/tmpnr5si_3l/tmp3a5iowzl.py", line 5
for i in rang:e(Num[0],10000):
^
SyntaxError: invalid syntax
| |
s200383898 | p04045 | u103341055 | 1555181206 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 269 | Num = [int(n) for n in input().rstrip().split()][0]
D = [int(n) for n in inut().rstrip().split()]
numberlist = [n if n not in D for n in range(9)]
anslist = []
for num in numberlist:
if num >= Num:
anslist.append(num)
else:pass
print(min(anslist))
| File "/tmp/tmpocf5anv0/tmpc5r2085j.py", line 5
numberlist = [n if n not in D for n in range(9)]
^^^^^^^^^^^^^^^
SyntaxError: expected 'else' after 'if' expression
| |
s328592033 | p04045 | u370331385 | 1554946217 | Python | Python (3.4.3) | py | Runtime Error | 33 | 3572 | 508 | import itertools
N,K = map(int,input().split())
D = list(map(int,input().split()))
#使用可能数字の取り出し
Num1 = []
for i in range(10):
if(i in D): continue
else: Num1.append(i)
#組み合わせ
Comb = []
n = len(str(N))
for i in range(n):
Comb.append(Num1)
Comb = list(itertools.product(*Comb))
for i in range(len(Comb)):
tmp = Comb[i]
tmp_num = ''
for j in range(n): tmp_num += str(tmp[j])
tmp_num = int(tmp_num)
if(N <= tmp_num):
ans = tmp_num
break
print(ans) | Traceback (most recent call last):
File "/tmp/tmpwe3tuz_y/tmpd7pl42lf.py", line 2, in <module>
N,K = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s225364593 | p04045 | u370331385 | 1554945589 | Python | Python (3.4.3) | py | Runtime Error | 33 | 3572 | 615 | import itertools
N,K = map(int,input().split())
D = list(map(int,input().split()))
#使用可能数字の取り出し
Num = [1]*10 #index = num, 使用可能: 1,使用不可: 0
Num1 = [] #使用可能数字格納
for i in range(K):
Num[D[i]] = 0
for i in range(10):
if(Num[i] == 1):Num1.append(i)
#組み合わせ
Comb = []
n = len(str(N))
for i in range(n):
Comb.append(Num1)
Comb = list(itertools.product(*Comb))
for i in range(len(Comb)):
tmp = Comb[i]
tmp_num = ''
for j in range(n): tmp_num += str(tmp[j])
tmp_num = int(tmp_num)
if(N <= tmp_num):
ans = tmp_num
break
print(ans) | Traceback (most recent call last):
File "/tmp/tmpu_n_lxo9/tmpuqhh1h4q.py", line 2, in <module>
N,K = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s608941100 | p04045 | u319818856 | 1554765505 | Python | Python (3.4.3) | py | Runtime Error | 20 | 3188 | 1861 | def irohas_obsession(N: int, K: int, D: list) -> int:
# D に含まれない最小の値
min_not_d = min(d for d in range(10) if d not in D)
min_not_d_and_not_zero = min(d for d in range(10) if d not in D and d != 0)
# 数字を各桁に分解する。
nums = []
while N > 0:
nums = [N % 10] + nums
N //= 10
# 上位の桁から見ていって最初に D に含まれる数字を探す。
# convert_idx = len(nums)
for i, n in enumerate(nums):
if n not in D:
# 変換の必要がない
continue
convert_idx = i
break
# print(convert_idx)
for i in range(convert_idx, -1, -1):
n = nums[i]
if n > 9:
n %= 10
if i > 0:
nums[i - 1] += 1
else:
nums = [min_not_d_and_not_zero] + nums
for d in range(n, 10):
# 変換先が n 以上 9 以下
if d in D:
# NG
continue
nums[i] = d
break
else:
# 変換先が n 未満
for d in range(n, 10):
if d in D:
# NG
continue
nums[i] = d
# 上位の桁に繰り上がりを伝搬
if i > 0:
nums[i - 1] += 1
else:
nums = [min_not_d_and_not_zero] + nums
# 残りの桁は D に含まれない最小の値に変換する。
nums = [min_not_d if n in D else n for n in nums]
ret = 0
digit = 1
# print(nums)
for n in reversed(nums):
ret += n * digit
digit *= 10
return ret
if __name__ == "__main__":
N, K = map(int, input().split())
D = [int(s) for s in input().split()]
ans = irohas_obsession(N, K, D)
print(ans)
| Traceback (most recent call last):
File "/tmp/tmpcf3i9hsc/tmp_mbbmrl7.py", line 68, in <module>
N, K = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s702061477 | p04045 | u319818856 | 1554765495 | Python | Python (3.4.3) | py | Runtime Error | 21 | 3064 | 1859 | def irohas_obsession(N: int, K: int, D: list) -> int:
# D に含まれない最小の値
min_not_d = min(d for d in range(10) if d not in D)
min_not_d_and_not_zero = min(d for d in range(10) if d not in D and d != 0)
# 数字を各桁に分解する。
nums = []
while N > 0:
nums = [N % 10] + nums
N //= 10
# 上位の桁から見ていって最初に D に含まれる数字を探す。
# convert_idx = len(nums)
for i, n in enumerate(nums):
if n not in D:
# 変換の必要がない
continue
convert_idx = i
break
# print(convert_idx)
for i in range(convert_idx, -1, -1):
n = nums[i]
if n > 9:
n %= 10
if i > 0:
nums[i - 1] += 1
else:
nums = [min_not_d_and_not_zero] + nums
for d in range(n, 10):
# 変換先が n 以上 9 以下
if d in D:
# NG
continue
nums[i] = d
break
else:
# 変換先が n 未満
for d in range(n, 10):
if d in D:
# NG
continue
nums[i] = d
# 上位の桁に繰り上がりを伝搬
if i > 0:
nums[i - 1] += 1
else:
nums = [min_not_d_and_not_zero] + nums
# 残りの桁は D に含まれない最小の値に変換する。
nums = [min_not_d if n in D else n for n in nums]
ret = 0
digit = 1
print(nums)
for n in reversed(nums):
ret += n * digit
digit *= 10
return ret
if __name__ == "__main__":
N, K = map(int, input().split())
D = [int(s) for s in input().split()]
ans = irohas_obsession(N, K, D)
print(ans)
| Traceback (most recent call last):
File "/tmp/tmpy35hhcvm/tmp0gu_gokw.py", line 68, in <module>
N, K = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s630252720 | p04045 | u319818856 | 1554765246 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3192 | 1601 | def irohas_obsession(N: int, K: int, D: list) -> int:
# D に含まれない最小の値
min_not_d = min(d for d in range(10) if d not in D)
# 数字を各桁に分解する。
nums = []
while N > 0:
nums = [N % 10] + nums
N //= 10
# 上位の桁から見ていって最初に D に含まれる数字を探す。
# convert_idx = len(nums)
for i, n in enumerate(nums):
if n not in D:
# 変換の必要がない
continue
convert_idx = i
break
# print(convert_idx)
for i in range(convert_idx, -1, -1):
n = nums[i]
for d in range(n, 10):
# 変換先が n 以上 9 以下
if d in D:
# NG
continue
nums[i] = d
break
else:
# 変換先が n 未満
for d in range(n, 10):
if d in D:
# NG
continue
nums[i] = d
# 上位の桁に繰り上がりを伝搬
if i > 0:
nums[i - 1] += 1
else:
nums = [min_not_d] + nums
# 残りの桁は D に含まれない最小の値に変換する。
nums = [min_not_d if n in D else n for n in nums]
ret = 0
digit = 1
# print(nums)
for n in reversed(nums):
ret += n * digit
digit *= 10
return ret
if __name__ == "__main__":
N, K = map(int, input().split())
D = [int(s) for s in input().split()]
ans = irohas_obsession(N, K, D)
print(ans)
| Traceback (most recent call last):
File "/tmp/tmpnes5cpf2/tmpdizj7i98.py", line 60, in <module>
N, K = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s340420510 | p04045 | u319818856 | 1554765210 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 1599 | def irohas_obsession(N: int, K: int, D: list) -> int:
# D に含まれない最小の値
min_not_d = min(d for d in range(10) if d not in D)
# 数字を各桁に分解する。
nums = []
while N > 0:
nums = [N % 10] + nums
N //= 10
# 上位の桁から見ていって最初に D に含まれる数字を探す。
# convert_idx = len(nums)
for i, n in enumerate(nums):
if n not in D:
# 変換の必要がない
continue
convert_idx = i
break
# print(convert_idx)
for i in range(convert_idx, -1, -1):
n = nums[i]
for d in range(n, 10):
# 変換先が n 以上 9 以下
if d in D:
# NG
continue
nums[i] = d
break
else:
# 変換先が n 未満
for d in range(n, 10):
if d in D:
# NG
continue
nums[i] = d
# 上位の桁に繰り上がりを伝搬
if i > 0:
nums[i - 1] += 1
else:
nums = [min_not_d] + nums
# 残りの桁は D に含まれない最小の値に変換する。
nums = [min_not_d if n in D else n for n in nums]
ret = 0
digit = 1
print(nums)
for n in reversed(nums):
ret += n * digit
digit *= 10
return ret
if __name__ == "__main__":
N, K = map(int, input().split())
D = [int(s) for s in input().split()]
ans = irohas_obsession(N, K, D)
print(ans)
| Traceback (most recent call last):
File "/tmp/tmpipzvcucz/tmpvsjaslxc.py", line 60, in <module>
N, K = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s432334079 | p04045 | u712975113 | 1553653979 | Python | Python (3.4.3) | py | Runtime Error | 74 | 3900 | 170 | N,K=map(int,input().split())
D=list(map(int,input().split()))
def dfs(n):
if all(not(int(i) in D) for i in str(n)):
return n
return dfs(n+1)
print(dfs(N)) | Traceback (most recent call last):
File "/tmp/tmpspcayho8/tmp687iv8d6.py", line 1, in <module>
N,K=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s073727031 | p04045 | u179719532 | 1553387014 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 266 | # coding: UTF-8
N, _ = input().split()
dislike_nums = set(map(int, input().split()))
nums = set(range(10))
nums -= dislike_nums
for i in range(len(N)):
Ni = int(N[i])
larger_num = [n for n in nums if n >= Ni]
print(min(larger_num), end="")
print()
| Traceback (most recent call last):
File "/tmp/tmp5atjendr/tmp036oi8i1.py", line 4, in <module>
N, _ = input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s374368397 | p04045 | u964763428 | 1551044048 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 326 | import sys
N, _ = map(int, input().split())
D = list(map(int, input().split()))
E = [str(i) for i in [0,1,2,3,4,5,6,7,8,9] if i not in D]
for n in N:
if not n in E:
for e in E:
if e>n:
n=e
sys.stdout.write(n)
break;
else:
sys.stdout.write(n)
| Traceback (most recent call last):
File "/tmp/tmp_l7tefxl/tmpkdaoxw2x.py", line 2, in <module>
N, _ = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s429625303 | p04045 | u610232844 | 1549628292 | Python | Python (3.4.3) | py | Runtime Error | 31 | 2940 | 238 | N,K = map(int,input().split())
D = {int(n) for n in input().split()}
for j in range(10000):
if N <= j:
L = {int(result) for result in str(j)}
if D.isdisjoint(L):
D_love = j
break
print(D_love)
| Traceback (most recent call last):
File "/tmp/tmpz5fxwqve/tmpckiwxhqf.py", line 1, in <module>
N,K = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s253526970 | p04045 | u610232844 | 1549627423 | Python | Python (3.4.3) | py | Runtime Error | 29 | 2940 | 238 | N,K = map(int,input().split())
D = {int(n) for n in input().split()}
for j in range(10001):
if N <= j:
L = {int(result) for result in str(j)}
if D.isdisjoint(L):
D_love = j
break
print(D_love)
| Traceback (most recent call last):
File "/tmp/tmpuxuqxqk5/tmp063y0llx.py", line 1, in <module>
N,K = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s623472986 | p04045 | u610232844 | 1549625844 | Python | Python (3.4.3) | py | Runtime Error | 32 | 3060 | 286 | 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)
| Traceback (most recent call last):
File "/tmp/tmp55r3vbpo/tmpxjdrfrxe.py", line 1, in <module>
N,K = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s351592054 | p04045 | u483645888 | 1548864268 | Python | Python (3.4.3) | py | Runtime Error | 21 | 3188 | 405 | N, K = map(int, input().split())
de_num = list(map(int, input().split()))
ok_num = []
cand_num = []
ans_num = []
for i in range(10):
if i not in de_num:
ok_num.append(i)
for i in ok_num:
for j in ok_num:
for k in ok_num:
for l in ok_num:
num = 1000*i + 100*j + 10*k + l
cand_num.append(num)
for cd in cand_num:
if cd >= N:
ans_num.append(cd)
print(min(ans_num)) | Traceback (most recent call last):
File "/tmp/tmp24vv8hwx/tmpxiphywgy.py", line 1, in <module>
N, K = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s904543504 | p04045 | u017810624 | 1545648648 | Python | Python (3.4.3) | py | Runtime Error | 21 | 3188 | 360 | n,k=map(int,input().split())
d=list(map(int,input().split()))
l=[0,1,2,3,4,5,6,7,8,9]
for i in range(k):
l.remove(d[i])
L=[]
for j1 in range(len(l)):
for j2 in range(len(l)):
for j3 in range(len(l)):
for j4 in range(len(l)):
L.append(l[j1]*1000+l[j2]*100+l[j3]*10+l[j4])
for k in range(len(L)):
if L[k]>=n:
x=L[k]
break
print(x) | Traceback (most recent call last):
File "/tmp/tmpp22nwlux/tmppwrvxwo6.py", line 1, in <module>
n,k=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s935033810 | p04045 | u278670845 | 1545250921 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 385 | import itertools
def main():
n,k = map(int, input().split())
ds = map(int, input().split())
canuse = [i for i in range(10)]
for d in ds: canuse.remove(d)
canuse = [str(c) for c in canuse]
digit = len(str(n))
x = [int("".join(a)) for a in itertools.product(canuse, repeat=digit) if int("".join(a))>=n]
print(min(x))
if __name__ == "__main__":
main() | Traceback (most recent call last):
File "/tmp/tmpo8lvmr99/tmpajcko592.py", line 12, in <module>
main()
File "/tmp/tmpo8lvmr99/tmpajcko592.py", line 3, in main
n,k = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s593053584 | p04045 | u726615467 | 1545195483 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3428 | 782 | # encoding: utf-8
N, K = map(int, input().split())
D = list(map(int, input().split()))
Db = []
for Di in range(10):
if Di not in D: Db.append(Di)
# print("#", Db)
for level in range(6):
if N // (10 ** level) < 1: break
# print("#", level)
memo = [None] * (level * 10000)
def pay(pos, tmp):
# print("##", pos, tmp)
if pos > level or tmp >= N:
if tmp >= N:
# print("###", tmp)
return tmp
else: return 10000
elif memo[pos * 10000 + tmp] != None: return memo[pos * 10000 + tmp]
rets = []
for Dbi in Db:
add = Dbi * (10 ** pos)
rets.append(pay(pos + 1, tmp + add))
ret = min(rets)
if memo[pos * 10000 + tmp] == None: memo[pos * 10000 + tmp] = ret
return ret
print(pay(0, 0)) | Traceback (most recent call last):
File "/tmp/tmprrav5dng/tmpvfp95o4g.py", line 2, in <module>
N, K = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s419587123 | p04045 | u669770658 | 1542153574 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3060 | 286 | price, len_hate_set = map(int, input().split())
hate_set = set([int(i) for i in input().split()])
ans = 0
while True:
if all(map(lambda x: int(x) in set(range(0, 10)) - hate_set, [int(str(ans)[i]) for i in range(len(str(ans)))])) and ans >= price:
return ans
ans += 1
| File "/tmp/tmpbaoqph5w/tmp1b9j7toq.py", line 8
return ans
^^^^^^^^^^
SyntaxError: 'return' outside function
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.