Buggy python submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(20000)


class Dp:

    def __init__(self, size):
        self.size = size
        self.array = [0] * (size+1)

    def calc(self, n):
        if n == 1:
            return 1
        if self.array[n] != 0:
            return self.array[n]
        self.array[n] = self.calc(n//2) * 2 + 1
        return self.array[n]


def main():
    h = int(input())
    dp = Dp(h)
    result = dp.calc(h)
    print(result)


if __name__ == "__main__":
    main()


Fixed submission:
import sys
from functools import lru_cache
sys.setrecursionlimit(20000)


class Dp:

    def __init__(self, size):
        self.size = size

    @lru_cache(maxsize=None)
    def calc(self, n):
        if n == 1:
            return 1
        return self.calc(n//2) * 2 + 1


def main():
    h = int(input())
    dp = Dp(h)
    result = dp.calc(h)
    print(result)


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(20000)


class Dp:

    def __init__(self, size):
        self.size = size
        self.array = [0] * (size+1)

    def calc(self, n):
        if n == 1:
            return 1
        if self.array[n] != 0:
            return self.array[n]
        self.array[n] = self.calc(n//2) * 2 + 1
        return self.array[n]


def main():
    h = int(input())
    dp = Dp(h)
    result = dp.calc(h)
    print(result)


if __name__ == "__main__":
    main()


Fixed submission:
import sys
from functools import lru_cache
sys.setrecursionlimit(20000)


class Dp:

    def __init__(self, size):
        self.size = size

    @lru_cache(maxsize=None)
    def calc(self, n):
        if n == 1:
            return 1
        return self.calc(n//2) * 2 + 1


def main():
    h = int(input())
    dp = Dp(h)
    result = dp.calc(h)
    print(result)


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(10000)


class Dp:

    def __init__(self, size):
        self.size = size
        self.array = [0] * (size+1)

    def calc(self, n):
        if n == 1:
            return 1
        if self.array[n] != 0:
            return self.array[n]
        self.array[n] = self.calc(n//2) * 2 + 1
        return self.array[n]


def main():
    h = int(input())
    dp = Dp(h)
    result = dp.calc(h)
    print(result)


if __name__ == "__main__":
    main()


Fixed submission:
import sys
from functools import lru_cache
sys.setrecursionlimit(20000)


class Dp:

    def __init__(self, size):
        self.size = size

    @lru_cache(maxsize=None)
    def calc(self, n):
        if n == 1:
            return 1
        return self.calc(n//2) * 2 + 1


def main():
    h = int(input())
    dp = Dp(h)
    result = dp.calc(h)
    print(result)


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(10**20)


class Dp:

    def __init__(self, size):
        self.size = size
        self.array = [0] * (size+1)

    def calc(self, n):
        if n == 1:
            return 1
        if self.array[n] != 0:
            return self.array[n]
        self.array[n] = self.calc(n//2) * 2 + 1
        return self.array[n]


def main():
    h = int(input())
    dp = Dp(h)
    result = dp.calc(h)
    print(result)


if __name__ == "__main__":
    main()

    

Fixed submission:
import sys
from functools import lru_cache
sys.setrecursionlimit(20000)


class Dp:

    def __init__(self, size):
        self.size = size

    @lru_cache(maxsize=None)
    def calc(self, n):
        if n == 1:
            return 1
        return self.calc(n//2) * 2 + 1


def main():
    h = int(input())
    dp = Dp(h)
    result = dp.calc(h)
    print(result)


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
class Dp:

    def __init__(self, size):
        self.size = size
        self.array = [0] * (size+1)

    def calc(self, n):
        if n == 1:
            return 1
        if self.array[n] != 0:
            return self.array[n]
        self.array[n] = self.calc(n//2) * 2 + 1
        return self.array[n]


def main():
    h = int(input())
    dp = Dp(h)
    result = dp.calc(h)
    print(result)


if __name__ == "__main__":
    main()


Fixed submission:
import sys
from functools import lru_cache
sys.setrecursionlimit(20000)


class Dp:

    def __init__(self, size):
        self.size = size

    @lru_cache(maxsize=None)
    def calc(self, n):
        if n == 1:
            return 1
        return self.calc(n//2) * 2 + 1


def main():
    h = int(input())
    dp = Dp(h)
    result = dp.calc(h)
    print(result)


if __name__ == "__main__":
    main()