problem_id stringlengths 6 6 | user_id stringlengths 10 10 | time_limit float64 1k 8k | memory_limit float64 262k 1.05M | problem_description stringlengths 48 1.55k | codes stringlengths 35 98.9k | status stringlengths 28 1.7k | submission_ids stringlengths 28 1.41k | memories stringlengths 13 808 | cpu_times stringlengths 11 610 | code_sizes stringlengths 7 505 |
|---|---|---|---|---|---|---|---|---|---|---|
p02702 | u597455618 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['import sys\n\ns = str(sys.stdin.buffer.readline().rstrip())\nc = [2019*i for i in range(1, 100)]\nans = 0\n\nfor i in range(99):\n if str(c[i]) in s:\n ans += s.count(str(c[i]))\n\nprint(ans)', 'import re\nimport sys\n\ns = sys.stdin.buffer.readline().rstrip().decode()\nans = 0\n\nfor i in range(len(s) - 3)... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s380111478', 's625280864', 's928899318'] | [8948.0, 10156.0, 9344.0] | [51.0, 30.0, 104.0] | [191, 209, 244] |
p02702 | u597622207 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['s = input()\nresult = 0\n\nfor i in range(int(s)//2019):\n b = (i+1) * 2019\n result += s.count(str(b))\n\nprint(result)', 's = input()[::-1]\n\n\ncnts = [0] * 2019\ncnts[0] = 1\nmod_num = 0\nd = 1\n\nfor c in s:\n t = d * int(c)\n mod_num += t\n mod_num %= 2019\n cnts[mod_num] += 1\n d *= 10\n d %= 2019\n\nr... | ['Time Limit Exceeded', 'Accepted'] | ['s886576177', 's128492207'] | [9520.0, 9268.0] | [2206.0, 120.0] | [115, 305] |
p02702 | u609061751 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['import sys\ninput = sys.stdin.readline\nmod = 2019\ns = input().rstrip()\nn = len(s)\nmod_list = [0]\nfor i in range(n - 1, -1, -1):\n print(s[i])\n mod_list.append((mod_list[-1] + int(s[i]) * 10**(n - 1 - i) ) % mod)\nfrom collections import Counter\nc = Counter(mod_list)\nans = 0\nfor i in c.keys():\n ans ... | ['Wrong Answer', 'Accepted'] | ['s687452555', 's273474616'] | [9980.0, 16716.0] | [2206.0, 348.0] | [345, 336] |
p02702 | u612223903 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['import collections\ns = list(input())\ns = list(map(int,s))\ns_mod =[]\nfor i in range(len(s)):\n mod = s[i]*10**i % 2019\n s_mod.append(mod)\ns_values = list(collections.Counter(s_mod).values())\nprint(int(sum(s_values[i]*(s_values[i]-1)/2 for i in range(len(s_values)))))', 'import collections\ns = list(input(... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s159648083', 's728352517', 's896722271', 's934917951', 's546083583'] | [12372.0, 12456.0, 12528.0, 11620.0, 9316.0] | [2206.0, 2206.0, 2206.0, 2206.0, 156.0] | [271, 319, 333, 391, 245] |
p02702 | u614162316 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['s=input()\ns=s[::-1]\na=1\nb=0\nt=[0]*2019\nans=0\nfor i in range(len(s)):\n b+=int(s[i])*a\n b%=2019\n ans+=t[b]\n t[b]+=1\n a*=10\n a%=2019\n\nprint(ans)', 's=input()\ns=s[::-1]\na=1\nb=0\nt=[0]*2019\nt[0]=1\nans=0\nfor i in range(len(s)):\n b+=int(s[i])*a\n b%=2019\n a*=10\n ans+=t[b]... | ['Wrong Answer', 'Accepted'] | ['s029313806', 's106990625'] | [9340.0, 9340.0] | [135.0, 136.0] | [159, 166] |
p02702 | u616117610 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['s = list(str(input()))\na = [0]\nb = [0]*2019\nfor num,i in enumerate(reversed(s)):\n a.append(a[num]+int(i)*10**num)\n b[(a[num]+int(i)*10**num)%2019] += 1\nans = 0\nfor i in b:\n ans += i*(i-1)//2\nprint(ans)', 's = list(str(input()))\nb = {}\nb[0] = 1\nc_ = 0\ns = s.reverse()\nfor i in s:\n c = (c_+int(i)*10**... | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s045839379', 's116847667', 's553124572', 's717839513', 's808639447', 's904843200', 's249292317'] | [53804.0, 10520.0, 9360.0, 9056.0, 9092.0, 10584.0, 9184.0] | [2207.0, 21.0, 23.0, 23.0, 23.0, 125.0, 114.0] | [204, 221, 197, 196, 203, 185, 194] |
p02702 | u616534089 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['n = input()\nl = len(n)\nmod = [0]*2019\nmod[0] += 1\n\nfor i in range(l):\n a = int(n[i:]) % 2019\n mod[a] += 1\n\nres = 0 \nfor m in mod:\n res += m*(m-1)/2\nprint(res)\n', 'n = input()\nl = len(n)\nmod = [0]*2019\nmod[0] += 1\nT = 0\nd = 1 \nfor i, s in enumerate(Sr):\n T += int(s) * d\n T %= 2019\n d = (d ... | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s455459856', 's744469129', 's822208935', 's724702691'] | [9256.0, 9360.0, 8984.0, 9292.0] | [2206.0, 24.0, 24.0, 109.0] | [163, 212, 327, 211] |
p02702 | u620868411 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['def f(s):\n pl = [str(2019*i) for i in range(1,51000)]\n res = 0\n for p in pl:\n res += s.count(p)\n # start = 0\n \n # while pos>=0:\n # res += 1\n \n \n return res\n\nif __name__ == "__main__":\n print(f(input()))', 'from collections import defaul... | ['Wrong Answer', 'Accepted'] | ['s676450898', 's700722946'] | [13036.0, 9648.0] | [2206.0, 128.0] | [343, 272] |
p02702 | u624617831 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['s = str(input())[::-1]\n\ntmp_amari = [0]*2019\n\n#amari = 0\nnum = 0\norder = 1\nfor i in s:\n num += int(i)*order\n num %= 2019\n #print(num)\n tmp_amari[num] += 1\n order *= 10\n\n\n#print(tmp_print)\n\nans = 0\nans += tmp_amari[0]\n\nfor i in tmp_print:\n ans += (i*(i-1))//2\n\nprint(ans)\n', 's... | ['Runtime Error', 'Accepted'] | ['s836069222', 's902505699'] | [9372.0, 9352.0] | [2206.0, 111.0] | [333, 368] |
p02702 | u629454253 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['import collections\ns = input()\n\nl = [int(s[-1])]\nd = 1\nfor i in range(len(s)-1, -1, -1):\n print(i)\n l.append((l[-1] + int(s[i])*d) % 2019)\n d *= 10\n d %= 2019\n\nd = collections.Counter(l)\ncount = 0 \nfor i in d:\n count += d[i]*(d[i]-1)//2\n\ncount += d[0]\n\nprint(count)', 's = input()\ncount = 0\n\... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s430646949', 's472501647', 's789092858'] | [16980.0, 9528.0, 16580.0] | [200.0, 2205.0, 132.0] | [271, 171, 255] |
p02702 | u638033979 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['from collections import deque\ns = deque(input())\nn = len(s)\n\ntemp = [0]*2019\nt = 1\nnum = 0\nfor i in range(n):\n num += int(s.pop())*t % 2019\n temp[num] += 1\n t *= 10\n\nans = temp[0]\nfor t in temp:\n if t > 1:\n ans += t*(t-1)/2\n\nprint(int(ans))', 'from collections import deque\ns = deq... | ['Runtime Error', 'Accepted'] | ['s027286594', 's002085092'] | [11096.0, 10920.0] | [24.0, 119.0] | [259, 269] |
p02702 | u638282348 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['from math import log10\nfrom collections import Counter\nS = int(input())\nl = int(log10(S)) + 1\nprint(sum(n * (n - 1) // 2 for n in Counter((S := S % 10 ** (l - i)) % 2019 for i in range(l + 1)).values()))\n', 'from collections import Counter\nl = len(S := input())\ncounts = Counter((n := (n + (d := d * 10 % 2019) ... | ['Runtime Error', 'Accepted'] | ['s971329433', 's265947482'] | [8908.0, 9652.0] | [25.0, 115.0] | [204, 234] |
p02702 | u642668851 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['s=input()\na=0\nm={}\nfor i in range(len(s)):\n b=int(s[len(s)-1-i])*10**i+a\n b=b%2019\n a=b\n if b in m:\n m[b]+=1\n else:\n m[b]=1\nsum=0\nfor i in m:\n sum+=m[i]*(m[i]-1)/2\nprint(int(sum))', 's=input()\na=0\nm={}\nd=1\nfor i in range(len(s)):\n b=int(s[len(s)-1-i])*d+a\n b=b%2019\n a=b\n d=d*10%2... | ['Wrong Answer', 'Accepted'] | ['s830085587', 's948714279'] | [9312.0, 9380.0] | [2205.0, 169.0] | [191, 237] |
p02702 | u645487439 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['s = input()[::-1]\nd = 1\nnum = 0\nmod_list = [0] * 2019\n\nfor char in s:\n num += int(char) * d\n num %= 2019\n d *= 10\n d%= 2019\n counts[num] += 1\n\nans = mod_list[0]\nfor cnt in range(1, 2019):\n ans += mod_list[cnt] * (mod_list[cnt] - 1) // 2\n\nprint(ans)\n', 's = input()[::-1]\nd = 1\nnum ... | ['Runtime Error', 'Accepted'] | ['s464515124', 's705913698'] | [9336.0, 9212.0] | [20.0, 108.0] | [267, 257] |
p02702 | u646412443 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['s = input()[::-1]\nm = 2019\nans = 0\nx = 1\ntot = 0\ncnt = [0] * m\nfor s in s:\n cnt[tot] += 1\n tot += int(s) * x\n tot %= m\n \n x *= 10\n x %= m\n\nprint(sum(i*(i-1)//2 for i in cnt))\n', 's = input()[::-1]\nmod = 2019\ncnt = [0] * mod\nx = 1\ncnt[0] = 1\ntotal = 0\nfor s in s:\n total = int... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s394865991', 's724649930', 's781034898', 's571114423'] | [9364.0, 9412.0, 9280.0, 9200.0] | [114.0, 2206.0, 22.0, 119.0] | [209, 203, 149, 218] |
p02702 | u652656291 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['s = input()\nans = 0\nif int(s) < 2019 :\n print(0)\nelse:\n for i in range(len(s)-3):\n for j in range(4,len(s)):\n a =s[i:j+1]\n if int(a) % 2019 == 0:\n ans += 1\n \nprint(ans)', 's = input()\nL = [s[i] for i in range(len(s))]\nans = 0\n\nfor j in range(0,len(L)-3):\n for k in range(3... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s147767563', 's159617446', 's245738840', 's376879182', 's379153641', 's475145632', 's551871829', 's563925802', 's624435385', 's646955261', 's682844133', 's880227944', 's900254917', 's958763450', 's339648654'] | [9264.0, 10688.0, 3567520.0, 9224.0, 9204.0, 3568232.0, 9332.0, 9232.0, 9016.0, 9104.0, 9036.0, 9212.0, 9336.0, 9388.0, 9040.0] | [2206.0, 31.0, 2095.0, 2206.0, 2205.0, 2083.0, 2205.0, 20.0, 19.0, 20.0, 18.0, 2205.0, 23.0, 2206.0, 89.0] | [197, 197, 202, 162, 144, 224, 187, 142, 134, 142, 190, 190, 157, 160, 245] |
p02702 | u653837719 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['s = input()\nl = len(s)\nd = [[0] * 2020 for i in range(l + 1)]\n\nfor i in range(0, l):\n d[i + 1] = d[i][int(s[i]):] + d[i][:int(s[i])]\n d[i + 1][int(s[i])] += 1\n d[i + 1][2019] += d[i][2019] + d[i + 1][0]\n\nprint(d[l][2019])', 's = input()\nl = len(s)\nt = [0] * l\nt[l - 1] = int(s[l - 1])\nm = [0] * 2... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s783367741', 's792926553', 's794197403'] | [1382352.0, 18592.0, 9236.0] | [2244.0, 196.0, 101.0] | [230, 297, 211] |
p02702 | u657994700 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ["from collections import Counter\n\n# print('input >>')\n\nS = input()\nS = S[::-1]\n\nmods = [0] * (len(S)+1)\nmods[0] = int(S[0]) % 2019\n\nfor i in range(len(mods)-1-1):\n mods[i+1] = (int(S[i+1]) * 10 ** (i+1) + mods[i]) % 2019\n\n# print(mods)\n\n# ans = 0\n\n# counter = Counter(mods)\n\n# for n in counter.val... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s198136086', 's501714641', 's750917938'] | [11496.0, 11588.0, 9584.0] | [2206.0, 2206.0, 117.0] | [396, 399, 569] |
p02702 | u658447090 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['S = input()[::-1]\n\n\ncounts = [0]*2019\n\ncounts[0] = 1\n\nnum, d = 0, 1\n\nfor c in s:\n \n num += int(c) * d\n num %= 2019\n \n \n d *= 10\n #d %= 2019\n \n counts[num] += 1\n \nans = 0\nfor cnt in counts:\n \n ans += cnt * (cnt-1) //2\n \nprint(ans)', 'S = input()[::-1]\n \n\ncounts = [0]*2019\n\nco... | ['Runtime Error', 'Accepted'] | ['s470915437', 's032035241'] | [9292.0, 9264.0] | [22.0, 109.0] | [347, 349] |
p02702 | u673922428 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['#A,B,C,D=map(int,input().split(" "))\n\nimport collections\n\nmod=2019\na=input()\n\nN=len(a)\nt=[]\nans=0\n\nfor i in range(N):\n u=int(a[i::])\n v=u % mod\n t.append(v)\n \ntt = collections.Counter(t)\nfor i in tt.values():\n #print(i)\n if i==0:\n ans+=1\n else:\n ans += (i-1)*i//2\nprint(ans)', '#A,B... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s051679963', 's721847195', 's283350587'] | [9888.0, 134644.0, 9376.0] | [2206.0, 2302.0, 138.0] | [287, 235, 195] |
p02702 | u674052742 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['# -*- coding: utf-8 -*-\n"""\nCreated on Sun Apr 26 22:28:26 2020\n\n@author: Kanaru Sato\n"""\n\ns = input()\nn = len(s)\ndic = {}\nmod = 2019\ncount = 0\n\nfor i in range(1,n+1):\n num = int(s[n-i:n])\n num %= mod\n if num in dic:\n dic[num] += 1\n if num not in dic:\n dic[num] = 1\n\nans ... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s037265435', 's287188708', 's358008534', 's558333385', 's625418201', 's626838773', 's757053527'] | [9264.0, 35868.0, 9284.0, 84480.0, 9324.0, 10468.0, 12268.0] | [2206.0, 2206.0, 203.0, 2208.0, 2206.0, 25.0, 152.0] | [371, 375, 385, 367, 386, 343, 397] |
p02702 | u678505520 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['S = str(input())\ns = int(S)\nn = len(S)\ncount = 0\nfor i in range(1,n+1):\n for j in range(i+4,n+1):\n si = s%10**(n-i+1)\n sij = si//10**(n-j)\n if sij % 2019 == 0:\n count+=1\n i+=4\n j+=4\n\nprint(count)', 'S = str(input())\ns = int(S)\nn = len(S)\ncount =... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s053989425', 's448045302', 's816745076', 's733468556'] | [9600.0, 9504.0, 9596.0, 16804.0] | [2206.0, 2206.0, 2206.0, 343.0] | [252, 249, 271, 233] |
p02702 | u679390859 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['S = input()\nS = S[::-1]\nL = [0]\ni = 0\nfor x in S:\n tmp = L[-1] + 10 ** i * int(x) % 2019\n # print(tmp % 2019)\n L.append(tmp % 2019)\n i += 1\nL = sorted(L[1::])\ndef counter(array):\n from collections import Counter\n return list(Counter(array).most_common())\nc = counter(L)\nfrom math import ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s314518819', 's807232104', 's954526779'] | [9028.0, 8984.0, 20176.0] | [22.0, 21.0, 383.0] | [489, 490, 453] |
p02702 | u680851063 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['s = input()\nnum = len(s)\nl = []\nfrom collections import deque\nl = deque(l) \n\nfor _ in range(1, 20190000):\n if _%2019 == 0:\n l.append(str(_))\nl = set(l)\n#print(l)\n\ndef aaa(s, num):\n x = 0\n for i in range(4,num+1):\n for j in range(num - i + 1):\n if s[j:j+i] in l:\n ... | ['Time Limit Exceeded', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Runtime Error', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Accepted'] | ['s029042536', 's404528394', 's421934964', 's522261944', 's609376695', 's710830195', 's838409174', 's569935562'] | [10760.0, 124920.0, 10428.0, 128800.0, 120664.0, 10632.0, 10680.0, 9296.0] | [2206.0, 2209.0, 2206.0, 2209.0, 1209.0, 2206.0, 2206.0, 100.0] | [381, 608, 404, 556, 603, 381, 300, 358] |
p02702 | u684267998 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ["def main():\n S = input()[::-1]\n ans = 0\n mods = [0] * 2019\n mods[0] = 1\n current = 0\n x = 1\n for s in S:\n current = (current + x * int(s)) % 2019\n mods[current % 2019] += 1\n x = x * 10 % 2019\n \n for i in len(mods):\n ans += mods[i] * (mods[i]-1)//2\n ... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s220349311', 's753543969', 's985071344', 's010109354'] | [9248.0, 9132.0, 9396.0, 9260.0] | [87.0, 22.0, 88.0, 87.0] | [355, 350, 341, 335] |
p02702 | u685983477 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['from itertools import accumulate\nfrom collections import defaultdict\nS = list(input().rstrip())\nr = 1\ni=len(S)\nacc=0\ndd = defaultdict(int)\nfor s in S[::-1]:\n acc+=r*int(s)\n acc%=2019\n r%=2019\n r*=10\n dd[acc]+=1\n i-=1\nans=0\nfor i in dd.values():\n ans+=(i*(i-1))/2\nprint(ans)\n', 'f... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s478953558', 's641513353', 's350499569'] | [12600.0, 12448.0, 12440.0] | [143.0, 138.0, 128.0] | [295, 296, 297] |
p02702 | u696499790 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ["def function(S):\n S = S[::-1]\n mods = [0]*2019 \n \n \n \n num = 0\n digit = 1\n for c in S:\n num = (int(c) * digit + num) % 2019\n digit = (digit * 10) % 2019\n mods[num] += 1\n \n result = 0\n for m in mods:\n result += m * (m-1) // 2\n\n return st... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s434414566', 's849663530', 's739744981'] | [9252.0, 9184.0, 9372.0] | [78.0, 262.0, 84.0] | [500, 637, 539] |
p02702 | u706330549 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['s = input()\n\nmod = [0] * 2019\nmod[0] = 1\nd = 1\nn = 0\nans = 0\n\nfor i in reversed(s):\n n += int(i) * d\n n %= 2019\n d *= 10\n d %= 2019\n mod[n % 2019] += 1\n\nfor i in mod:\n ans += sum(i*(i-1) // 2)\n\nprint(ans)\n', 's = input()\n\nmod = [0] * 2019\nmod[0] = 1\nd = 1\nn = 0\nans = 0\n\nfo... | ['Runtime Error', 'Accepted'] | ['s795861772', 's205444791'] | [9168.0, 9040.0] | [120.0, 119.0] | [223, 238] |
p02702 | u707124227 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['s=input()\nn=len(s)\nsi=int(s)\nmod=2019\nfrom collections import defaultdict\nt=defaultdict(lambda:0)\nfor i in range(n):\n si-=int(s[i])*pow(10,n-1-i)\n t[si]+=1\nans=0\nfor v in t.values():\n ans+=(v*(v-1))//2\nprint(ans)', 's=input()\nn=len(s)\nsi=int(s)\nmod=2019\nfrom collections import defaultdict\nt=... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s084949891', 's351507103', 's427087537'] | [49452.0, 9808.0, 9240.0] | [2207.0, 2206.0, 133.0] | [221, 229, 245] |
p02702 | u709304134 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['S = input()\nMOD = 2019\ncnt = [0]*MOD\ncur = 0 \ncnt[cur] = 1 \nd = 1 \nfor s in for S[::-1]:\n cur += int(s)*d \n r %= MOD\n cnt[cur] += 1\n \n d *= 10 \n d %= MOD \nans = 0\nfor c in cnt:\n ans += c*(c-1)//2\nprint (ans)\n\n', 'S = input()\nMOD = 2019\ncnt = [0]*MOD\ncur = 0 \ncnt[cur] = 1 \nd... | ['Runtime Error', 'Accepted'] | ['s207241588', 's891725208'] | [8892.0, 9376.0] | [22.0, 116.0] | [433, 461] |
p02702 | u721316601 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ["import sys\ninput = sys.stdin.readline\nfrom collections import Counter\n\ndef main():\n MOD = 2019\n S = input()[::-1]\n n = 0\n x = 1\n c = Counter()\n ans = 0\n \n for s in S:\n c[n] += 1\n n += int(s) * x\n n %= MOD\n ans += c[n]\n x = x * 10 % MOD\n ... | ['Runtime Error', 'Accepted'] | ['s963070117', 's034069856'] | [9600.0, 9684.0] | [24.0, 168.0] | [375, 208] |
p02702 | u722148122 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['S = input()\ncnt = 0\nis_end = [False] * (len(S) + 1)\nfor i in range(len(S)):\n if is_end[i]:\n continue\n is_end[i] = True\n bingo = [i]\n s = 0\n for j in range(i+1, len(S)+1):\n if is_end[j]:\n continue\n s += int(S[j-1])\n if s % 3 != 0:\n continue... | ['Wrong Answer', 'Accepted'] | ['s263970850', 's802819726'] | [10924.0, 9372.0] | [2206.0, 111.0] | [472, 264] |
p02702 | u726285999 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['S = input()\n\nA = []\nprint(len(S))\nfor i in range(len(S)):\n for j in range(i+1,len(S)+1):\n if int(S[i:j]) % 2019 == 0:\n A.append((i+1,j))\n\nprint(len(A))', 'from collections import Counter\nimport sys\n\n# input = lambda : sys.stdin.readline().rstrip()\n\nS = input()\nn = len(S)\n\nM = []\... | ['Wrong Answer', 'Accepted'] | ['s447288093', 's455855504'] | [9344.0, 16812.0] | [2206.0, 347.0] | [172, 424] |
p02702 | u727148417 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['from scipy.special import comb\nfrom collections import Counter, deque\n\nD = deque(map(int, list(input())))\na = {}\nvalue = 0\n\nfor i in range(len(D)):\n value = value + D.pop() * 10**i\n modulo = value % 2019\n # print(modulo)\n if modulo in a.keys():\n a[modulo] += 1\n else:\n a[modul... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s227079534', 's649130777', 's390038472'] | [45176.0, 45360.0, 12004.0] | [2207.0, 302.0, 327.0] | [395, 424, 319] |
p02702 | u729133443 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['def resolve():\n s = input()\n n = len(s)\n counter = [0] * 2019\n counter[0] += 1\n temp = ""\n for i, c in enumeate(s[::-1], 1):\n temp = c + temp\n counter[int(temp) % 2019] += 1\n\n ans = 0\n for i in counter:\n ans += (i * (i - 1)) // 2\n\n print(ans)\nresolve()', ... | ['Runtime Error', 'Accepted'] | ['s492315522', 's035102469'] | [9348.0, 9220.0] | [20.0, 134.0] | [300, 97] |
p02702 | u729417323 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ["S = input()\n\nX = [0]*2019\nX[0] = 1\nd = 1\na = 0\n\nfor s in reversed(S):\n a = ((ord(s) - ord('0'))*d + a)%2019\n d = d*10%2019\n print(a)\n X[a] += 1\n\nans = sum(x*(x-1)//2 for x in X)\nprint(ans)\n\n \n", "S = input()\n\nX = [0]*2019\nX[0] = 1\nd = 1\na = 0\n\nfor s in reversed(S):\n a = ((or... | ['Wrong Answer', 'Accepted'] | ['s877748706', 's248901157'] | [9228.0, 9284.0] | [162.0, 101.0] | [207, 194] |
p02702 | u734423776 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['S = str(input())\nN = len(h)\na = [0] * 2019\na[0] = 1\nT = 0\nr = 1\nc = 0\nfor i in range(N-1, -1, -1):\n T = T + int(S[i]) * r\n r = r * 10\n c += a[T%2019]\n a[T%2019] += 1\nprint(c)', 'S = input()\nN = len(h)\na = [0] * 2019\na[0] = 1\nT = 0\nr = 1\nc = 0\nfor i in range(N-1, -1, -1):\n T = T + in... | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s119745040', 's233601176', 's579530962', 's952671078', 's315120373'] | [9144.0, 9160.0, 12616.0, 9232.0, 12372.0] | [20.0, 22.0, 2206.0, 22.0, 128.0] | [186, 181, 338, 181, 227] |
p02702 | u736470924 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['s = input()\nl = len(s)\nA = [i for i in range(2019, int(s) + 2019, 2019)]\nans = 0\nfor a in A:\n di = len(str(a))\n for i in range(l - di + 1):\n # print(s[i:i + di], a)\n if s[i:i + di] == str(a):\n ans +=1\nprint(ans)', 's = input()\nl = len(s)\ndp = [0 for i in range(2019)]\ndp[0] ... | ['Time Limit Exceeded', 'Accepted'] | ['s283794405', 's563990213'] | [2059008.0, 9248.0] | [2272.0, 324.0] | [242, 216] |
p02702 | u739959951 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['s=(input())\nn=len(s)\n\nans=0\n\nfor i in range(n):\n for j in range(i+3,n):\n s_ans=s[i:j+1]\n s_ans=int("".join(s_ans))\n print(s_ans)\n if s_ans%2019==0:\n ans+=1\n \nprint(ans)', 'S=input()[::-1]\nl=[0]*2019\na=1\nd=0\n\nfor s in S:\n d=d+int(s)*a\n l[d%2019]+=1\n a*=10\n a%=2019\n \n... | ['Wrong Answer', 'Accepted'] | ['s550285626', 's581109268'] | [25408.0, 9224.0] | [2252.0, 107.0] | [191, 166] |
p02702 | u745514010 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['s = input()[::-1]\n\nlst = []\nnum = 1\npow10 = [1]\nfor _ in range(len(s) - 1):\n num = num * 10 % 2019\n pow10.append(num)\n\nnum = 0\nfor s_num, p10 in zip(s, pow10):\n num = (num + (int(s_num) * p10)) % 2019\n lst.append(num)\nlst.sort()', 's = input()[::-1]\n\nlst = []\nnum = 1\npow10 = [1]\nfor _ in... | ['Wrong Answer', 'Accepted'] | ['s639345506', 's561986455'] | [24384.0, 24376.0] | [166.0, 211.0] | [240, 449] |
p02702 | u747391638 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['s=input()\nn=len(s)\n\nmodlist=[]\n\nfor i in range(n):\n modlist.append(int(s[i:])%2019)\n\nmodlist.append(0)\n \nresult = 0\n \nfor i in range(2019):\n c = modlist.count(i)\n if c<=1:\n result += 0\n else:\n result += c*(c-1)/2\n\nprint(result)', 's=input()\nn=len(s)\n\nmodlist=[]\n\nfor i in range(n):\n... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s108657519', 's467332240', 's588526024', 's928758389'] | [9424.0, 9396.0, 9424.0, 10596.0] | [2206.0, 2206.0, 2206.0, 119.0] | [238, 225, 201, 230] |
p02702 | u749742659 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['s = int(input())\nss = len(str(s))\n\ncount = 0\nfor i in range(ss):\n for j in range(i,ss):\n sa = s // (10**i)\n sb = sa % (10**(j+1-i))\n if (sb % 2019 == 0):\n count += 1\n print(i,j,sb)\n\nprint(count)', 's = input()[::-1]\n\ndataset = [0]*2019\ndataset[0] = 1\n\nn =... | ['Wrong Answer', 'Accepted'] | ['s129573248', 's115015863'] | [9164.0, 9300.0] | [2205.0, 113.0] | [240, 232] |
p02702 | u752907966 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['s=input()\nans = 0\ndp = [[0 for i in range(len(s)+3)]for j in range(len(s)+3)]\ndef rec(i,j,num):\n global ans\n if dp[i][j] == 1:\n return\n dp[i][j] = 1\n if int(num) % 2019 == 0:\n ans += 1\n else:\n if j < len(s):\n rec(i,j+1,num+s[j])\n if len(num) >= 5:\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s188240197', 's555750922', 's267381517'] | [594416.0, 557472.0, 16332.0] | [2222.0, 2222.0, 348.0] | [442, 486, 360] |
p02702 | u755989869 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['s = input()\nn = len(s)\n\na = [0]*2019\ncount = 0\nval = 10\nfor i in range(n):\n tmp = int(s[n-i-1,n]) % 2019\n count = count + a[tmp]\n a[tmp] = a[tmp] + 1\n if(tmp == 0):\n count = count + 1\n val = val * 10\n\nprint(count)', 's = input()[::-1]\nn = len(s)\n\na = [0]*2019\na[0] = 1\ncount = ... | ['Runtime Error', 'Accepted'] | ['s904948120', 's437524835'] | [9288.0, 9316.0] | [20.0, 124.0] | [235, 233] |
p02702 | u756420279 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['#!/usr/bin/env python3\n\nS = input()\nlis_2019 = [2019 * i for i in range(1, 99)]\ncnt = 0\nS_len = len(S)\ncnt_1 = 0\nS_lis = [S]\n\nfor i in range(4, S_len):\n while cnt_1 != S_len - i + 1:\n for j in lis_2019:\n if j == S[cnt_1:cnt_1+i]:\n cnt += 1\n cnt_1 += 1\n cnt_... | ['Wrong Answer', 'Accepted'] | ['s756368458', 's662730255'] | [9140.0, 9240.0] | [2206.0, 110.0] | [320, 255] |
p02702 | u760256928 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['import collections\n\ns = input()\ns_len = len(s)\nn = 2019\nmod_list = [0] * n\n\nfor i in range(s_len):\n t = s[i:]\n t_i = int(t)\n m = t_i % n\n #mod_list.append(m)\n mod_list[m] += 1\n\n#c = collections.Counter(mod_list)\n\nresult = sum(i * (i - 1) // 2 for i in mod_list)\nprint(result)', 's = inp... | ['Wrong Answer', 'Accepted'] | ['s725893145', 's358892132'] | [10004.0, 9176.0] | [2206.0, 114.0] | [341, 250] |
p02702 | u764215612 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['def main():\n n, d, mods = 0, 1, [1]+[0]*2019\n \n # n = (n+int(i)*d)%2019\n # d = d*10%2019\n # mods[n] += 1\n for i, j in enumerate(reversed(s)):\n n = (n+int(j)*10**i%2019)%2019\n mods[n] += 1\n print(sum([i*(i-1)//2 for i in mods]))\nmain()', 's = input()\nn = 0\nans = 0\nmods = [0]*p\nmods[0] = 1\... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s662982323', 's689161997', 's615708777'] | [9016.0, 9220.0, 9308.0] | [21.0, 22.0, 81.0] | [278, 190, 188] |
p02702 | u773865844 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['import sys\nlines = sys.stdin.readlines()\n\nS = str(lines[0])\nX = []\n\nfor i in range(len(S)):\n a = int(S[i:])\n c = a-int(a/2019)*2019\n X.append(c)\n\nX.sort()\nflag =1\nn = 0\nfor i in range(len(X)-1):\n if X[i]==0:\n n +=1\n if X[i]==X[i+1]:\n flag += 1\n else:\n n += int(flag*(flag-1)/2)\n ... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error... | ['s037881059', 's082665599', 's083492780', 's088894845', 's154960544', 's175858306', 's191185514', 's227832217', 's241253575', 's241623164', 's411508293', 's458943373', 's471765493', 's478718618', 's514383588', 's579362092', 's608189248', 's699869786', 's715021547', 's783849171', 's890962467', 's137397724'] | [9328.0, 16380.0, 16220.0, 9268.0, 9288.0, 9432.0, 16348.0, 16180.0, 8976.0, 9512.0, 16440.0, 9160.0, 24396.0, 9500.0, 16312.0, 8936.0, 24416.0, 9208.0, 16416.0, 9012.0, 16240.0, 24284.0] | [206.0, 61.0, 59.0, 204.0, 22.0, 2206.0, 61.0, 58.0, 19.0, 2206.0, 60.0, 23.0, 241.0, 2205.0, 58.0, 23.0, 239.0, 205.0, 58.0, 23.0, 58.0, 235.0] | [316, 562, 230, 331, 145, 327, 391, 206, 117, 311, 556, 555, 517, 154, 389, 246, 548, 322, 390, 256, 559, 576] |
p02702 | u785573018 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['S = input()\na = []\nb = [0]*2019\nc = 0\nd = 0\nfor n in range(len(S)):\n c += 10*n*int(S[-n-1])\n a.append(c%2019)\nfor n in range(len(S)):\n b[a[n]] += 1\nfor n in range(2019):\n d += int(b[n]*(b[n]-1)/2)\nprint(d)', 'S = input()\nl = len(S)\na = [0]\nb = [0]*2019\nc = [1]\nd = 0\ne = 0\nfor n in range... | ['Wrong Answer', 'Accepted'] | ['s180098761', 's192358315'] | [16344.0, 23544.0] | [146.0, 173.0] | [217, 277] |
p02702 | u788703383 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['s = input()\nMOD = 2019\nr = [0]*MOD\nr[0] = 1\nz = 0\nt = 0\nfor i in reversed(s):\n z = int(i) * pow(10,t,m) + z\n z %= MOD\n r[z] += 1\n t += 1\nprint(sum(i*(i-1)//2 for i in r))\n', 's = input()\nn = len(s)\nm = 2019\na = 0\nr = [0 for _ in range(m+1)]\nr[0] = 1\nfor i in range(0,n):\n z = (int(s[n... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s206527916', 's660265702', 's641570248'] | [9324.0, 9168.0, 9260.0] | [21.0, 19.0, 84.0] | [183, 175, 291] |
p02702 | u789199177 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['import collections\ns = input()\nn = len(s)\nmod_list = [0]\n\nT = 0\nfor i in range(n):\n T += int(s[-1-i])*pow(10, i, 2019)%2019\n T = T%2019\n mod_list.append(T)\n\nres = collections.Counter(mod_list)\ncnt = 0\nfor d in res.values:\n cnt += int(d*(d-1)/2)\nprint(cnt)', "s = input()\nn = len(s)\n\nskip_... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s391441901', 's860538587', 's981708138'] | [16628.0, 9328.0, 16760.0] | [358.0, 2205.0, 356.0] | [267, 256, 269] |
p02702 | u801570811 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ["def d164(n):\n res = 0\n for i in range(1, 200000):\n count = 2019*i\n if n.count(str(count)) != 0:\n res += n.count(str(count))\n return res\n\ndef main():\n n = str(input())\n print(d164(n))\nif __name__ == '__main__':\n main()", "if __name__ == '__main__':\n n = str(in... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s113559191', 's124055719', 's978577069'] | [9148.0, 9344.0, 24756.0] | [2205.0, 2206.0, 176.0] | [260, 204, 396] |
p02702 | u802234211 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['\ns = list(str(10**200000))\nn = len(s)\nans = 0\ns.reverse()\n# print(s)\nx = 1\ntot = 0\ncount = [0]*2019\nfor i in range(n):\n count[tot]+=1\n tot += int(s[i])*x\n # print(tot)\n tot %= 2019\n ans += count[tot]\n x = x*10%2019\nprint(ans)', 'from math import factorial\nS=list(map(int,input()))\nS... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s004271479', 's233101795', 's360588856', 's191928189'] | [10564.0, 10756.0, 12404.0, 10424.0] | [625.0, 41.0, 635.0, 141.0] | [262, 337, 260, 262] |
p02702 | u802963389 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['S = input()\n\nmods = [0 for _ in range(2019)]\n\nnum = 0\nfor itr, s in enumerate(S[::-1]):\n num = int(s) * 10 ** itr + num\n mo = num % 2019\n mods[mo] += 1\n\nans = 0\nfor m in mods:\n ans += m * (m - 1) // 2\n\nprint(ans)\n', 'S = list(map(int, list(input())))\n\nMOD = 2019\n\nmods = [0 for _ in range(2019)]... | ['Wrong Answer', 'Accepted'] | ['s455996927', 's360051641'] | [9384.0, 12004.0] | [2206.0, 109.0] | [217, 275] |
p02702 | u809816772 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['S = str(input())\nans = 0\n\nif len(S) <= 3:\n print(0)\nelse: \n for i in range(len(S)-3):\n if int(S[i:i+3]) % 2019 == 0:\n ans+=1\n print(ans)', 'S = str(input())\nans = 0\n\nif len(S) <= 3:\n print(ans)\nelse: \n for i in range(0,len(S)-2):\n for j in range(i+3,len(S)-2... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s337309316', 's477033617', 's527703879', 's118976160'] | [9184.0, 9396.0, 9140.0, 9348.0] | [80.0, 2206.0, 24.0, 115.0] | [165, 213, 160, 219] |
p02702 | u814986259 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ["S = list(map(int, list(input())))\nN = len(S)\n\ndp = [[0]*N for i in range(N)]\nif N < 4:\n print(0)\n exit(0)\n\nD = [[0]*N for i in range(9)]\nfor i in range(9):\n D[i][i] = (i+1)\n for j in range(i+1, N):\n D[i][j] = D[i][j-1]*10 % 2019\n\n\nprint(D)\nans = 0\n\ndp[0] = S[0]\nfor i in range(1, ... | ['Runtime Error', 'Accepted'] | ['s645958149', 's412487113'] | [2690312.0, 19468.0] | [2275.0, 161.0] | [571, 408] |
p02702 | u816265237 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['# multiple\nline = input()\nln = [0]\ncounts=[0]*2019\nfor i in range(1,len(line) + 1):\n ti1 = (ln[-1] +(int(line[-1*i])*10**(i-1))%2019)%2019\n counts[ti1] += 1\n ln.append(ti1)\ntotal = 0\ncounts[0] +=1\nfor i in range(len(counts)):\n total += counts[i]*(counts[i] - 1)/2\nprint(total)', '# multiple\nli... | ['Wrong Answer', 'Accepted'] | ['s765411769', 's572359859'] | [9808.0, 9092.0] | [2206.0, 125.0] | [288, 300] |
p02702 | u829249049 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['S=list(input())\nN=len(S)\nmod=[0 for i in range(2019)]\ns=0\nans=0\nfor i in range(2019):\n k=mod[i]\n if i==0:\n if k>=2:\n ans+=k*(k-1)//2+k\n else:\n ans+=k\n else:\n if k>=2:\n ans+=k*(k-1)//2\nprint(ans) ', 'from scipy.special import comb\nS=input()\nN=len(S)\nmod=[0 for i in ran... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s590982300', 's904954564', 's927170416', 's942020484'] | [10468.0, 42836.0, 10632.0, 9336.0] | [26.0, 2207.0, 2206.0, 112.0] | [227, 312, 166, 318] |
p02702 | u840579553 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['"""\nimport random\nimport functools\nimport copy\nimport bisect\nimport array\nimport re\nimport collections\nimport heapq\nimport fractions\nimport itertools\nimport string\nimport math\nfrom operator import itemgetter as ig\nfrom bisect import bisect_left, bisect_right, insort_left, insort_right\nfrom itertools im... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s073581686', 's845034043', 's083336382'] | [8832.0, 9496.0, 9272.0] | [22.0, 2206.0, 113.0] | [2229, 223, 273] |
p02702 | u841856382 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['S = input()\nans = 0\nnd = 1\nmod2 = 0\nlistmod = [0]*2019\nfor i in S[::-1]:\n mod1 = (int(i)*nd + mod2)%2019\n listmod[mod1] += 1\n mod2 = mod1\n nd = (nd*10)%2019\nfor i in range(2019):\n n = listmod[i]\n if(i == 0):\n ans += int(n*(n+1))/2\n else:\n ans += int((n-1)*n/2)\nprint(... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s786083307', 's893415491', 's934914024', 's885873436'] | [9324.0, 9232.0, 9264.0, 9088.0] | [107.0, 101.0, 101.0, 105.0] | [306, 245, 230, 376] |
p02702 | u857428111 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['s = input()\nn = len(s)\ns_cu = [0] * n\ncounter = [0] * 2019\n\nfor i in range(1, n+1):\n s_cu[i-1] = int(s[n-i:]) \n counter[int(s[n-i-1:]) % 2019] += 1\nprint(s_cu)\n\n#diff\ncounter[0]+=1\n#diff end\n\n\nans = 0\nfor i in counter:\n ans += (i * (i - 1)) // 2\n\n\n#print(counter[0])\n\nprint(ans)', '\nimp... | ['Wrong Answer', 'Accepted'] | ['s553482396', 's411091415'] | [26960.0, 23936.0] | [2206.0, 343.0] | [322, 682] |
p02702 | u857759499 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['def main():\n s = input()[::-1]\n l = len(s)\n n = 2019\n dp = [0]*n\n wk = 0\n r = 1\n for i in range(l):\n wk += int(s[i])*r\n wk %= n\n dp[wk] += 1\n r*= 10\n r %= n\n print(sum([i*(i-1)//2 for i in dp]),dp)\nmain()', 'def main():\n s = input()[::-1]\n l = len(s)\n n = 2019\n dp = [0]*n\... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s360686262', 's704166538', 's249863481'] | [9416.0, 9352.0, 9188.0] | [86.0, 87.0, 85.0] | [227, 224, 230] |
p02702 | u860002137 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['import numpy as np\nimport math\n\ns = input()[::-1]\nlength = len(s)\na = np.zeros(length, dtype=int)\nd = np.zeros(length, dtype=int)\nans = np.zeros(2019, dtype=int)\n\nfor i in range(length):\n if i == 0:\n a[i] = int(s[i])\n d[i] = a[i]\n else:\n a[i] = int(s[i]) * pow(10, i) % 2019\n ... | ['Wrong Answer', 'Time Limit Exceeded', 'Accepted'] | ['s473732932', 's844125956', 's690738690'] | [27472.0, 27432.0, 31900.0] | [2206.0, 2206.0, 165.0] | [439, 449, 642] |
p02702 | u861471387 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['S = input()\nB = defaultdict(int)\nB[0]=1\nans=0\n\nfor i in range(len(S)):\n m=int(S[-i-1:])%2019\n ans+=B[m]\n B[m]+=1\n\nprint(int(ans))', 'from collections import defaultdict\n\nS = input()\nB = defaultdict(int)\nB[0]=1\nans=0\nprev=0\n\nfor i in range(len(S)):\n m=(prev+int(S[-i-1])*pow(10,i,2019))%2... | ['Runtime Error', 'Accepted'] | ['s988198229', 's998811403'] | [9164.0, 9644.0] | [22.0, 365.0] | [138, 214] |
p02702 | u861886710 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['S = int(input())\nS = str(S)\nn = len(str(S))\nj = 0\nif n > 4:\n for i in range(n-3):\n for j in range(i+4, n+1):\n nn = int(S[i:j])\n print(nn)\n if nn % 2019 == 0:\n j += 1\nprint(j)', 'S = int(input())\nS = str(S)\nn = len(str(S))\n\nj = 0\nif n > 4:\n ... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s134511662', 's628018027', 's949068370', 's951142006', 's468150753'] | [27120.0, 9216.0, 137328.0, 27172.0, 16776.0] | [2250.0, 781.0, 2013.0, 2248.0, 336.0] | [232, 165, 247, 208, 234] |
p02702 | u863433366 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['S = input()\ns = S[::-1]\n\ncnt = [0]*2019\ns[0] = 1\nnumber = 0\nd = 1\n\nfor i in s:\n number += int(i)*d\n cnt[number % 2019] += 1\n d *= 10\n d = d % 2019\n\nans = 0\nfor i in cnt:\nans += i*(i-1) // 2\n\nprint(ans)', 'S = input()\ns = S[::-1]\n\ncnt = [0]*2019\ncnt[0] = 1\nnumber = 0\nd = 1\n\nfor i in s:\n ... | ['Runtime Error', 'Accepted'] | ['s373164489', 's038855406'] | [9032.0, 9284.0] | [21.0, 105.0] | [205, 209] |
p02702 | u863964720 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['import collections\n\ndef ConZ(i):\n z_num = i+int(i*(i-1)/2)\n return z_num\ndef ConN(i):\n n_num = int(i*(i-1)/2)\n return n_num\n\nS = input()[::-1]\nketa = 1\nA_num = 0\nx = 0\nmod = [0]*2019\nmodcount = []\nfor i in range(len(S)):\n A_num += (int(S[i:i+1])*keta)%2019\n if A_num >= 2019:\n ... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s245793933', 's284510156', 's739280832', 's378519219'] | [9632.0, 11900.0, 27288.0, 27176.0] | [2206.0, 2206.0, 279.0, 289.0] | [591, 556, 703, 687] |
p02702 | u871934301 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['import collections\nS=input()\nl=len(S)\nT=0\nA=[0]*2019\nA[0]=1\nfor i in range(l):\n T+=int(S[l-i-1])*(10**i)\n A[T%2019]+=1\nans = 0\nfor cnt in A:\n ans += cnt * (cnt - 1) // 2\nprint(cnt)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n', 'import collections\nS=input()\nl=len(S)\nT,d=0,1\nA=[0]*2019\nA[0]=1\nfor i in rang... | ['Wrong Answer', 'Accepted'] | ['s947856669', 's187068575'] | [9748.0, 9592.0] | [2206.0, 134.0] | [204, 208] |
p02702 | u872538555 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | [' = input()[::-1]\n\ncounts = [0] * 2019\ncounts[0] = 1\n\nnum, d = 0, 1\n\nfor char in s:\n num += int(char) * d\n num %= 2019\n counts[num] += 1\n d *= 10\n\nans = 0\nfor cnt in counts:\n ans += cnt * (cnt - 1) // 2\n \nprint(ans)', 's = input()[::-1]\n\ncounts = [0] * 2019\ncounts[0] = 1\n\nnum, d... | ['Runtime Error', 'Accepted'] | ['s526475269', 's448201986'] | [8936.0, 9380.0] | [21.0, 110.0] | [232, 247] |
p02702 | u875291233 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['print(len(set(open(0).read().split()))-1)', '# coding: utf-8\n# Your code here!\nimport sys\nreadline = sys.stdin.readline\nread = sys.stdin.read\n\n\ns = input()\n\nMOD = 2019\nd = [0]*MOD\nd[0] = 1\nr = 0\nt = 1\nfor i in reversed(s):\n r += int(i)*t\n r %= MOD\n t *= 10\n t %= MOD\n d[r] += 1\n \... | ['Wrong Answer', 'Accepted'] | ['s061495743', 's854057820'] | [9200.0, 9360.0] | [23.0, 116.0] | [41, 296] |
p02702 | u875541136 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ["import collections\nS = input()\nN = len(S)\nM = [0]\nfor i in range(N):\n M.append(int(S[:i+1] + '0' * (N-1-i)) % 2019)\ncount = collections.Counter(M)\nprint(count)\nprint(sum([c*(c-1)//2 for c in count.values()]))", 'import collections\nS = input()\nN = len(S)\nM = [0]\nmod = 0\nten = 1\nfor s in S[::-1]:\n mod ... | ['Wrong Answer', 'Accepted'] | ['s017973924', 's861868119'] | [9856.0, 16652.0] | [2206.0, 139.0] | [209, 251] |
p02702 | u876438858 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['import sys\nfrom math import sqrt\nfrom collections import Counter, defaultdict, deque\n\ninput = sys.stdin.readline\nsys.setrecursionlimit(10 ** 6)\n\n\ndef I():\n return int(input())\n\n\ndef MI():\n return map(int, input().split())\n\n\ndef LI():\n return list(MI())\n\n\ndef LIN(n: int):\n return [I() ... | ['Wrong Answer', 'Accepted'] | ['s137686478', 's155442152'] | [9648.0, 27308.0] | [2206.0, 278.0] | [790, 483] |
p02702 | u878129968 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['s = input()\nn = len(s)\nsums_from_first_mod = [0] * (n+1)\nfor i in range(1,n+1):\n sums_from_first_mod[i] = (sums_from_first_mod[i-1] + int(s[i-1])) % 3\n# print(sums_from_first_mod)\nind0 = [i for i, x in enumerate(sums_from_first_mod) if x == 0]\nind1 = [i for i, x in enumerate(sums_from_first_mod) if x == 1]\... | ['Wrong Answer', 'Accepted'] | ['s684179899', 's797090407'] | [21780.0, 9200.0] | [2206.0, 124.0] | [617, 235] |
p02702 | u884601206 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['s=input()\ns=s[::-1]\nn=len(s)\ncount=[0]*2019\nnum,d=0,1\n\nfor i in s:\n num+=int(i)*d\n num%=2019\n d*=10\n d%=2019\n count[num]+=1\n\nans=0\nfor i in count:\n ans+=i*(i-1)//2\n \nprint(ans)\n\n ', 's=input()\ns=s[::-1]\nn=len(s)\ncount=[0]*2019\ncount[0]=1\nnum,d=0,1\n\nfor i in s:\n num+=int(i)*d\n num... | ['Wrong Answer', 'Accepted'] | ['s075757994', 's428679828'] | [9256.0, 9276.0] | [116.0, 112.0] | [187, 198] |
p02702 | u884982181 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['import sys\nfrom collections import deque\nfrom collections import defaultdict\nimport math\nimport copy\n#input = sys.stdin.readline\nsys.setrecursionlimit(20000000)\ns = input()\ns = s[::-1]\nn = len(s)\ndp = [0]*(n+1)\nk = 1\na = defaultdict(int)\na[0]+=1\nfor i in range(n):\n dp[i] = (dp[i-1]+int(s[i])*k)%2019\n... | ['Wrong Answer', 'Accepted'] | ['s647434729', 's228050397'] | [16896.0, 16864.0] | [165.0, 149.0] | [399, 404] |
p02702 | u888092736 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['from collections import Counter\nfrom operator import mul\nfrom functools import reduce\n\n\ndef cmb(n, r):\n r = min(n - r, r)\n if r == 0:\n return 1\n over = reduce(mul, range(n, n - r, -1))\n under = reduce(mul, range(1, r + 1))\n return over // under\n\n\ns = input()[::-1]\nacc = [int(s[0])... | ['Wrong Answer', 'Accepted'] | ['s653442968', 's487772746'] | [32548.0, 9736.0] | [2275.0, 315.0] | [545, 301] |
p02702 | u888337853 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ["import sys\n\n# import re\nimport math\nimport collections\n\nimport bisect\nimport itertools\nimport fractions\n# import functools\nimport copy\nimport heapq\nimport decimal\n# import statistics\nimport queue\n\n# import numpy as np\n\nsys.setrecursionlimit(10000001)\nINF = 10 ** 16\nMOD = 10 ** 9 + 7\n# MOD = 99824... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s010194503', 's124494033', 's368577298'] | [10888.0, 10848.0, 10876.0] | [86.0, 33.0, 95.0] | [840, 835, 842] |
p02702 | u892305365 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['s = list(input())\nmods = [0]*(len(s))\ncountRemainder = [0] * 2019\ncnt = 0\n\nfor i in range(len(s)):\n if i == 0:\n mods[0] = int(s[-1])\n else:\n mods[i] = mods[i-1] + (10**i % 2019) * int(s[len(s) - i - 1])\n countRemainder[mods[i]] += 1\n\ncountRemainder[0] += 1\n\nfor i in range(2019):\n... | ['Runtime Error', 'Accepted'] | ['s450178980', 's160171658'] | [11620.0, 11884.0] | [26.0, 148.0] | [380, 349] |
p02702 | u896741788 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['s=input()\na=0\nl=[0]*2019\nfor i in list(s):\n a=(a*10+int(i))%2019\n l[a]+=1\nans=0\nfor i in l:\n ans+=(i-1)*i//2\nprint(ans+l[0])\n', 's=input()\na=0\nnow=1\nl=[0]*2019\nfor i in list(s)[::-1]:\n a=(a+now*int(i))%2019\n l[a]+=1\n\n now*=10\n now%=2019\nans=0\nfor i in l:\n ans+=(i-1)*i//2\... | ['Wrong Answer', 'Accepted'] | ['s964854534', 's715884989'] | [10344.0, 12172.0] | [83.0, 104.0] | [134, 173] |
p02702 | u901582103 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['s=input()\nn=len(s)\nc=0\nd=0\nfor i in range(n):\n for j in range(i+1,n+1):\n if int(s[i:j])%2019==0:\n c+=1\n print(s[i:j])\n d+=1\nprint(c)', 'from collections import Counter\ns=input()\nn=len(s)\nMOD=2019\nL=[0]\nfor i in range(n):\n l=(int(s[n-1-i])*pow(10,i,MOD)+L[i])%M... | ['Wrong Answer', 'Accepted'] | ['s466562197', 's186930651'] | [12128.0, 16740.0] | [2221.0, 354.0] | [171, 212] |
p02702 | u908763441 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['\nimport numpy as np\n\ns = input()[::-1]\nlength = len(s)\na = np.zeros(length, dtype=int)\nd = np.zeros(length, dtype=int)\nans = np.zeros(2019, dtype=int)\nx = 1\n\na[0] = int(s[0])\nd[0] = a[0]\nans[0] = 1\nans[d[0]] += 1\n\nfor i in range(1, length):\n a[i] = int(s[i]) * x % 2019\n d[i] = (d[i-1] + a[i]) %... | ['Wrong Answer', 'Time Limit Exceeded', 'Accepted'] | ['s340711073', 's616621925', 's999157309'] | [30328.0, 9268.0, 9312.0] | [439.0, 2206.0, 128.0] | [471, 612, 1692] |
p02702 | u909616675 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['s=int(input())\nn=len(str(s))\na=[0]*2019\nans=0\nk=s%2019\na[k]+=1\nfor i in range(n):\n s=int(s*0.1)\n k=s%2019\n a[k]+=1\nfor i in range(2019):\n ans+=a[i]*(a[i]-1)/2\n\nprint(int(ans))', 's=input()\nn=len(s)\na=[0]*2019\na[0]=1\nk=0\nans=0\nmod=1\nfor i in range(n-1,-1,-1):\n k=(k+int(s[i])*mod)%2019\n mod=... | ['Runtime Error', 'Accepted'] | ['s959635390', 's766837278'] | [9276.0, 9288.0] | [717.0, 109.0] | [179, 184] |
p02702 | u914802579 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['a=2019\nfor i in range(int(a**0.5)):\n if a%i==0:\n print(i)\n break', 's = input()\np=2019;n=len(s)\ndigit_rm = [0 for _ in range(n)]\nfor i in range(n):\n\tdigit_rm[i] = (int(s[n-1-i]) * pow(10, i, p) ) % p\n\nremain = [0 for _ in range(n)]\nfor i in range(n):\n\tif i == 0:\n\t\tremain[i] = digit_rm[i]\n\tel... | ['Runtime Error', 'Accepted'] | ['s323270630', 's530963677'] | [9408.0, 23816.0] | [21.0, 418.0] | [71, 419] |
p02702 | u922952729 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['S=input()\nlength=len(S)\nS=int(S)\nprint(0)', "from functools import lru_cache\n\n\n\nS=input()\ncount=[0 for i in range(2019)]\nlength=len(S)\n#S=int(S)\nS=S+'0'\nS=S[::-1]\n_S=0\n\nbase=1\nfor i,s in enumerate(S):\n _S=base*int(s)+_S\n count[_S%2019]+=1\n base*=10\n base=base%2019\n _S=_S%2019\n\n\n... | ['Wrong Answer', 'Accepted'] | ['s490691718', 's932204149'] | [9240.0, 9748.0] | [205.0, 132.0] | [41, 340] |
p02702 | u935642171 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['s = input()\nmul = set(str(2019*i) for i in range(1,100))\nans = 0\nfor m in mul:\n ans += s.count(m)\nprint(ans)', 'S = input()[::-1]\nans = 0\nmods = [0] * 2019\nmods[0] = 1\ncurrent = 0\nx = 1\nfor s in S:\n current = (current + x * int(s)) % 2019\n ans += mods[current % 2019]\n mods[current % 2019] += 1\n x ... | ['Wrong Answer', 'Accepted'] | ['s625077708', 's758635406'] | [9120.0, 9124.0] | [55.0, 141.0] | [109, 216] |
p02702 | u961674365 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['s=input()\nn=len(s)\nrst=[0 for j in range(2019)]\nx=0\nans=0\nfor i in range(n):\n y=(int(s[n-1-i])*(10**i))%2019\n x+=y\n if x>=2019:\n x%=2019\n print(x,y)\n ans+=rst[x]\n rst[x]+=1\nif rst[0]==1:\n ans+=1\n\nprint(ans)', 's=input()\nn=len(s)\nrst=[0 for j in range(2019)]\nrst[0]=1\nx=0... | ['Wrong Answer', 'Accepted'] | ['s801753575', 's419202249'] | [9516.0, 9364.0] | [2206.0, 158.0] | [234, 279] |
p02702 | u969708690 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['a=0\nS=int(input())\nfor i in range(N-3):\n for j in range(i+3,N+1):\n A=int(float(S[i:j+1]))\n if A%2019==0:\n a=a+1\nprint(a)', 'ans=0\nS=input()\na=len(S)\nk=0\nc=dict()\nmod=2019\ns=1\nc[0]=1\nfor i in range(a):\n k+=(s*int(S[a-i-1]))\n k%=mod\n s*=10\n s%=mod\n if k in c:\n c[k]+=1\n else:\n... | ['Runtime Error', 'Accepted'] | ['s130629809', 's359002708'] | [9148.0, 9192.0] | [203.0, 157.0] | [132, 216] |
p02702 | u971124021 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ["from collections import Counter\nS = input()\nS = S + '0'\nmod = 2019\np = [-1] * len(S)\nr = 0\nd = 1\nfor i,s in enumerate(S[::-1]):\n t = int(s)%mod\n r += t*d\n r %= mod\n d = d*10%mod\n p[i] = r\n\nans = 0\nc = Counter(p)\nfor k,n in c.most_common():\n if n > 1 ans n%2 == 0:\n ans += n//2\n else:break\... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s380879729', 's479262528', 's829488064', 's854730207', 's160607426'] | [8872.0, 288820.0, 288524.0, 513300.0, 16604.0] | [25.0, 2213.0, 2216.0, 2220.0, 151.0] | [309, 259, 260, 243, 302] |
p02702 | u975445930 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['S = input()\nT = [0]*2019\nT[0]=1\nt = 0\nans = 0\ndig = 1\nfor i in range(n):\n t = (t + (int(S[-i-1]))*dig)%2019\n dig = dig*10%2019\n T[t] += 1\nfor j in T:\n ans +=int(j*(j-1)/2)\nprint(ans)', 'S = input()\nT = [0]*2019\nT[0]=1\nt = 0\nans = 0\ndig = 1\nfor i in range(n):\n t = (t + (int(S[-i-1]))*... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s272032781', 's749327407', 's707802946'] | [9280.0, 9300.0, 9236.0] | [22.0, 23.0, 114.0] | [194, 196, 201] |
p02702 | u977490411 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['S = input()\n\nc = [0] * 2019\nfor i in range(len(S)):\n c[int(S[i:])%2019] += 1\n\nans = 0\nfor m in c:\n ans += m * (m - 1) / 2\n\nprint(int(ans)) ', 'S = input()\n\nmod = [0] * 2019\nmod[0] = 1\ndigit = 1\ntemp = 0\n \nfor i in S[::-1]:\n temp = (temp + digit * int(i)) % 2019\n mod[temp] += 1\n digi... | ['Wrong Answer', 'Accepted'] | ['s641856364', 's107571120'] | [9388.0, 9236.0] | [2206.0, 97.0] | [145, 235] |
p02702 | u988661952 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['S=input()\nn=len(S)\ndef T(i):\n if i == 0:\n return 0\n else:\n i-=1\n return T(i)+(10**i)*int(S[n-1-i])\ns=[0]*2018\nfor j in range(1,n+1):\n print(T(j))\n m=T(j)%2019\n s[m]+=1\n\nc=s[0]\n\nfor m in s:\n c += m*(m-1)/2\n\nprint(int(c))', 'S=input()\nn=len(S)\ndef T(i):\n i... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s268376842', 's609818135', 's768194390', 's674820330'] | [9972.0, 10144.0, 10136.0, 9148.0] | [1460.0, 1461.0, 1466.0, 327.0] | [258, 259, 258, 193] |
p02702 | u990653216 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['import collections\nimport sys\nS = input()[::-1]\n \nMOD=2019\nX = [0]\nfor i, s in enumerate(S):\n X.append((X[-1]+int(s)*pow(10,i,MOD))%MOD)\n \nc = collections.Counter(X)\nans = 0\nfor v in C.values():\n ans += v * (v - 1) // 2\nprint(ans)', 'import collections\nimport sys\nS = input()[::-1]\nif len(S... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s865880277', 's968882006', 's202990742'] | [16580.0, 16556.0, 16608.0] | [326.0, 336.0, 329.0] | [242, 284, 242] |
p02702 | u996665352 | 2,000 | 1,048,576 | Given is a string S consisting of digits from `1` through `9`. Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition: Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019. | ['s = input()\nc = 0\nfor i in range(len(s)):\n for j in range(i+4,len(s)+1):\n a = int(s[i:j])\n if a>=2019 and a%3==0 a%673==0:\n c += 1\nprint(c)', 's = input()\nc = 0\nfor i in range(len(s)):\n for j in range(i+4,len(s)+1):\n a = int(s[i:j])\n print(a)\n if a>2019... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s053064859', 's526342367', 's659512377'] | [9028.0, 27496.0, 9280.0] | [26.0, 2325.0, 122.0] | [167, 191, 210] |
p02703 | u075595666 | 2,000 | 1,048,576 | There are N cities numbered 1 to N, connected by M railroads. You are now at City 1, with 10^{100} gold coins and S silver coins in your pocket. The i-th railroad connects City U_i and City V_i bidirectionally, and a one- way trip costs A_i silver coins and takes B_i minutes. You cannot use gold coins to pay the fare... | ['import sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\nfrom heapq import heappush, heappop\n\nN,M,S = map(int,readline().split())\nABC = [list(map(int,readline().split())) for _ in range(M)]\nm = map(int,read().split())\nCD = list(zip(m,m))\n\ngraph =... | ['Runtime Error', 'Accepted'] | ['s383353538', 's222431402'] | [9368.0, 24304.0] | [21.0, 491.0] | [1401, 1401] |
p02703 | u375616706 | 2,000 | 1,048,576 | There are N cities numbered 1 to N, connected by M railroads. You are now at City 1, with 10^{100} gold coins and S silver coins in your pocket. The i-th railroad connects City U_i and City V_i bidirectionally, and a one- way trip costs A_i silver coins and takes B_i minutes. You cannot use gold coins to pay the fare... | ['from collections import defaultdict\nimport heapq\nN,M,S = map(int,input().split())\nE=[list(map(int,input().split())) for _ in range(M)]\n\nC=[list(map(int,input().split())) for _ in range(N)]\n\nA_max=max([a for _,_,a,_ in E])\n\nD=defaultdict(lambda :[])\n\nfor u,v,a,b in E:\n u-=1;v-=1\n for from_a in range... | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s170953917', 's750393969', 's947580581', 's988503838', 's782233828'] | [27004.0, 26668.0, 9708.0, 9884.0, 155688.0] | [157.0, 154.0, 26.0, 29.0, 1947.0] | [1367, 1367, 1081, 1081, 1330] |
p02703 | u380524497 | 2,000 | 1,048,576 | There are N cities numbered 1 to N, connected by M railroads. You are now at City 1, with 10^{100} gold coins and S silver coins in your pocket. The i-th railroad connects City U_i and City V_i bidirectionally, and a one- way trip costs A_i silver coins and takes B_i minutes. You cannot use gold coins to pay the fare... | ["def main(): \n import heapq\n \n n, m, s = map(int, input().split())\n if s >= 2500:\n s = 2499\n \n edges = [[] for _ in range(n)]\n for _ in range(m):\n from_, to, cost, time = map(int, input().split())\n edges[from_-1].append((to-1, cost, time))\n edges[to-1].app... | ['Wrong Answer', 'Accepted'] | ['s788140344', 's703572133'] | [10192.0, 23840.0] | [25.0, 494.0] | [1546, 1548] |
p02703 | u581187895 | 2,000 | 1,048,576 | There are N cities numbered 1 to N, connected by M railroads. You are now at City 1, with 10^{100} gold coins and S silver coins in your pocket. The i-th railroad connects City U_i and City V_i bidirectionally, and a one- way trip costs A_i silver coins and takes B_i minutes. You cannot use gold coins to pay the fare... | ['\nfrom heapq import heappush, heappop\ndef resolve():\n INF = float(\'inf\')\n maxMoney = 2502\n\n def Dijkstra(g):\n ans = {}\n \n dp = [[INF] * (maxMoney + 1) for _ in range(N)]\n # (time, node, silver)\n hq = []\n heappush(hq, (0, 0, min(S, maxMoney)))\n wh... | ['Runtime Error', 'Accepted'] | ['s108486968', 's915475374'] | [9132.0, 24404.0] | [24.0, 494.0] | [1776, 1777] |
p02703 | u678167152 | 2,000 | 1,048,576 | There are N cities numbered 1 to N, connected by M railroads. You are now at City 1, with 10^{100} gold coins and S silver coins in your pocket. The i-th railroad connects City U_i and City V_i bidirectionally, and a one- way trip costs A_i silver coins and takes B_i minutes. You cannot use gold coins to pay the fare... | ["N, M, S = map(int, input().split()) \n\n# U = [0]*M \n# V = [0]*M\n\n\ntrain = [[] for _ in range(N)]\nfor i in range(M):\n u,v,a,b = map(int, input().split())\n train[u-1].append([v-1,a,b])\n train[v-1].append([u-1,a,b])\n\n\n\nfor i in range(N):\n c,d = map(int, input().split())\n train[i].append([i,... | ['Wrong Answer', 'Accepted'] | ['s229747432', 's162144215'] | [348928.0, 44744.0] | [2215.0, 1115.0] | [923, 1945] |
p02703 | u707498674 | 2,000 | 1,048,576 | There are N cities numbered 1 to N, connected by M railroads. You are now at City 1, with 10^{100} gold coins and S silver coins in your pocket. The i-th railroad connects City U_i and City V_i bidirectionally, and a one- way trip costs A_i silver coins and takes B_i minutes. You cannot use gold coins to pay the fare... | ['from heapq import heappop, heappush\n\nimport sys\ndef input():return sys.stdin.readline().strip()\n\ndef main():\n N, M, S = map(int, input().split())\n to = [{} for _ in range(N)]\n for _ in range(M):\n u, v, a, b = map(int, input().split())\n u -= 1\n v -= 1\n to[u][v] = (a, b... | ['Wrong Answer', 'Accepted'] | ['s398595714', 's578317329'] | [35952.0, 36544.0] | [779.0, 1028.0] | [1375, 1376] |
p02703 | u729133443 | 2,000 | 1,048,576 | There are N cities numbered 1 to N, connected by M railroads. You are now at City 1, with 10^{100} gold coins and S silver coins in your pocket. The i-th railroad connects City U_i and City V_i bidirectionally, and a one- way trip costs A_i silver coins and takes B_i minutes. You cannot use gold coins to pay the fare... | ['from scipy.sparse import*\n(n,m,s,*D),*t=[map(int,t.split())for t in open(0)]\nR,C=[],[]\nx=51\nr=range(x*x)\nfor u,v,a,b in t[:m]:\n for i in r:k=(i+a)*x;R+=k+u,k+v;C+=i*x+v,i*x+u;D+=b,b\ni=0\nfor c,d in t[m:]:\n i+=1\n for j in r:R+=j*x+i,;C+=(j+c)*x+i,;D+=d,\nd=csgraph.dijkstra(csr_matrix((D,(R,C)),[x*j]*2),1,min(... | ['Runtime Error', 'Runtime Error', 'Time Limit Exceeded', 'Runtime Error', 'Runtime Error', 'Time Limit Exceeded', 'Wrong Answer', 'Accepted'] | ['s015007297', 's235924742', 's393219425', 's463032591', 's681834488', 's955474308', 's976870206', 's105773890'] | [103164.0, 9052.0, 126892.0, 108424.0, 91020.0, 126772.0, 122888.0, 126748.0] | [621.0, 20.0, 2209.0, 2207.0, 402.0, 2209.0, 782.0, 765.0] | [363, 358, 349, 366, 366, 349, 440, 350] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.