Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!
def main():
    from functools import reduce
    import collections
     
    S = list(map(int,input().rstrip()))
    N=len(S)
    mod_list = [0]
    for i in range(N):
        new = (mod_list[-1]+S[N-1-i]*10**i)%2019
        mod_list.append(new)
        
    count = collections.Counter(mod_list)
    ans =0
    for j in range(2019):
        n = count[j]
        ans+= n*(n-1)/2
    print(int(ans))
if __name__ == "__main__":
    main()

Fixed submission:
# coding: utf-8
# Your code here!
def main():
    from functools import reduce
    import collections
     
    S = list(map(int,input().rstrip()))
    N=len(S)
    mod_list = [0]
    for i in range(1,N+1):
        new1 =pow(10,i-1,2019)
        new = (new1*S[-i]+mod_list[-1])%2019
        #print(new)
        mod_list.append(new)
        
    count = collections.Counter(mod_list)
    ans =0
    for j in range(2019):
        n = count[j]
        ans+= n*(n-1)/2
    print(int(ans))
if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!
from functools import reduce
import collections
 
S = list(map(int,input().rstrip()))
N=len(S)
mod_list = [0]
for i in range(N):
    new = (mod_list[-1]+S[N-1-i]*10**i)%2019
    mod_list.append(new)
count = collections.Counter(mod_list)
#print(mod_list)
ans =0
for j in range(2019):
    n = count[j]
    ans+= n*(n-1)/2
print(int(ans))

Fixed submission:
# coding: utf-8
# Your code here!
def main():
    from functools import reduce
    import collections
     
    S = list(map(int,input().rstrip()))
    N=len(S)
    mod_list = [0]
    for i in range(1,N+1):
        new1 =pow(10,i-1,2019)
        new = (new1*S[-i]+mod_list[-1])%2019
        #print(new)
        mod_list.append(new)
        
    count = collections.Counter(mod_list)
    ans =0
    for j in range(2019):
        n = count[j]
        ans+= n*(n-1)/2
    print(int(ans))
if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!
from functools import reduce
import collections

S = list(map(int,input().rstrip()))
N=len(S)
mod_list = [0]
for i in range(N):
    T = reduce( lambda a,b:10*a+b, S[i:N+1])%2019
    mod_list.append(T)
    #print(T)
count = collections.Counter(mod_list)
ans =0
for j in range(2019):
    n = count[j]
    ans+= n*(n-1)/2
print(int(ans))

Fixed submission:
# coding: utf-8
# Your code here!
def main():
    from functools import reduce
    import collections
     
    S = list(map(int,input().rstrip()))
    N=len(S)
    mod_list = [0]
    for i in range(1,N+1):
        new1 =pow(10,i-1,2019)
        new = (new1*S[-i]+mod_list[-1])%2019
        #print(new)
        mod_list.append(new)
        
    count = collections.Counter(mod_list)
    ans =0
    for j in range(2019):
        n = count[j]
        ans+= n*(n-1)/2
    print(int(ans))
if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
def main():
    S = list(map(str,input().rstrip()))
    l = len(S)
    result=0   
    
    for i in range(l):
        for j in range(1,l-i+1):
            print(S[i,i+j+1])
            n = int("".join(map(str, St)))
            print(S)
            if n %2019==0:
                result+=1
    print(result)
    
if __name__ == "__main__":
    main()  
    

Fixed submission:
# coding: utf-8
# Your code here!
def main():
    from functools import reduce
    import collections
     
    S = list(map(int,input().rstrip()))
    N=len(S)
    mod_list = [0]
    for i in range(1,N+1):
        new1 =pow(10,i-1,2019)
        new = (new1*S[-i]+mod_list[-1])%2019
        #print(new)
        mod_list.append(new)
        
    count = collections.Counter(mod_list)
    ans =0
    for j in range(2019):
        n = count[j]
        ans+= n*(n-1)/2
    print(int(ans))
if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
S = list(map(int,input().rstrip()))
result=0
for i in range(len(S)):
    for j in range(1,len(S)-i+1):
        n = reduce(lambda a,b:10*a+b, S[i:i+j])
        if n %2019==0:
            result+=1
print(result)
    

Fixed submission:
# coding: utf-8
# Your code here!
def main():
    from functools import reduce
    import collections
     
    S = list(map(int,input().rstrip()))
    N=len(S)
    mod_list = [0]
    for i in range(1,N+1):
        new1 =pow(10,i-1,2019)
        new = (new1*S[-i]+mod_list[-1])%2019
        #print(new)
        mod_list.append(new)
        
    count = collections.Counter(mod_list)
    ans =0
    for j in range(2019):
        n = count[j]
        ans+= n*(n-1)/2
    print(int(ans))
if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
S = list(map(int,input().rstrip()))
l=len(S)
result=0
for i in range(0,int(l-3)):
    for j in range(i+4,int(l+1)):
        n = reduce( lambda a,b:10*a+b, S[i:j])
        if n %673==0 and n%3==0:
            result+=1
print(result)

Fixed submission:
# coding: utf-8
# Your code here!
def main():
    from functools import reduce
    import collections
     
    S = list(map(int,input().rstrip()))
    N=len(S)
    mod_list = [0]
    for i in range(1,N+1):
        new1 =pow(10,i-1,2019)
        new = (new1*S[-i]+mod_list[-1])%2019
        #print(new)
        mod_list.append(new)
        
    count = collections.Counter(mod_list)
    ans =0
    for j in range(2019):
        n = count[j]
        ans+= n*(n-1)/2
    print(int(ans))
if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
S = list(map(int,input().rstrip()))
l=len(S)
result=0
for i in range(0,int(l-3)):
    for j in range(i+4,int(l+1)):
        n = reduce( lambda a,b:10*a+b, S[i:j])
        if n %673==0 and n%3==0:
            result+=1
print(result)

Fixed submission:
# coding: utf-8
# Your code here!
def main():
    from functools import reduce
    import collections
     
    S = list(map(int,input().rstrip()))
    N=len(S)
    mod_list = [0]
    for i in range(1,N+1):
        new1 =pow(10,i-1,2019)
        new = (new1*S[-i]+mod_list[-1])%2019
        #print(new)
        mod_list.append(new)
        
    count = collections.Counter(mod_list)
    ans =0
    for j in range(2019):
        n = count[j]
        ans+= n*(n-1)/2
    print(int(ans))
if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
S = list(map(int,input().rstrip()))
l=len(S)
result=0
for i in range(0,int(l-3)):
    for j in range(i+4,int(l+1)):
        n = reduce( lambda a,b:10*a+b, S[i:j])
        if n %673==0:
            if n%3==0:
                result+=1
print(result)

Fixed submission:
# coding: utf-8
# Your code here!
def main():
    from functools import reduce
    import collections
     
    S = list(map(int,input().rstrip()))
    N=len(S)
    mod_list = [0]
    for i in range(1,N+1):
        new1 =pow(10,i-1,2019)
        new = (new1*S[-i]+mod_list[-1])%2019
        #print(new)
        mod_list.append(new)
        
    count = collections.Counter(mod_list)
    ans =0
    for j in range(2019):
        n = count[j]
        ans+= n*(n-1)/2
    print(int(ans))
if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
S = list(map(int,input().rstrip()))
l=len(S)
result=0
for i in range(0,int(l-3)):
    for j in range(i+4,int(l+1)):
        n = reduce( lambda a,b:10*a+b, S[i:j])
        if n %2019==0:
            result+=1
print(result)

Fixed submission:
# coding: utf-8
# Your code here!
def main():
    from functools import reduce
    import collections
     
    S = list(map(int,input().rstrip()))
    N=len(S)
    mod_list = [0]
    for i in range(1,N+1):
        new1 =pow(10,i-1,2019)
        new = (new1*S[-i]+mod_list[-1])%2019
        #print(new)
        mod_list.append(new)
        
    count = collections.Counter(mod_list)
    ans =0
    for j in range(2019):
        n = count[j]
        ans+= n*(n-1)/2
    print(int(ans))
if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
S = list(map(int,input().rstrip()))
l=len(S)
result=0
for i in range(0,l-3):
    for j in range(i+4,l+1):
        n = reduce( lambda a,b:10*a+b, S[i:j])
        if n %2019==0:
            result+=1
print(result)

Fixed submission:
# coding: utf-8
# Your code here!
def main():
    from functools import reduce
    import collections
     
    S = list(map(int,input().rstrip()))
    N=len(S)
    mod_list = [0]
    for i in range(1,N+1):
        new1 =pow(10,i-1,2019)
        new = (new1*S[-i]+mod_list[-1])%2019
        #print(new)
        mod_list.append(new)
        
    count = collections.Counter(mod_list)
    ans =0
    for j in range(2019):
        n = count[j]
        ans+= n*(n-1)/2
    print(int(ans))
if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
S = list(map(int,input().rstrip()))
l=len(S)
result=0
for i in range(l):
    for j in range(i+1,l+1):
        n = reduce( lambda a,b:10*a+b, S[i:j])
        if n %2019==0:
            result+=1
print(result)

Fixed submission:
# coding: utf-8
# Your code here!
def main():
    from functools import reduce
    import collections
     
    S = list(map(int,input().rstrip()))
    N=len(S)
    mod_list = [0]
    for i in range(1,N+1):
        new1 =pow(10,i-1,2019)
        new = (new1*S[-i]+mod_list[-1])%2019
        #print(new)
        mod_list.append(new)
        
    count = collections.Counter(mod_list)
    ans =0
    for j in range(2019):
        n = count[j]
        ans+= n*(n-1)/2
    print(int(ans))
if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
S = list(map(int,input().rstrip()))
result=0
for i in range(len(S)):
    for j in range(i+1,len(S)+1):
        n = reduce( lambda a,b:10*a+b, S[i:j])
        if n %2019==0:
            result+=1
print(result)
        

Fixed submission:
# coding: utf-8
# Your code here!
def main():
    from functools import reduce
    import collections
     
    S = list(map(int,input().rstrip()))
    N=len(S)
    mod_list = [0]
    for i in range(1,N+1):
        new1 =pow(10,i-1,2019)
        new = (new1*S[-i]+mod_list[-1])%2019
        #print(new)
        mod_list.append(new)
        
    count = collections.Counter(mod_list)
    ans =0
    for j in range(2019):
        n = count[j]
        ans+= n*(n-1)/2
    print(int(ans))
if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
S = list(map(int,input().rstrip()))
result=0
for i in range(len(S)):
    for j in range(i+1,len(S)+1):
        n = reduce( lambda a,b:10*a+b, S[i:j])
        if n %2019==0:
            result+=1
print(result)

Fixed submission:
# coding: utf-8
# Your code here!
def main():
    from functools import reduce
    import collections
     
    S = list(map(int,input().rstrip()))
    N=len(S)
    mod_list = [0]
    for i in range(1,N+1):
        new1 =pow(10,i-1,2019)
        new = (new1*S[-i]+mod_list[-1])%2019
        #print(new)
        mod_list.append(new)
        
    count = collections.Counter(mod_list)
    ans =0
    for j in range(2019):
        n = count[j]
        ans+= n*(n-1)/2
    print(int(ans))
if __name__ == "__main__":
    main()