cl, cr = [0 for i in range(28)], [0 for i in range(28)]
for i in range(1000):
cs = sum(int(d) - int('0') for d in str(i))
if i >= 100: cl[cs] += 1
cr[cs] += 1
print(sum(cl[i] * cr[i] for i in range(28)))
Y2wsIGNyID0gWzAgZm9yIGkgaW4gcmFuZ2UoMjgpXSwgWzAgZm9yIGkgaW4gcmFuZ2UoMjgpXQpmb3IgaSBpbiByYW5nZSgxMDAwKToKCWNzID0gc3VtKGludChkKSAtIGludCgnMCcpIGZvciBkIGluIHN0cihpKSkKCWlmIGkgPj0gMTAwOiBjbFtjc10gKz0gMQoJY3JbY3NdICs9IDEKcHJpbnQoc3VtKGNsW2ldICogY3JbaV0gZm9yIGkgaW4gcmFuZ2UoMjgpKSkK