Problem:
 Score : 1300 points    Problem Statement We will call a non-negative integer increasing if, for any two adjacent digits in its decimal representation, the digit to the right is greater than or equal to the digit to the left.
For example, 1558 , 11 , 3 and 0 are all increasing; 10 and 20170312 are not.  Snuke has an integer N . Find the minimum number of increasing integers that can represent N as their sum.      Constraints  1 \leq N \leq 10^{500000}         Input The input is given from Standard Input in the following format:  N       Output Print the minimum number of increasing integers that can represent N as their sum.        Sample Input 1 80      Sample Output 1 2  One possible representation is 80 = 77 + 3 .       Sample Input 2 123456789      Sample Output 2 1  123456789 in itself is increasing, and thus it can be represented as the sum of one increasing integer.       Sample Input 3 20170312      Sample Output 3 4       Sample Input 4 7204647845201772120166980358816078279571541735614841625060678056933503      Sample Output 4 31

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

"""
・1,11,111,...に分解して9個ずつまとめる
・9倍して考える。9N+x の digit sum <= x となる最小のxが知りたい
・xが満たせばx+1も満たすので、二分探索できる
"""

N = [x - ord('0') for x in map(int,read().rstrip())][::-1]


N = [9 * x for x in N] + [0] * 10
L = len(N)

for i in range(L-1):
    q,r = divmod(N[i],10)
    N[i] = r
    N[i+1] += q

high1 = sum(N[10:])
N[10] += 1
for i in range(10,L-1):
    if N[i] == 10:
        N[i] = 0
        N[i+1] += 1
high2 = sum(N[10:])
low = N[:10]

low = sum(x * 10 ** i for i,x in enumerate(N[:10]))

A = 10 ** 10

def digit_sum(N):
    return sum(map(int,str(N)))

def test(x):
    if low + x >= A:
        return digit_sum(low + x) - 1 + high2 <= x
    return digit_sum(low + x) + high1 <= x

left = 0
right = 10 ** 10
while left + 1 < right:
    x = (left + right) // 2
    if test(x):
        right = x
    else:
        left = x

answer = (right + 8) // 9
print(answer)

Solution (Python):
n=list(input())
n.reverse()
lb,ub=0,len(n)
def check(x):
	g=0
	for i in n:
		x-=(x+g-int(i))%10
		if x<0:
			break
		g=(x+g)//10
	return x>=0
while ub-lb>1:
	mid=(lb+ub)//2
	if check(9*mid):
		ub=mid
	else:
		lb=mid
print(ub)