problem_id
stringlengths
32
32
name
stringlengths
2
54
problem
stringlengths
204
5.28k
solutions
sequencelengths
1
5.17k
test_cases
stringlengths
38
86.7k
difficulty
stringclasses
1 value
language
stringclasses
1 value
source
stringclasses
1 value
num_solutions
int64
1
5.17k
starter_code
stringclasses
1 value
000226c6000c597d60e93105ad1571c8
Restoring Password
Igor K. always used to trust his favorite Kashpirovsky Antivirus. That is why he didn't hesitate to download the link one of his groupmates sent him via QIP Infinium. The link was said to contain "some real funny stuff about swine influenza". The antivirus had no objections and Igor K. run the flash application he had downloaded. Immediately his QIP Infinium said: "invalid login/password". Igor K. entered the ISQ from his additional account and looked at the info of his main one. His name and surname changed to "H1N1" and "Infected" correspondingly, and the "Additional Information" field contained a strange-looking binary code 80 characters in length, consisting of zeroes and ones. "I've been hacked" — thought Igor K. and run the Internet Exploiter browser to quickly type his favourite search engine's address. Soon he learned that it really was a virus that changed ISQ users' passwords. Fortunately, he soon found out that the binary code was actually the encrypted password where each group of 10 characters stood for one decimal digit. Accordingly, the original password consisted of 8 decimal digits. Help Igor K. restore his ISQ account by the encrypted password and encryption specification. The input data contains 11 lines. The first line represents the binary code 80 characters in length. That is the code written in Igor K.'s ISQ account's info. Next 10 lines contain pairwise distinct binary codes 10 characters in length, corresponding to numbers 0, 1, ..., 9. Print one line containing 8 characters — The password to Igor K.'s ISQ account. It is guaranteed that the solution exists. Sample Input 01001100100101100000010110001001011001000101100110010110100001011010100101101100 0100110000 0100110010 0101100000 0101100010 0101100100 0101100110 0101101000 0101101010 0101101100 0101101110 10101101111001000010100100011010101101110010110111011000100011011110010110001000 1001000010 1101111001 1001000110 1010110111 0010110111 1101001101 1011000001 1110010101 1011011000 0110001000 Sample Output 12345678 30234919
[ "s = input()\na = []\nfor i in range(10):\n a.append(input())\n\np = 0\nwhile(p < 80):\n for i in range(10):\n if a[i] == s[p:p+10]:\n print(i, end='')\n p += 10\n break\n\n", "password = input()\r\nnum = []\r\npas = []\r\nfor i in range(10): num.append(input())\r\n\r\nwhile password != '':\r\n\titem = password[:10]\r\n\tpassword = password[10:]\r\n\tpas.append(num.index(item))\r\n\r\nfor i in range(8):\r\n\tprint(pas[i], end='')\r\n", "password=input();nums=[];ans=''\r\nfor i in range(10):num=input();nums.append(num)\r\nfor i in range(0,80,10):ans+=str(nums.index(password[i:i+10]))\r\nprint(ans)\r\n", "import sys\r\n\r\ndef get_ints(): return [int(x) for x in sys.stdin.readline().strip().split()]\r\ndef get_string(): return sys.stdin.readline().strip()\r\n\r\ns=get_string()\r\nsar=[get_string() for i in range(10)]\r\n\r\nfor i in range(8):\r\n str=s[i*10:i*10+10]\r\n for j in range(len(sar)):\r\n if(str==sar[j]):\r\n print(j,end=\"\")\r\n break\r\n\r\n", "def splitter(s):\r\n\tli=[]\r\n\ti=0\r\n\tj=10\r\n\tfor k in range(8):\r\n\t\tli.append(s[i:j])\r\n\t\ti+=10\r\n\t\tj+=10\r\n\treturn li\r\nlist1=splitter(input())\r\nans=\"\"\r\nkey_w=[]\r\nfor i in range(10):\r\n\tkey_w.append(input())\r\nfor i in list1:\r\n\tans+=str(key_w.index(i))\r\nprint(ans)", "from textwrap import wrap\r\np=wrap(input(), 10);l=[]\r\nfor i in range(10):\r\n c=input();l.append(c)\r\nprint(*[l.index(j) for j in p], sep=\"\")", "n= list(input())\r\nans =[]\r\nfor i in range(len(n)//10):\r\n tmp = n[:10]\r\n n= n[10:]\r\n ans.append(tmp)\r\na2=[]\r\nfor i in ans:\r\n a2.append(''.join(i))\r\nans=[]\r\nfor i in range(10):\r\n ans.append(input())\r\n\r\ns='' \r\nfor i in a2:\r\n s+=str(ans.index(i))\r\n \r\nprint(s) ", "code = input()\r\ndic = {}\r\nfor i in range(10):\r\n\tstr = input()\r\n\tdic[str] = i\r\n\r\nwhile len(code) > 0 :\r\n\tprint(dic[code[0:10]], end='')\r\n\tcode = code[10:]", "s = input()\r\nd = {}\r\nfor i in range(10):\r\n d[input()] = str(i)\r\nans = ''\r\nfor i in range(0, 80, 10):\r\n ans += d[s[i:i+10]]\r\nprint(ans)", "s=input()\r\ng={}\r\nfor i in range(10):g[input()]=i\r\nfor i in range(0,80,10):print(g[s[i:i+10]],end='')", "# LUOGU_RID: 120992711\nsx=input();s0=input();s1=input();s2=input();s3=input();s4=input();s5=input();s6=input();s7=input();s8=input();s9=input()\na1=sx[0]+sx[1]+sx[2]+sx[3]+sx[4]+sx[5]+sx[6]+sx[7]+sx[8]+sx[9]\na2=sx[10]+sx[11]+sx[12]+sx[13]+sx[14]+sx[15]+sx[16]+sx[17]+sx[18]+sx[19]\na3=sx[20]+sx[21]+sx[22]+sx[23]+sx[24]+sx[25]+sx[26]+sx[27]+sx[28]+sx[29]\na4=sx[30]+sx[31]+sx[32]+sx[33]+sx[34]+sx[35]+sx[36]+sx[37]+sx[38]+sx[39]\na5=sx[40]+sx[41]+sx[42]+sx[43]+sx[44]+sx[45]+sx[46]+sx[47]+sx[48]+sx[49]\na6=sx[50]+sx[51]+sx[52]+sx[53]+sx[54]+sx[55]+sx[56]+sx[57]+sx[58]+sx[59]\na7=sx[60]+sx[61]+sx[62]+sx[63]+sx[64]+sx[65]+sx[66]+sx[67]+sx[68]+sx[69]\na8=sx[70]+sx[71]+sx[72]+sx[73]+sx[74]+sx[75]+sx[76]+sx[77]+sx[78]+sx[79]\nif a1==s0:\n print(\"0\",end=\"\")\nelif a1==s1:\n print(\"1\",end=\"\")\nelif a1==s2:\n print(\"2\",end=\"\")\nelif a1==s3:\n print(\"3\",end=\"\")\nelif a1==s4:\n print(\"4\",end=\"\")\nelif a1==s5:\n print(\"5\",end=\"\")\nelif a1==s6:\n print(\"6\",end=\"\")\nelif a1==s7:\n print(\"7\",end=\"\")\nelif a1==s8:\n print(\"8\",end=\"\")\nelif a1==s9:\n print(\"9\",end=\"\")\nif a2==s0:\n print(\"0\",end=\"\")\nelif a2==s1:\n print(\"1\",end=\"\")\nelif a2==s2:\n print(\"2\",end=\"\")\nelif a2==s3:\n print(\"3\",end=\"\")\nelif a2==s4:\n print(\"4\",end=\"\")\nelif a2==s5:\n print(\"5\",end=\"\")\nelif a2==s6:\n print(\"6\",end=\"\")\nelif a2==s7:\n print(\"7\",end=\"\")\nelif a2==s8:\n print(\"8\",end=\"\")\nelif a2==s9:\n print(\"9\",end=\"\")\nif a3==s0:\n print(\"0\",end=\"\")\nelif a3==s1:\n print(\"1\",end=\"\")\nelif a3==s2:\n print(\"2\",end=\"\")\nelif a3==s3:\n print(\"3\",end=\"\")\nelif a3==s4:\n print(\"4\",end=\"\")\nelif a3==s5:\n print(\"5\",end=\"\")\nelif a3==s6:\n print(\"6\",end=\"\")\nelif a3==s7:\n print(\"7\",end=\"\")\nelif a3==s8:\n print(\"8\",end=\"\")\nelif a3==s9:\n print(\"9\",end=\"\")\nif a4==s0:\n print(\"0\",end=\"\")\nelif a4==s1:\n print(\"1\",end=\"\")\nelif a4==s2:\n print(\"2\",end=\"\")\nelif a4==s3:\n print(\"3\",end=\"\")\nelif a4==s4:\n print(\"4\",end=\"\")\nelif a4==s5:\n print(\"5\",end=\"\")\nelif a4==s6:\n print(\"6\",end=\"\")\nelif a4==s7:\n print(\"7\",end=\"\")\nelif a4==s8:\n print(\"8\",end=\"\")\nelif a4==s9:\n print(\"9\",end=\"\")\nif a5==s0:\n print(\"0\",end=\"\")\nelif a5==s1:\n print(\"1\",end=\"\")\nelif a5==s2:\n print(\"2\",end=\"\")\nelif a5==s3:\n print(\"3\",end=\"\")\nelif a5==s4:\n print(\"4\",end=\"\")\nelif a5==s5:\n print(\"5\",end=\"\")\nelif a5==s6:\n print(\"6\",end=\"\")\nelif a5==s7:\n print(\"7\",end=\"\")\nelif a5==s8:\n print(\"8\",end=\"\")\nelif a5==s9:\n print(\"9\",end=\"\")\nif a6==s0:\n print(\"0\",end=\"\")\nelif a6==s1:\n print(\"1\",end=\"\")\nelif a6==s2:\n print(\"2\",end=\"\")\nelif a6==s3:\n print(\"3\",end=\"\")\nelif a6==s4:\n print(\"4\",end=\"\")\nelif a6==s5:\n print(\"5\",end=\"\")\nelif a6==s6:\n print(\"6\",end=\"\")\nelif a6==s7:\n print(\"7\",end=\"\")\nelif a6==s8:\n print(\"8\",end=\"\")\nelif a6==s9:\n print(\"9\",end=\"\")\nif a7==s0:\n print(\"0\",end=\"\")\nelif a7==s1:\n print(\"1\",end=\"\")\nelif a7==s2:\n print(\"2\",end=\"\")\nelif a7==s3:\n print(\"3\",end=\"\")\nelif a7==s4:\n print(\"4\",end=\"\")\nelif a7==s5:\n print(\"5\",end=\"\")\nelif a7==s6:\n print(\"6\",end=\"\")\nelif a7==s7:\n print(\"7\",end=\"\")\nelif a7==s8:\n print(\"8\",end=\"\")\nelif a7==s9:\n print(\"9\",end=\"\")\nif a8==s0:\n print(\"0\",end=\"\")\nelif a8==s1:\n print(\"1\",end=\"\")\nelif a8==s2:\n print(\"2\",end=\"\")\nelif a8==s3:\n print(\"3\",end=\"\")\nelif a8==s4:\n print(\"4\",end=\"\")\nelif a8==s5:\n print(\"5\",end=\"\")\nelif a8==s6:\n print(\"6\",end=\"\")\nelif a8==s7:\n print(\"7\",end=\"\")\nelif a8==s8:\n print(\"8\",end=\"\")\nelif a8==s9:\n print(\"9\",end=\"\")", "s=input()\r\na,b=list(),list()\r\nfor i in range(0,len(s)-9,10):a.append(s[i:i+10])\r\nfor i in range(10):b.append(input())\r\nfor i in a:print(b.index(i),end='')", "code = input()\r\nl = [None] * 10 \r\nfor i in range (10) : \r\n l[i] = input()\r\nres = \"\" \r\nfor i in range(0 , len(code) , 10) : \r\n res += str(l.index(code[i : i+10]))\r\nprint(res) ", "n = input()\r\nl = list()\r\nsss = \"\"\r\nll = list()\r\nfor i in range(10):\r\n s = input()\r\n ll.append(s)\r\n \r\nfor i in range(8):\r\n n = \"\".join(n)\r\n l.append(n[0:10])\r\n n = list(n)\r\n del n[0:10]\r\nfor i in l:\r\n sss+=str(ll.index(i))\r\n\r\nprint(sss)", "pwd = str(input())\r\nseq = [str(input()),str(input()),str(input()),str(input()),str(input())\r\n ,str(input()),str(input()),str(input()),str(input()),str(input())]\r\nfor n in range(0 , 8):\r\n for i in range(0 ,len(seq)) :\r\n if pwd[n*10:n*10+10] ==seq[i] :\r\n print(i , end= '')", "CODE = input()\r\nMAP = []\r\nfor i in range(10):\r\n MAP += [input()]\r\n\r\nans = \"\"\r\ni = 0\r\nwhile i + 10 <= 80:\r\n ans += str(MAP.index(CODE[i:i+10]))\r\n i += 10\r\nprint(ans)\r\n ", "code = input()\r\ncode_nums = []\r\npwd = \"\"\r\nfor i in range(10):\r\n code_num = input()\r\n code_nums.append(code_num)\r\nfor i in range(0, 71, 10):\r\n for j in range(len(code_nums)):\r\n if code_nums[j] == code[i:i+10]:\r\n pwd += str(j)\r\nprint(pwd)\r\n", "encrypted_password = input()\nbinary_codes = [input() for _ in range(10)]\n\ndecryption_map = {binary: str(i) for i, binary in enumerate(binary_codes)}\n\npassword = ''\nfor i in range(0, len(encrypted_password), 10):\n digit_binary = encrypted_password[i:i+10]\n password += decryption_map[digit_binary]\n\nprint(password)\n \t\t\t\t \t \t \t\t\t \t \t \t\t \t\t\t", "n = input()\r\nl = [input() for i in range(10)]\r\n\r\nprint(*[l.index(n[i * 10:(i + 1) * 10]) for i in range(8)], sep='')\r\n", "ISQ = input()\ni = 0\nnumbers = {}\nwhile i < 10:\n numbers[input()] = i\n i += 1\n\nISQpart = []\nfor i in range(0, len(ISQ),10):\n num = \"\"\n for j in range(i, i+10):\n num += ISQ[j]\n ISQpart += [num ,]\npword = \"\"\nfor i in ISQpart:\n if i in numbers:\n pword += str(numbers[i])\nprint(pword)\n", "s = input()\r\nd = {input(): str(x) for x in range(10)}\r\nres = ''\r\nfor i in range(0, len(s), 10):\r\n res += d[s[i:i+10]]\r\nprint(res)", "s = input()\r\nl = [input() for i in range(10)]\r\nans = ''\r\nfor i in range(8):\r\n ans += str(l.index(s[i * 10:(i + 1) * 10]))\r\nprint(ans)", "# Read the input\nencrypted_code = input().strip()\nbinary_codes = [input().strip() for _ in range(10)]\n\n# Create a dictionary to map binary codes to decimal digits\nbinary_to_decimal = {binary_codes[i]: str(i) for i in range(10)}\n\n# Initialize an empty string to store the decrypted password\npassword = \"\"\n\n# Decode the binary code in groups of 10 characters\nfor i in range(0, len(encrypted_code), 10):\n group = encrypted_code[i:i+10]\n password += binary_to_decimal[group]\n\n# Print the decrypted password\nprint(password)\n\n \t \t\t \t\t \t\t \t \t\t\t \t \t", "s=input()\r\nchs=[input() for i in range(10)]\r\nfor i in range(1,9):\r\n st=(i-1)*10\r\n en=st+10\r\n for e in range(10):\r\n if(s[st:en]==chs[e]):\r\n print(e,end=\"\")\r\n", "s=input()\nd={}\nfor i in range(10):\n d[input()]=str(i)\nans=[]\nfor i in range(8):\n a=s[:10]\n s=s[10:]\n ans.append(d[a])\nprint(''.join(ans))\n \n", "id={}\r\nans=\"\"\r\nsrc = input()\r\nfor i in range(10):\r\n id[input()]=i\r\nfor j in range(8):\r\n ans+=str(id[src[j*10:j*10+10]])\r\nprint(ans)", "t = input()\r\np = [t[i: i + 10] for i in range(0, 80, 10)]\r\nfor i in range(10):\r\n x = input()\r\n for j in range(8):\r\n if p[j] == x: p[j] = i\r\nprint(''.join(str(i) for i in p))", "password = (input()) \r\nl = list()\r\nm = list()\r\nfor a in range(0,10):\r\n\tl.append((input()))\r\n\r\nfor a in range(0,len(password),10):\r\n\tfor b in l:\r\n\t\tif(b == password[a:a+10]):\r\n\t\t\tm.append(str(l.index(b)))\r\n\r\nprint(\"\".join(m))", "code = input()\nhints = []\ndecoded = \"\"\n\nfor i in range(10):\n hints.append(input())\n\nfor j in range(8):\n for hint in hints:\n if code[(j * 10):(j * 10) + 10] == hint:\n decoded += str(hints.index(hint))\nprint(decoded)\n\n", "n=input()\r\nl = [input() for _ in range(10)]\r\nprint(*[l.index(n[i:i+10]) for i in range(0, 80, 10)], sep='')", "code = input()\r\nnum = {}\r\nfor i in range(10):\r\n num[input()] = str(i)\r\nans = \"\"\r\nfor i in range(8):\r\n ans += num[code[i*10:(i*10+10)]]\r\nprint(ans)\r\n \r\n", "encrypted_data = input()\r\ndecryption_key = [input() for i in range(10)]\r\npassword = ''\r\nfor i in range(8):\r\n for j in range(10):\r\n if decryption_key[j] == encrypted_data[:10]:\r\n password += str(j)\r\n encrypted_data = encrypted_data[10:] \r\nprint(password) ", "n = input()\r\npas = []\r\nans = ''\r\n\r\nfor i in range(10):\r\n pas.append(input())\r\n\r\nfor i in range(0, 80, 10):\r\n ans += str(pas.index(n[i:i+10]))\r\n\r\nprint(ans)\r\n", "key = input()\nc = [str(input()) for i in range(1,11)]\nb = []\nfor i in range(0,80,10):\n\tb.append(key[i:i+10])\nfor i in range(0,len(b)):\n\tprint(c.index(b[i]),end = \"\")\nprint(\"\")", "\n\npassword = input()\n\nstr_to_dec = {}\n\nfor dec in range(10):\n str_to_dec[input()] = dec\n\ndec_pass = \"\"\n\nfor i in range(8):\n dec_pass += str(str_to_dec[password[10*i:10*(i+1)]])\n\nprint(dec_pass)\n\n\n\n", "# мне очень понравилась задача\r\n# интереснее было бы её решить (наверно)\r\n# с знанием списков и прочей наврено полезности.....\r\n\r\ncode = input()\r\nn0, n1, n2, n3, n4 = input(), input(), input(), input(), input()\r\nn5, n6, n7, n8, n9 = input(), input(), input(), input(), input()\r\nanswer = \"\"\r\n\r\n# самой больно от этого... Прости будущая Ариша\r\ndef chekSearch(string):\r\n if string == n0:\r\n return \"0\"\r\n if string == n1:\r\n return \"1\"\r\n if string == n2:\r\n return \"2\"\r\n if string == n3:\r\n return \"3\"\r\n if string == n4:\r\n return \"4\"\r\n if string == n5:\r\n return \"5\"\r\n if string == n6:\r\n return \"6\"\r\n if string == n7:\r\n return \"7\"\r\n if string == n8:\r\n return \"8\"\r\n if string == n9:\r\n return \"9\"\r\n\r\nfor i in range (0, len(code) - 10 + 1, 10):\r\n num = code[i:i + 10]\r\n answer += chekSearch(num)\r\n\r\nprint(answer)", "s = input()\r\nd = {}\r\nfor i in range(10):\r\n d[input()] = i\r\nfor i in range(8):\r\n print(d[s[i*10:(i+1)*10]], end='')\r\n", "s=input()\r\nd={}\r\nfor i in range(0,10):\r\n d[input()]=i\r\nfor i in range(8):\r\n print(d[s[i*10:(i+1)*10]],end='')\r\n", "\n\n\n\n\n\npw = [*(input())]\npwseg = [\"\".join(pw[x : x + 10]) for x in range(0, len(pw), 10)]\n\nfinpass = \"\"\n\nnums = []\n# print(\"pwseg\", pwseg)\nfor i in range(10) :\n num = input()\n nums.append(num)\n\n\n\n# print(\"nums\", nums)\nfor seg in pwseg :\n # print(\"seg\", seg)\n finpass += str(nums.index(seg))\n\nprint(finpass)\n\n \n\n\n \t \t \t \t \t\t \t\t \t\t \t \t \t\t", "\r\ninp=input()\r\nnum=[]\r\na=''\r\nfor x in range(10):\r\n num.append(input())\r\n\r\narr=[]\r\nfor x in range(8):\r\n arr.append(inp[(x*10):((x*10)+10)])\r\n\r\nfor x in arr:\r\n for q in range(10):\r\n if(x==num[q]):\r\n a=a+str(q)\r\n\r\nprint(a)\r\n", "ch = input()\r\nch0 = input()\r\nch1 = input()\r\nch2 = input()\r\nch3 = input()\r\nch4 = input()\r\nch5 = input()\r\nch6 = input()\r\nch7 = input()\r\nch8 = input()\r\nch9 = input()\r\nremaining_lines = [ch0,ch1,ch2,ch3,ch4,ch5,ch6,ch7,ch8,ch9]\r\nbegin = 0\r\nend = 10\r\ndigit = \"\"\r\nwhile(end <= len(ch)+1):\r\n digit = digit + str(remaining_lines.index(ch[begin:end]))\r\n begin = begin + 10\r\n end = end + 10\r\n\r\nprint(digit) ", "s=input()\r\np={}\r\nfor i in range(10):\r\n str=input()\r\n p[str]=i\r\nfor i in range(8):\r\n print(p[s[i*10:i*10+10]],end=\"\")", "n=input()\nvalues = []\nans=''\nfor i in range(10):\n values.append(input())\nparametro=0\nfor i in range(8):\n if n[parametro:parametro+10] in values:\n ans += str(values.index(n[parametro:parametro+10]))\n parametro+=10\nprint(ans)\n\n", "msg = input()\r\npassword = [msg[i:i+10] for i in range(0,80, 10)]\r\nfor i in range(10):\r\n\tdigit = input()\r\n\twhile digit in password:\r\n\t\tpassword[password.index(digit)] = str(i)\r\n\r\nprint(\"\".join(password))\r\n\r\n", "def main():\n s = input()\n d = {input(): str(_) for _ in range(10)}\n print(''.join(d[s[_:_ + 10]] for _ in range(0, 80, 10)))\n\n\nif __name__ == '__main__':\n main()", "code, digits = input(), {input():d for d in '0123456789'}\r\nprint(''.join(digits[code[10*i:10*(i+1)]] for i in range(8)))", "st = input(); ls = []\r\nfor i in range(10):\r\n ls.append(input())\r\npas = ''\r\nfor i in range(0,80,10):\r\n q = ls.index(st[i:i+10])\r\n pas+=str(q)\r\nprint(pas)", "a=input()\r\nc=[]\r\nfor i in range(0,10):\r\n b=input()\r\n c.append(b)\r\nk=0\r\nfor i in range(0,8):\r\n x=a[k:k+10]\r\n j=0\r\n while(x!=c[j]):\r\n j=j+1\r\n print(j,end=\"\")\r\n k=k+10", "if __name__ == '__main__':\r\n\ts = input()\r\n\td = dict()\r\n\tfor i in range (0,10):\r\n\t\ta = input()\r\n\t\td[a]=i\r\n\ti = 0\r\n\tans=''\r\n\twhile i < 80:\r\n\t\tans=ans+str(d[s[i:i+10]])\r\n\t\ti = i+10\r\n\tprint(ans)", "s = input()\r\nd = {}\r\ni = -1\r\nfor i in range(10):\r\n t = input()\r\n d[t] = i\r\nfor j in range(0, 80, 10):\r\n print(d[s[j : j + 10]], end=\"\")\r\n", "crypted_pass = input()\r\nlist_pass = [crypted_pass[i*10:i*10+10] for i in range(8)]\r\nd = {input(): str(i) for i in range(10)}\r\npassword = ''.join([d[list_pass[i]] for i in range(8)])\r\nprint(password)", "code_password = input()\r\ncode_numbers = {}\r\n\r\nfor i in range(10):\r\n code_numbers[input()] = i\r\n \r\nfor i in range(0, 71, 10):\r\n print(code_numbers[code_password[i:i + 10]], end='')", "s = input()\r\narr = []\r\nfor i in range(10):\r\n s1 = input()\r\n arr.append(s1)\r\nl = []\r\na,b=0,10\r\nfor i in range(8):\r\n l.append(s[a:b])\r\n a, b = a + 10, b + 10\r\nfor i in l:\r\n print(arr.index(i),end=\"\")", "code = input()\r\ncode_actual = []\r\nfor i in range (0,8):\r\n code_actual.append(code[i*10:(i+1)*10])\r\ncode_map = {}\r\nfor i in range (0,10):\r\n code_map[input()] = str(i)\r\nans = ''\r\nfor i in code_actual:\r\n ans += code_map[i]\r\nprint(ans)\r\n\r\n", "cpass = input()\ncpass_len = len(cpass)\ncdig = {}\nfor i in range(0, 10):\n\ts = input()\n\tcd_len = len(s)\n\tcdig[s] = i\n\nres = \"\"\nnd = cpass_len // cd_len\nfor i in range(0, nd):\n\td = cdig[cpass[cd_len * i : cd_len * (i + 1)]]\n\tres += str(d)\nprint(res)\n\t\n\t\n\t\n", "password = input()\ndico = {}\nfor x in range(10):\n dico[input()] = str(x)\nres = \"\"\nwhile password:\n res += dico[password[:10]]\n password = password[10:]\nprint(res)\n", "pas = input()\r\ndic = {}\r\nfor i in range(10):\r\n a = input()\r\n dic[a] = i \r\nans = \"\"\r\nfor i in range(0,len(pas),10):\r\n x = pas[i:i+10]\r\n ans += str(dic[x])\r\nprint(ans)", "import sys\r\nimport math\r\n\r\n#to read string\r\nget_string = lambda: sys.stdin.readline().strip()\r\n#to read list of integers\r\nget_int_list = lambda: list( map(int,sys.stdin.readline().strip().split()) )\r\n#to read integers\r\nget_int = lambda: int(sys.stdin.readline())\r\n#to print fast\r\npt = lambda x: sys.stdout.write(str(x)+'\\n')\r\n\r\n#--------------------------------WhiteHat010--------------------------------------#\r\ns = input()\r\nd = {}\r\nfor i in range(10):\r\n d[input()] = str(i)\r\nres = ''\r\nfor i in range(0,71,10):\r\n res = res + d[ s[i:i+10] ]\r\nprint(res)", "lst = str(input())\r\n\r\nadad = []\r\n\r\nfor i in range(10):\r\n x = str(input())\r\n adad.append(x)\r\n\r\nAdad = []\r\n\r\nfor i in range(0 , 71 , 10):\r\n z = \"\".join(lst[i : i + 10])\r\n Adad.append(z)\r\n\r\n#print(Adad)\r\n\r\nans = \"\"\r\n\r\nfor i in range(len(Adad)):\r\n ans += str(adad.index(Adad[i]))\r\n \r\nprint(ans)", "x=input()\r\na=[]\r\nans=\"\"\r\nfor i in range(10):\r\n a.append(input())\r\nj=0\r\nfor i in range(8):\r\n s=x[j:j+10]\r\n for t in range(10):\r\n if s==a[t]:\r\n ans+=str(t)\r\n break\r\n j+=10\r\nprint(ans)\r\n \r\n \r\n \r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n\r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n", "ans = dict()\r\n\r\ns = input()\r\nfor i in range(10):\r\n key = input()\r\n\r\n ans[key] = i\r\n\r\n\r\nfor i in range(0,80,10):\r\n part = s[i:i+10][:]\r\n print(ans[part] , end = '')\r\n ", "s=input()\nx={}\nfor i in range(10):\n w=input()\n x[w]=str(i)\nans=\"\"\nfor i in range(0,80,10):\n ans+=x[s[i:i+10]]\nprint(ans)\n", "c=[input() for i in range(11)]\r\nx=[ c[0][i:i+10] for i in range(0,80,10)]\r\nfor i in x:\r\n print(c.index(i)-1,end='')\r\n", "s = input()\nd = {}\nfor i in range(10):\n d[input()] = i\nfor j in range(0, 80, 10):\n print(d[s[j:j + 10]], end='')\n", "s=input()\r\nl=[]\r\nfor i in range(0,10):\r\n l.append(input())\r\nfor i in range(0,8):\r\n print(l.index(s[i*10:(i+1)*10]),end=\"\")", "num=input()\r\ndecimal_list,div_list=[],[]\r\nstart,end=0,10\r\nfor i in range(10):\r\n line=input()\r\n decimal_list.append(line)\r\nfor i in range(8):\r\n print(decimal_list.index(num[start:end]),end='')\r\n start,end=end,end+10", "s = input()\r\nar = []\r\nfor i in range(10):\r\n code = input()\r\n ar.append(code)\r\nfor i in range(0, 80, 10):\r\n print(ar.index(s[i:i + 10]), end = '')\r\n", "# cook your dish here\ndef solve():\n cadena = input()\n subcadenas = dict()\n for i in range(10):\n numero = input()\n subcadenas[numero] = i\n for i in range(0,80,10):\n print(subcadenas[cadena[i:i+10]],end='')\n \n\ndef main():\n solve()\nmain()\n \t \t \t \t \t \t\t \t \t\t \t\t", "account_info = input()\r\narr = []\r\nres = ''\r\n\r\nfor _ in range(10):\r\n arr.append(input())\r\n\r\nfor i in range(0, 80, 10):\r\n digit = account_info[i:i + 10]\r\n for j in range(10):\r\n if digit == arr[j]:\r\n res += str(j)\r\n break\r\n\r\nprint(res)\r\n", "word = input()\r\ndc = dict()\r\nfor i in range(10): \r\n dc[input()] = str(i)\r\nprint(''.join(dc[word[i:i + 10]] for i in range(0,80,10)))", "\r\ncontrasenia_encriptada = input()\r\ncodigo_binario = []\r\n\r\nfor i in range(10):\r\n codigo_binario.append(input())\r\n\r\ncontrasenia = ''\r\n\r\nfor i in range(8):\r\n for j in range(10):\r\n if contrasenia_encriptada[i*10:i*10+10] == codigo_binario[j]:\r\n contrasenia = contrasenia + str(j)\r\n\r\nprint(contrasenia)", "s = input()\r\n\r\nmapping = {}\r\nj = 0\r\ncases = 10\r\nwhile cases:\r\n cases -= 1\r\n ss = input()\r\n mapping[ss] = str(j)\r\n j += 1\r\nans = \"\"\r\nfor i in range(0, 80, 10):\r\n ans += mapping[s[i:i+10]]\r\n\r\nprint(ans)\r\n", "encrypted_password = input()\r\nnumbers = []\r\n\r\nfor i in range(10):\r\n numbers.append(input())\r\n\r\ncharacters = \"\"\r\noriginal_password = \"\"\r\n\r\nfor i in encrypted_password:\r\n characters += i\r\n\r\n if(len(characters) == 10):\r\n for j in range(len(numbers)):\r\n if(characters == numbers[j]):\r\n original_password += str(j)\r\n flag = 0\r\n characters = \"\"\r\n\r\nprint(original_password)", "read=input()\r\narr=[]\r\n\r\nfor i in range(8):\r\n str1=\"\"\r\n for j in range(10):\r\n str1+=read[10*i+j]\r\n arr.append(str1)\r\n\r\nmp = {'key':'value'}\r\n\r\nfor i in range(10):\r\n s=input()\r\n mp[s]=i\r\n\r\n\r\nresult=\"\"\r\nfor i in range(8):\r\n result+=str(mp[arr[i]])\r\n\r\nprint(result)", "binary = input()\nl = []\nfor i in range(10):\n l.append(input())\nfor i in range(8):\n bl = binary[i*10:(i + 1)*10]\n for j in range(10):\n if l[j] == bl:\n print(j, end='')\n break", "dic = {}\nsenha = input()\nres = ''\nfor i in range(10):\n dic[input()] = str(i)\nfor i in range(10,90,10):\n res += dic[senha[i-10:i]]\nprint(res)", "n=input()\r\nlst=[]\r\nlst1=[]\r\nn1=n[:10]\r\nlst.append(n1)\r\nn2=n[10:20]\r\nlst.append(n2)\r\nn3=n[20:30]\r\nlst.append(n3)\r\nn4=n[30:40]\r\nlst.append(n4)\r\nn5=n[40:50]\r\nlst.append(n5)\r\nn6=n[50:60]\r\nlst.append(n6)\r\nn7=n[60:70]\r\nlst.append(n7)\r\nn8=n[70:]\r\nlst.append(n8)\r\nfor i in range(10):\r\n s=input()\r\n lst1.append(str(i)+' '+s)\r\nfor j in lst:\r\n for k in lst1:\r\n if(j in k):\r\n print(k[0],end='')", "from collections import defaultdict, deque, Counter, OrderedDict\r\n#import sys, threading\r\ndef main():\r\n s = input()\r\n d = defaultdict(int)\r\n for i in range(10):\r\n d[input()] = i\r\n ans = \"\"\r\n for i in range(0,80,10):\r\n ans += str(d[s[i:i+10]])\r\n print(ans)\r\n\r\n\r\nif __name__ == \"__main__\":\r\n \"\"\"sys.setrecursionlimit(200000)\r\n threading.stack_size(10240000)\r\n thread = threading.Thread(target=main)\r\n thread.start()\"\"\"\r\n main()", "a=input().strip()\r\nk=[input().strip() for i in range(10)]\r\nfor i in range(0,len(a),10):\r\n\to=a[i:i+10]\r\n\tprint(k.index(o),end=\"\")\r\n", "n = input()\r\ndict={}\r\n\r\nfor i in range(10):\r\n x = int(input())\r\n dict[x] = i\r\n\r\nfor i in range(0,len(n),10):\r\n print(dict[int(n[i:i+10])], end='')", "s = input()\r\narr =[input() for i in range(10)]\r\nrs = \"\"\r\nfor i in range(0,80,10): rs+=str(arr.index(s[i:i+10]))\r\nprint(rs)", "\r\ndef pars(_str):\r\n pars_list = []\r\n for i in range(0,80,10):\r\n pars_list.append(_str[i:i+10])\r\n return pars_list\r\n\r\ndef recover(_str,_list):\r\n password = ''\r\n for i in _str:\r\n if i in _list:\r\n password += str(_list.index(i))\r\n return password\r\n\r\n_str = input()\r\n_list = []\r\nfor i in range(10):\r\n _list.append(input())\r\n_str = pars(_str)\r\nprint(recover(_str,_list))\r\n", "s,arr,r = input(), [input() for i in range(10)], \"\"\r\nfor i in range(0,80,10): r+=str(arr.index(s[i:i+10]))\r\nprint(r)", "n=input()\r\narr=[]\r\nfor i in range(10):\r\n arr.append(input())\r\n\r\nfor i in range(9):\r\n te=n[i*10:i*10+10]\r\n for j in range(len(arr)):\r\n if(arr[j]==te):\r\n print(j,end='')\r\n break\r\n", "import sys\r\ninput = sys.stdin.readline\r\n\r\ns = input()[:-1]\r\ng = [input()[:-1] for _ in range(10)]\r\nd = []\r\nfor i in range(8):\r\n d += [s[i*10:(i+1)*10]]\r\nfor i in d:\r\n for j in range(10):\r\n if g[j] == i:\r\n print(j, end='')", "s = input()\ncode = []\nfor i in range(10):\n\tcode.append(input())\nans = ''\nfor i in range(0, len(s), 10):\n\tans += str(code.index(s[i: i + 10]))\nprint(ans)\n", "s=input()\r\nfull=[]\r\norgin=[]\r\nout=[]\r\nfor i in range(8):\r\n temp = []\r\n for j in range(10):\r\n temp.append(s[i*10+j])\r\n full.append(''.join(temp))\r\n\r\nfor i in range(10):\r\n orgin.append(input())\r\n\r\nfor i in range(8):\r\n for j in range(10):\r\n if full[i]==orgin[j]:\r\n out.append(str(j))\r\n break\r\n\r\nprint(''.join(out))", "s = input()\nm = {input(): str(i) for i in range(10)}\nres = \"\".join(m[s[i : i + 10]] for i in range(0, len(s), 10))\nprint(res)\n", "b=input()\r\nl=[]\r\nfor i in range (10):\r\n x=input()\r\n l.append(x)\r\ns='' \r\ni=0\r\nwhile i<(len(b)):\r\n if (b[i:i+10] in l)==True:\r\n s+=str(l.index(b[i:i+10]))\r\n i+=10\r\n else :\r\n i+=1\r\nprint(s) ", "senha = input()\nchave = [input() for i in range(10)]\nans = []\nfor i in range(8):\n\ttrecho = senha[10*i:10*(i+1)]\n\tindex = chave.index(trecho)\n\tprint(index, end='')\nprint()\n", "n = input()\r\n\r\nnumbers = {}\r\n\r\nfor i in range(10):\r\n x = input()\r\n numbers[x] = i\r\nres = []\r\nfor i in range(8):\r\n p = n[i*10 : (i*10)+10 ]\r\n #print(p)\r\n if p in numbers:\r\n res.append(numbers[p])\r\n\r\nfor i in res:\r\n print(i,end=\"\")\r\n\r\n\r\n \r\n", "inp=input()\r\ninp_list=[]\r\nfor i in range(8):\r\n inp_list.append(inp[i*10:i*10+10])\r\ndec_list=[]\r\nfor i in range(10):\r\n dec_list.append(input())\r\n\r\nout=[]\r\nans=\"\"\r\nfor i in range(8):\r\n out.append(dec_list.index(inp_list[i]))\r\n\r\nfor i in range(8):\r\n ans+=str(out[i])\r\nprint(ans)\r\n \r\n", "s = input()\r\nmp = dict()\r\nfor i in range(10):\r\n x = input()\r\n mp[x]=i\r\n#print(mp)\r\nfor i in range(0,80,10):\r\n print(mp[s[i:i+10]],end='')", "s=input();d={}\r\nfor i in range(10):\r\n code=input()\r\n d[code]=i\r\nres=''\r\nfor i in range(0,80,10):\r\n res += str(d[s[i:i+10]])\r\nprint(res)", "string = input()\r\nnew_string = []\r\n\r\nfor i in range(10):\r\n\tnew_string.append(string[i * 10: i * 10 + 10])\r\n\r\ny = []\r\n\r\nfor i in range(10):\r\n\ty.append(input())\r\n\r\nfor i in range(len(new_string)):\r\n\tfor e in range(len(new_string)):\r\n\t\tif y[e] in new_string[i]:\r\n\t\t\tprint(e, end = \"\")", "storedpass,number,realpass = input(), [input() for i in range(10)], \"\"\r\nfor i in range(0,80,10): realpass+=str(number.index(storedpass[i:i+10]))\r\nprint(realpass)", "num_codes = 10\nnum_digits_in_password = 8\n\ninput_str = input()\ncodes = []\nfor i in range(num_codes):\n\tcodes.append(input())\nfor i in range(num_digits_in_password):\n\tprint(codes.index(input_str[i*num_codes:(i+1)*num_codes]), end='')\nprint('')\n", "def main():\n encrypted = input()\n decrypted = [''] * 8\n numbers = {}\n\n for i in range(10):\n numbers[input()] = i\n\n start = 0\n end = start + 10\n\n for i in range(8):\n decrypted[i] = str(numbers[encrypted[start:end]])\n start = end\n end += 10\n\n print(''.join(decrypted))\n\n\nif __name__ == '__main__':\n main()\n", "word = input()\r\nn = []\r\nfor i in range (10):\r\n\ta = input()\r\n\tn.append(a)\r\nfor i in range (8):\r\n\tbiner = word[10*i:10*(i+1)]\r\n\tfor j in range (10):\r\n\t\tif(biner == n[j]):\r\n\t\t\tprint (j, end = '')\r\n", "def main():\r\n\tm = input().strip()\r\n\tm = [m[x:x+10] for x in range(0, 80, 10)]\r\n\tn = []\r\n\tfor i in range(10):\r\n\t\tn.append(input().strip())\r\n\tfor i in m:\r\n\t\tfor index, j in enumerate(n):\r\n\t\t\tif j == i:\r\n\t\t\t\tprint(index, end=\"\")\r\n\t\t\t\t\r\nmain()", "def solv(s,l):\r\n rl = []\r\n for i in range(0,80,10):\r\n for j in range(10):\r\n if s[i:i+10]==l[j]:\r\n rl.append(j)\r\n break\r\n return ''.join(map(str,rl))\r\n\r\ns = input()\r\nl = [input() for _ in range(10)]\r\nprint(solv(s,l))\r\n", "password = input()\r\n\r\nnums = [0] * 10\r\n\r\nfor index in range(10) : nums[index] = input()\r\n\r\nfor index in range(0 , 80 , 10) :\r\n num = password[index:index + 10] \r\n print(nums.index(num) , end=\"\")", "string = input()\nval = []\nfor i in range(10):\n val.append(input())\n\nfor i in range(0,80,10):\n temp = string[i:i+10]\n for pos,j in enumerate(val):\n if temp == j:\n print(pos,end='')\n break\n\n \t\t \t\t\t \t\t\t \t\t\t \t\t\t\t\t \t \t", "X, Numbers = input(), {}\r\nfor i in range(10):\r\n Numbers[input()] = i\r\nfor i in range(8):\r\n print(Numbers[X[i * 10:(i + 1) * 10]], end=\"\")\r\n", "s=input()\r\np=[]\r\nfor i in range(10):\r\n p.append(input())\r\nresult=''\r\nfor i in range(8):\r\n for j in range(10):\r\n if s[i*10:i*10+10]==p[j]:\r\n result+=str(j)\r\n break\r\nprint(result)", "code = input()\r\nx = [code[0:10], code[10:20], code[20:30], code[30:40], code[40:50], code[50:60], code[60:70], code[70:80]]\r\na = []\r\nb = []\r\nfor i in range(10):\r\n a.append(input())\r\nfor j in range(len(x)):\r\n b.append(a.index(x[j]))\r\n\r\nprint(*b,sep=\"\")\r\n", "s = input()\r\na = input()\r\nb = input()\r\nc = input()\r\nd = input()\r\ne = input()\r\nf = input()\r\ng = input()\r\nh = input()\r\ni = input()\r\nj = input()\r\narr = [a, b, c, d, e, f, g, h, i, j]\r\nd = \"\"\r\npassword = \"\"\r\nfor k in range(0, len(s)):\r\n d+=s[k]\r\n if len(d) == 10:\r\n password += str(arr.index(d))\r\n d = \"\"\r\nprint(password)\r\n ", "s = str(input())\nd = {}\nfor i in range(10):\n k = str(input())\n d[k] = str(i)\nres = []\nfor i in range(8):\n t = s[i*10:i*10+10]\n res.append(d[t])\nprint(''.join(res))\n", "s=input()\r\nl1=[]\r\ni=0\r\nwhile i<8:\r\n targ = s[0+i*10:(i+1)*10]\r\n l1.append(targ)\r\n i+=1\r\nl2=[]\r\nfor x in range(10):\r\n l2.append(input())\r\ncout=\"\"\r\nfor x in l1:\r\n cout+=str(l2.index(x))\r\nprint(cout)\r\n", "coder = input()\r\ncode = list(coder)\r\nkeys = []\r\nfor i in range(10):\r\n keys.append(input())\r\nfor i in range(8):\r\n c = code[:10]\r\n for key in keys:\r\n if (list(key) == c): \r\n print(keys.index(key), end=\"\")\r\n break\r\n code[:10] = []\r\n", "bnrypswrd = input()\r\ndigits = []\r\nfor i in range(10):\r\n digits.append(input())\r\npswrd = [0,0,0,0,0,0,0,0]\r\nfor i in range (8):\r\n for j in range(10):\r\n if bnrypswrd[10*i:10*(i+1)] == digits[j]:\r\n pswrd[i] = j\r\nfor i in range(8):\r\n print(pswrd[i],end=\"\")", "s = input()\nl = [input() for i in range(10)]\nans = ''\nj = 0\nfor i in range(10,81,10):\n ss = s[j:i]\n ans += str(l.index(ss))\n j += 10\n\nprint(ans)\n\t\t \t\t\t\t\t\t\t \t\t \t\t\t\t\t\t\t \t\t", "s = [e.strip('\\n') for e in [*open(0)]]\r\nx = list(s[0])\r\nfor i in range(len(x)):\r\n if (i+1)%10 == 0 and i != 0:\r\n x[i] = x[i]+','\r\nx = ''.join(x)\r\nprint(''.join([str(s.index(e)-1) for e in x.split(',')[:-1]]))", "password = input()\r\ncrypt0 = input()\r\ncrypt1 = input()\r\ncrypt2 = input()\r\ncrypt3 = input()\r\ncrypt4 = input()\r\ncrypt5 = input()\r\ncrypt6 = input()\r\ncrypt7 = input()\r\ncrypt8 = input()\r\ncrypt9 = input()\r\nbits = list(password)\r\ncodes = [''.join(bits[0:10]), ''.join(bits[10:20]), ''.join(bits[20:30]), ''.join(bits[30:40]), ''.join(bits[40:50]), ''.join(bits[50:60]), ''.join(bits[60:70]), ''.join(bits[70:])]\r\ni = 0\r\nfor code in codes:\r\n if code == crypt0:\r\n codes[i] = '0'\r\n elif code == crypt1: \r\n codes[i] = '1'\r\n elif code == crypt2: \r\n codes[i] = '2'\r\n elif code == crypt3: \r\n codes[i] = '3'\r\n elif code == crypt4: \r\n codes[i] = '4'\r\n elif code == crypt5: \r\n codes[i] = '5'\r\n elif code == crypt6: \r\n codes[i] = '6'\r\n elif code == crypt7: \r\n codes[i] = '7'\r\n elif code == crypt8: \r\n codes[i] = '8'\r\n else: \r\n codes[i] = '9'\r\n i += 1\r\nprint(''.join(codes))", "s=input()\r\nlst=[]\r\nfor i in range(10):\r\n lst.append(input())\r\nres=''\r\nfor i in range(0,80,10):\r\n res+=str(lst.index(s[i:i+10]))\r\nprint(res)", "binary = input()\r\nlist = []\r\nstring = \"\"\r\nlist3 = []\r\n\r\nfor i in range(10):\r\n list.append(input())\r\n\r\nlist2 = [binary[i:i+10] for i in range(0, len(binary), 10)]\r\n\r\nfor i in range(len(list2)):\r\n num = str(list.index(list2[i]))\r\n list3.append(num)\r\n\r\nprint(string.join(list3))\r\n", "s=input()\r\nd=dict()\r\nfor i in range(10):\r\n d[input()]=i\r\nfor i in range(0,len(s),10):\r\n print(d[s[i:i+10]],end=\"\")\r\nprint()", "import textwrap as tw\r\n\r\np = input()\r\nd = list()\r\nd.extend(input() for _ in range(10))\r\n\r\np = tw.wrap(p, width=10)\r\n\r\nfor dg in (d.index(i) for i in p):\r\n print(dg, end='')", "account = input()\r\ncodes = []\r\nfor _ in range(10):\r\n codes.append(input())\r\nans = ''\r\nfor i in range(8):\r\n digit = codes.index(account[(10 * i):(10 * (i + 1))])\r\n print(digit, end='')", "s = input()\r\nstrn = ''\r\narr = []\r\nfor i in range(0,71,10):\r\n arr.append(s[i:i+10])\r\narrn = []\r\nfor i in range(10):\r\n arrn.append(input())\r\nfor i in arr:\r\n for j in range(10):\r\n if i==arrn[j]:\r\n strn += str(j)\r\nprint(strn)", "ch= input()\r\nch0=input()\r\nch1=input()\r\nch2=input()\r\nch3=input()\r\nch4=input()\r\nch5=input()\r\nch6=input()\r\nch7=input()\r\nch8=input()\r\nch9=input()\r\nL=[ch0,ch1,ch2,ch3,ch4,ch5,ch6,ch7,ch8,ch9]\r\n\r\nx=\"\"\r\npassword=\"\"\r\ni=0\r\nwhile i<(len(ch)):\r\n x= ch[i:i+10]\r\n password=password + str(L.index(x))\r\n i=i+10\r\n \r\nprint(password)\r\n", "s = input()\r\ndic = dict()\r\nfor i in range(10):\r\n dic[input()] = str(i)\r\nfor i in range(8):\r\n print(dic.get(s[10*i:10*i+10]), end = \"\")\r\n", "p = input()\r\nl = []\r\nfor k in range(0,80,10):\r\n l.append(p[k:k+10])\r\nc = []\r\nfor j in range(10):\r\n c.append(input())\r\ns = ''\r\nfor h in l:\r\n s += str(c.index(h))\r\nprint(s)", "def readln(): return tuple(map(int, input().split()))\n\ns = input()\nm = {input():i for i in range(10)}\nfor i in range(8):\n print(m[s[i*10:(i + 1)*10]], end='')\nprint()\n", "s = input()\nl = [input() for i in range(10)]\nfor i in range(0, 80, 10):\n print(l.index(s[i:i + 10]), end=\"\")\n\n \t \t\t\t\t \t\t \t \t \t \t \t", "n=input()\nmap1={}\nfor i in range (0,10):\n x=input()\n map1[x]=i\n\nstr1=\"\"\nfor j in range (0,80,10):\n sub=n[j:j+10]\n str1+=str(map1[sub])\n\n\nprint (str1)\n \n", "def main():\n s = input()\n l = []\n for i in range(10):\n l.append(input())\n ret = \"\"\n i = 0\n while i < 80:\n for j in range(10):\n if l[j] == s[i:i+10]:\n ret += str(j)\n i += 10\n break\n return ret\n\nprint(main())\n", "s = input()\r\n\r\ndigit = []\r\nfor i in range(10):\r\n digit.append(input())\r\n \r\nans = ''\r\n\r\nfor i in range(8):\r\n dig = digit.index(s[10*i:10*(i+1)])\r\n ans += str(dig)\r\n\r\nprint(ans)", "a = input()\r\nm = {}\r\nfor i in range(10):\r\n m[input()] = str(i)\r\ns = ''\r\nfor j in range(8):\r\n s += m[a[j*10:(j+1)*10]]\r\nprint(s)", "s=input();n=[];x=1;y=''\nfor i in range(0,10):\n n.append(input())\nfor j in range(0,8):\n for k in range(0,10):\n y=y+s[j*10+k]\n for l in range(0,10):\n if n[l]==y:\n print(l,end='')\n y=''\nprint('')", "from sys import stdin; inp = stdin.readline\r\nfrom math import dist, ceil, floor, sqrt, log\r\nfrom collections import defaultdict, Counter\r\ndef IA(sep=' '): return list(map(int, inp().split(sep)))\r\ndef FA(): return list(map(float, inp().split()))\r\ndef SA(): return inp().split()\r\ndef I(): return int(inp())\r\ndef F(): return float(inp())\r\ndef S(): return input()\r\ndef P(x): return print(x)\r\ndef O(l:list): return ' '.join(map(str, l))\r\n\r\ndef main():\r\n p = S()\r\n n = len(p)\r\n d = {}\r\n for i in range(10):\r\n d[S()] = str(i)\r\n res = ''\r\n for i in range(10, n+1, 10):\r\n dig = p[i-10:i]\r\n res += d[dig]\r\n return res\r\n\r\nif __name__ == '__main__':\r\n print(main())", "c = input()\r\nd = []\r\nfor j in range(10):\r\n d.append(input())\r\nfor i in range(8):\r\n for j in range(10):\r\n if c[i * 10:(i + 1) * 10] == d[j]:\r\n print(j, end='')", "n = input()\r\na_dict = {}\r\nfor i in range(10):\r\n a_dict[input()] = str(i)\r\nans = ''\r\nfor j in range(8):\r\n ans += a_dict[n[10*j:10*(j+1)]]\r\nprint(ans)", "s=input()\r\n\r\nl=[input() for i in range(10)]\r\n\r\na=''\r\n\r\nfor i in range(8):\r\n\tfor j in range(10):\r\n\t\tt=s[10*i:10*(i+1)]\r\n\t\tif(l[j]== t):\r\n\t\t\ta+=str(j)\r\n\t\t\tbreak\r\n\r\n\r\nprint(a)\r\n", "\nfull = input()\nbi = [input() for i in range(10)]\npassword = ''\nj = 0\nfor i in range(10,81,10):\n index = full[j:i]\n password += str(bi.index(index))\n j += 10\n\nprint(password)\n \t \t \t \t \t \t\t \t \t \t", "arr=[]\ncount=0\nrst=''\nstr_to=''\nx=input()\nfor i in range(10):\n arr.append(input())\nfor i in range(len(x)):\n count+=1\n str_to+=x[i]\n if count==10:\n for j in range(len(arr)):\n if str_to==arr[j]:\n count=0\n rst+=str(j)\n str_to=''\nprint(rst)\n \t\t \t\t \t\t \t \t\t \t \t\t \t\t", "\ns = input()\ncodes = []\nres=''\n\nfor i in range(10):\n codes.append(input())\n\nfor i in range(8):\n for idx,code in enumerate(codes):\n if code == s[i*10:(i*10)+10]:\n res+=str(idx)\n break\n\nprint(res)\n\n\n\n\n\n", "s=input()\r\na=[ ]\r\nfor i in range(10):\r\n k=input()\r\n a.append(k)\r\nfor i in range(0,8):\r\n print(a.index(s[i*10:(i+1)*10]),end='')", "s = input()\r\na = []\r\nj = 0\r\nfor i in range(10, 81, 10):\r\n a.append(s[j:i])\r\n j = i\r\np = ''\r\nv = []\r\nfor _ in range(10):\r\n v.append(input())\r\nfor i in range(8):\r\n p += str(v.index(a[i]))\r\nprint(p)", "import sys\r\nfrom array import array # noqa: F401\r\n\r\n\r\ndef input():\r\n return sys.stdin.buffer.readline().decode('utf-8')\r\n\r\n\r\ns = input().rstrip()\r\na = [input().rstrip() for _ in range(10)]\r\nans = []\r\nfor i in range(8):\r\n for j in range(10):\r\n if s[i * 10:(i + 1) * 10] == a[j]:\r\n ans.append(j)\r\n break\r\n\r\nprint(*ans, sep='')\r\n", "code, digits, res = input(), [input() for _ in range(10)], \"\"\nfor i in range(0, 80, 10): res += str(digits.index(code[i:i+10]))\nprint(res)\n", "a=input()\r\nb=[input() for _ in range(10)]\r\nwhile a:\r\n for i in range(10):\r\n if a.startswith(b[i]):\r\n a=a[10:]\r\n print(i,end=\"\")", "s=input()\r\nx={}\r\nfor i in range(10):\r\n w=input()\r\n x[w]=str(i)\r\nans=''\r\nfor i in range(0,80,10):\r\n ans+=x[s[i:i+10]]\r\nprint(ans)", "key = input()\r\npw = [input() for i in range(10)]\r\nanswerstr = ''\r\nfor i in range(0,80,10):\r\n answerstr += str(pw.index(key[i:i+10]))\r\nprint(answerstr)", "code = input()\r\ndigit = list()\r\nfor i in range(10):\r\n digit.append(input())\r\n\r\nresult=str()\r\nfor i in range(0,len(code),10):\r\n result += str(digit.index(code[i:i+10]))\r\n\r\nprint(result)", "i = str(input())\ndef wrap(s, w):\n return [s[i:i + w] for i in range(0, len(s), w)]\ntab = wrap(i, 10)\ntab2 = []\nfor i in range(10):\n tt = input()\n tab2.append([tt, i])\nresult = []\nfor i in tab:\n for j in tab2:\n if i == j[0]:\n result.append(j[1])\nfor i in result:\n print (i, end='')\nprint()", "n = input()\r\nl = []\r\nfor i in range(10):\r\n\tl.append(input())\r\nk = ''\r\nfor i in range(0,80,10):\r\n\tq = n[i:i+10]\r\n\tfor j in range(10):\r\n\t\tif q == l[j]:\r\n\t\t\tk+=str(j)\r\n\t\t\tbreak\r\nprint(k)\r\n\t\t\t\r\n", "try :\r\n a =input()\r\n i =0 ; j=int(i+10)\r\n dictt = {}\r\n for _ in range(10):\r\n dictt[input()]=i\r\n i+=1\r\n i = 0\r\n j = 10\r\n for w in range(10):\r\n print(dictt[a[i:i+10]],end=\"\")\r\n i+=10\r\nexcept :\r\n pass\r\n", "s = input()\r\nn = list()\r\nresult = \"\"\r\nfor i in range(10):\r\n\tn.append(input())\r\ni = 0\r\nwhile i!=80:\r\n\tif s[i:i+10] in n:\r\n\t\tresult+=str(n.index(s[i:i+10]))\r\n\t\ti+=10\r\nprint(result)", "s = input()\r\nlst = []\r\nfor i in range(10):\r\n lst.append(input())\r\n\r\nfor i in range(0, 80, 10):\r\n si = s[i:i+10]\r\n print(lst.index(si), end=\"\")\r\n", "test = input()\r\n\r\nnum0 = input()\r\nnum1 = input()\r\nnum2 = input()\r\nnum3 = input()\r\nnum4 = input()\r\nnum5 = input()\r\nnum6 = input()\r\nnum7 = input()\r\nnum8 = input()\r\nnum9 = input()\r\n\r\noutput = \"\"\r\n\r\nfor x in range(8):\r\n \r\n \r\n \r\n numx = x*10\r\n numx1 = numx + 10\r\n \r\n \r\n if test[numx:numx1] == num0:\r\n output += \"0\"\r\n elif test[numx:numx1] == num1:\r\n output += \"1\"\r\n elif test[numx:numx1] == num2:\r\n output += \"2\"\r\n elif test[numx:numx1] == num3:\r\n output += \"3\"\r\n elif test[numx:numx1] == num4:\r\n output += \"4\"\r\n elif test[numx:numx1] == num5:\r\n output += \"5\"\r\n elif test[numx:numx1] == num6:\r\n output += \"6\"\r\n elif test[numx:numx1] == num7:\r\n output += \"7\"\r\n elif test[numx:numx1] == num8:\r\n output += \"8\"\r\n else:\r\n output +=\"9\"\r\n \r\n \r\nprint(output)", "def main():\r\n enc_password = input()\r\n enc_to_str = {}\r\n\r\n for i in range(10):\r\n enc = input()\r\n enc_to_str[enc] = str(i)\r\n\r\n length = len(enc_password)\r\n chunks = [enc_password[i:i + 10] for i in range(0, length, 10)]\r\n\r\n result = ''.join(enc_to_str[c] for c in chunks)\r\n print(result)\r\n\r\n\r\nmain()\r\n", "password = input()\r\ndigits = [input() for p in range(10)]\r\nsolve = ''\r\nfor i in range(0, 80, 10):\r\n solve += str(digits.index(password[i:i+10]))\r\nprint(solve)\r\n", "s=input()\r\nenc=dict({str(input()):i for i in range(10)})\r\nfor i in range(0,80,10):\r\n print(enc[s[i:(10+i)]],end='')", "def main():\r\n s = input()\r\n a = {}\r\n for i in range(10):\r\n a[input()] = i\r\n for i in range(1,9):\r\n print(a[s[10*(i-1):10*i]],end='')\r\n\r\nmain()\r\n\r\n", "def main():\r\n d = defaultdict(int)\r\n n = input()\r\n for i in range(10):\r\n d[input()] = i\r\n for i in range(8):\r\n print(d[n[i * 10:i * 10 + 10]], end='')\r\n\r\nfrom sys import *\r\nimport inspect\r\nimport re\r\nfrom math import *\r\nimport threading\r\nfrom collections import *\r\nfrom pprint import pprint as pp\r\nmod = 998244353\r\nMAX = 10**5\r\n\r\n\r\ndef lie():\r\n return int(input())\r\n\r\n\r\ndef liee():\r\n return map(int, input().split())\r\n\r\n\r\ndef array():\r\n return list(map(int, input().split()))\r\n\r\n\r\ndef deb(p):\r\n for line in inspect.getframeinfo(inspect.currentframe().f_back)[3]:\r\n m = re.search(r'\\bdeb\\s*\\(\\s*([A-Za-z_][A-Za-z0-9_]*)\\s*\\)', line)\r\n print('%s %s' % (m.group(1), str(p)))\r\n\r\n\r\ndef vec(size, val=0):\r\n vec = [val for i in range(size)]\r\n return vec\r\n\r\n\r\ndef mat(rowNum, colNum, val=0):\r\n mat = []\r\n for i in range(rowNum):\r\n collumn = [val for j in range(colNum)]\r\n mat.append(collumn)\r\n return mat\r\n\r\n\r\ndef dmain():\r\n setrecursionlimit(100000000)\r\n threading.stack_size(40960000)\r\n thread = threading.Thread(target=main)\r\n thread.start()\r\n\r\n\r\nif __name__ == '__main__':\r\n # main()\r\n dmain()\r\n", "password = input()\r\nnumbers = {}\r\n\r\nfor i in range(10):\r\n numbers[input()] = i\r\n\r\nfor i in range(1, 9):\r\n print(numbers[password[(i - 1) * 10 : i * 10]], end=\"\")", "s=input()\r\ndecode={}\r\nfor x in range(10):\r\n\tdecode[input()]=x\r\ntemp=\"\"\r\npassword=[]\r\nfor x in range(1,81):\r\n\ttemp+=s[x-1]\r\n\tif x%10==0:\r\n\t\tpassword.append(temp)\r\n\t\ttemp=\"\"\r\nfor x in password:\r\n\tprint(decode[x],end=\"\")", "s=input()\r\na=[]\r\nfor i in range(10):\r\n b=input()\r\n a.append(b)\r\nfor j in range (0,80,10):\r\n string=s[j:j+10]\r\n x=a.index(string)\r\n print(x,end='')\r\n ", "s=str(input());a=[];t=''\r\nfor i in range(10):\r\n a.append(str(input()))\r\nfor i in range(0,80,10):\r\n p=s[i:i+10]\r\n for j in range(10):\r\n if a[j]==p:\r\n t+=str(j)\r\n break\r\nprint(t)\r\n", "s = input()\r\nm = {input(): str(i) for i in range(10)}\r\nres = \"\"\r\nfor i in range(0, len(s), 10):\r\n substring = s[i : i + 10]\r\n res += m[substring]\r\nprint(res)\r\n", "v = input()\r\nnum0 = input()\r\nnum1 = input()\r\nnum2 = input()\r\nnum3 = input()\r\nnum4 = input()\r\nnum5 = input()\r\nnum6 = input()\r\nnum7 = input()\r\nnum8 = input()\r\nnum9 = input()\r\nk=''\r\nfor i in range(0,len(v),10):\r\n if v[i]+v[i+1]+v[i+2]+v[i+3]+v[i+4]+v[i+5]+v[i+6]+v[i+7]+v[i+8]+v[i+9] == num0:\r\n k+='0'\r\n continue\r\n if v[i]+v[i+1]+v[i+2]+v[i+3]+v[i+4]+v[i+5]+v[i+6]+v[i+7]+v[i+8]+v[i+9] == num1:\r\n k+='1'\r\n continue\r\n if v[i]+v[i+1]+v[i+2]+v[i+3]+v[i+4]+v[i+5]+v[i+6]+v[i+7]+v[i+8]+v[i+9] == num2:\r\n k+='2'\r\n continue\r\n if v[i]+v[i+1]+v[i+2]+v[i+3]+v[i+4]+v[i+5]+v[i+6]+v[i+7]+v[i+8]+v[i+9] == num3:\r\n k+='3'\r\n continue\r\n if v[i]+v[i+1]+v[i+2]+v[i+3]+v[i+4]+v[i+5]+v[i+6]+v[i+7]+v[i+8]+v[i+9] == num4:\r\n k+='4'\r\n continue\r\n if v[i]+v[i+1]+v[i+2]+v[i+3]+v[i+4]+v[i+5]+v[i+6]+v[i+7]+v[i+8]+v[i+9] == num5:\r\n k+='5'\r\n continue\r\n if v[i]+v[i+1]+v[i+2]+v[i+3]+v[i+4]+v[i+5]+v[i+6]+v[i+7]+v[i+8]+v[i+9] == num6:\r\n k+='6'\r\n continue\r\n if v[i]+v[i+1]+v[i+2]+v[i+3]+v[i+4]+v[i+5]+v[i+6]+v[i+7]+v[i+8]+v[i+9] == num7:\r\n k+='7'\r\n continue\r\n if v[i]+v[i+1]+v[i+2]+v[i+3]+v[i+4]+v[i+5]+v[i+6]+v[i+7]+v[i+8]+v[i+9] == num8:\r\n k+='8'\r\n continue\r\n if v[i]+v[i+1]+v[i+2]+v[i+3]+v[i+4]+v[i+5]+v[i+6]+v[i+7]+v[i+8]+v[i+9] == num9:\r\n k+='9'\r\n continue\r\nprint(k)", "binary = input()\r\nh = {}\r\nfor i in range(10):\r\n h[input()] = str(i)\r\nres = \"\"\r\nfor i in range(0, 80, 10):\r\n res += h[binary[i:i+10]]\r\nprint(res)", "import re\r\ncode=input()\r\nd={}\r\nfor i in range(10):\r\n d[i]=input()\r\nj=0\r\nk=10\r\nl=list(d.items())\r\nv=list(d.values())\r\nans=''\r\nfor i in range(8):\r\n x=code[j:k]\r\n a=v.index(x)\r\n ans+=str(l[a][0])\r\n j=k\r\n k=k+10\r\nprint(ans) \r\n \r\n \r\n \r\n \r\n \r\n", "\n\n# import sys\n# sys.stdin = open('input.txt', 'r')\n\n\ndef solve():\n s = input()\n hm = {}\n \n for i in range(10):\n a = input()\n hm[a] = str(i)\n\n ans = \"\"\n i = 0\n n = len(s)\n while i < n:\n ans += hm[s[i:i+10]]\n i += 10\n \n print(ans)\n\n\n\nsolve() ", "def solve(s, d):\n res = ''\n for i in range(0,len(s), 10):\n res += str(d[s[i:i+10]])\n return res\n \n \n\n\n\n\n \n\n \ndef main() :\n # s = input()\n # n = int(input())\n # arr = list(map(int, input().split(' ')))\n s = input()\n # res=''\n d = {}\n for i in range(10):\n n = input()\n d[n] = i\n print(solve(s, d))\nmain()\n", "s=input()\r\nl1=[]\r\nfor i in range(0,10):\r\n l1.append(input())\r\nfor i in range(0,8):\r\n print(l1.index(s[i*10:(i+1)*10]),end=\"\")", "\r\n\r\ndef main_function():\r\n s = input()\r\n codes = [input() for i in range(10)]\r\n real_code = \"\"\r\n for i in range(8):\r\n binary_code = s[i * 10:(i + 1) * 10]\r\n for j in range(len(codes)):\r\n if codes[j] == binary_code:\r\n real_code += str(j)\r\n return real_code\r\n\r\n\r\n\r\n\r\n\r\n\r\nprint(main_function())", "# Read the encrypted binary code\r\nencrypted_code = input()\r\n\r\n# Read the binary codes for numbers 0 to 9\r\nbinary_codes = [input() for _ in range(10)]\r\n\r\n# Create a dictionary to map binary codes to digits\r\nbinary_to_digit = {binary_code: str(i) for i, binary_code in enumerate(binary_codes)}\r\n\r\n# Decrypt the password\r\npassword = ''.join(binary_to_digit[encrypted_code[i:i+10]] for i in range(0, 80, 10))\r\n\r\n# Print the decrypted password\r\nprint(password)", "codes = {}\ncode = input()\nans = \"\"\n\nfor i in range(10):\n codes[input()] = i\n\nfor j in range(0, len(code), 10):\n ans += str(codes[code[j:j+10]])\n\nprint(ans)", "code = input()\r\nans = ''\r\nnums = []\r\nfor i in range(10):\r\n nums.append(input())\r\nfor i in range(0,80,10):\r\n ans += str(nums.index(code[i:i+10]))\r\nprint(ans)", "code = input()\r\nx = []\r\na = []\r\nb = []\r\n\r\nfor k in range(0, 80, 10):\r\n x.append(code[k:k+10])\r\nfor i in range(10):\r\n a.append(input())\r\nfor j in range(len(x)):\r\n b.append(a.index(x[j]))\r\n\r\nprint(*b,sep=\"\")\r\n", "import math\r\nimport sys\r\nimport re\r\n\r\nn = input()\r\nl = [n[:10] , n[10:20] , n[20:30] , n[30:40] , n[40:50] , n[50:60] , n[60:70] , n[70:80]]\r\ns = ''\r\nl1 = []\r\nfor x in range(10):\r\n a = input()\r\n l1.append(a)\r\nfor y in l:\r\n s = s + str(l1.index(y))\r\nprint(s)", "if __name__==\"__main__\":\r\n st80=input()\r\n st_10=[]\r\n dic={}\r\n for i in range(10):\r\n el=input()\r\n st_10.append(el)\r\n for i in range(10):\r\n dic.setdefault(st_10[i],i)\r\n ans=\"\"\r\n parts=[]\r\n for i in range(0,len(st80),10):\r\n el=st80[i:i+10]\r\n parts.append(el)\r\n for i in parts:\r\n ans=ans+str(dic[i])\r\n print(ans)\r\n\r\n\r\n\r\n", "import re\r\n\r\npassword = input()\r\ncodes = {}\r\n\r\nfor i in range(0, 10):\r\n code = input()\r\n codes[code]= i\r\n\r\norigPassword = \"\"\r\n\r\nwhile len(origPassword) < 8:\r\n for code in codes:\r\n if re.search(\"^\"+code, password):\r\n origPassword += str(codes[code])\r\n password = password[10:]\r\n\r\nprint(origPassword)", "s = input()\r\nd = {}\r\n\r\nfor i in range(10):\r\n d[input()] = i\r\n\r\nfor i in range(8):\r\n cur = s[:10]\r\n s = s[10:]\r\n print(d[cur], end = \"\")\r\n", "#codeforces 94A\r\na=input()\r\nb=[]\r\nc=''\r\nfor i in range(10):\r\n b.append(input())\r\nfor j in range(1,9):\r\n for i in range(10):\r\n if a[(j-1)*10:(j*10)]== b[i]:\r\n c+=str(i)\r\n break\r\n\r\nprint(c)", "cc = list(input())\r\nz = str(input())\r\na = str(input())\r\nb = str(input())\r\nc = str(input())\r\nd = str(input())\r\ne = str(input())\r\nf = str(input())\r\ng = str(input())\r\nh = str(input())\r\ni = str(input())\r\np = []\r\nfor x in range(0, 9):\r\n if ''.join([str(elem) for elem in cc[:10]]) == z:\r\n p.append(0)\r\n cc = cc[10:]\r\n if ''.join([str(elem) for elem in cc[:10]]) == a:\r\n p.append(1)\r\n cc = cc[10:]\r\n elif ''.join([str(elem) for elem in cc[:10]]) == b:\r\n p.append(2)\r\n cc = cc[10:]\r\n elif ''.join([str(elem) for elem in cc[:10]]) == c:\r\n p.append(3)\r\n cc = cc[10:]\r\n elif ''.join([str(elem) for elem in cc[:10]]) == d:\r\n p.append(4)\r\n cc = cc[10:]\r\n elif ''.join([str(elem) for elem in cc[:10]]) == e:\r\n p.append(5)\r\n cc = cc[10:]\r\n elif ''.join([str(elem) for elem in cc[:10]]) == f:\r\n p.append(6)\r\n cc = cc[10:]\r\n elif ''.join([str(elem) for elem in cc[:10]]) == g:\r\n p.append(7)\r\n cc = cc[10:]\r\n elif ''.join([str(elem) for elem in cc[:10]]) == h:\r\n p.append(8)\r\n cc = cc[10:]\r\n elif ''.join([str(elem) for elem in cc[:10]]) == i:\r\n p.append(9)\r\n cc = cc[10:]\r\nprint(''.join([str(elem) for elem in p]))", "s=input()\nd={}\nfor i in range(10):\n d[input()]=i\ntemp=0\n# print(d)\n# print(d['0100110000'])\nans=\"\"\nwhile temp != 80:\n # ans += str(d[s[temp:temp+8]])\n # print(s[temp:temp+10])\n print(d[s[temp:temp+10]],end=\"\")\n temp += 10", "s = input()\r\nl = []\r\nfor i in range(10):\r\n\tl+=[input()]\r\ni = 0\r\nwhile i<80:\r\n\tprint(l.index(s[i:i+10]),end='')\r\n\ti+=10\r\n", "s=input()\nl=[]\nfor i in range(10):\n l.append(input())\np=\"\"\nfor j in range(8):\n y=s[10*j:10*j+10]\n a=l.index(y)\n p+=str(a)\n\nprint(p)\n \n", "s = input()\r\nl = list()\r\nfor i in range(10):\r\n l.append(input())\r\nfor i in range(0,80,10):\r\n for j in range(10):\r\n if(s[i:i+10] == l[j]):\r\n print(j,end=\"\")\r\n\r\n", "# LUOGU_RID: 113733671\na=input();b={}\nfor i in range(10):b[input()]=i\nfor i in range(8):print(b[a[i*10:i*10+10]],end=\"\")", "s=input()\r\na=[]\r\nfor i in range(0,10):\r\n a.append(input())\r\nfor i in range(0,8):\r\n print(a.index(s[i*10:(i+1)*10]),end=\"\")", "#!/usr/bin/python3\n\ns = input()\n\nd = dict()\nfor i in range(10):\n t = input()\n d[t] = i\n\nans = []\nfor i in range(8):\n ans.append(d[s[10 * i:10 * i + 10]])\n\nprint(\"\".join(map(str, ans)))\n", "word=str(input())\r\nalist=[]\r\nfor i in range(10):\r\n num=str(input())\r\n alist.append(num)\r\n\r\nj=0\r\nblist=[]\r\nfor j in range(0,80,10):\r\n m=alist.index(word[j:j+10])\r\n \r\n blist.append(str(m))\r\nprint(\"\".join(blist))", "a = input()\r\nnumbers = []\r\nfor i in range(10):\r\n numbers.append(input())\r\n\r\nres = \"\"\r\nfor i in range(0, len(a), 10):\r\n k = a[i:i+10]\r\n for idx, num in enumerate(numbers):\r\n if(k == num):\r\n res += str(idx)\r\nprint(res)", "import sys\r\n\r\ninput = sys.stdin.readline\r\n\r\ndata = input().rstrip()\r\nmemo = [input().rstrip() for _ in range(10)]\r\n\r\nfor i in range(0, 71, 10):\r\n tmp = memo.index(data[i:i + 10])\r\n print(tmp, end='')\r\n", "n=input()\r\ndict={}\r\nb=0\r\nfor a in range(10):\r\n c=input()\r\n dict[c]=b\r\n b+=1\r\n \r\na=10\r\nb=0\r\nlist=[]\r\nwhile a<=80:\r\n q=n[b:a]\r\n b+=10\r\n a+=10\r\n list.append(str(dict[q]))\r\n \r\ns=''.join(list)\r\nprint(s) \r\n \r\n \r\n \r\n ", "n=input()\r\nn=list(n)\r\nstr=\"\"\r\nz=[]\r\nfor i in range(0,10):\r\n x=input()\r\n z.append(x)\r\nj=0\r\nwhile j<80:\r\n m=0\r\n y=\"\"\r\n for i in range(j,j+10):\r\n y=y+n[i]\r\n for k in range(0,10):\r\n if y==z[k]:\r\n print(k,end=\"\")\r\n break\r\n j=j+10", "# https://codeforces.com/problemset/problem/94/A\n# 900\n\ne = input()\n\nd = {}\nfor i in range(10):\n k = input()\n d[k] = str(i)\n\nn = 0\nk = \"\"\np = \"\"\nfor c in e:\n if n == 10:\n p += d[k]\n k = \"\"\n n = 0\n\n k += c\n n += 1\n\np += d[k]\nprint(p)", "\r\nst = input()\r\nl = []\r\nfor _ in range(10):\r\n\tl.append(input())\r\n\r\n\r\nans = ''\r\nfor i in range(0, 80, 10):\r\n\tans += str(l.index(st[i : i + 10]))\r\n\r\nprint(ans)\r\n", "x = input()\r\ncrack = dict()\r\nfor i in range(10):\r\n code = input()\r\n crack[int(code, 2)] = i\r\nhas = []\r\nfor i in range(8):\r\n code = x[10*i:10*i+10]\r\n code = int(code, 2)\r\n has.append(str(crack[code]))\r\n\r\nprint(''.join(has))\r\n", "code=(lambda s:[s[i*10:(i+1)*10] for i in range(8)])(input())\r\nc2d=dict((input(),str(i)) for i in range(10))\r\nprint(''.join(map(lambda x:c2d[x],code)))\r\n", "binary_input = input()\r\nrepresent_0 = input()\r\nrepresent_1 = input()\r\nrepresent_2 = input()\r\nrepresent_3 = input()\r\nrepresent_4 = input()\r\nrepresent_5 = input()\r\nrepresent_6 = input()\r\nrepresent_7 = input()\r\nrepresent_8 = input()\r\nrepresent_9 = input()\r\n\r\npassword = ''\r\nten_digit_start = 0\r\nten_digit_stop = 10\r\n\r\nfor i in range(0, 8):\r\n word = binary_input[ten_digit_start:ten_digit_stop]\r\n if word == represent_0:\r\n password += '0'\r\n elif word == represent_1:\r\n password += '1'\r\n elif word == represent_2:\r\n password += '2'\r\n elif word == represent_3:\r\n password += '3'\r\n elif word == represent_4:\r\n password += '4'\r\n elif word == represent_5:\r\n password += '5'\r\n elif word == represent_6:\r\n password += '6'\r\n elif word == represent_7:\r\n password += '7'\r\n elif word == represent_8:\r\n password += '8'\r\n elif word == represent_9:\r\n password += '9'\r\n ten_digit_start += 10\r\n ten_digit_stop += 10\r\n\r\nprint(password)\r\n", "s = input()\r\n\r\narr = []\r\nres = ''\r\n\r\nfor i in range(10):\r\n p = input()\r\n arr.append(p)\r\n\r\nfor i in range(8):\r\n res += str(arr.index(s[i*10:(i + 1) * 10]))\r\n\r\nprint(res)\r\n", "binary_code = input().strip()\r\ndigit_codes = []\r\nfor i in range(10):\r\n digit_codes.append(input().strip())\r\n\r\n# Split the binary code into groups of 10 characters\r\ncode_groups = [binary_code[i:i+10] for i in range(0, 80, 10)]\r\n\r\n# Find the corresponding digits for each code group\r\ndigits = ''\r\nfor group in code_groups:\r\n for i in range(10):\r\n if group == digit_codes[i]:\r\n digits += str(i)\r\n break\r\n\r\n# Output the password\r\nprint(digits)\r\n", "import sys\r\ninput = sys.stdin.readline\r\n\r\nx = list(input().rstrip())\r\nd = dict()\r\nfor i in range(10):\r\n s = input().rstrip()\r\n d[s] = str(i)\r\nans = []\r\nfor i in range(8):\r\n ans.append(d[\"\".join(x[(10 * i):(10 * (i + 1))])])\r\nprint(\"\".join(ans))", "s = input()\n\nnums = {}\nfor i in range(10):\n nums[input()] = str(i)\n\nres = ''\nfor i in range(0, 80, 10):\n res += nums[s[i:i + 10]]\n\nprint(res)\n", "kol=1\r\not=''\r\nd=[]\r\nl=input()+'*'\r\nfor i in list(l):\r\n if kol<10:\r\n kol+=1\r\n ot+=i\r\n else:\r\n kol=1\r\n ot+=i\r\n d.append(ot)\r\n ot=''\r\n\r\ns=[]\r\nfor i in range(10):\r\n s.append(input())\r\nfor i in d:\r\n print(s.index(i),end='')\r\n", "def main():\r\n go()\r\n \r\ndef go():\r\n enc_str = input('')\r\n ks, ans = [], []\r\n \r\n for x in range(10):\r\n ks.append(input(''))\r\n \r\n for i in range(8):\r\n ans.append(str(ks.index(enc_str[i*10:i*10+10])))\r\n \r\n print('{0}'.format( ''.join(ans) ))\r\n \r\nmain()", "inp = input(\"\")\r\nls = []\r\n\r\nbinaries = []\r\nfor i in range(0, 8):\r\n binaries.append(inp[i * 10:(i + 1) * 10])\r\n\r\nel = []\r\nresult = ''\r\nfor i in range(10):\r\n el.append(input(\"\"))\r\n\r\nfor i in range(8):\r\n if binaries[i] in el:\r\n result += str(el.index(binaries[i]))\r\n\r\nprint(result)\r\n", "n=input()\r\na=[]\r\nfor i in range(10):\r\n a.append(input())\r\ns=''\r\nfor i in range(8):\r\n for g in range(len(a)):\r\n if a[g]==n[10*i:10*(i+1)]:\r\n s+=str(g)\r\nprint(s)\r\n", "s=input()\r\nl={}\r\nfor i in range(10):\r\n x=input()\r\n l[x]=str(i)\r\nd=''\r\nfor i in range(8):\r\n d+=l[s[10*i:(i+1)*10]]\r\nprint(d)\r\n", "n = input()\r\nd = {}\r\nfor i in range(10):\r\n d[input()] = str(i)\r\np = ''\r\nfor i in range(8):\r\n b = n[:10]\r\n for j in d:\r\n if b == j:\r\n p += d.get(j)\r\n break\r\n else:\r\n continue\r\n n = n[10:]\r\nprint(p)\r\n\r\n", "\r\ninp = input()\r\n\r\nbins = {}\r\n\r\nfor i in range(10):\r\n bins[input()] = i\r\n\r\noriginal = \"\"\r\nfor i in range(0, 80, 10):\r\n \r\n original += str(bins[inp[i:(i + 10)]])\r\n\r\nprint(original)", "while(1):\r\n try:\r\n s=input()\r\n a=[]\r\n for i in range(0,10):\r\n a.append(input())\r\n i=0\r\n while i<80:\r\n ind=a.index(s[i:i+10])\r\n print(ind,end=\"\")\r\n i+=10\r\n print(\"\")\r\n except EOFError:\r\n break\r\n ", "code = input()\r\npassword = [code[i:i+10] for i in range(0, 80, 10)]\r\nconv_table = {input(): str(i) for i in range(10)}\r\nprint(''.join(conv_table[c] for c in password))", "encoded_string = input()\ndigits = {}\nfor i in range(10):\n digits[input()] = i\n\n\nresult = []\nfor i in range(0, 80, 10):\n cur_sub = encoded_string[i:i+10]\n result.append(digits[cur_sub])\n\nprint(''.join(str(x) for x in result))", "\nI0 = lambda :map(int,input().split())\nI1 = lambda :int(input())\nI2 = lambda :list(map(int,input().split()))\n#####################################################\ns = input()\na = list()\nstart = 0\nend = 10\nres = ''\nfor i in range(10):\n a.append(input())\nfor i in range(8):\n for j in range(10):\n if s[start:end] == a[j]:\n res+=str(j)\n break\n start = end\n end+=10\nprint(res)", "\r\n\"\"\"\r\ndef main():\r\n t = int(input())\r\n for _ in range(t):\r\n n,m = sep()\r\n a=list(sep())\r\n b=list(sep())\r\n ans=0\r\n a = sorted(a,reverse=True)\r\n for i in range(n):\r\n if a[i]>=i+1:\r\n ans+=b[i]\r\n else:\r\n ans+=b[a[i]-1]\r\n print(ans)\r\nif __name__ == '__main__':\r\n main()\r\n\"\"\"\r\n\r\n\"\"\"\r\ndef main():\r\n n=int(input())\r\n x = int(input())\r\n p=7-x\r\n for i in range(n):\r\n c = list(sep())\r\n if x in c or p in c:\r\n print(\"NO\")\r\n break\r\n else:\r\n print(\"YES\")\r\nif __name__ == '__main__':\r\n main()\r\n\"\"\"\r\n\"\"\"\r\ndef main():\r\n s,k = sep()\r\n a=[0,1]\r\n ans=[]\r\n #print(ans)\r\n while(a[-1]<s):\r\n a.append(sum(a[-k:]))\r\n a.reverse()\r\n #print(list(a))\r\n for i in a:\r\n if i<=s:\r\n ans.append(i)\r\n s-=i\r\n print(len(ans))\r\n print(*ans)\r\nif __name__ == '__main__':\r\n main()\r\n\"\"\"\r\n\r\ndef sep(): return map(int,input().split())\r\n\"\"\"\r\ndef main():\r\n n = int(input())\r\n a = list(sep())\r\n d = {}\r\n f = True\r\n for i in range(n):\r\n if (f == False):\r\n break\r\n for j in range(i):\r\n # print(d)\r\n\r\n if (a[i] + a[j] in d):\r\n ii, jj = d[a[i] + a[j]]\r\n if (len(set([i, j, ii, jj])) == 4):\r\n print('YES')\r\n f = False\r\n print(i + 1, j + 1, ii + 1, jj + 1)\r\n break\r\n \r\n else:\r\n d[a[i] + a[j]] = (i, j)\r\n\r\n if (f):\r\n print('NO')\r\nif __name__ == '__main__':\r\n main()\r\n\"\"\"\r\ndef main():\r\n s=input()\r\n d={}\r\n i=-1\r\n for _ in range(10):\r\n i+=1\r\n t = input()\r\n d[t]=i\r\n #print(d)\r\n j=0\r\n while(j<80):\r\n print(d[s[j:10+j]],end=\"\")\r\n j+=10\r\nif __name__ == '__main__':\r\n main()", "encrypted_code = input().strip()\r\nbinary_codes = [input().strip() for _ in range(10)]\r\nbinary_to_digit = {binary: str(digit) for digit, binary in enumerate(binary_codes)}\r\npassword = ''.join(binary_to_digit[encrypted_code[i:i+10]] for i in range(0, 80, 10))\r\nprint(password)\r\n", "def RestoringPassword(encrpswd,digkeys):\r\n\ti=0\r\n\tresult=\"\"\r\n\twhile i<8:\r\n\t\tstartingIndex = i*10\r\n\t\tendingIndex = (i+1)*10\r\n\t\t\r\n\t\tcode = encrpswd[startingIndex:endingIndex]\r\n\t\tj=0\r\n\t\twhile j<10:\r\n\t\t\tif digkeys[j]==code:\r\n\t\t\t\tresult+=str(j)\r\n\t\t\tj+=1\r\n\t\ti+=1\r\n\treturn result\r\n\r\nencrpswd = input()\r\ndigkeys=[]\r\ni=0\r\nwhile i<10:\r\n\tdigkeys.append(input())\r\n\ti+=1\r\n\r\nprint(RestoringPassword(encrpswd,digkeys))\r\n\r\n", "s=input()\r\nl=[]\r\nfor i in range(10):\r\n l.append(input())\r\nfor i in range(0,len(s),10):\r\n p=s[i]+s[i+1]+s[i+2]+s[i+3]+s[i+4]+s[i+5]+s[i+6]+s[i+7]+s[i+8]+s[i+9]\r\n a = l.index(p)\r\n print(a,end=\"\")", "s = input()\r\na, d = [], {}\r\nfor i in range(0,71,10):\r\n\ta.append(s[i:i+10])\r\nfor i in range(10):\r\n\td[input()]=i\r\nfor i in a:\r\n\tprint(d[i], end='')", "password = input()\n\nkeys = []\ndecrypted = \"\"\nfor i in range(10) :\n keys.append(input())\n\nfor i in range(0,71, 10) :\n decrypted += str( int( keys.index(password[i:i+10])) )\n\nprint(decrypted)\n \t \t\t \t\t \t \t\t\t \t \t\t \t", "s=input()\r\nss=[input() for i in range(10)]\r\nfor i in range(0,80,10):\r\n print(ss.index(s[i:i+10]),end='')", "k = str(input())\r\nhashMap = {}\r\n\r\nfor i in range(10):\r\n code = str(input())\r\n hashMap[code] = str(i)\r\n\r\nres = []\r\nfor i in range(0, len(k), 10):\r\n val = k[i:i+10]\r\n convert = hashMap[val]\r\n res.append(convert)\r\n\r\nprint(\"\".join(res))", "p = input()\r\nnum = {}\r\nfor i in range(10):\r\n num[input()] = i\r\nout = ''\r\nfor i in range(0,len(p),10):\r\n part = p[i:i+10]\r\n out += str(num[part])\r\nprint(out)\r\n", "n = input()\r\nd = dict()\r\nfor i in range(10):\r\n\ts = input()\r\n\td[s] = i\r\n\r\nfor i in range(8):\r\n\ts = n[i * 10:i * 10 + 10]\r\n\tprint(d[s], end=\"\")", "n=input()\r\nm=[]\r\n\r\nseq_size = 10\r\nseq_num = 8\r\na=''\r\n\r\nfor i in range(seq_num):\r\n m.append(n[i*seq_size:(i+1)*seq_size])\r\nmas=[]\r\nfor i in range(10):\r\n l=input()\r\n mas.append(l)\r\n\r\nfor i in m:\r\n a+=str(mas.index(i))\r\nprint(a)", "s = input()\r\nd = {}\r\n\r\nfor i in range(10):\r\n x = input()\r\n d[x] = str(i)\r\n\r\nans = ''\r\nfor i in range(8):\r\n ans += d[s[i*10 : (i * 10 + 10)]]\r\n\r\nprint(ans)", "#!/usr/bin/python3\ns, ma = input(), {}\n[ma.update({input(): i}) for i in range(10)]\n[print(ma[s[i:(i+10)]], end='') for i in range(0, len(s), 10)]\n", "i=input\r\na=i()\r\nexec('b=['+'i(),'*10+']')\r\nb=dict(zip(b,range(10)))\r\nfor i in range(0,len(a),10):\r\n print(b[a[i:i+10]],end='')", "password = input()\r\nvalues = [None]*10\r\nfor i in range(10) :\r\n values[i] = input()\r\nans = \"\"\r\nfor i in range(0, 80, 10):\r\n ans += str(values.index(password[i:i+10]))\r\nprint(ans)\r\n ", "s = input()\r\nd={}\r\nfor i in range(10):\r\n d[i] = input()\r\nr = ''\r\nfor i in range(0, len(s),10):\r\n for k in d:\r\n if d[k] == s[i:i+10]:\r\n r += str(k)\r\n else:\r\n continue\r\nprint(r)", "s=input()\na0=input()\na1=input()\na2=input()\na3=input()\na4=input()\na5=input()\na6=input()\na7=input()\na8=input()\na9=input()\nx=0\nfor i in range(0,81,10):\n if s[x:i]==a1:print(1,end='')\n elif s[x:i]==a2:print(2,end='')\n elif s[x:i]==a3:print(3,end='')\n elif s[x:i]==a4:print(4,end='')\n elif s[x:i]==a5:print(5,end='')\n elif s[x:i]==a6:print(6,end='')\n elif s[x:i]==a7:print(7,end='')\n elif s[x:i]==a8:print(8,end='')\n elif s[x:i]==a9:print(9,end='')\n elif s[x:i]==a0:print(0,end='') \n x=i\n\n \t\t \t \t \t \t \t\t \t \t\t", "a = input()\r\nsim = {\r\n input(): '0',\r\n input(): '1',\r\n input(): '2',\r\n input(): '3',\r\n input(): '4',\r\n input(): '5',\r\n input(): '6',\r\n input(): '7',\r\n input(): '8',\r\n input(): '9'\r\n}\r\nexi = ''\r\nj = 0\r\nfor i in range(10, 90, 10):\r\n exi += sim[a[j:i]]\r\n j += 10\r\nprint(exi)", "s=input()\r\nl=[]\r\nfor i in range(10):\r\n\tl.append(input())\r\nfor i in range(0,80,10):\r\n\tprint(l.index(s[i:i+10]),end=\"\")", "x=input()\r\nl=[]\r\nans=''\r\nfor i in range(0,10):\r\n n=input()\r\n l.append([str(i),n])\r\nini=0\r\nf=10\r\nfor i in range(ini,f):\r\n for j in l:\r\n if x[ini:f]==j[1]:\r\n ans=ans+j[0]\r\n break\r\n else:\r\n continue\r\n ini=ini+10\r\n f=f+10\r\nprint(ans)\r\n", "s=input()\r\nL=[]\r\nfor i in range(0,10):\r\n\tp=input()\r\n\tL.append(p)\r\npassword=''\r\nfor i in range(0,8):\r\n\tj=L.index(s[10*i:10*i+10])\r\n\tpassword+=str(j)\r\nprint(password)\r\n", "s = input()\r\nss = []\r\n\r\nfor i in range(10):\r\n ss.append(input())\r\nans = []\r\nfor i in range(8):\r\n for j in range(10):\r\n if(ss[j] == s[i*10: (i+1)*10]):\r\n ans.append(j)\r\n break\r\n\r\nfor i in ans:\r\n print(i, end=\"\")", "s=input()\r\nl=[]\r\nfor i in range(10):\r\n l.append(input())\r\n\r\n#print(l)\r\nls=[]\r\nfor i in range(0,80,10):\r\n ls.append(s[i:i+10])\r\nfor i in ls:\r\n for j in range(len(l)):\r\n if i==l[j]:\r\n print(j,end='')\r\n", "# https://codeforces.com/contest/94/problem/A\r\n\r\n\r\ndef single_integer():\r\n return int(input())\r\n\r\n\r\ndef multi_integer():\r\n return map(int, input().split())\r\n\r\n\r\ndef string():\r\n return input()\r\n\r\n\r\ndef multi_string():\r\n return input().split()\r\n\r\n\r\nn = input()\r\nnumbers_dict = dict()\r\nfor i in range(10):\r\n numbers_dict[input()] = i\r\ni = 0\r\nwhile i < 80:\r\n s = numbers_dict[n[i:i + 10]]\r\n print(s, end=\"\")\r\n i += 10\r\n", "s = input()\r\na = [s[i:i+10] for i in range(0, len(s), 10)]\r\nlst = []\r\nd = []\r\nfor i in range(10):\r\n n = input()\r\n lst.append(n)\r\nfor i in range(len(a)):\r\n if (a[i] in lst):\r\n d.append(lst.index(a[i]))\r\nfor i in d:\r\n print(i, end = \"\")", "password = input()\r\ncode_dict = {input(): str(i) for i in range(10)}\r\nresult = ''\r\nfor i in range(0, 80, 10):\r\n result += code_dict[password[i:i+10]]\r\nprint(result)", "a = input()\r\nb = [input() for i in range(10)]\r\nprint(*[b.index(a[i:i + 10]) for i in range(0, 80, 10)], sep='')", "bcode = input()\nnum = []\nfor i in range(10):\n num.append(input())\nans = ''\nfor i in range(0,len(bcode),10):\n ans += str(num.index(bcode[i:i+10]))\nprint(ans)\n\t \t \t\t\t \t\t\t\t\t \t\t \t \t\t\t \t \t\t \t", "s = input()\nl = []\nfor _ in range(10):\n l.append(input())\nres = ''\nfor i in range(0,80,10):\n det = s[i:i+10]\n for j in range(10):\n if l[j] == det:\n res += str(j)\nprint(res)\n", "s=input()\nd={}\nfor i in range(10):\n\td[input()]=i\nss=[]\nfor i in range(8):\n\tss.append(d[s[i*10:(i+1)*10]])\nprint(*ss,sep=\"\")\n\t \t\t\t\t \t\t\t\t \t\t\t\t \t\t \t\t \t \t", "# import sys\n# sys.stdin=open('input.txt', 'r')\n# sys.stdout=open('output.txt', 'w')\n\nn=list(input())\nmydict=[]\nfor i in range(8):\n j=i*10\n mydict.append(''.join(n[j:j+10]))\ncode={}\nfor i in range(10):\n x=input()\n code[x]=i\nans=[]\nfor i in range(len(mydict)):\n ans.append(str(code[mydict[i]]))\nprint(''.join(ans))\n\n\t\t \t\t\t\t\t \t\t\t \t \t \t \t\t \t \t \t \t\t", "string = str(input())\r\n\r\nnumber0 = str(input())\r\nnumber1 = str(input())\r\nnumber2 = str(input())\r\nnumber3 = str(input())\r\nnumber4 = str(input())\r\nnumber5 = str(input())\r\nnumber6 = str(input())\r\nnumber7 = str(input())\r\nnumber8 = str(input())\r\nnumber9 = str(input())\r\n\r\nnumber = \"\"\r\ni = 0\r\nwhile i <= 80:\r\n\ttry:\r\n\t\tif string[i:i + 10] == number0:\r\n\t\t\tnumber += \"0\"\r\n\t\telif string[i:i + 10] == number1:\r\n\t\t\tnumber += \"1\"\r\n\t\telif string[i:i + 10] == number2:\r\n\t\t\tnumber += \"2\"\r\n\t\telif string[i:i + 10] == number3:\r\n\t\t\tnumber += \"3\"\r\n\t\telif string[i:i + 10] == number4:\r\n\t\t\tnumber += \"4\"\r\n\t\telif string[i:i + 10] == number5:\r\n\t\t\tnumber += \"5\"\r\n\t\telif string[i:i + 10] == number6:\r\n\t\t\tnumber += \"6\"\r\n\t\telif string[i:i + 10] == number7:\r\n\t\t\tnumber += \"7\"\r\n\t\telif string[i:i + 10] == number8:\r\n\t\t\tnumber += \"8\"\r\n\t\telif string[i:i + 10] == number9:\r\n\t\t\tnumber += \"9\"\r\n\t\t\r\n\t\ti += 10\r\n\t\r\n\texcept IndexError:\r\n\t\tpass\r\n\r\nprint(number)", "s=input()\r\na,p=[],[]\r\nfor i in range(10):\r\n a.append(input())\r\nfor i in range(8):\r\n for j in range(10):\r\n sr=s[10*i:10*(i+1)]\r\n if sr==a[j]:\r\n p.append(j)\r\nprint(*p,sep='')", "password = input()\r\nnumbers = []\r\nfor i in range(10):\r\n numbers.append(input())\r\none = password[0:10]\r\ntwo = password[10:20]\r\nthree = password[20:30]\r\nfour = password[30:40]\r\nfive = password[40:50]\r\nsix = password[50:60]\r\nseven = password[60:70]\r\neight = password[70:80]\r\nprint(str(numbers.index(one)) + str(numbers.index(two)) + str(numbers.index(three)) + str(numbers.index(four)) + str(numbers.index(five)) + str(numbers.index(six)) + str(numbers.index(seven)) + str(numbers.index(eight)))\r\n", "import sys\r\nimport math\r\n\r\nst = sys.stdin.readline()\r\n\r\nd = dict()\r\nres = []\r\nfor i in range(10):\r\n t = sys.stdin.readline()\r\n d[t[:10]] = str(i)\r\n \r\nfor i in range(1, 9):\r\n res.append(d[st[(i * 10 - 10):(i * 10)]])\r\n \r\nprint(\"\".join(res))\r\n ", "t = input()\r\nl = []\r\nfor i in range(10):\r\n\tt1 = input()\r\n\tl.append(t1)\r\nfor i in range(10,90,10):\r\n\tfor j in range(len(l)):\r\n\t\tif t[i-10:i] == l[j]:\r\n\t\t\tprint(j,end=\"\")\r\n\t\t\tbreak\r\n", "binary = input()\ncodes = {}\n\nfor code in range(10):\n codes[input()] = code\n\nfor i in range(8):\n current = binary[i*10:i*10 + 10]\n print(codes[current], end=\"\")", "def main():\r\n p = input().strip()\r\n ns = dict()\r\n for i in range(10):\r\n ns[input().strip()] = i\r\n\r\n i = 0\r\n while i < len(p):\r\n print(ns[p[i:i+10]], end='')\r\n i += 10\r\n print()\r\n\r\n\r\nif __name__ == \"__main__\":\r\n main()\r\n\r\n\r\n", "s, lst = input(), [input() for x in range(10)]\r\nfor x in range(0, 80, 10):\r\n for i in range(10):\r\n if s[x:x + 10] == lst[i]: \r\n print(i, end = \"\")\r\n break", "password = input()\nx = dict()\nfor i in range(10):\n x[input()] = str(i)\nans = ''\nfor i in range(0,80,10):\n ans+= x[password[i:i+10]]\nprint(ans)\n", "s = input()\npasswd = \"\"\ndigit = []\nfor i in range(10):\n digit.append(input())\n\nfor i in range(8):\n num = s[i * 10: (i * 10) + 10 ]\n for j in range(10):\n if digit[j] == num:\n j = str(j)\n passwd = passwd + j\n break\nprint(passwd)", "s = input()\r\nd = {}\r\nfor i in range(10):\r\n d[input()] = str(i)\r\n\r\nret = \"\"\r\nfor i in range(0, len(s), 10):\r\n ret += d[s[i:i+10]]\r\nprint(ret)", "#https://codeforces.com/problemset/problem/94/A\nfrom textwrap import wrap\npw_hash = wrap(input().strip(),10)\npw_hash = list(map(lambda x : int(x,2),pw_hash))\ndecrypt_keys = []\nfor i in range(10):\n decrypt_keys.append(int(input().strip(),2))\n\npassword = ''\nfor c in pw_hash:\n password += str(decrypt_keys.index(c))\nprint(password)", "a=input()\r\nb=[]\r\nfor i in range(10):\r\n b+=[input()]\r\nc=''\r\nwhile a:\r\n d=a[:10]\r\n a=a[10:]\r\n c+=str(b.index(d))\r\nprint(c)\r\n" ]
{"inputs": ["01001100100101100000010110001001011001000101100110010110100001011010100101101100\n0100110000\n0100110010\n0101100000\n0101100010\n0101100100\n0101100110\n0101101000\n0101101010\n0101101100\n0101101110", "10101101111001000010100100011010101101110010110111011000100011011110010110001000\n1001000010\n1101111001\n1001000110\n1010110111\n0010110111\n1101001101\n1011000001\n1110010101\n1011011000\n0110001000", "00010101101110110101100110101100010101100010101111000101011010011010110010000011\n0101010110\n0001001101\n1001101011\n0000100011\n0010101111\n1110110101\n0001010110\n0110111000\n0000111110\n0010000011", "10100100010010010011011001101000100100110110011010011001101011000100110110011010\n1111110011\n1001000111\n1001000100\n1100010011\n0110011010\n0010000001\n1110101110\n0010000110\n0010010011\n1010010001", "00101100011111010001001000000110110000000110010011001111111010110010001011000000\n0010000001\n0110010011\n0010000010\n1011001000\n0011111110\n0110001000\n1111010001\n1011000000\n0000100110\n0010110001", "10001110111110000001000010001010001110110000100010100010111101101101010000100010\n0000010110\n1101010111\n1000101111\n0001011110\n0011110101\n0101100100\n0110110101\n0000100010\n1000111011\n1110000001", "10010100011001010001010101001101010100110100111011001010111100011001000010100000\n0011100000\n1001100100\n0001100100\n0010100000\n0101010011\n0010101110\n0010101111\n0100111011\n1001010001\n1111111110", "01101100111000000101011011001110000001011111111000111111100001011010001001011001\n1000000101\n0101101000\n0101110101\n1101011110\n0000101100\n1111111000\n0001001101\n0110111011\n0110110011\n1001011001", "11100011000100010110010011101010101010011110001100011010111110011000011010110111\n1110001100\n0110101111\n0100111010\n0101000000\n1001100001\n1010101001\n0000100010\n1010110111\n1100011100\n0100010110", "10000110110000010100000010001000111101110110101011110111000100001101000000100010\n0000010100\n0000110001\n0110101011\n1101110001\n1000011011\n0000110100\n0011110111\n1000110010\n0000100010\n0000011011", "01000000010000000110100101000110110000100100000001101100001000011111111001010001\n1011000010\n1111101010\n0111110011\n0000000110\n0000001001\n0001111111\n0110010010\n0100000001\n1011001000\n1001010001", "01111000111110011001110101110011110000111110010001101100110110100111101011001101\n1110010001\n1001100000\n1100001000\n1010011110\n1011001101\n0111100011\n1101011100\n1110011001\n1111000011\n0010000101", "01001100101000100010001011110001000101001001100010010000001001001100101001011111\n1001011111\n1110010111\n0111101011\n1000100010\n0011100101\n0100000010\n0010111100\n0100010100\n1001100010\n0100110010", "01110111110000111011101010110110101011010100110111000011101101110101011101001000\n0110000101\n1010101101\n1101010111\n1101011100\n0100110111\n0111011111\n1100011001\n0111010101\n0000111011\n1101001000", "11101001111100110101110011010100110011011110100111010110110011000111000011001101\n1100011100\n1100110101\n1011101000\n0011011110\n0011001101\n0100010001\n1110100111\n1010101100\n1110110100\n0101101100", "10101010001011010001001001011000100101100001011011101010101110101010001010101000\n0010110101\n1010011010\n1010101000\n1011010001\n1010101011\n0010010110\n0110100010\n1010100101\n0001011011\n0110100001", "11110101001100010000110100001110101011011111010100110001000001001010001001101111\n0101101100\n1001101111\n1010101101\n0100101000\n1111110000\n0101010010\n1100010000\n1111010100\n1101000011\n1011111111", "10001100110000110111100011001101111110110011110101000011011100001101110000110111\n0011110101\n0101100011\n1000110011\n1011011001\n0111111011\n0101111011\n0000110111\n0100001110\n1000000111\n0110110111", "10000100010000111101100100111101111011101000001001100001000110000010010000111101\n1001001111\n0000111101\n1000010001\n0110011101\n0110101000\n1011111001\n0111101110\n1000001001\n1101011111\n0001010100", "01101111000110111100011011110001101111001010001100101000110001010101100100000010\n1010001100\n0011010011\n0101010110\n1111001100\n1100011000\n0100101100\n1001100101\n0110111100\n0011001101\n0100000010", "10100111011010001011111000000111100000010101000011000010111101010000111010011101\n1010011101\n1010111111\n0110100110\n1111000100\n1110000001\n0000101111\n0011111000\n1000110001\n0101000011\n1010001011", "10000111111000011111001010101010010011111001001111000010010100100011000010001100\n1101101110\n1001001111\n0000100101\n1100111010\n0010101010\n1110000110\n1100111101\n0010001100\n1110000001\n1000011111", "10110110111011001111101100111100111111011011011011001111110110010011100010000111\n0111010011\n0111101100\n1001101010\n0101000101\n0010000111\n0011111101\n1011001111\n1101111000\n1011011011\n1001001110", "01001001100101100011110110111100000110001111001000100000110111110010000000011000\n0100100110\n1000001011\n1000111110\n0000011000\n0101100011\n1101101111\n1111001000\n1011011001\n1000001101\n0010101000", "10010100011101000011100100001100101111000010111100000010010000001001001101011101\n1001000011\n1101000011\n1001010001\n1101011101\n1000010110\n0011111101\n0010111100\n0000100100\n1010001000\n0101000110", "01111111110101111111011111111111010010000001100000101000100100111001011010001001\n0111111111\n0101111111\n0100101101\n0001100000\n0011000101\n0011100101\n1101001000\n0010111110\n1010001001\n1111000111", "00100011111001001010001111000011101000001110100000000100101011101000001001001010\n0010001111\n1001001010\n1010011001\n0011100111\n1000111000\n0011110000\n0000100010\n0001001010\n1111110111\n1110100000", "11011101000100110100110011010101100011111010011010010011010010010010100110101111\n0100110100\n1001001010\n0001111101\n1101011010\n1101110100\n1100110101\n0110101111\n0110001111\n0001101000\n1010011010", "10000010111101110110011000111110000011100110001111100100000111000011011000001011\n0111010100\n1010110110\n1000001110\n1110000100\n0110001111\n1101110110\n1100001101\n1000001011\n0000000101\n1001000001", "11101100101110111110111011111010001111111111000001001001000010001111111110110010\n0101100001\n1111010011\n1110111110\n0100110100\n1110011111\n1000111111\n0010010000\n1110110010\n0011000010\n1111000001", "01011110100101111010011000001001100000101001110011010111101011010000110110010101\n0100111100\n0101110011\n0101111010\n0110000010\n0101001111\n1101000011\n0110010101\n0111011010\n0001101110\n1001110011", "01100000100101111000100001100010000110000010100100100001100000110011101001110000\n0101111000\n1001110000\n0001000101\n0110110111\n0010100100\n1000011000\n1101110110\n0110000010\n0001011010\n0011001110", "11110011011000001001111100110101001000010100100000110011001110011111100100100001\n1010011000\n1111001101\n0100100001\n1111010011\n0100100000\n1001111110\n1010100111\n1000100111\n1000001001\n1100110011", "10001001011000100101010110011101011001110010000001010110000101000100101111101010\n0101100001\n1100001100\n1111101010\n1000100101\n0010000001\n0100010010\n0010110110\n0101100111\n0000001110\n1101001110", "00110010000111001001001100100010010111101011011110001011111100000101000100000001\n0100000001\n1011011110\n0010111111\n0111100111\n0100111001\n0000010100\n1001011110\n0111001001\n0100010011\n0011001000", "01101100001000110101101100101111101110010011010111100011010100010001101000110101\n1001101001\n1000110101\n0110110000\n0111100100\n0011010111\n1110111001\n0001000110\n0000000100\n0001101001\n1011001011", "10101110000011010110101011100000101101000110100000101101101101110101000011110010\n0110100000\n1011011011\n0011110010\n0001110110\n0010110100\n1100010010\n0001101011\n1010111000\n0011010110\n0111010100", "11000101011100100111010000010001000001001100101100000011000000001100000101011010\n1100010101\n1111101011\n0101011010\n0100000100\n1000110111\n1100100111\n1100101100\n0111001000\n0000110000\n0110011111", "11110100010000101110010110001000001011100101100010110011011011111110001100110110\n0101100010\n0100010001\n0000101110\n1100110110\n0101000101\n0011001011\n1111010001\n1000110010\n1111111000\n1010011111", "00011001111110000011101011010001010111100110100101000110011111011001100000001100\n0111001101\n0101011110\n0001100111\n1101011111\n1110000011\n0000001100\n0111010001\n1101100110\n1010110100\n0110100101", "10111110010011111001001111100101010111010011111001001110101000111110011001111101\n0011111001\n0101011101\n0100001010\n0001110010\n1001111101\n0011101010\n1111001001\n1100100001\n1001101000\n1011111001", "01111101111100101010001001011110111001110111110111011111011110110111111011011111\n1111110111\n0010000101\n0110000100\n0111111011\n1011100111\n1100101010\n1011011111\n1100010001\n0111110111\n0010010111", "01111100000111110000110010111001111100001001101010110010111010001000101001101010\n0100010101\n1011110101\n1010100100\n1010000001\n1001101010\n0101100110\n1000100010\n0111110000\n1100101110\n0110010110", "11100011010000000010011110010111001011111001000111000000001000000000100111100101\n0000000010\n1110001101\n0011010101\n0111100101\n1001000111\n1101001111\n0111010110\n1100101111\n0110000000\n1101101011", "01111011100111101110011001000110001111101000111110100100100001011111001011100010\n0110010100\n1100010001\n0111101110\n1001001000\n1010011011\n1000111110\n0010110101\n1011100010\n0101111100\n0110010001", "11011010001100000011000100110011010101000110011110110000001100111100001000011111\n0000100010\n1000011111\n1101101000\n0110011110\n0011110000\n1100000011\n0010001100\n0101101000\n0001001100\n1101010100", "01011001011111010010101111011001000011001100011101101111011011010011101011110110\n0100001100\n0101100101\n1111111011\n1111010010\n1111101100\n1100011101\n1011000011\n1101001110\n1011110110\n0110001010", "11110011011000111111001100111110001111111100000010111100110100110011111111001101\n1111001101\n1001101010\n1100110010\n0011001111\n0001011110\n1000110011\n1000111111\n0110001010\n1001011101\n1100000010", "01110011110010000011011001011000001000010110010110011001100001100110001100101000\n0000100001\n0110011000\n1010000010\n1110011101\n0111001111\n1100101000\n0010000011\n0110010000\n1100100101\n0110010110", "00001011001111110111111111011111111101110101110100010111010010100101100001010110\n1111110111\n0001010110\n0111011011\n0111000001\n1010010110\n0101110100\n0001000101\n0000111000\n0110100001\n0000101100"], "outputs": ["12345678", "30234919", "65264629", "98484434", "96071437", "89787267", "88447623", "80805519", "09250147", "40862358", "73907059", "57680434", "93678590", "58114879", "61146904", "23558422", "76827631", "26240666", "21067271", "77770029", "09448580", "99411277", "86658594", "04536863", "21066773", "01063858", "01599791", "40579016", "75424967", "72259657", "22339256", "70554591", "18124952", "33774052", "97961250", "21954161", "78740192", "05336882", "62020383", "24819275", "90010504", "85948866", "77874864", "10374003", "22955387", "25893541", "13805878", "06369030", "46909115", "90005541"]}
UNKNOWN
PYTHON3
CODEFORCES
254
0009291163ba4c4519b618bd57707c1b
Math Show
Polycarp takes part in a math show. He is given *n* tasks, each consists of *k* subtasks, numbered 1 through *k*. It takes him *t**j* minutes to solve the *j*-th subtask of any task. Thus, time required to solve a subtask depends only on its index, but not on the task itself. Polycarp can solve subtasks in any order. By solving subtask of arbitrary problem he earns one point. Thus, the number of points for task is equal to the number of solved subtasks in it. Moreover, if Polycarp completely solves the task (solves all *k* of its subtasks), he recieves one extra point. Thus, total number of points he recieves for the complete solution of the task is *k*<=+<=1. Polycarp has *M* minutes of time. What is the maximum number of points he can earn? The first line contains three integer numbers *n*, *k* and *M* (1<=≤<=*n*<=≤<=45, 1<=≤<=*k*<=≤<=45, 0<=≤<=*M*<=≤<=2·109). The second line contains *k* integer numbers, values *t**j* (1<=≤<=*t**j*<=≤<=1000000), where *t**j* is the time in minutes required to solve *j*-th subtask of any task. Print the maximum amount of points Polycarp can earn in *M* minutes. Sample Input 3 4 11 1 2 3 4 5 5 10 1 2 4 8 16 Sample Output 6 7
[ "n,k,M = [int(i) for i in input().split(' ')]\ntasks = [int(i) for i in input().split(' ')]\ntasks = sorted(tasks)\nans = 0\nfor i in range(n+1):\n remaining_time = M - i*sum(tasks)\n if(remaining_time < 0):\n break\n value = (k+1)*i\n for j in range(k):\n for take in range(n-i):\n if(remaining_time >= tasks[j]):\n value += 1\n remaining_time -= tasks[j]\n ans = max(ans,value)\nprint(ans)\n", "n, k, M = list(map(int, input().split()))\r\na = list(map(int, input().split()))\r\na.sort()\r\nsuma = sum(a)\r\nans = 0\r\nfor total in range(n + 1):\r\n m = M - suma * total\r\n if m < 0:\r\n break\r\n r = total * (k + 1)\r\n for x in a:\r\n solved = min((n-total), m // x)\r\n r += solved\r\n m -= solved * x\r\n ans = max(ans, r)\r\nprint(ans)", "n,k,M = map(int,input().split())\r\n\r\nT = sorted(map(int,input().split()))\r\n\r\nsT = sum(T)\r\n\r\ndef it(p):\r\n # pタスク完成させるノリ\r\n score = p*(k+1)\r\n m = M - p*sT\r\n\r\n if m < 0:\r\n return 0\r\n\r\n q = n-p\r\n\r\n for t in T:\r\n if m > q*t:\r\n m -= q*t\r\n score += q\r\n else:\r\n score += m//t\r\n break\r\n return score\r\n\r\nprint(max(it(i) for i in range(n+1)))", "from itertools import accumulate\r\nfrom bisect import *\r\nn, k, m = list(map(int, input().split()))\r\nt = sorted(map(int, input().split()))\r\n\r\nres = 0\r\ns = sum(t)\r\nps = list(accumulate(t))\r\nfor x in range(min(n, m//s)+1):\r\n rem = m - x*s\r\n if x < n:\r\n y = bisect_right(ps, rem/(n-x))\r\n rem -= (n-x)*(ps[y-1] if y>0 else 0)\r\n if y < k:\r\n z = rem // t[y]\r\n else:\r\n z = 0\r\n else:\r\n y = z = 0\r\n r = x*(k+1) + y*(n-x) + z + ((n-x) if y==k else 0) + (z if y == k-1 else 0)\r\n res = max(res, r)\r\nprint(res)", "##a = list(map(int, input().split()))\r\n##print(' '.join(map(str, res)))\r\n\r\n[n, k, M] = list(map(int, input().split()))\r\nt = list(map(int, input().split()))\r\nt.sort()\r\ntot = sum(t)\r\n\r\nres = 0\r\nfor x in range(n+1):\r\n need = x*tot \r\n if need <= M:\r\n cnt = x*(k+1)\r\n r = M-need\r\n j = 0\r\n while r > 0 and j < k:\r\n if t[j]*(n-x) <= r:\r\n cnt += n-x\r\n r -= t[j]*(n-x)\r\n j += 1\r\n else:\r\n cnt += r//t[j]\r\n r -= (r//t[j])*t[j]\r\n break\r\n res = max(res, cnt)\r\nprint(res)\r\n\r\n \r\n", "import sys\r\ninput = sys.stdin.readline\r\nsys.setrecursionlimit(100000)\r\nfrom collections import deque, defaultdict\r\np = print\r\nr = range\r\nde = defaultdict\r\ndef I(): return int(input())\r\ndef II(): return list(map(int, input().split()))\r\ndef S(): return input()[:-1]\r\ndef M(n): return [list(map(int, input().split())) for ___ in r(n)]\r\ndef pb(b): print('YES' if b else 'NO')\r\ndef INF(): return float('inf')\r\n# -----------------------------------------------------------------------------------------------------\r\n#\r\n#             ∧_∧\r\n#       ∧_∧   (´<_` )  Welcome to My Coding Space !\r\n#      ( ´_ゝ`) /  ⌒i Free Hong Kong !\r\n#     /   \    | | Free Tibet !\r\n#     /   / ̄ ̄ ̄ ̄/ |  |\r\n#   __(__ニつ/  _/ .| .|____\r\n#      \/____/ (u ⊃\r\n#\r\n# 再帰関数ですか? SYS!!!!\r\n# BINARY SEARCH ?\r\n# -----------------------------------------------------------------------------------------------------\r\nn, k, m = II()\r\na = sorted(II())\r\ntotal = sum(a)\r\nres = -1\r\nfor i in r(n+1):\r\n # i - fully solved questions\r\n t = m - total*i\r\n points = i*(k+1)\r\n if t < 0:\r\n break\r\n j = 0\r\n while t > 0:\r\n if j == k-1:\r\n break\r\n if t >= (n-i) * a[j]:\r\n t -= (n-i) * a[j]\r\n points += n-i\r\n j += 1\r\n else:\r\n points += (t//a[j])\r\n break\r\n res = max(res,points)\r\np(res)\r\n\r\n", "def solve(n, k, M, t):\n task_sum = sum(t)\n t = sorted(t) # will take from smaller subtasks\n\n all_points = []\n for tasks_completed in range(n + 1): # loop over tasks fully taken from 0 to N taken tasks\n minutes_spent_on_full_tasks = tasks_completed * task_sum\n if minutes_spent_on_full_tasks > M:\n break\n\n # k subtasks + 1 for each\n total_points = tasks_completed * k + tasks_completed\n remaining_time = M - minutes_spent_on_full_tasks\n\n for i in range(k): # loop over subtasks\n # try take all smaller subtasks from remaining unsolved tasks\n # don't count in fully completed tasks\n subtasks_left = n - tasks_completed\n smaller_subtasks_time = subtasks_left * t[i] # total \"weight\" of all left subtasks for given time group\n\n if (smaller_subtasks_time <= remaining_time): # can take entire set of subtasks with given weight\n remaining_time -= smaller_subtasks_time\n total_points += subtasks_left # simply add all subtasks of given t[i]\n else: # cannot take entire set, lets take at least \"tail\"\n total_points += remaining_time // t[i]\n break # not time left\n\n all_points += [total_points]\n return max(all_points)\n\n\n\n\n\n\n\n\ndef main():\n n, k, M = [int(x) for x in input().split(\" \")]\n t = [int(x) for x in input().split(\" \")]\n # n, k, M = 4, 2, 15\n # t = [1, 2, 4, 8, 16]\n # t = [1, 1, 1, 1]\n # t = [4, 1]\n res = solve(n, k, M, t)\n\n print(res)\n\n\nif __name__ == '__main__':\n main()\n", "large, n, m = map(int, input().split())\nnums = list(map(int, input().split()))\nnums.sort()\ns = sum(nums)\nans = 0\nfor cnt in range(0, large+1):\n result = 0\n minute = m\n if m<cnt*s:\n break\n result += cnt*n+cnt\n minute -= cnt*s\n if cnt==large:\n ans = result\n break\n for i in range(n):\n if minute >= nums[i]*(large-cnt):\n minute -= nums[i]*(large-cnt)\n result += large-cnt\n else:\n result += minute//nums[i]\n break\n ans = max(ans, result)\nprint(ans)\n\t\t \t \t \t \t \t \t \t\t\t \t\t\t\t", "from itertools import accumulate\r\nfrom bisect import *\r\nn, k, m = list(map(int, input().split()))\r\nt = sorted(map(int, input().split()))\r\n\r\nres = 0\r\nfor x in range(min(n, m//sum(t))+1):\r\n mm = m-x*sum(t); r = x*(k+1)\r\n for i, ti in enumerate(t):\r\n for _ in range(n-x):\r\n if mm>=ti:\r\n mm -= ti\r\n r += 1 if i < k-1 else 2\r\n res = max(res, r)\r\nprint(res)", "n,k,M=map(int,input().split())\r\nt=[int(c) for c in input().split()]\r\nt.sort()\r\nres=0\r\ns=sum(t)\r\nfor to in range(n+1):\r\n m=M-(to*s)\r\n if m<0:\r\n break\r\n r=(k+1)*to\r\n for i in t:\r\n r+=min(n-to,m//(i))\r\n m-=(min(n-to,m//(i)))*i\r\n res=max(res,r)\r\nprint(res)\r\n", "n , k, M = [int(i) for i in input().split()]\r\nb = [int(i) for i in input().split()]\r\nb.sort()\r\nsuma = sum(b)\r\nans = 0\r\nfor total in range(n + 1):\r\n m = M - total * suma\r\n if m < 0:\r\n break\r\n r = (k + 1) * total\r\n for x in b:\r\n sol = min((n - total), m //x)\r\n r += sol\r\n m -= sol * x\r\n ans = max(ans, r)\r\nprint(ans)", "n, k, m = map(int, input().split())\r\n\r\nnums = list(map(int, input().split()))\r\n\r\nresult = -1\r\n\r\nalltime = sum(nums)\r\n\r\nfor made in range(n + 1):\r\n if(alltime * made > m):\r\n break\r\n currentres = (k + 1) * made\r\n currenttime = m - made * alltime\r\n available = []\r\n for item in nums:\r\n available.extend([item]*(n - made))\r\n available = sorted(available)\r\n for item in available:\r\n if(currenttime < item):\r\n break\r\n currenttime -= item\r\n currentres += 1\r\n result = max(result, currentres)\r\n\r\nprint(result)\r\n", "n, k, m = list(map(int, input().split()))\r\nt = sorted(map(int, input().split()))\r\n\r\nres = 0\r\nfor i in range(n+1):\r\n rem = m - i*sum(t)\r\n if rem < 0: break\r\n r = i*(k+1)\r\n for j in range(k):\r\n d = min(rem//t[j], n-i)\r\n rem -= d*t[j]\r\n r += d\r\n res = max(res, r)\r\n\r\nprint(res)", "n, k, m = list(map(int, input().split()))\r\nt = sorted(map(int, input().split()))\r\nres = 0\r\nfor i in range(n+1):\r\n rt = m-i*sum(t)\r\n r = i*(k+1)\r\n if (rt < 0): break\r\n for j in range(k):\r\n div = min(rt//t[j], n-i)\r\n rt -= div*t[j]\r\n r += div\r\n res = max(res, r)\r\nprint(res)", "import sys\r\n\r\nn, k, m = map(int, input().split())\r\na = list(map(int, input().split()))\r\ntotal = sum(a)\r\n\r\nif n * total <= m:\r\n print(n*(k+1))\r\n exit()\r\n\r\nans = 0\r\n\r\nfor complete in range(n):\r\n if complete*total > m:\r\n break\r\n\r\n items = a * (n - complete)\r\n dp = [-1]*(len(items)+1)\r\n dp[0] = m - complete * total\r\n\r\n for x in items:\r\n for i in range(len(items)-1, -1, -1):\r\n dp[i+1] = max(dp[i+1], dp[i]-x)\r\n\r\n for i in range(len(items), -1, -1):\r\n if dp[i] >= 0:\r\n ans = max(ans, i + complete * (k+1))\r\n break\r\n\r\nprint(ans)\r\n", "n,k, M = map(int,input().split())\ntime_list = sorted(list(map(int,input().split())))\nsum1 = sum(time_list)\ntries_list = []\nfor i in range(n+1):\n m = M\n c = 0\n for j in range(i):\n if m - sum1 >= 0:\n m -= sum1\n c += k + 1\n else:\n break\n for j in range(k):\n for _ in range(n-i):\n if m - time_list[j] >= 0:\n m -= time_list[j]\n c += 1\n else:\n break\n tries_list.append(c)\nprint(max(tries_list)) \n ", "n, k, M = list(map(int, input().strip().split()))\r\na = list(map(int, input().strip().split()))\r\na.sort()\r\n\r\nrimasto = []\r\npunteggio = []\r\n\r\ns = sum(a)\r\n\r\nfor i in range(n+1):\r\n if i * s <= M:\r\n rimasto.append(M - i*s)\r\n punteggio.append(i*(k+1))\r\n\r\nfor i in range(len(rimasto)):\r\n t = rimasto[i]\r\n task = 0\r\n while t > 0 and task < k:\r\n j = t // a[task]\r\n j = min(j, n-i)\r\n t = t - j * a[task]\r\n punteggio[i] += j\r\n task += 1\r\nprint(max(punteggio))", "n,k,m=map(int,input().split())\r\nt=list(map(int,input().split()))\r\nt.sort()\r\ns=[]\r\nfor i in range(min(m//sum(t)+1,n)):\r\n y=m\r\n x=i*(k+1)\r\n y-=i*sum(t)\r\n f=n-i\r\n for j in range(k-1):\r\n x+=min(f,y//t[j])\r\n y-=min(f,y//t[j])*t[j]\r\n x+=2*(min(f,y//t[k-1]))\r\n y-=min(f,y//t[k-1])*t[k-1]\r\n s.append(x)\r\nprint(max(s))", "n, k, m = [int(i) for i in input().split()]\r\na = [int(i) for i in input().split()]\r\na.sort()\r\nans = 0\r\nsm = sum(a)\r\nans = 0\r\nfor i in range(min(n, m // sm) + 1):\r\n ansn = (k + 1) * i\r\n tm = m - i * sm\r\n for j in range(k):\r\n q = min(n - i, max(0, tm // a[j]))\r\n ansn += q\r\n tm -= q * a[j]\r\n ans = max(ansn, ans)\r\nprint(ans)", "n, k, M = map(int, input().split())\r\nscore = sorted([int(x) for x in input().split()])\r\ns = sum(score); ans = 0\r\n\r\nfor i in range(n + 1):\r\n m = M - s*i\r\n if m < 0: break\r\n r = (k + 1) * i\r\n for x in score:\r\n solved = min(n - i, m // x)\r\n r += solved\r\n m -= solved * x\r\n ans = max(ans, r)\r\nprint(ans)\r\n", "\r\ndef solve(n, k, M, t):\r\n '''\r\n >>> solve(3, 4, 11, [1, 2, 3, 4])\r\n 6\r\n >>> solve(5, 5, 10, [1, 2, 4, 8, 16])\r\n 7\r\n >>> solve(3, 2, 4, [1, 1])\r\n 6\r\n >>> solve(5, 2, 10, [2, 3])\r\n 6\r\n '''\r\n t.sort()\r\n k = len(t)\r\n\r\n T = sum(t)\r\n\r\n max_score = 0\r\n\r\n for fully_solved in range(min(n, M // T) + 1):\r\n # Try to fully solve fully_solved problems, remainder is for remaining subproblems\r\n score_1 = fully_solved * (k + 1) # For fully solved\r\n\r\n score_2 = 0 # For partially solved\r\n remaining_time = M - T * fully_solved\r\n remaining_problems = n - fully_solved\r\n\r\n if remaining_problems > 0:\r\n level = 0\r\n while level < k:\r\n # remaining_time > 0 and level < k:\r\n level_coeff = 1 if level + 1 < k else 2 # last_level\r\n time_to_solve_level = t[level] * remaining_problems\r\n if time_to_solve_level <= remaining_time:\r\n score_2 += remaining_problems * level_coeff\r\n remaining_time -= time_to_solve_level\r\n else:\r\n score_2 += (remaining_time // t[level]) * level_coeff\r\n break\r\n level += 1\r\n score = score_1 + score_2\r\n max_score = max(score, max_score)\r\n\r\n return max_score\r\n\r\n\r\n\r\ndef main():\r\n n, k, M = map(int, input().split())\r\n t = list(map(int, input().split()))\r\n print(solve(n, k, M, t))\r\n\r\n\r\nif __name__ == '__main__':\r\n main()\r\n\r\n", "n, k, M = map(int, input().split())\nt = sorted(map(int, input().split()))\n\ndef calc(x):\n tot = x * sum(t)\n if tot > M:\n return 0\n tans = x * (k + 1)\n for i in range(k - 1):\n if t[i] * (n - x) + tot <= M:\n tot += t[i] * (n - x)\n tans += n - x\n else:\n tans += (M - tot) // t[i]\n break\n return tans\n\nprint(max([calc(x) for x in range(n + 1)]))\n", "# import sys\n# sys.stdin = open('in', 'r')\n\nn, k, m = map(int, input().split())\ntt = list(map(int, input().split()))\ntt.sort()\n\ns = sum(tt)\nans = 0\n\n\ndef check(x, m):\n ret = (k+1) * x\n m -= s * x\n if m < 0:\n return -1\n\n for i in range(k):\n if tt[i]*(n-x) <= m:\n m -= tt[i]*(n-x)\n ret += (n-x)\n else:\n ret += m//tt[i]\n m -= (m//tt[i])*tt[i]\n if m <= 0:\n break\n return ret\n\n\nfor i in range(n+1):\n ans = max(ans, check(i, m))\nprint(ans)\n", "\nn,k,m = map(int,input().split())\nl = list(map(int,input().split()))\nl.sort()\nsm = sum(l)\nans = 0\nfor i in range(n+1):\n\tif sm*i > m:\n\t\tbreak\n\tm1 = m-sm*i\n\tcnt = [n-i]*(k)\n\tcur = 0\n\tres = (k+1)*i\n\twhile m1 > 0:\n\t\tif cur >= k or l[cur] > m1:\n\t\t\tbreak\n\t\tx = min(m1//l[cur],cnt[cur])\n\t\tres += x\n\t\tm1 -= x*l[cur]\n\t\tcur += 1\n\tans = max(res,ans)\nprint(ans)", "n,k, M = map(int, input().split())\r\nT = list(map(int, input().split()))\r\nans = 0\r\ns = sum(T)\r\nfor i in range(0, n+1):\r\n total = s*i\r\n if total > M:\r\n break\r\n temp = (k+1)*i\r\n X = []\r\n for t in T:\r\n X += [t]*(n-i)\r\n X.sort()\r\n for t in X:\r\n if total+t <= M:\r\n temp += 1\r\n total += t\r\n else:\r\n break\r\n ans = max(ans, temp)\r\nprint(ans)\r\n", "import sys\ninput = sys.stdin.readline\nfrom collections import defaultdict\n\nn, k, m = map(int, input().split())\nl = list(map(int, input().split()))\ns = sum(l)\nans = 0\nfor x in range(n + 1):\n\tleft = m - s * x\n\tif left < 0:\n\t\tcontinue\n\telse:\n\t\ttemp = (k + 1) * x\n\t\tt = sorted(l * (n - x))\n\t\tz = len(t)\n\t\ti = 0\n\t\twhile (i < z):\n\t\t\tcur = t[i]\n\t\t\tif left >= cur:\n\t\t\t\tleft -= cur\n\t\t\t\ttemp += 1\n\t\t\t\ti += 1\n\t\t\telse:\n\t\t\t\tbreak\n\t\tans = max(ans, temp)\nprint(ans)", "n, k, m = list(map(int, input().split()))\r\nt = sorted(map(int, input().split()))\r\ns = sum(t)\r\nres = 0\r\nfor x in range(min(m//s, n)+1):\r\n rem = m - x*s;\r\n r = x*(k+1)\r\n for i in range(k):\r\n d = min(rem//t[i], n-x)\r\n rem -= d*t[i]\r\n r += d\r\n res = max(res, r)\r\nprint(res)", "n,k,M=map(int,input().split())\r\na=list(map(int,input().split()))\r\na.sort()\r\nans=0\r\nsumma=sum(a)\r\nfor total in range(n+1):\r\n m=M-total*summa\r\n if m<0:\r\n break\r\n r=(k+1)*total\r\n for x in a:\r\n solved=min((n-total),m//x)\r\n r+=solved\r\n m-=solved*x\r\n ans=max(ans,r)\r\nprint(ans)\r\n", "n,k,m=map(int,input().split())\r\nlst=list(map(int,input().split()))\r\nl=[]\r\ns=sum(lst)\r\nlst.sort()\r\ng=n\r\nh=m\r\nfor r in range(g+1):\r\n ans=0\r\n m=h\r\n \r\n n=g-r\r\n if s*r<=m:\r\n \r\n ans+=(k+1)*r\r\n #print(k,r,ans)\r\n m=m-s*r\r\n c=0\r\n while 1:\r\n if c>=k:\r\n break\r\n t=m//lst[c]\r\n #print(\"t=\",t,r,m)\r\n if t<=0:\r\n break\r\n #print(r)\r\n if(t>n):\r\n m=m-n*lst[c];\r\n ans+=n\r\n else:\r\n m=m-t*lst[c]\r\n ans+=t\r\n c+=1\r\n #print(r,ans)\r\n l.append(ans)\r\n else:\r\n #print(r*s,m,\"fgd\")\r\n break\r\nprint(max(l))", "from functools import reduce\r\nn,k,m = map(int, input().split())\r\nt = list(map(int, input().split()))\r\nt.sort()\r\nsum = reduce(lambda x,y: x+y, t)\r\nmx = 0\r\nfull = 0\r\nwhile full <= n and full*sum <= m:\r\n\tcnt = full*k + full\r\n\tfree_time = m - sum*full\r\n\tfor time in t:\r\n\t\ttasks = min(n - full, free_time // time) \r\n\t\tcnt += tasks\r\n\t\tfree_time -= tasks*time\r\n\tmx = max(mx, cnt)\r\n\tfull += 1\r\nprint(mx)\t\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n", "n,k,m = list(map(int,input().split()))\nt = list(map(int,input().split()))\nt.sort()\ns = sum(t)\nmmm = 0\nfor i in range(n+1):\n if i*s > m : break\n tm = m-i*s\n c = k*i+i\n for j in range(k):\n c+=min(tm//t[j],n-i)\n tm-=min(tm//t[j],n-i)*t[j]\n mmm = max(mmm,c)\nprint(mmm)", "n, k, m = list(map(int, input().split()))\r\na = list(map(int, input().split()))\r\na.sort()\r\nsum_row = 0\r\nfor elem in a:\r\n sum_row += elem\r\nmax_ans = 0\r\nfor i in range(min(n + 1, m // sum_row + 1)):\r\n ans = i * (k + 1)\r\n m1 = m - sum_row * i\r\n for j in range(k):\r\n t = (n - i) * a[j]\r\n if t <= m1:\r\n m1 -= t\r\n ans += (n - i)\r\n else:\r\n ans += m1 // a[j]\r\n break\r\n max_ans = max(max_ans, ans)\r\nprint(max_ans)\r\n", "f = lambda: map(int, input().split())\r\nn, k, m = f()\r\np = sorted(f())\r\nx = 0\r\ns = sum(p)\r\nfor j in range(n + 1):\r\n t = m - j * s\r\n if t < 0: break\r\n y = k * j + j\r\n for i in p:\r\n d = min(n - j, t // i)\r\n y += d\r\n t -= d * i\r\n x = max(x, y)\r\nprint(x)", "n, k, M = map(int, input().split())\r\nt = sorted(list(map(int, input().split())))\r\npt = t[:]\r\nfor i in range(1, k):\r\n pt[i] += pt[i - 1]\r\nans, r = 0, k - 1\r\nfor i in range(0, n + 1):\r\n if pt[-1] * i > M:\r\n break\r\n m = M - pt[-1] * i\r\n while r != -1 and pt[r] * (n - i) > m:\r\n r -= 1\r\n m -= (0 if r == -1 else pt[r] * (n - i))\r\n ans = max(ans, i * (k + 1) + (r + 1) * (n - i) + (m // t[r + 1] if r < k - 1 else 0))\r\nprint(ans)", "n, k, m = list(map(int, input().split()))\r\nt = sorted(map(int, input().split()))\r\nres = 0\r\nfor x in range(min(m//sum(t),n)+1):\r\n rem = m - x*sum(t)\r\n r = x*(k+1)\r\n for i in range(k):\r\n div = min(rem//t[i], n-x) \r\n rem -= div*t[i]\r\n r += div\r\n res = max(res, r)\r\nprint(res)", "n, k, M = map(int, input().split())\r\nt = list(map(int, input().split()))\r\nt.sort()\r\nS = sum(t[j] for j in range(k))\r\nans = 0\r\nfor i in range(n + 1):\r\n if i * S > M:\r\n break\r\n else:\r\n p = (k + 1) * i\r\n R = M - i * S\r\n for j in range(k):\r\n if R < t[j]:\r\n break\r\n else:\r\n q = min(n - i, R // t[j])\r\n R -= q * t[j]\r\n p += q\r\n ans = max(ans, p)\r\nprint(ans)", "n, k, m = [int(x) for x in input().split()]\r\na = sorted([int(x) for x in input().split()])\r\net = sum(a)\r\nes = k + 1\r\nans = []\r\nfor i in range(n + 1):\r\n ts = es * i\r\n ht = m - et * i\r\n if ht < 0:\r\n break\r\n for p in a:\r\n s = min(ht // p, n - i)\r\n ht -= s * p\r\n ts += s\r\n ans.append(ts)\r\nans.sort()\r\nprint(ans[-1])" ]
{"inputs": ["3 4 11\n1 2 3 4", "5 5 10\n1 2 4 8 16", "1 1 0\n2", "1 1 1\n1", "2 1 0\n2", "2 2 2\n2 3", "4 2 15\n1 4", "24 42 126319796\n318996 157487 174813 189765 259136 406743 138997 377982 244813 16862 95438 346702 454882 274633 67361 387756 61951 448901 427272 288847 316578 416035 56608 211390 187241 191538 299856 294995 442139 95784 410894 439744 455044 301002 196932 352004 343622 73438 325186 295727 21130 32856", "5 3 10\n1 3 6", "5 3 50\n1 3 6", "5 3 2000000000\n1 3 6", "5 3 49\n1 3 6", "3 4 16\n1 2 3 4", "11 2 20\n1 9", "11 3 38\n1 9 9", "5 3 11\n1 1 2", "5 4 36\n1 3 7 7", "1 13 878179\n103865 43598 180009 528483 409585 449955 368163 381135 713512 645876 241515 20336 572091", "1 9 262522\n500878 36121 420012 341288 139726 362770 462113 261122 394426", "45 32 252252766\n282963 74899 446159 159106 469932 288063 297289 501442 241341 240108 470371 316076 159136 72720 37365 108455 82789 529789 303825 392553 153053 389577 327929 277446 505280 494678 159006 505007 328366 460640 18354 313300", "44 41 93891122\n447 314862 48587 198466 73450 166523 247421 50078 14115 229926 11070 53089 73041 156924 200782 53225 290967 219349 119034 88726 255048 59778 287298 152539 55104 170525 135722 111341 279873 168400 267489 157697 188015 94306 231121 304553 27684 46144 127122 166022 150941", "12 45 2290987\n50912 189025 5162 252398 298767 154151 164139 185891 121047 227693 93549 284244 312843 313833 285436 131672 135248 324541 194905 205729 241315 32044 131902 305884 263 27717 173077 81428 285684 66470 220938 282471 234921 316283 30485 244283 170631 224579 72899 87066 6727 161661 40556 89162 314616", "42 9 4354122\n47443 52983 104606 84278 5720 55971 100555 90845 91972", "45 28 33631968\n5905 17124 64898 40912 75855 53868 27056 18284 63975 51975 27182 94373 52477 260 87551 50223 73798 77430 17510 15226 6269 43301 39592 27043 15546 60047 83400 63983", "18 3 36895\n877 2054 4051", "13 30 357\n427 117 52 140 162 58 5 149 438 327 103 357 202 1 148 238 442 200 438 97 414 301 224 166 254 322 378 422 90 312", "44 11 136\n77 38 12 71 81 15 66 47 29 22 71", "32 6 635\n3 4 2 1 7 7", "30 19 420\n2 2 1 2 2 1 1 2 1 2 2 2 1 2 2 2 2 1 2", "37 40 116\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1", "7 37 133\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1", "40 1 8\n3", "1 28 1\n3 3 2 2 1 1 3 1 1 2 2 1 1 3 3 1 1 1 1 1 3 1 3 3 3 2 2 3", "12 1 710092\n145588", "1 7 47793\n72277 45271 85507 39251 45440 101022 105165", "1 1 0\n4", "1 2 3\n2 2", "1 1 0\n5", "1 1 3\n5", "1 3 0\n6 3 4", "1 2 0\n1 2", "1 1 3\n5", "1 1 0\n5", "2 2 3\n7 2", "2 4 5\n1 2 8 6", "2 1 0\n3", "1 3 3\n16 4 5", "2 1 0\n1", "3 2 2\n6 1", "3 2 1\n1 1", "1 3 19\n12 15 6", "2 2 8\n12 1", "1 6 14\n15 2 6 13 14 4", "4 1 0\n1", "1 1 0\n2", "1 1 0\n2", "2 2 5\n5 6", "1 3 8\n5 4 4", "1 5 44\n2 19 18 6 8", "1 1 0\n4", "3 2 7\n5 1", "4 2 9\n8 6", "4 3 3\n6 12 7", "4 1 2\n1", "2 4 15\n8 3 7 8", "6 1 2\n4", "2 1 1\n1", "1 1 2\n3", "2 2 2\n1 4", "6 2 78\n12 10", "1 3 10\n17 22 15", "6 3 13\n1 2 3", "21 3 26\n1 2 3", "3 7 20012\n1 1 1 1 1 1 10000", "5 4 40\n4 2 3 3", "4 5 40\n4 1 3 2 4", "3 5 22\n1 1 4 1 1", "5 2 17\n3 4", "5 4 32\n4 2 1 1", "5 5 34\n4 1 1 2 4", "3 3 15\n1 2 1", "3 2 11\n1 2", "5 4 11\n2 1 3 4", "45 45 2000000000\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"], "outputs": ["6", "7", "0", "2", "0", "1", "9", "677", "6", "20", "20", "18", "9", "13", "15", "11", "13", "5", "2", "1094", "1084", "95", "124", "979", "28", "31", "11", "195", "309", "118", "136", "4", "1", "8", "1", "0", "1", "0", "0", "0", "0", "0", "0", "1", "3", "0", "0", "0", "2", "1", "2", "2", "3", "0", "0", "0", "1", "2", "4", "0", "4", "1", "0", "4", "3", "0", "2", "0", "2", "10", "0", "10", "24", "20", "17", "18", "16", "7", "21", "20", "12", "9", "8", "2070"]}
UNKNOWN
PYTHON3
CODEFORCES
37
00116124170d507613516798746290b0
A Lot of Games
Andrew, Fedor and Alex are inventive guys. Now they invent the game with strings for two players. Given a group of *n* non-empty strings. During the game two players build the word together, initially the word is empty. The players move in turns. On his step player must add a single letter in the end of the word, the resulting word must be prefix of at least one string from the group. A player loses if he cannot move. Andrew and Alex decided to play this game *k* times. The player who is the loser of the *i*-th game makes the first move in the (*i*<=+<=1)-th game. Guys decided that the winner of all games is the player who wins the last (*k*-th) game. Andrew and Alex already started the game. Fedor wants to know who wins the game if both players will play optimally. Help him. The first line contains two integers, *n* and *k* (1<=≤<=*n*<=≤<=105; 1<=≤<=*k*<=≤<=109). Each of the next *n* lines contains a single non-empty string from the given group. The total length of all strings from the group doesn't exceed 105. Each string of the group consists only of lowercase English letters. If the player who moves first wins, print "First", otherwise print "Second" (without the quotes). Sample Input 2 3 a b 3 1 a b c 1 2 ab Sample Output First First Second
[ "max_alpha = 26\r\n\r\nclass TrieNode:\r\n def __init__(self):\r\n self.children = [0] * max_alpha\r\n\r\ndef add_trie(root, word):\r\n v = root\r\n for char in word:\r\n c = ord(char) - ord('a')\r\n if not v.children[c]:\r\n v.children[c] = TrieNode()\r\n v = v.children[c]\r\n\r\ndef dfs(v):\r\n v.win = False\r\n v.lose = False\r\n is_leaf = True\r\n \r\n for i in range(max_alpha):\r\n if v.children[i]:\r\n is_leaf = False\r\n to = v.children[i]\r\n dfs(to)\r\n v.win |= not to.win\r\n v.lose |= not to.lose\r\n \r\n if is_leaf:\r\n v.lose = True\r\n\r\nclass TrieNode:\r\n def __init__(self):\r\n self.children = [0] * max_alpha\r\n self.win = False\r\n self.lose = False\r\n\r\ndef answer(res):\r\n print(\"First\" if res else \"Second\")\r\n exit(0)\r\n\r\nn, k = map(int, input().split())\r\nroot = TrieNode()\r\n\r\nfor _ in range(n):\r\n word = input().strip()\r\n add_trie(root, word)\r\n\r\ndfs(root)\r\n\r\nif k == 1:\r\n answer(root.win)\r\nelif not root.win:\r\n answer(root.win)\r\nelif root.lose:\r\n answer(root.win)\r\nelif k % 2 == 1:\r\n answer(root.win)\r\nelse:\r\n answer(not root.win)\r\n", "# LUOGU_RID: 132709230\n# pypy3\r\nfrom collections import *\r\nfrom itertools import *\r\nfrom functools import *\r\nfrom bisect import *\r\nfrom heapq import *\r\nimport sys\r\n\r\nfrom math import gcd\r\n\r\nIN = lambda: sys.stdin.readline().rstrip(\"\\r\\n\")\r\nPN = lambda x: sys.stdout.write(x)\r\nI = lambda: int(IN())\r\nS = lambda: IN().split()\r\nM = lambda: map(int, IN().split())\r\nL = lambda: list(map(int, IN().split()))\r\nG = lambda: map(lambda x: int(x) - 1, IN().split())\r\n\r\ntr = [[0 for i in range(26)] for _ in range(100010)]\r\nson = [0 for i in range(100010)]\r\nidx = 0\r\n\r\n\r\ndef ins(s):\r\n p = 0\r\n global idx\r\n for c in s:\r\n u = ord(c) - ord('a')\r\n if tr[p][u] == 0:\r\n idx += 1\r\n tr[p][u] = idx\r\n son[p] += 1\r\n p = tr[p][u]\r\n\r\n\r\nn, k = M()\r\nfor _ in range(n):\r\n ins(IN())\r\n\r\n\r\ndef win(p):\r\n for i in range(26):\r\n if tr[p][i] != 0 and not win(tr[p][i]):\r\n return True\r\n return False\r\n\r\n\r\ndef lose(p):\r\n for i in range(26):\r\n if tr[p][i] != 0 and not lose(tr[p][i]):\r\n return True\r\n if son[p] == 0:\r\n return True\r\n return False\r\n\r\n\r\nf, g = win(0), lose(0)\r\n\r\n\r\nif f:\r\n if g:\r\n print(\"First\")\r\n else:\r\n print(\"First\" if k % 2 == 1 else \"Second\")\r\nelse:\r\n print(\"Second\")\r\n" ]
{"inputs": ["2 3\na\nb", "3 1\na\nb\nc", "1 2\nab", "5 6\nabas\ndsfdf\nabacaba\ndartsidius\nkolobok", "4 2\naaaa\nbbbb\nccccc\ndumbavumba", "3 8\nso\nbad\ntest", "5 2\nwelcome\nto\nthe\nmatrix\nneo", "6 4\ndog\ncat\ncow\nhot\nice\nlol", "4 8\nla\na\nz\nka", "3 2\nop\nhop\ncop", "3 3\nabasdfabab\nabaaasdfdsf\nasdfaba", "2 2\naba\naa", "4 1\naa\naba\nba\nbba", "1 3\nab", "3 3\naa\nabb\ncc"], "outputs": ["First", "First", "Second", "Second", "First", "First", "First", "Second", "First", "First", "Second", "Second", "Second", "Second", "Second"]}
UNKNOWN
PYTHON3
CODEFORCES
2
0016836ae943bbac4c1846a047051d30
Perfect Number
"We consider a positive integer perfect, if and only if the sum of its digits is exactly $10$. Given(...TRUNCATED)
["k=int(input())\r\na=10\r\nwhile k!=0:\r\n a+=9\r\n s=sum(list(map(int,str(a))))\r\n # pri(...TRUNCATED)
"{\"inputs\": [\"1\", \"2\", \"13\", \"101\", \"1023\", \"9999\", \"10000\", \"2333\", \"9139\", \"9(...TRUNCATED)
UNKNOWN
PYTHON3
CODEFORCES
159
0019608f1af8cd1d0015e58a30bead95
Wrong Floyd
"Valera conducts experiments with algorithms that search for shortest paths. He has recently studied(...TRUNCATED)
["n,m,k=map(int,input().split())\r\nif k==n or m>(n-1)*(n-2)//2+n-k:print(-1)\r\nelse:\r\n\tbn=[int((...TRUNCATED)
"{\"inputs\": [\"3 2 2\\n1 2\", \"3 3 2\\n1 2\", \"300 43056 2\\n5 6\", \"300 44849 2\\n1 300\", \"3(...TRUNCATED)
UNKNOWN
PYTHON3
CODEFORCES
2
003925cb042a4e23c8a1ae7ed2d3c676
Golden System
"Piegirl got bored with binary, decimal and other integer based counting systems. Recently she disco(...TRUNCATED)
["def clean(d):\n ans = ['0']\n for c in list(d):\n ans.append(c)\n i = len(ans)(...TRUNCATED)
"{\"inputs\": [\"1000\\n111\", \"00100\\n11\", \"110\\n101\", \"0\\n0\", \"1\\n10\", \"11\\n10\", \"(...TRUNCATED)
UNKNOWN
PYTHON3
CODEFORCES
4
004052b4221db9fe863f7c0c314178ad
Simple Cycles Edges
"You are given an undirected graph, consisting of $n$ vertices and $m$ edges. The graph does not nec(...TRUNCATED)
["import sys\r\n\r\ndef solve():\r\n\tn, m = map(int, input().split())\r\n\tg = [[] for i in range(n(...TRUNCATED)
"{\"inputs\": [\"3 3\\n1 2\\n2 3\\n3 1\", \"6 7\\n2 3\\n3 4\\n4 2\\n1 2\\n1 5\\n5 6\\n6 1\", \"5 6\\(...TRUNCATED)
UNKNOWN
PYTHON3
CODEFORCES
1
00a6789db72f25421f52cf4aa40e1f80
Vitya and Strange Lesson
"Today at the lesson Vitya learned a very interesting function — mex. Mex of a sequence of number(...TRUNCATED)
["import os\r\nimport sys\r\nfrom io import BytesIO, IOBase\r\n\r\nBUFSIZE = 8192\r\n\r\n\r\nclass F(...TRUNCATED)
"{\"inputs\": [\"2 2\\n1 3\\n1\\n3\", \"4 3\\n0 1 5 6\\n1\\n2\\n4\", \"5 4\\n0 1 5 6 7\\n1\\n1\\n4\\(...TRUNCATED)
UNKNOWN
PYTHON3
CODEFORCES
2
00aa51e739d4197c4766ec0104225460
Laptops
"One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the (...TRUNCATED)
["def solve():\r\n x = int(input())\r\n l = []\r\n for i in range(x):\r\n a, b = map(...TRUNCATED)
"{\"inputs\": [\"2\\n1 2\\n2 1\", \"2\\n1 1\\n2 2\", \"3\\n2 2\\n3 3\\n1 1\", \"3\\n3 3\\n1 2\\n2 1\(...TRUNCATED)
UNKNOWN
PYTHON3
CODEFORCES
300
00d009aca003c86e98034a2626d72d5a
Increase and Decrease
"Polycarpus has an array, consisting of *n* integers *a*1,<=*a*2,<=...,<=*a**n*. Polycarpus likes it(...TRUNCATED)
["n = int(input())\r\narr = [int(i) for i in input().split()]\r\nif sum(arr)%n ==0: print(n)\r\nelse(...TRUNCATED)
"{\"inputs\": [\"2\\n2 1\", \"3\\n1 4 1\", \"4\\n2 -7 -2 -6\", \"4\\n2 0 -2 -1\", \"6\\n-1 1 0 0 -1 (...TRUNCATED)
UNKNOWN
PYTHON3
CODEFORCES
196
README.md exists but content is empty.
Downloads last month
39