Problem p03282 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import logging
import time
import math


class Solver:
    def __init__(self):
        self.s = ''
        self.k = 0

    # 入力
    def input_value(self):
        # self.n = int(input())
        # self.A, self.B = map(int, input().split())
        # self.A = list(map(int, input().split()))
        # self.a, self.b, self.c = map(int, [input() for i in range(4)])
        # self.t = [None] * self.n
        self.s = input()
        self.k = int(input())

    # @staticmethod
    # def run(s, k):
    #     # count = [None] * len(s)
    #     sum = 0
    #     for i in range(len(s) + 1):
    #         # count[i] = int(s[i]) ** (5 * 10 ** 15)
    #         # sum += int(s[i]) ** (5 * 10 ** 15)
    #         sum += (5 * 10 ** 15) * math.log10(int(s[i]))
    #         if sum > math.log10(k):
    #             return s[i]
    #     return '0'

    @staticmethod
    def run(s, k):
        # count = [None] * len(s)
        i = 0
        while s[i] == '1':
            i += 1
            if i >= len(s) or i >= k:
                return '1'
        return s[i]

    @staticmethod
    def test():
        start_time = time.time()

        assert Solver.run('1214', 4) == '2', 'Error.'
        assert Solver.run('3', 157) == '3', 'Error.'
        assert Solver.run('299792458', 9460730472580800) == '2', 'Error.'
        assert Solver.run('123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789', 100000000000000000) == '2', 'Error.'
        assert Solver.run('11123', 2) == '1', 'Error.'
        assert Solver.run('11123', 3) == '1', 'Error.'
        assert Solver.run('11123', 4) == '2', 'Error.'
        assert Solver.run('11123', 5) == '2', 'Error.'

        elapsed_time = time.time() - start_time
        logging.debug('elapsed_time: {0}'.format(elapsed_time) + '[sec]')


if __name__ == '__main__':
    logging.basicConfig(level=logging.DEBUG)

    solver = Solver()
    # Solver.test()

    solver.input_value()
    ans = solver.run(solver.s, solver.k)
    print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import logging
import time
import math


class Solver:
    def __init__(self):
        self.s = ''
        self.k = 0

    # 入力
    def input_value(self):
        # self.n = int(input())
        # self.A, self.B = map(int, input().split())
        # self.A = list(map(int, input().split()))
        # self.a, self.b, self.c = map(int, [input() for i in range(4)])
        # self.t = [None] * self.n
        self.s = input()
        self.k = int(input())


    @staticmethod
    def run(s, k):
        # count = [None] * len(s)
        sum = 0
        for i in range(len(s) + 1):
            # count[i] = int(s[i]) ** (5 * 10 ** 15)
            # sum += int(s[i]) ** (5 * 10 ** 15)
            sum += (5 * 10 ** 15) * math.log10(int(s[i]))
            if sum >= math.log10(k):
                return s[i]
        return s[len(s)]

    @staticmethod
    def test():
        start_time = time.time()

        assert Solver.run('1214', 4) == '2', 'Error.'
        assert Solver.run('3', 157) == '3', 'Error.'
        assert Solver.run('299792458', 9460730472580800) == '2', 'Error.'

        elapsed_time = time.time() - start_time
        logging.debug('elapsed_time: {0}'.format(elapsed_time) + '[sec]')


if __name__ == '__main__':
    logging.basicConfig(level=logging.DEBUG)

    solver = Solver()
    # Solver.test()

    solver.input_value()
    ans = solver.run(solver.s, solver.k)
    print(ans)