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
u202634017
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\ns = list(input())\nls = len(s)\nT = [0] * (ls+1)\nmodL = [0]\ncnt = 0\npad = 1\n\nfor i in reversed(range(0, ls)):\n T[i] = T[i+1] + int(s[i]) * pad\n modL.append(T[i] % 2019)\n pad = pad * 10 % 2019\n\nprint(modL)\n\nans = 0\nfor c in Counter(modL).values():\n ans += c ...
['Wrong Answer', 'Accepted']
['s484415120', 's932677450']
[28432.0, 26164.0]
[169.0, 156.0]
[327, 314]
p02702
u203383537
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\nt=0\nx=1\nans=0\ncnt=[0]*2019\n\nfor i in s:\n t += int(i)*x\n t %= 2019\n x *= 10\n x %= 2019\n cnt[t]+=1\n\nfor i in cnt:\n ans +=i*(i-1)//2\n\nprint(ans) ', 's=input()\ns=s[::-1]\n\nt=0\n\nx=1\ncnt=[0]*2019\ncnt[0]=1\n\n\nfor i in s:\n t += int(i)*x\n t %= 2019\n ...
['Wrong Answer', 'Accepted']
['s446015540', 's350774600']
[9388.0, 9188.0]
[110.0, 115.0]
[181, 194]
p02702
u204616996
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)\nif N<4:\n print(0)\n exit(0)\nM=2019\nX=S\nans=0\nx=[]\nfor l in range(N-3):\n for r in range(l+3,N):\n if int(X[l:r+1])%M==0:\n ans+=1\n x.append([l,r])\n break\ndef search(a,x,j):\n while j<len(x):\n if a[1]==x[j][0]:\n return 1+search(x[j],x,j+1)\n j+=1\n retu...
['Wrong Answer', 'Accepted']
['s118191275', 's076036810']
[9780.0, 9788.0]
[2206.0, 351.0]
[364, 228]
p02702
u207097826
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()\nmod2019 = [0]*(len(S)+1)\n\nfor i in range(len(S)-1):\n mod2019[i] = int(S[i:len(S)-1])%2019\n\nanswer = 0\ncount = [0 for _ in range(2020)]\n\n\nfor i in range(len(S)):\n answer += count[mod2019[i]]\n count[mod2019[i]] += 1\nprint(answer)', 'S = input()\nmod2019 = [0]*(len(S)+1)\n\nfor i in ran...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s101412618', 's143159531', 's272531909', 's422603238', 's514581848', 's920915497', 's470753989']
[11032.0, 10972.0, 11008.0, 10980.0, 10956.0, 11020.0, 16384.0]
[2206.0, 2206.0, 2206.0, 2206.0, 2206.0, 2206.0, 165.0]
[248, 238, 253, 255, 240, 246, 362]
p02702
u211160392
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.
['# 2019 = 3*673\nMOD = 2019\nS = input()\nN = len(S)\nX = [0]*2100\nX[0] += 1\ntmp = 0\nhoge = pow(10,N,2019)\n\nfor i in range(N):\n tmp = (tmp*10+int(S[i]))%MOD\n hoge = (hoge*202)%MOD \n X[(tmp*hoge)%MOD] += 1\n\nans = 0\n\nfor i in X:\n if i >= 2:\n ans += (i*i-1)\n\nprint(ans)', '# 2019 = 3*673...
['Wrong Answer', 'Accepted']
['s430590873', 's486350919']
[9372.0, 9324.0]
[122.0, 127.0]
[280, 268]
p02702
u213497190
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\ns = input()[::-1]\nn = len(s)\ncounts = [0] * 2019\ncounts[0] = 1\ncurrent = 0\nd = 0\n\nfor i in range(n):\n current += int(s[i]) * 10**d\n d += 1\n current %= 2019\n counts[current] += 1\n\nans = 0\nfor i, count in enumerate(counts):\n if count > 1:\n print(i...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s471764557', 's655993301', 's847325161', 's915805891']
[9696.0, 9732.0, 9844.0, 9324.0]
[2206.0, 2206.0, 2206.0, 110.0]
[536, 227, 219, 306]
p02702
u218838821
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(str,input()))\n\ncounter = 0\n\nfor i in range(len(S)):\n for j in range(1,len(S)-i):\n s = int("".join(S[i:i+j]))\n if s % 2019 == 0:\n counter += 1\n\nprint(counter)', 'S = list(map(int,input()))[::-1] \n\ncounter = 0\namari = [0]*2019\namari[0] = 1\n\ns,d = 0,1\n\nfor i in ...
['Wrong Answer', 'Accepted']
['s529944661', 's090343588']
[10524.0, 12024.0]
[2206.0, 104.0]
[198, 259]
p02702
u221061152
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_int = int(S)\nmods_count = collections.Counter([int(S[i:])%2019 for i in range(len(S))])\ncount = 0\nfor mod in mods_count:\n c = mods_count[mod]\n if c > 1:\n count += c*(c-1)//2\nprint(count)', 'S=input()\ndp = [0]*2019\ndp[0]+=1\n\np=0\nq=1\nfor i in reversed(range(len(S)-1)...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s423051701', 's804999684', 's880218154']
[9852.0, 9196.0, 9336.0]
[2206.0, 103.0, 133.0]
[223, 176, 212]
p02702
u227020436
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# -*- coding: utf-8 -*-\n\n# D - Multiple of 2019\n\ns = input()\n\ncount = 0\ncounter = Counter([0])\n\nsuffix = 0\npow = 1\nfor i in range(len(s) - 1, -1, -1):\n suffix = (int(s[i]) * pow + suffix) % 2019\n pow = pow * 10 % 2019\n count += counter[suffix]\n counter[suffix] += 1\n...
['Runtime Error', 'Accepted']
['s657845054', 's354040062']
[9284.0, 9676.0]
[21.0, 169.0]
[315, 300]
p02702
u237299453
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(a) for a in input()[::-1]]\n\nm = 2019\nn = len(S)\n\nf = 0\n\np = 1\n\nX = [0] * 2019\n\nX[0] = 1\n\nq = 0\n\nfor a in S:\n f = (f + a * p) % m\n q += X[f]\n \n X[s] += 1\n \n p = p * 10 % m\n \n\nprint(q)', 'n =input()\n\n\ndef judge(x):\n \n if x % 2019 == 0:\n return(1)\n else:\n ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s042740142', 's841309715', 's478482712']
[10840.0, 9256.0, 10832.0]
[48.0, 20.0, 123.0]
[209, 219, 197]
p02702
u237327356
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 = 2019\n\nd=[0]*(n+1)\nk=1\nfor i in range(n):\n d[i+1]=d[i]+k*int(s[n-i-1])\n d[i+1]%=mod\n k*=10\n k%=mod\n\ncount = [0]*mod\nfor i in range(n+1):\n count[d[i]] += 1\n\nans = 0\nfor i in range(mod):\n c = count[i]\n ans += c*(c-1) / 2\n\nprint(ans)\n', 's = li...
['Wrong Answer', 'Accepted']
['s563578576', 's804562328']
[17712.0, 17800.0]
[177.0, 176.0]
[286, 287]
p02702
u243312682
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()\n s_len = len(s)\n s_rev = reversed(s)\n mod = 2019\n d = [0] * mod\n d[0] = 1\n rev_num = 0\n \n for i in range(l_len):\n rev_num += int(s_rev(i)) * (10**i%mod)\n rev_num %= mod\n d[rev_num] += 1\n \n \n print(sum(i*(i-1)//2 for i in ...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s661372458', 's788806363', 's506641422']
[9164.0, 9128.0, 9336.0]
[21.0, 27.0, 859.0]
[501, 642, 680]
p02702
u249218427
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 -*-\nS = input()\nprint(len(S))\ndict_amari = {}\ncount = 0\n\nhenkan = {i: [(10*j+i)%2019 for j in range(2019)] for i in range(1,10)}\n\ndef amari_new(dict_amari, s, henkan):\n dict_amari_new = {henkan[k] : v for k,v in dict_amari.items()}\n if s in dict_amari_new.keys():\n dict_amari_new[s]...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s117835949', 's751774107', 's220249421']
[9992.0, 9192.0, 9120.0]
[2206.0, 122.0, 123.0]
[514, 294, 306]
p02702
u250664216
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()\ncount = 0\nleft = -1\nright = 4\nfor i in range(len(s)-4):\n for j in range(i+4,len(s)):\n if int(s[i:j]) % 2019 == 0:\n left = i\n right = j\n break\n\nif left >= 0:\n while right <= len(s):\n if int(s[left:right]) % 2019 == 0:\n # print(s[...
['Wrong Answer', 'Accepted']
['s939870334', 's196272898']
[9312.0, 8908.0]
[2206.0, 110.0]
[447, 227]
p02702
u250828304
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\np = 2019\nN = len(S)\nt = [0]*(N+1)\nfor i in range(N-1,-1,-1):\n k = (int(S[i]) * pow(10,N-i-1,p))%p\n t[i] = (t[i+1]+k)%p\nt= t[:N]\ncnt = [0]*p\nfor i in range(N):\n cnt[t[i]]+=1 \nans = 0\nfor i in range(p):\n m = cnt[i]\n ans += (m*(m-1))\nprint(ans)', 'S = input()\n\np = 7\nN = len(S)\nt = [...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s214479087', 's383797916', 's782314210', 's928940373', 's905942410']
[17872.0, 12224.0, 17772.0, 18052.0, 17892.0]
[382.0, 289.0, 384.0, 379.0, 384.0]
[259, 309, 271, 270, 319]
p02702
u253389610
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\n\n\ndef count_multi(s, d):\n m = a = np.array([c for c in s]).astype(np.int)\n keta = 1\n count = np.count_nonzero(m == 0)\n while len(m) > 1:\n m = (m[:-1]*10 + a[keta:]) % d\n keta += 1\n count += np.count_nonzero(m == 0)\n return count\n \nprint(count_multi(input().strip()*...
['Wrong Answer', 'Time Limit Exceeded', 'Runtime Error', 'Accepted']
['s078090754', 's294496935', 's317043580', 's901242774']
[1114456.0, 33624.0, 8956.0, 9364.0]
[2232.0, 2207.0, 23.0, 78.0]
[318, 321, 319, 330]
p02702
u266014018
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# import os\n# import numpy as np\n# path = os.path.join(os.getcwd(),'input.txt')\n# input = open(path).readline\n\nS = input()\ncand = np.zeros(2019,dtype=int)\nans = 0\nrem = 0\nfor i,s in enumerate(S[::-1]):\n rem += int(s)*(10**i)\n rem %= 2019\n cand[rem] +=1\nans = cand[0]\ncand = cand[c...
['Runtime Error', 'Accepted']
['s445194823', 's513356595']
[9192.0, 27324.0]
[21.0, 284.0]
[361, 394]
p02702
u267718666
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()\nP = [0 for _ in range(len(S)+1)]\nmod = 2019\nd = 1\nfor i in range(len(S), 0, -1):\n P[i-1] = int(S[i-1])*d + P[i]\n P[i-1] = P[i-1] % mod\n d *= 10\n\nfor p in P:\n A[p] += 1\n\nans = 0\nfor a in A:\n ans += a*(a-1)//2\nprint(ans)', 'from collections import Counter\nS = input()\nP = [0] ...
['Runtime Error', 'Accepted']
['s279374302', 's896318555']
[12528.0, 16544.0]
[2206.0, 164.0]
[245, 278]
p02702
u268210555
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\ns = input()\ny = 2019\ndp = np.zeros(y, dtype="int64")\ntmp = np.zeros(y, dtype="int64")\nk = 1\nr = 0\nfor c in s[::-1]:\n i = int(c)*k%y\n tmp[i:] = dp[:y-i]\n tmp[:i] = dp[-i:]\n tmp[i] += 1\n dp, tmp = tmp, dp\n r += dp[0]\n k *= 10\n k %= y\nprint(r) 1', 'from collecti...
['Runtime Error', 'Accepted']
['s908305475', 's678176123']
[8956.0, 9932.0]
[20.0, 175.0]
[285, 193]
p02702
u268318377
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\nS = [int(s) for s in input()]\ny = 2019\nT = [S[-1]] * len(S)\n\nfor i in range(len(S)-2, -1, -1):\n T[i] = (T[i+1] + S[i] * 10) % y\n\ncnt = 0\nfor c in Counter(T).values():\n cnt += c * (c - 1) // 2\n \nprint(cnt)', 'from queue import deque\n\n\nS = deque(input())\nmod = 2019\n...
['Wrong Answer', 'Accepted']
['s419301522', 's574065642']
[18148.0, 11152.0]
[109.0, 135.0]
[240, 262]
p02702
u272336707
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())\nL = len(s)\ndict = {}\nfor i in range(L):\n amari = s[i:] % 2019\n if not(amari in dict.keys()):\n dict[amari] = 1\n else:\n dict[amari] += 1\nans = 0\nfor key in dict.keys():\n ans += (dict[amari]*(dict[amari]-1))/2\nprint(ans)', 's = str(input())\nL = len(s)\ndict = {}\nfor i in range(L)...
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s035910473', 's528597778', 's617250648', 's661029809', 's725015932', 's970068220', 's652186413']
[9280.0, 9424.0, 9424.0, 9568.0, 9540.0, 9428.0, 9276.0]
[23.0, 2206.0, 2206.0, 2206.0, 2206.0, 2206.0, 336.0]
[244, 273, 325, 260, 250, 252, 276]
p02702
u281796054
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_inv = str(input())[::-1]\ndp = [1]+[0]*2018\nans = 0\nnum = 0\nk = 1 \nfor i in range(len(s_inv)):\n num+=int(s_inv[i])*k % 2019\n dp[num] += 1\n k = k*10 % 2019\nfor i in dp:\n ans += i*(i-1)/2', 'S=int(input())\nm=S//2019\nans=0\nbaisu=[]\nfor i in range(m):\n baisu.append(2019*(i+1))\nfor num in basiu:\n i...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s104062495', 's474919999', 's554934268', 's507219198']
[9396.0, 617096.0, 9260.0, 9288.0]
[22.0, 2226.0, 23.0, 117.0]
[190, 147, 186, 233]
p02702
u289162337
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 = int(s)\nmods = [a%2019]\nfor i in range(len(s)):\n a = int((a-int(s[-(i+1)]))/10)\n mods.append(a%2019)\nmod_N ={}\nfor i in mods:\n if not i in mod_N:\n mod_N[i] = 1\n else:\n mod_N[i] += 1\nans = 0\nfor i in mod_N:\n ans += int(mod_N[i]*(mod_N[i]-1)/2)\nprint(ans)', 's = input()\na = int...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Time Limit Exceeded', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Runtime Error', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Wrong Answer', 'Accepted']
['s039084854', 's069585952', 's079432441', 's162692479', 's183063486', 's220030418', 's262904883', 's373012543', 's495253903', 's497325731', 's623762633', 's733519563', 's734692058', 's940146620', 's952004213']
[9212.0, 9652.0, 9376.0, 9300.0, 19232.0, 9580.0, 9368.0, 9032.0, 19400.0, 9600.0, 9284.0, 9492.0, 9496.0, 9428.0, 9352.0]
[205.0, 2206.0, 222.0, 293.0, 2206.0, 2206.0, 217.0, 21.0, 2206.0, 2205.0, 204.0, 2205.0, 2206.0, 295.0, 101.0]
[279, 208, 200, 197, 215, 207, 215, 264, 200, 106, 279, 102, 134, 197, 179]
p02702
u293436958
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 = list(input())\na=[int(x) for x in S] \na.reverse()\nprint(a)\n\nn=len(a)\nT=[0]*n\n\nT[0]=a[0]\n\nfor i in range(1,n):\n T[i]=T[i-1]+(a[i]*10**i)\n \n\n\nprint(T)\nL=list()\nfor i in range(n):\n L.append(T[i]%2019)\n \n\nprint(L)\nc = collections.Counter(L)\n\n\nprint(int(len([i[0...
['Wrong Answer', 'Accepted']
['s295040214', 's059730962']
[89108.0, 12348.0]
[2209.0, 128.0]
[457, 255]
p02702
u296557772
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 defaultdict\n\ndef count_substring(s):\n found_remainder = defaultdict(int)\n current_mod = 0\n found_remainder[0] = 1\n\n output = 0\n for i in range(len(s)-1,-1,-1):\n digit = s[i]\n current_mod = (int(digit)*10**(len(s)-1-i) % 2019 + current_mod) % 2019\n ...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s247196076', 's362971122', 's850828895', 's200731286']
[9920.0, 9608.0, 9356.0, 9576.0]
[2206.0, 127.0, 22.0, 124.0]
[478, 666, 317, 667]
p02702
u297667660
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\nount = 0\nfor i in range(N):\n for j in range(i,N):\n if int(S[i:j+1]) % 2019 == 0:\n count = count + 1\n else:\n continue\nprint(count)', 'S = input()[::-1]\nN = len(S)\nl = [0]*2019\nl[0] = 1\nn = 0\nd = 1\n\nfor i in range(N):\n n += int(S[i]) *...
['Runtime Error', 'Accepted']
['s020550262', 's908215703']
[9236.0, 9336.0]
[24.0, 118.0]
[193, 221]
p02702
u306950978
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())\np = [0 for i in range(2019)]\nn = len(s)\nans = 0\nkar = 0\nfor i in range(n):\n kar = kar + int(s[n-1-i])*10**i\n p[kar%2019] += 1\n\nfor i in p:\n ans += i*(i-1)//2\nprint(ans)', 's = list(input())\np = [0 for i in range(2019)]\nn = len(s)\nans = 0\nkar = 0\ndig = 1\nfor i in range(n):\n...
['Wrong Answer', 'Accepted']
['s584129684', 's656617387']
[10644.0, 10416.0]
[2206.0, 121.0]
[195, 278]
p02702
u307516601
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\nsys.setrecursionlimit(10**6)\nreadline = sys.stdin.readline\nS = input()\n\nres = 0\nstart = 0\nmin_length = 4\nend = start+min_length\nmax_end = len(S)\n\nwhile True:\n tmp_s = S[start:end]\n \n if int(tmp_s) % 2019 == 0:\n print(tmp_s)\n res += 1\n \n if end+1 <= max_end:\n end += 1\n eli...
['Wrong Answer', 'Time Limit Exceeded', 'Wrong Answer', 'Accepted']
['s342900507', 's566507672', 's998130143', 's919962313']
[12164.0, 9312.0, 9436.0, 9364.0]
[2348.0, 2206.0, 2206.0, 114.0]
[406, 1067, 1066, 277]
p02702
u307622233
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_len = len(s)\nref = [0] * s_len\n\nfor i in range(1, s_len + 1):\n ref[-i] = int(s[-i]) * pow(10, i, MOD) % MOD\n\nfor i in range(1, s_len):\n ref[-i - 1] += ref[-i]\n ref[-i - 1] %= MOD\n\nref_cnt = Counter(ref)\nans = sum(ref_cnt.values()) - len(ref_cnt)\n\n\nfor i in ref_cnt.values():\n ans += (i - 1...
['Runtime Error', 'Accepted']
['s160967276', 's184776786']
[9056.0, 16748.0]
[24.0, 411.0]
[367, 423]
p02702
u312695001
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 = list(input())\n N = len(S)\n ans = 0\n m = 2019\n div_list = [0]*m\n div_list[0] += 1\n num = 0\n print(N)\n for i in range(N):\n num += 10**i*int(S[N-i-1])\n div_list[num%m] += 1\n\n for item in div_list:\n ans += int(item*(item-1)/2)\n\n print(...
['Wrong Answer', 'Accepted']
['s984948059', 's042978994']
[10496.0, 10564.0]
[2208.0, 301.0]
[347, 394]
p02702
u325956328
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\nsys.setrecursionlimit(10 ** 7)\ndef main():\n A = input()[::-1]\n A = "0" + A\n # lis_num = [int(s) for s in A]\n\n # print(lis_num)\n\n # S = [0] * len(lis_num)\n S = [0] * len(A)\n cnt = [0] * 2019\n cnt[0] = 1\n\n for i in range(len(A) - 1):\n ...
['Runtime Error', 'Accepted']
['s685816414', 's809740343']
[10556.0, 16328.0]
[21.0, 329.0]
[590, 514]
p02702
u331997680
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 for i in reversed(input()):\n n = (n+int(i)*d)%2019\n d = d*10\n mods[n] += 1\n print(n,d)\n print(sum([i*(i-1)//2 for i in mods]))\nmain()\n', "S = list(input())\nP = 0\nfor i in range(len(S)-4):\n for j in range(i+5,len(S)+1):\n M = ''.join(S[...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s620558216', 's769250267', 's750120060']
[33424.0, 27480.0, 9308.0]
[2263.0, 2300.0, 82.0]
[195, 199, 184]
p02702
u346812984
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\nimport numpy as np\n\nsys.setrecursionlimit(10 ** 6)\nINF = float("inf")\nMOD = 10 ** 9 + 7\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef main():\n S = list(input())\n N = len(S)\n\n val = [0] * (2019)\n tenfactor = 1\n cur = 0\n for i in range(N):\n cur = (c...
['Wrong Answer', 'Accepted']
['s858342623', 's703249750']
[28632.0, 28520.0]
[181.0, 184.0]
[543, 561]
p02702
u347600233
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\nfor l in range(len(s)):\n r = l + 4\n while r < len(s) and int(s[l:r]) % 2019 != 0:\n r += 1\n if int(s[l:r]) % 2019 == 0:\n cnt += 1\n print(l, r, s[l:r])\nprint(cnt) ', 's = input()\ncnt = 0\nfor l in range(len(s)):\n r = l + 1\n while r < len(s) and i...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s175272851', 's386872792', 's513722124']
[9408.0, 9272.0, 9212.0]
[2206.0, 25.0, 135.0]
[217, 217, 191]
p02702
u350248178
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()\nm=len(s)\nif n<2019:\n print(0)\n exit()\nfrom collections import Counter\nc=Counter()\ntmp=""\nc[0]+=1\nfor i in s[::-1]:\n tmp=i+tmp\n c[int(tmp)%2019]+=1\n\nll=c.most_common()\nans=0\nfor i,j in ll:\n if j>=2:\n ans+=j*(j-1)//2\n else:\n break\nprint(ans)\n', 's=[int(j) f...
['Runtime Error', 'Accepted']
['s496256527', 's081533039']
[9276.0, 27896.0]
[23.0, 195.0]
[282, 187]
p02702
u364862909
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()\nmem_mod = [0 for i in range(0,2019,1)]\nN = len(S)\ncounter = 0\nS_num_tmp = list(S)\nS_num = list(map(int, S_num_tmp))', 'S=input()\nmem_mod = [0 for i in range(0,2019,1)]\nN = len(S)\ncounter = 0\nS_num_tmp = list(S)\nS_num = list(map(int, S_num_tmp))\ntmp=10\nfor i in range(1,N,1):\n S_num[N-i-1] = S...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s308597425', 's561860217', 's378057338']
[12524.0, 1965576.0, 11216.0]
[42.0, 2254.0, 669.0]
[125, 221, 922]
p02702
u365838886
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(S)\nb = [0] * 2019\ncount = 0\nb[0] = 1\nt = 0\nk = 1\n\nif len(S) < 4:\n print(0)\nelse:\n t = int(S[-1])\n b[t] += 1\n for i in range(1,N):\n k = k * 10 % 2019\n t = (k * int(S[-i-1]) + t) % 2019 \n b[t] += 1\n\nfor i in b:\n count += i*(i-1)//2', 'S = s...
['Wrong Answer', 'Accepted']
['s993235923', 's895905371']
[9268.0, 9168.0]
[125.0, 122.0]
[290, 316]
p02702
u366963613
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 -*-\ns = input()\n# K = [2019, 4038, 6057, 8076, 10095, 12114, 14133, 16152, 18171, 20190, 22209, 24228, 26247, 28266, 30285, 32304, 34323, 36342, 38361, 40380, 42399, 44418, 46437, 48456, 50475, 52494, 54513, 56532, 58551, 60570, 62589, 64608, 66627, 68646, 70665, 72684, 74703, 76722, 78741, 8076...
['Wrong Answer', 'Accepted']
['s523879016', 's908499331']
[9400.0, 9124.0]
[46.0, 101.0]
[1844, 354]
p02702
u367965715
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\n\ns = input()\n\na = np.zeros(len(s)+1, dtype='i8')\nres = 0\nfor i in range(len(s)):\n for k in range(i+4, len(s)+1):\n if int(s[i:k]) % 2019 == 0:\n print(i, k)\n res += a[i] + 1\n a[k] += 1\n break\n\nprint(res)\n", 's = input()[::-1]\n\nres...
['Wrong Answer', 'Accepted']
['s445479761', 's692918198']
[27172.0, 9468.0]
[2206.0, 153.0]
[275, 215]
p02702
u374531474
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\nL = len(S)\nd = 1\nM = 0\nans = 0\nwhile d <= 10 ** 100:\n if '0' in str(d):\n d *= 2019\n continue\n ds = str(d)\n l = len(ds)\n for i in range(L - l):\n if S[i:i + l] == ds:\n ans += 1\n d *= 2019\nprint(ans)\n", 'S = list(map(int, list(input()[::-1])))\...
['Wrong Answer', 'Accepted']
['s001192253', 's355842684']
[9156.0, 12320.0]
[97.0, 126.0]
[257, 199]
p02702
u374671031
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\nN = len(S)\n\nans = 0\nfor i in range(5,N+1):\n for j in range(0,N-i+1):\n Si = S[j:j+i]\n if int(Si) % 2019 == 0:\n ans += 1\n print(Si)\n\nprint(ans)', 'S = input()\ncounts =[0] * 2019\ncounts[0] = 1\nnum, d = 0,1\n\nfor s in S[::-1]:\n num += int(s) *d\n d *= 10\n num %= 2019\n ...
['Wrong Answer', 'Accepted']
['s281346602', 's162780490']
[9436.0, 9272.0]
[2214.0, 109.0]
[171, 224]
p02702
u375253797
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 = int(input())\nNN =str(N)\n\nq = N // 2019\n\nprint(q)\n\ndic = {}\n\nfor num in range(1,q+1):\n keta = len(str(2019*num))\n if str(keta) in dic:\n dic[str(keta)].append(str(2019*num).split())\n else:\n dic[str(keta)] = list(str(2019*num).split())\n\nresult = 0\n\nfor num, s in enumerate(NN)...
['Wrong Answer', 'Accepted']
['s393678901', 's686080285']
[306300.0, 9200.0]
[2216.0, 112.0]
[480, 234]
p02702
u375616706
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 defaultdict\nS = input()\nN = len(S)\n\nD=defaultdict(int)\nprev=0\nans=0\nfor i,s in enumerate(reversed(S)):\n cur=prev+pow(10,i,2019)*int(s)%2019\n ans+=D[cur]\n D[cur]+=1\n prev=cur\nprint(ans)\n', 'from collections import defaultdict\nS = input()\nN = len(S)\n\nD=defaultdict()\...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s226800013', 's599149483', 's402334955']
[30360.0, 9640.0, 9584.0]
[397.0, 25.0, 370.0]
[221, 218, 231]
p02702
u379716238
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\nj = 4\ns = 0\nwhile j < len(S)+1:\n for i in range(s, j-3):\n if int(S[i:j]) % 2019 == 0:\n ans += 1\n j += 4\n s += 4\n j += 1\nprint(ans)', 'S = input()\nmod_bucket = [0] * 2019\nmod_bucket[0] = 1\n \n_S = S[::-1]\nmod = 0\np = 1\nfor i in range(le...
['Wrong Answer', 'Accepted']
['s819591142', 's288962474']
[9380.0, 9332.0]
[2206.0, 105.0]
[196, 255]
p02702
u382407432
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()\ncount=0\nfor i in range(len(N)+1):\n for j in range(i+1,len(N)+1):\n if(int(N[i:j])%3==0):\n continue\n if(int(N[i:j])%673==0):\n count+=1\n\nprint(count)', 'from collections import Counter\nN = input()\nS=0\nmod_count=[0]\nans=0\ni=0\nfor X in N[::-1]:\n S = int(X)*pow(10,i,2019) % 201...
['Wrong Answer', 'Accepted']
['s819025020', 's734999776']
[9172.0, 16920.0]
[2206.0, 353.0]
[175, 260]
p02702
u384124931
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)\nans = 0\nfor i in range(l):\n for j in range(i+1, l+1):\n a =int(s[i:j]) % 10**9+7 \n if a % 2019 % 10**9+7 == 0:\n ans +=1\nprint(ans)', 's=input()[::-1]\nans=0\nu=0\nd=1\nl=[0]*2019\nl[0]=1\nfor i in map(int,s):\n u=u+(i*d)%2019\n l[u]+=1\n d=d*10%2019\nfor i in l:\n ans+=i*...
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s230876708', 's597194326', 's781443421', 's945950694']
[9256.0, 9312.0, 9256.0, 9368.0]
[2205.0, 23.0, 20.0, 102.0]
[164, 151, 151, 158]
p02702
u385649291
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 = list(map(str,input().rstrip()))\n l = len(S)\n result=0 \n \n for i in range(l):\n for j in range(1,l-i+1):\n print(S[i,i+j+1])\n n = int("".join(map(str, St)))\n print(S)\n if n %2019==0:\n result+=1\n print(resul...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s610929075', 's856965288', 's972074871']
[10616.0, 18524.0, 18244.0]
[34.0, 376.0, 322.0]
[358, 521, 522]
p02702
u391589398
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()\ncount = 0\nfor i in range(i, len(S) - 4):\n for j in range(i+4, len(S)):\n if int(S[i:j]) // 2019 == 0:\n count += 1\nprint(count)', 'S = input()\nmod = 2019\n\ncs_mods = {0:1}\ncumsum = 0\ncount = 0\nfor i, s in enumerate(S[::-1]):\n cumsum = (cumsum + int(s) * pow(10, i, mod)) %...
['Runtime Error', 'Accepted']
['s153586688', 's106661429']
[9340.0, 9388.0]
[25.0, 354.0]
[158, 317]
p02702
u391725895
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()\nanswer = 0\nfor i in range(int(int(S))//2019 + 1):\n f = 2019 * i\n if f in S:\n answer += 1\n\nprint(answer)', 'S = input()\nanswer = 0\nfor i in range(-int(-int(S))//2019):\n f = 2019 * i\n if f in S:\n answer += 1\n \nprint(answer)', 'S = input()\nanswer = 0\nfor i in ...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Time Limit Exceeded', 'Accepted']
['s036891374', 's529289698', 's651723289', 's680175557', 's739472229', 's810652330', 's562782873']
[9632.0, 9496.0, 9508.0, 9304.0, 8916.0, 9556.0, 12172.0]
[210.0, 203.0, 204.0, 87.0, 20.0, 2205.0, 118.0]
[128, 134, 123, 301, 179, 128, 275]
p02702
u392319141
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.
['#include <bits/stdc++.h>\nusing namespace std;\n\ntemplate <class A, class B>\nstring to_string(pair<A, B> p);\n\ntemplate <class A, class B, class C>\nstring to_string(tuple<A, B, C> p);\n\ntemplate <class A, class B, class C, class D>\nstring to_string(tuple<A, B, C, D> p);\n\nstring to_string(const string& s) {\n ...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s711079128', 's742977531', 's832850305']
[8948.0, 27212.0, 26924.0]
[20.0, 2206.0, 953.0]
[3638, 372, 295]
p02702
u402629484
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\nfrom collections import defaultdict\n\ndef gen_10exp_mod(n, mod):\n a = 1\n yield a\n for _ in range(1, n):\n a = (a*10) % mod\n yield a\n\ndef main():\n MOD = 2019\n S = input()[::-1]\n \n A = [int(s)*n % MOD for s, n in zip(S, gen_10exp_mod(len(S), MOD))]\n \n ACC = [0]\...
['Wrong Answer', 'Accepted']
['s677162927', 's046213774']
[26364.0, 24100.0]
[146.0, 128.0]
[1153, 1138]
p02702
u408262366
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\n\nlength = len(S)\nfor i in range(0,len(S)-4):\n for j in range(i+4,i+4+length//100):\n if int(S[i:j+1]) % 2019 == 0 and j<length:\n cnt += 1\n\nprint(cnt)', 'S = input()\ncnt = 0\n\nfor i in range(0,len(S)-2):\n for j in range(i+1,len(S)):\n if int(S[i:j+1]) % 2019 == 0:\n cnt...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s208950663', 's456723786', 's828711262', 's473213831']
[9404.0, 9392.0, 9260.0, 16636.0]
[2206.0, 2206.0, 2205.0, 325.0]
[177, 163, 171, 315]
p02702
u408375121
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()\ndic = {}\nfor i in range(2019):\n dic[i] = 0\ndic[0] = 1\nfor j in range(1, len(s)+1):\n m = int(s[:j]) % 2019\n dic[m] += 1\nans = 0\nfor v in dic.values():\n ans += v*(v-1) // 2\nprint(ans)\n', 's = input()\ndic = {}\nfor i in range(2019):\n dic[i] = 0\ndic[0] = 1\nm = 0\nfor j in range(len(s)):\n...
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s067819517', 's649432623', 's781089369', 's986998345', 's327178140']
[9404.0, 9216.0, 9232.0, 9284.0, 9344.0]
[2206.0, 21.0, 22.0, 103.0, 132.0]
[198, 205, 192, 210, 267]
p02702
u409542115
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()\ni=2019\nx = 0\nwhile i <= int(S):\n for j in range(1,len(S)-len(str(i))+2,1):\n if int(S[j-1:j-1+len(str(i))]) == i:\n x += 1\n i += 2019\nprint(x)\n', 'S = input()[::-1]\n\nS_mod = [0] * (len(S)+1)\nS_mod[0] = int(S[0])\n\nd = 10\n\nfor i in range(len(S)-1):\n S_mod[i + 1] = (S_...
['Time Limit Exceeded', 'Accepted']
['s909636995', 's262974287']
[9396.0, 16048.0]
[2206.0, 139.0]
[175, 360]
p02702
u413165887
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.
['use std::io::stdin;\nfn main() {\n let mut st = String::new();\n stdin().read_line(&mut st).unwrap();\n let s:Vec<char> = st.trim().chars().collect();\n let mut ten = 1;\n let mut c:usize = 0;\n let mut r:[i64;2020] = [0;2020];\n let m = s.len() as usize;\n for i in 1..m+1 {\n let mut x...
['Runtime Error', 'Accepted']
['s340583712', 's591798925']
[8940.0, 12256.0]
[20.0, 108.0]
[615, 296]
p02702
u432251613
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()\n n = len(S)\n p = 2019 \n \n \n \n \n \n \n \n # ...\n \n \n \n \n \n \n \n \n \n\n \n S = [S[i] for i in range(n-1,-1,-1)]\n \n modp_counter = [0 for _ in range(p)]\n modp_tmp = int(S[0])%p\n modp_counter[modp_tm...
['Wrong Answer', 'Accepted']
['s286556904', 's815168847']
[10700.0, 10788.0]
[2206.0, 105.0]
[1259, 1433]
p02702
u433836112
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().strip()\nt = []\nfor i in range(len(s)):\n t.append(int(s[i:]) % 2019)\n \nt.append(0)\ncount = dict(collections.Counter(t))\nprint(count)\ntot = 0\nfor c in count.values():\n tot += c*(c-1)/2\nprint(int(tot))', 'import numpy as np\n\ns = input().strip()\nt = 0\ncounts = np...
['Wrong Answer', 'Accepted']
['s356760217', 's504194302']
[9580.0, 27328.0]
[2206.0, 248.0]
[240, 243]
p02702
u445983356
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 = [1] + [0] * 2018\ns, p = 0, 1\n\nfor i in reversed(input()) :\n s = (s + p * int(i)) % 2019\n p = p * 10 % 2019\n a[s] += 1\n print(i, s, p, a[s])\n\nprint(sum(x * (x - 1) // 2 for x in a))', 'S = input()\nP =2019\nans = 0\n\ncount = [0] * P\ncount[0] = 1\nu = 0\nfor i, s in enumerate(reversed(S)):\n ...
['Wrong Answer', 'Accepted']
['s355290955', 's718955612']
[9284.0, 9188.0]
[295.0, 342.0]
[196, 189]
p02702
u449822557
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 = list(reversed(s))\nn = len(s)\ndp1 = [0]*n\ndp2 = [0]*n\ncounting = [0]*2019\ncounitng[0] += 1\ndp1[0] = 1\ndp2[0] = int(s[0])\ncounting[dp2[0]] += 1\nif n >= 2:\n for i in range(1,n):\n dp1[i] = (10*dp1[i-1]) % 2019\n dp2[i] = (int(s[i])*dp1[i]+dp2[i-1]) % 2019\n counting[dp2...
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s180600459', 's233031165', 's303993704', 's718364051', 's741589788', 's339675184']
[13396.0, 24992.0, 24744.0, 9180.0, 24720.0, 24744.0]
[30.0, 160.0, 154.0, 24.0, 157.0, 165.0]
[414, 373, 380, 358, 375, 414]
p02702
u449863068
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\nr = 1\narr = [0]\nfor c in S[::-1]:\n arr.append((arr[-1] + int(c) * r) % 2019)\n r *= 10\n r %= 2019\nfrom collections import Counter\nctr = Counter(arr)\nans = 0\nfor v in ctr.values():\n ans += v*v(v-1)//2\nprint(ans)', 'S = input()\n\nr = 1\n arr = [0]\n for c in S[::-1]:\n arr.append((arr[-1...
['Runtime Error', 'Runtime Error', 'Accepted']
['s172411316', 's682066380', 's368656944']
[16736.0, 9012.0, 16648.0]
[124.0, 21.0, 124.0]
[226, 231, 225]
p02702
u459150945
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\nsys.setrecursionlimit(10000000)\nS = input()\nans = 0\n\n# for j in range(i+4, len(S)+1):\n# if int(S[i:j]) % 2019 == 0:\n# ans += 1\n# # break\n# print(ans)\ni = 0\nwhile i < len(S)-3:\n for j in range(i+4, len(S)+1):\n if int(S[i:j]) % 2019 == 0:\n ...
['Wrong Answer', 'Accepted']
['s476430468', 's597105746']
[9156.0, 23380.0]
[2133.0, 161.0]
[403, 392]
p02702
u460375306
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.
["# if the remainders (mod 2019) are equal, the difference will be divisible\n# x = Q*2019+5 y = R*2019+5 then x-y=(Q-R)*2019\n# unless Q-R<=0\n# where the substring itself is (Q-R)*2019/10**(something)\n\n# so multiplying by 10 doesn't affect whether a number is divisible by it\nfrom collections import Counter\ns = in...
['Wrong Answer', 'Accepted']
['s192637675', 's460049655']
[9640.0, 16980.0]
[2206.0, 350.0]
[817, 696]
p02702
u469254913
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\n# import math\n# import copy\n# from collections import deque\nimport sys\ninput = sys.stdin.readline\n\nfrom numba import njit\n\n\n@njit\ndef loof(a):\n N = len(a)\n M = np.zeros(2019,dtype=np.int16)\n M[0] += 1\n T = 0\n memo = pow_mod(10,N,2019)\n for i in range(N-1,-1,-1):\n...
['Time Limit Exceeded', 'Time Limit Exceeded', 'Accepted']
['s871314098', 's990899344', 's044809464']
[122920.0, 120988.0, 112988.0]
[2209.0, 2209.0, 635.0]
[1094, 793, 943]
p02702
u470369730
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 re\n\ns = input()\nary = []\nfor i in range(10000):\n if not '0' in str(2019*i):\n ary.append(2019*i)\n\nresult = 0\nfor val in ary:\n result += len(re.findall(str(val), s))\n\nprint(result)\n", "import re\n\ns = input()\nary = []\nfor i in range(10000):\n if not '0' in str(2019*i):\n ary.append(2019*...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s071342470', 's552604782', 's365493298']
[11400.0, 17788.0, 9200.0]
[2206.0, 2206.0, 136.0]
[191, 163, 215]
p02702
u470560351
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 = int(input())\nS = [ input() for _ in range(N) ]\nprint(len(set(S)))', 'S = str(input())\nN = len(S)\nl = 0\nr = 0\n\n\nfollow = 0\namari = [0] * N\nfor i in range(N):\n Kazu = int(S[N-i-1]) * pow(10, i)\n Amari_ = (int(Kazu) + follow) % 2019\n amari[i] = Amari_\n follow = Amari_\n\nfrom collections import Cou...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s575777374', 's923131484', 's312530488']
[9444.0, 11460.0, 9360.0]
[210.0, 2206.0, 114.0]
[69, 386, 246]
p02702
u479719434
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(S=None):\n if not S:\n S = input()\n count = 0\n candidates = [str(i) for i in range(2019, 200000, 2019)]\n s_len = len(S)\n for candidate in candidates:\n candidate_len = len(candidate)\n for i in range(s_len):\n if i+candidate_len > s_len:\n bre...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s003635945', 's079543414', 's148345182', 's302584398', 's661016749']
[9292.0, 9632.0, 9340.0, 9600.0, 9400.0]
[2206.0, 2205.0, 23.0, 2206.0, 83.0]
[554, 588, 497, 530, 493]
p02702
u480200603
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)\nmod = [1] + [0 for _ in range(2017)]\nml = [0 for _ in range(l + 1)]\nans = 0\n\ntmp = 0\nfor idx, degit in s[::-1]:\n m = (int(degit) * (10 ** idx) + tmp) % 2019\n tmp = m\n ans += mod[m]\n mod[m] += 1\n\nprint(ans)\n', 's = input()\nl = len(s)\nmod = [1] + [0 for _ in range(2019...
['Runtime Error', 'Accepted']
['s750755003', 's346592215']
[10812.0, 10788.0]
[28.0, 362.0]
[241, 269]
p02702
u480264129
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\nt=[0]*(len(s)+1)\nfor i in [str(i*2019) for i in range(1,10000) if '0' not in str(2019*i)]:\n idx=-1\n while s[idx+1:].count(i)>0:\n idx=s[idx+1:].find(i)\n t[idx+len(i)]+=1+t[idx]\n c+=1\n c+=t[idx]\nprint(c)", 's=input()\nn=len(s)\nmod=2019\nd=0\np=1\nml=[0]*mod\nfor i in range(1,n+1):...
['Time Limit Exceeded', 'Accepted']
['s292693069', 's012230536']
[11016.0, 9256.0]
[2206.0, 130.0]
[229, 184]
p02702
u480847874
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 sys import stdin\n\ninput = stdin.readline\n\n\ndef main():\n s = list(input())\n s.reverse()\n MOD = 2019\n tot = 0\n ans = 0\n d = [0 for _ in range(MOD)]\n for i in range(len(s)):\n d[tot] += 1\n x = (10 ** i) % MOD\n p = int(s[i]) * x\n p %= MOD\n tot =...
['Runtime Error', 'Accepted']
['s945709353', 's706562184']
[10520.0, 10448.0]
[22.0, 311.0]
[402, 354]
p02702
u482743994
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)\nMOD=2019\nfrom collections import defaultdict\nd=defaultdict(int)\nfor i in range(n-1,-1,-1):\n d[int(s[i:n])%2019]+=1\nans=0\nfor i,v in enumerate(d):\n if i==0:\n ans+=v\nelse:\n ans+=v*(v-1)//2\nprint(ans)\n', 's=input()\nn=len(s)\nl=[0]*2019\nl[0]=1\nk=0\nmod=2019\nr=1\nfor i in range(n...
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s060555505', 's130034277', 's411255157', 's158445417']
[9604.0, 9300.0, 9276.0, 9172.0]
[2206.0, 20.0, 23.0, 122.0]
[223, 166, 172, 181]
p02702
u490489966
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.
['#D\ns = input()\ncount = 0\n# print(len(s))\nfor left in range(len(s) - 3):\n for right in range(left + 3, len(s)):\n print(left + 1, right + 1)\n if int(float(s[left:right + 1])) % 2019 == 0:\n print(s[left:right])\n count += 1\nprint(count)', 's = input()\nans = 0\na = [0] * 2...
['Runtime Error', 'Accepted']
['s682096976', 's923991186']
[9168.0, 9284.0]
[21.0, 108.0]
[271, 229]
p02702
u508426820
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)\nans = 0\nT = []\nfor i in range(N):\n\n T.append(int(S[i : N]) % 2019)\nT.sort()\nt = set(T)\ncounted = []\nfor i in t:\n a = T.count(i)\n if a > 1:\n counted.append(a)\nfor i in counted:\n ans += i * (i - 1) // 2\nprint(ans)\n', 'S = input()\nN = len(S)\namari = [0 fot i i...
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s395545287', 's727743873', 's936261548', 's906396775']
[9440.0, 8884.0, 8772.0, 9296.0]
[2206.0, 21.0, 24.0, 113.0]
[254, 197, 199, 315]
p02702
u509739538
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 math\nfrom collections import defaultdict\n \ndef readInt():\n\treturn int(input())\ndef readInts():\n\treturn list(map(int, input().split()))\ndef readChar():\n\treturn input()\ndef readChars():\n\treturn input().split()\ndef factorization(n):\n\tres = []\n\tif n%2==0:\n\t\tres.append(2)\n\tfor i in range(3,m...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s002902945', 's015264631', 's111999247', 's197757671', 's229819799', 's405689488', 's414509382', 's463491596', 's487142295', 's561393862', 's586461133', 's684857535', 's704950027', 's817229876', 's819608557', 's912526851', 's977009931', 's972502282']
[11236.0, 9228.0, 11968.0, 13008.0, 9216.0, 13008.0, 9324.0, 12988.0, 12520.0, 13088.0, 9248.0, 9052.0, 9204.0, 9268.0, 12204.0, 9092.0, 13252.0, 16684.0]
[379.0, 331.0, 25.0, 2206.0, 21.0, 2206.0, 27.0, 2206.0, 2206.0, 2206.0, 21.0, 19.0, 21.0, 322.0, 77.0, 20.0, 2206.0, 382.0]
[1034, 131, 203, 540, 263, 261, 419, 266, 259, 528, 274, 253, 164, 162, 254, 430, 311, 1067]
p02702
u511379665
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\nans=0\ndd=[]\n\nfir=int(s[0])*1000+int(s[1])*100+int(s[2])*10+int(s[3])\ndd.append(fir%673)\nfor i in range(4,len(s)):\n tmp=(dd[i-4]*10+int(s[i]))%673\n dd.append(tmp)\n\nclass Bit:\n def __init__(self, n):\n self.size = n\n self.tree = [0] * (n + 1)\n\n def sum(self, i):\n ...
['Runtime Error', 'Accepted']
['s412471954', 's201643327']
[21596.0, 9220.0]
[2206.0, 110.0]
[766, 191]
p02702
u512212329
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()\n # si = tuple(int(c) for c in s) # integers of one digit\n # ms = {2019 * x for x in range(10 ** 200000 - 1 // 2019)}\n ans = 0\n lg = len(si)\n # to slice till the last letter, +1 is needed.\n for i in range(lg + 1):\n for j in range(i + 4, lg + 1):\n ...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s344510696', 's819523692', 's734875634']
[9188.0, 9100.0, 9364.0]
[23.0, 203.0, 301.0]
[544, 133, 351]
p02702
u514118270
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]*2019\ncnt[0] = 1\nn = 0\nt = 1\nfor i in reversed(S):\n n += i*t\n n %= 2019\n cnt[n] += 1\n t *= 10\n t %= 2019\nprint(sum(i*(i-1)//2 for i in cnt))', 'S = input()\nmod = 2019\ncnt = [0]*mod\ncnt[0] = 1\nn = 0\nt = 1\nfor i in map(int,n[::-1]):\n n += i*t\n cnt[n%mod] += 1...
['Runtime Error', 'Runtime Error', 'Accepted']
['s158698224', 's910050930', 's134488398']
[9288.0, 9224.0, 9320.0]
[23.0, 21.0, 115.0]
[176, 168, 181]
p02702
u518064858
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_int=[0]*n\nx=pow(10,n-1)\nfor i in range(n):\n s_int[i]=int(s[i])\n x=x//10\n', 's=input()\nn=len(s)\ns_int=[0]*n\nx=pow(10,n-1)', 's=input()\nn=len(s)\ns_int=[0]*n\nx=pow(10,n-1)\nfor i in range(n):\n s_int[i]=(int(s[i])*x)%2019\n', 's=input()\nn=len(s)\ns_int=[0]*n\nx=pow(10,n-1)\nfo...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s236209190', 's258256660', 's265601578', 's410286441', 's805580365', 's382798884']
[10820.0, 10628.0, 11176.0, 10740.0, 18992.0, 24360.0]
[2206.0, 35.0, 2206.0, 75.0, 2206.0, 434.0]
[99, 44, 96, 86, 94, 467]
p02702
u521866787
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\nS=[0,]\ncnt=[0]*2019\ncnt[0]=1\nd=1\nnum=0\nfor i in range(len(s)):\n num += int(s[i])*d\n num %= 2019\n d *= 10\n d%= 2019\n # S.append((int(S[i]) + int(s[i]) * 10**i) % 2019)\n cnt[num]+=1\n\nans=0\nfor i in cnt:\n ans += i*(i-1) //2', 's=input()\ns= s[::-1]\n\nS=[0,]\n...
['Wrong Answer', 'Accepted']
['s216637643', 's438063220']
[9328.0, 9212.0]
[116.0, 122.0]
[263, 275]
p02702
u532966492
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 import heapq\n inf = 10**16\n n, m, s = map(int, input().split())\n uvab = [list(map(int, input().split())) for _ in [0]*m]\n cd = [list(map(int, input().split())) for _ in [0]*n]\n g = [[] for _ in [0]*n]\n [g[a-1].append([b-1, c, d]) for a, b, c, d in uvab]\n [g[b-1].append([a-...
['Runtime Error', 'Accepted']
['s515309726', 's050542375']
[9268.0, 9232.0]
[206.0, 293.0]
[1030, 226]
p02702
u539367121
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]\nn=len(s)\np=2019\nS=[0 for i in range(n+1)]\nans=[0]*p\n\nx10=1\nfor j, i in enumerate(s):\n S[j+1]=(S[j]+(x10*int(i)))%p\n x10=10**j\n x10%=p\n ans[S[j+1]]+=1\n\ncnt=ans[0]\nfor a in ans:\n cnt+=(a*(a-1))//2\n \nprint(cnt)\n', 's=input()[::-1]\nn=len(s)\np=2019\nS=[0 for i in range(n+1)]\nans=...
['Wrong Answer', 'Accepted']
['s519234798', 's225925937']
[11464.0, 16568.0]
[2206.0, 162.0]
[230, 228]
p02702
u539969758
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)\n\na = [0]*length\nfor i in range(length):\n pickup = int(S[length - i - 1])\n a[i] = pickup*pow(10, i, 2019)\n\n\nb = [0]*length\nb[0] = a[0]\nfor i in range(1, length):\n b[i] = (b[i-1] + a[i]) % 2019\n\ncnt, ans = [0] * 2019, 0\nfor x in b:\n ans += cnt[x]\n cnt[x] += 1\npri...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s119006904', 's390497894', 's146590893']
[23872.0, 25292.0, 25324.0]
[399.0, 407.0, 395.0]
[308, 318, 310]
p02702
u547608423
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,M=map(int,input().split())\n\nli=list(range(N+1))\ncount=0\n\n#print(li)\nfor i in range(M,N+2):\n small=(i*(i-1))//2\n large=small+li[-i]*i\n count+=large-small+1\n\nprint(count%(pow(10,9)+7))', 'S=input()\n\nN=len(S)\ncount=0\ntot=[0]*2019\nS=S[::-1]\nbase=0\n#print(S)\nfor i,s in enumerate(S):\n base...
['Runtime Error', 'Accepted']
['s511954125', 's382539098']
[9144.0, 9260.0]
[205.0, 343.0]
[193, 304]
p02702
u549383771
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()\nfrom collections import Counter\nx = 1\nmod = 2019\ntotal = 0\nans = 0\ncnt = Counter()\nfor i in range(len(s)-1,0,-1):\n cnt[total] += 1\n total = int(s[i::])%mod\n ans += cnt[total]\nprint(ans)', 's = input()\nfrom collections import Counter\nx = 1\nmod = 2019\ntotal = 0\nans = 0\ncnt = Counte...
['Wrong Answer', 'Accepted']
['s740167277', 's607837783']
[9776.0, 9528.0]
[2205.0, 181.0]
[206, 246]
p02702
u557494880
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 for i in range(2019)]\nx = 0\nfor i in range(len(S)):\n p = i + 1\n a = (int(S[-p]))*10**i % 2019\n x = (x+a) % 2019\n A[x] += 1\nans = A[i]\nfor i in range(2019):\n ans += A[i]*(A[i]-1)//2\nprint(ans)', 'S = input()\nA = [0 for i in range(2019)]\nx = 0\nfor i in range(len(S)):\n ...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s156859593', 's211266450', 's830166026']
[9392.0, 8864.0, 9284.0]
[2206.0, 23.0, 142.0]
[225, 225, 253]
p02702
u558764629
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())\n\na = ''\ncount = 0\ni = 0\nwhile(i < len(S)):\n for j in range(i,len(S)):\n a += S[j]\n if(int(a) % 2019 == 0):\n count += 1\n a = ''\n for j in range(i,len(S) - i):\n a += S[j]\n if(int(a) % 2019 == 0):\n count += 1\n i += 1\n a = '...
['Wrong Answer', 'Accepted']
['s612557888', 's902348059']
[10564.0, 9276.0]
[2206.0, 341.0]
[316, 190]
p02702
u561083515
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 = input()\nN = len(S)\n\ncnt = [0] * 2019\n\nans = 0\nfor i in range(N - 1, -1, -1):\n ans += cnt[int(S[i:N]) % 2019]\n cnt[int(S[i:N]) % 2019] += 1\n\nprint(ans)', '\nS = input()\nN = len(S)\n\ncnt = [0] * 2019\n\ncnt[0] = 1\n\nans = 0\ne = 1; cur = 0\nfor s in reversed(S):\n cur = (cur + int(s) * e) % ...
['Wrong Answer', 'Accepted']
['s548961695', 's113141588']
[9196.0, 9336.0]
[2206.0, 115.0]
[171, 221]
p02702
u562577097
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 python\nfrom __future__ import division, print_function\n\nimport os\nimport sys\nfrom io import BytesIO, IOBase\n\nif sys.version_info[0] < 3:\n from __builtin__ import xrange as range\n from future_builtins import ascii, filter, hex, map, oct, zip\n\n\n# region fastio\n\nBUFSIZE = 8192\n\n\ncla...
['Runtime Error', 'Accepted']
['s474780215', 's057677097']
[9852.0, 9584.0]
[211.0, 328.0]
[3203, 563]
p02702
u563838154
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]) \nn = len(s)\ncounts = [0]*2019\ncounts[0]=1\nb = 1\nnum = 0\nfor i in range(n):\n num += int(s[i])*b\n num %=2019\n b *=10\n b %2019\n counts[num]+=1\n\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n# print(counts)\nans ...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s228067951', 's454900745', 's607129587', 's150182839']
[9328.0, 9316.0, 9464.0, 9212.0]
[2206.0, 2206.0, 206.0, 111.0]
[395, 425, 425, 284]
p02702
u564589929
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\nsys.setrecursionlimit(10 ** 6)\ninput = sys.stdin.readline ####\nint1 = lambda x: int(x) - 1\ndef II(): return int(input())\n \ndef MI(): return map(int, input().split())\ndef MI1(): return map(int1, input().split())\n \ndef LI(): return list(map(int, input().split()))\ndef LI1(): return list(map(int1,...
['Runtime Error', 'Runtime Error', 'Accepted']
['s225611338', 's992553190', 's344547993']
[12120.0, 12116.0, 23668.0]
[40.0, 40.0, 145.0]
[992, 984, 1384]
p02702
u565448206
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.
["if __name__ == '__main__':\n n=input()\n count=0\n for i in range(0,len(n)-1):\n for j in range(i+1, len(n)):\n if int(n[i:j+1])%2019==0:\n print(int(n[i:j+1]))\n count+=1\n print(count)", 'num = [0 for i in range(2019)]\nnum[0] = 1\ncount = 0\ns = input()\n...
['Wrong Answer', 'Accepted']
['s749234597', 's981211689']
[9828.0, 9092.0]
[2217.0, 124.0]
[238, 227]
p02702
u572142121
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=0\nans=0\nA=[0]*2019\nA[0]=1\nfor i,j in enumerate(reversed(s)):\n n=(n+int(j)*pow(10,i,2019))%2019\n print(i,n)\n A[n]+=1\nfor i in A:\n ans+=i*(i-1)//2\nprint(ans)', 's=input()\nn=0\nans=0\nA=[0]*2019\nA[0]=1\nfor i in range(len(s)):\n n=(n+int(s[-1-i])*pow(10,i,2019))%2019\n #print(i,n)\n A[n]+...
['Wrong Answer', 'Accepted']
['s540899650', 's087369615']
[9180.0, 9296.0]
[427.0, 325.0]
[171, 167]
p02702
u572343785
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())\n\ndef main(S):\n count = 0\n a = len(S)\n \n for i in range(a):\n for j in range(i,a):\n if int(S[i:])%2019 == int(S[j:])%2019:\n count += 1\n print(count)\nif __name__ == '__main__':\n main(S)\n", 's = input()[::-1] \n\ncounts = [0] * 2019\ncounts[...
['Wrong Answer', 'Accepted']
['s301849901', 's240420002']
[9536.0, 9384.0]
[2206.0, 109.0]
[251, 301]
p02702
u579508806
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.
['string=input()\nlength=len(string)\nmod=[1]*2019\nwhile length > 0:\n mod[int(string[length-1:])%2019]+=1\n length-=1\nprint(int(sum([(i*(i-1))/2 for i in mod])))\n', 'string=input()\nlength=len(string)\nmod=[0]*2019\nwhile length > 0:\n mod[int(string[length-1:])%2019]+=1\n length-=1\nprint(int(sum([(i*(i-1))/2 ...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Time Limit Exceeded', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s104780189', 's506920804', 's680170063', 's758301823', 's831479625', 's982715603', 's610720925']
[9256.0, 9228.0, 9408.0, 9188.0, 9368.0, 9352.0, 9312.0]
[2206.0, 2206.0, 2205.0, 2206.0, 881.0, 2206.0, 325.0]
[159, 159, 158, 303, 271, 158, 175]
p02702
u580273604
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=int(S)\nc=0\nfor i in range(1,s//2019+1):\n C=str(2019*i)\n if '0' in C:\n continue\n if C in S:\n c+=1\nprint(c)\n\n\nexit()\n\n\n\n\nc=0;s=[]\nfor i in range(0,len(S)+1):\n for j in range(i,len(S)):\n s.append(S[i:j+1])\ndel s[0]\nss = [int(i) for i in s] \n#print(ss)\nsss = list(map(la...
['Time Limit Exceeded', 'Accepted']
['s790347160', 's989263040']
[9788.0, 16236.0]
[2206.0, 521.0]
[349, 218]
p02702
u580697892
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\nS = input()\nans = 0\nfor i in range(len(S)):\n for j in range(i+4, len(S)):\n tmp = int(S[i:j])\n if tmp % 2019 == 0:\n ans += 1\nprint(ans)', '# coding: utf-8\nS = input()\nans = 0\nP = 2019\nN = len(S)\nS = S[::-1]\ncnt = [0 for _ in range(P)]\ncnt[0] = 1\nv = 0\nbai = ...
['Wrong Answer', 'Accepted']
['s582886220', 's677147939']
[9340.0, 9348.0]
[2205.0, 128.0]
[178, 288]
p02702
u585704797
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=input()\ns=[0 for i in range(len(S))]\n\nfor i in range(len(S)):\n s[i]=int(S[i])\nCHECK=[0 for i in range(2021)]\nans=0\ntemp=0\nfor i in range(1,len(s)+1):\n #print(s[-i])\n temp=(temp+s[-i]*pow(10,i-1,2019)+2019*2)%2019\n #print(i,temp)\n #print(temp)\n CHECK[temp]+=1\nfor i in CHECK:\n an...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s778309392', 's835723336', 's034979673']
[10728.0, 10900.0, 10956.0]
[347.0, 349.0, 330.0]
[328, 392, 343]
p02702
u586639900
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())\n\nleng = len(str(S))\ncount = 0\n\nfor j in range(leng-3):\n for i in range(leng, 1, -1):\n partial = S // (10 ** j)\n partial = partial % (10 ** i)\n if partial == 0:\n continue\n if partial % 2019 == 0:\n count += 1\n\nprint(count)\n', 'S = inpu...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s184791944', 's326097377', 's340363838', 's460149576', 's658323208', 's074144656']
[9520.0, 9156.0, 9176.0, 9304.0, 9744.0, 9288.0]
[2205.0, 2206.0, 2206.0, 221.0, 2210.0, 111.0]
[291, 210, 227, 200, 272, 261]
p02702
u588794534
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.
['baisu=set([])\n\ni=1\nwhile 1:\n temp=2019*i\n if "0" not in str(temp):\n baisu.add(str(temp))\n \n if temp>2000000000:\n break\n i+=1\n\nn=input()\ncnt=0\nfor i in baisu:\n if i in n:\n cnt+=1\n\nprint(cnt)\n\n', 's=input()\n\n\n\n\n\n\n\n\n\n\ncnt=[0]*2019\n\ncnt[0]=1\n\n\nfac...
['Wrong Answer', 'Runtime Error', 'Time Limit Exceeded', 'Wrong Answer', 'Accepted']
['s052074042', 's157034181', 's569352850', 's694297906', 's613301491']
[53268.0, 9156.0, 193100.0, 9972.0, 9160.0]
[2207.0, 130.0, 2212.0, 1334.0, 144.0]
[230, 1358, 231, 228, 1364]
p02702
u595905528
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 digitSum(n):\n \n s = str(n)\n \n array = list(map(int, s))\n \n return sum(array)\nS = input()\nScount = 0\nfor i in range(len(S)):\n for j in range(1,len(S)):\n if (i+j)<len(S):\n part_S = S[i:i+j]\n num = int(part_S)\n if num % 673 == 0:\n ...
['Runtime Error', 'Accepted']
['s079564818', 's008988529']
[9276.0, 9556.0]
[24.0, 338.0]
[648, 264]
p02702
u596681540
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 defaultdict\n\n\ns = input()\nn = len(s)\n\ndd = defaultdict(int)\n\nd = [0] * 2019\ndd[0] = 1\ntmp = 0\n_10 = 1\n# print(s, n)\nfor i in range(n - 1, -1, -1):\n # print(i, s[i])\n tmp = tmp + int(s[i]) * _10\n _10 *= 10\n # print(tmp, tmp % 2019)\n d[tmp % 2019] += 1\n\n\ncount...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s105625193', 's362906918', 's814966521', 's818452019', 's967154165', 's311577204']
[9520.0, 18608.0, 18696.0, 9044.0, 9412.0, 9516.0]
[2206.0, 425.0, 421.0, 20.0, 2205.0, 123.0]
[452, 428, 428, 236, 437, 696]