Buggy python submission (verdict: Time Limit Exceeded):
def main():
    import collections

    S = input()

    mod_list = [0]+[False for i in range(len(S))]

    for i in range(len(S)):
        index = len(S) - i - 1
        
        num = int(S[index:])
        mod_list[i+1] = num % 2019


    CTR_mod_list = collections.Counter(mod_list).most_common()
    cnt = 0

    for i in range(len(CTR_mod_list)):
        n = CTR_mod_list[i][1]

        if (n == 1):
            break
        
        cnt += n * (n - 1) // 2

    print(cnt)

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    import collections

    S = input()

    mod_list = [0]

    for i in range(len(S)):
        index = len(S) - i - 1
        num = int(S[index])

        mod_list.append((mod_list[-1] + num * pow(10, i, 2019)) % 2019)

    CTR_mod_list = collections.Counter(mod_list).most_common()
    cnt = 0

    for i in range(len(CTR_mod_list)):
        n = CTR_mod_list[i][1]

        if (n == 1):
            break

        cnt += n * (n - 1) // 2

    print(cnt)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    import collections

    S = input()

    mod_list = [0]+[False for i in range(len(S))]

    for i in range(len(S)):
        index = len(S) - i - 1
        
        num = int(S[index:])
        mod_list[i+1] = num % 2019


    CTR_mod_list = collections.Counter(mod_list).most_common()
    cnt = 0

    for i in range(len(CTR_mod_list)):
        n = CTR_mod_list[i][1]
        cnt += n * (n - 1) // 2

    print(cnt)

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    import collections

    S = input()

    mod_list = [0]

    for i in range(len(S)):
        index = len(S) - i - 1
        num = int(S[index])

        mod_list.append((mod_list[-1] + num * pow(10, i, 2019)) % 2019)

    CTR_mod_list = collections.Counter(mod_list).most_common()
    cnt = 0

    for i in range(len(CTR_mod_list)):
        n = CTR_mod_list[i][1]

        if (n == 1):
            break

        cnt += n * (n - 1) // 2

    print(cnt)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import collections

S = input()

mod_list = [0]+[False for i in range(len(S))]

for i in range(len(S)):
    index = len(S) - i - 1
    
    num = int(S[index:])
    mod_list[i+1] = num % 2019


CTR_mod_list = collections.Counter(mod_list).most_common()
cnt = 0

for i in range(len(CTR_mod_list)):
    n = CTR_mod_list[i][1]

    if (n > 1):
        cnt += n * (n - 1) // 2

print(cnt)


Fixed submission:
def main():
    import collections

    S = input()

    mod_list = [0]

    for i in range(len(S)):
        index = len(S) - i - 1
        num = int(S[index])

        mod_list.append((mod_list[-1] + num * pow(10, i, 2019)) % 2019)

    CTR_mod_list = collections.Counter(mod_list).most_common()
    cnt = 0

    for i in range(len(CTR_mod_list)):
        n = CTR_mod_list[i][1]

        if (n == 1):
            break

        cnt += n * (n - 1) // 2

    print(cnt)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
def main():
    import sys
    S = sys.stdin.readline()[:-1]

    S = input()
    int_S = int(S)
    N = len(S)
    cnt = 0
    pos_l = 0
    pos_r = 0


    while (True):
        pos_r +=  + 1
        
        if (pos_r < N):
            tmp = int(S[pos_l: pos_r + 1])
            if (tmp % 2019 == 0):
                cnt += 1
                pos_l = pos_r
        else:
            pos_l += 1
        
        if (pos_l >= N):
            break


    print(cnt)

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    import collections

    S = input()

    mod_list = [0]

    for i in range(len(S)):
        index = len(S) - i - 1
        num = int(S[index])

        mod_list.append((mod_list[-1] + num * pow(10, i, 2019)) % 2019)

    CTR_mod_list = collections.Counter(mod_list).most_common()
    cnt = 0

    for i in range(len(CTR_mod_list)):
        n = CTR_mod_list[i][1]

        if (n == 1):
            break

        cnt += n * (n - 1) // 2

    print(cnt)

if __name__ == '__main__':
    main()