Dataset Viewer
Auto-converted to Parquet Duplicate
text
string
181718171817181718171817181718171817181718171817181718171817181718171817181718171817
import math , string , itertools , fractions , heapq , collections , re , array , bisect , sys , random , time , copy , functools
from collections import deque
sys . setrecursionlimit ( 10 ** 7 )
inf = 10 ** 20
mod = 10 ** 9 + 7
DR = [ 1 , - 1 , 0 , 0 ]
DC = [ 0 , 0 , 1 , - 1 ]
def LI ( ) : return [ int ( x ) for x in sys . stdin . readline ( ) . split ( ) ]
def LI_ ( ) : return [ int ( x ) - 1 for x in sys . stdin . readline ( ) . split ( ) ]
def LF ( ) : return [ float ( x ) for x in sys . stdin . readline ( ) . split ( ) ]
def LS ( ) : return sys . stdin . readline ( ) . split ( )
def I ( ) : return int ( sys . stdin . readline ( ) )
def F ( ) : return float ( sys . stdin . readline ( ) )
def S ( ) : return input ( )
def main ( ) :
s = S ( )
k = 2019
tens = [ 1 for _ in range ( len ( s ) + 1 ) ]
for i in range ( 1 , len ( s ) + 1 ) :
tens [ i ] = tens [ i - 1 ] * 10 % k
mods0toi = [ 0 for _ in range ( len ( s ) ) ]
cur = 0
for i in range ( len ( s ) ) [ : : - 1 ] :
j = len ( s ) - i - 1
mods0toi [ i ] = ( cur + int ( s [ i ] ) * tens [ j ] ) % k
cur = mods0toi [ i ]
s = collections . Counter ( mods0toi )
ans = 0
t = s . keys ( )
for c in t :
if c == 0 :
ans += s [ c ]
ans += ( s [ c ] ) * ( s [ c ] - 1 ) // 2
print ( ans )
main ( )
20
366735600000
x = int ( input ( ) )
def factorization ( n ) :
arr = [ ]
temp = n
for i in range ( 2 , int ( - ( - n ** 0.5 // 1 ) ) + 1 ) :
if temp % i == 0 :
cnt = 0
while temp % i == 0 :
cnt += 1
temp //= i
arr . append ( [ i , cnt ] )
if temp != 1 :
arr . append ( [ temp , 1 ] )
if arr == [ ] :
arr . append ( [ n , 1 ] )
return arr
l = factorization ( x )
l = sorted ( l )
ans = 0
for i in range ( len ( l ) ) :
if l [ i ] [ 0 ] == 1 :
continue
else :
s = 0
num = l [ i ] [ 1 ]
if num == 1 :
j = 1
else :
for j in range ( 1 , num ) :
s += j
if s == num :
break
elif s > num :
j -= 1
break
ans += j
print ( ans )
10
10 10 0 0
import sys
def solve ( H : int , W : int , A : int , B : int ) :
answer = [ [ "0" ] * W for _ in range ( H ) ]
for i in range ( H ) :
for j in range ( W ) :
if i < B :
if j < A :
answer [ i ] [ j ] = "0"
else :
answer [ i ] [ j ] = "1"
else :
if j < A :
answer [ i ] [ j ] = "1"
else :
answer [ i ] [ j ] = "0"
for i in range ( H ) :
print ( '' . join ( answer [ i ] ) )
return
def main ( ) :
def iterate_tokens ( ) :
End of preview. Expand in Data Studio

No dataset card yet

Downloads last month
27