Buggy python submission (verdict: Time Limit Exceeded):
# 2019-11-23 21:00:35(JST)
import sys

def main():
    m = int(sys.stdin.readline().rstrip())

    res = []

    total = 0
    for i in range(m):
        d, c = sys.stdin.readline().split()
        s = d
        count = 0
        for _ in range(int(c)-1):
            s = str(int(s) + int(d))
            count += 1
            if len(s) == 2:
                s = str(int(s[0]) + int(s[1]))
                count += 1
        total += count
        res.append(s)
    

    s = res[0]
    for i in range(1, m):
        s = str(int(s) + int(res[i]))
        total += 1
        if len(s) == 2:
            s = str(int(s[0]) + int(s[1]))
            total += 1
    print(total)
    

if __name__ == '__main__':
    main()


Fixed submission:
# 2019-11-23 21:00:35(JST)
import sys
import collections
import math

def main():
    m = int(sys.stdin.readline().rstrip())

    a = collections.defaultdict(int)
    for _ in range(m):
        d, c = map(int, sys.stdin.readline().split())
        a[d] += c
    

    b = 0
    for i in range(10):
        b += (i + 9) * a[i]
    
    ans = math.ceil((b - 9)/ 9) - 1
    print(ans)
    
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
# 2019-11-23 21:00:35(JST)
import sys

def main():
    m = int(sys.stdin.readline().rstrip())

    S = ''

    total = 0
    for i in range(m):
        d, c = sys.stdin.readline().split()
        c = int(c)
        s = d * c
        count = 0
        while len(s) >= 2:
            s = str(int(s[0]) + int(s[1])) + s[2:]
            count += 1
        total += count
        S += s

    
    while len(S) >= 2:
        S = str(int(S[0]) + int(S[1])) + S[2:]
        total += 1
    
    print(total)


if __name__ == '__main__':
    main()


Fixed submission:
# 2019-11-23 21:00:35(JST)
import sys
import collections
import math

def main():
    m = int(sys.stdin.readline().rstrip())

    a = collections.defaultdict(int)
    for _ in range(m):
        d, c = map(int, sys.stdin.readline().split())
        a[d] += c
    

    b = 0
    for i in range(10):
        b += (i + 9) * a[i]
    
    ans = math.ceil((b - 9)/ 9) - 1
    print(ans)
    
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
# 2019-11-23 21:00:35(JST)
import sys

def main():
    m = int(sys.stdin.readline().rstrip())

    s = ''
    for i in range(m):
        d, c = sys.stdin.readline().split()
        c = int(c)
        s += d * c

    count = 0
    while len(s) >= 2:
        s = str(int(s[0]) + int(s[1])) + s[2:]
        count += 1
    
    print(count)




if __name__ == '__main__':
    main()


Fixed submission:
# 2019-11-23 21:00:35(JST)
import sys
import collections
import math

def main():
    m = int(sys.stdin.readline().rstrip())

    a = collections.defaultdict(int)
    for _ in range(m):
        d, c = map(int, sys.stdin.readline().split())
        a[d] += c
    

    b = 0
    for i in range(10):
        b += (i + 9) * a[i]
    
    ans = math.ceil((b - 9)/ 9) - 1
    print(ans)
    
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
# 2019-11-23 21:00:35(JST)
import sys

def main():
    m = int(sys.stdin.readline().rstrip())

    s = ''
    for i in range(m):
        d, c = sys.stdin.readline().split()
        c = int(c)
        s += d * c

    count = 0
    while int(s) >= 10:
        s = str(int(s[0]) + int(s[1])) + s[2:]
        count += 1
    
    print(count)




if __name__ == '__main__':
    main()


Fixed submission:
# 2019-11-23 21:00:35(JST)
import sys
import collections
import math

def main():
    m = int(sys.stdin.readline().rstrip())

    a = collections.defaultdict(int)
    for _ in range(m):
        d, c = map(int, sys.stdin.readline().split())
        a[d] += c
    

    b = 0
    for i in range(10):
        b += (i + 9) * a[i]
    
    ans = math.ceil((b - 9)/ 9) - 1
    print(ans)
    
if __name__ == '__main__':
    main()