inputs: I found an interesting problem on https://codeforces.com/problemset/problem/1245/E:
Hyakugoku has just retired from being the resident deity of the South Black Snail Temple in order to pursue her dream of becoming a cartoonist. She spent six months in that temple just playing "Cat's Cradle" so now she wants to try a different game — "Snakes and Ladders". Unfortunately, she already killed all the snakes, so there are only ladders left now. 

The game is played on a $10 \times 10$ board as follows:  At the beginning of the game, the player is at the bottom left square.  The objective of the game is for the player to reach the Goal (the top left square) by following the path and climbing vertical ladders. Once the player reaches the Goal, the game ends.  The path is as follows: if a square is not the end of its row, it leads to the square next to it along the direction of its row; if a square is the end of its row, it leads to the square above it. The direction of a row is determined as follows: the direction of the bottom row is to the right; the direction of any other row is opposite the direction of the row below it. See Notes section for visualization of path.  During each turn, the player rolls a standard six-sided dice. Suppose that the number shown on the dice is $r$. If the Goal is less than $r$ squares away on the path, the player doesn't move (but the turn is performed). Otherwise, the player advances exactly $r$ squares along the path and then stops. If the player stops on a square with the bottom of a ladder, the player chooses whether or not to climb up that ladder. If she chooses not to climb, then she stays in that square for the beginning of the next turn.  Some squares have a ladder in them. Ladders are only placed vertically — each one leads to the same square of some of the upper rows. In order for the player to climb up a ladder, after rolling the dice, she must stop at the square containing the bottom of the ladder. After using the ladder, the player will end up in the square containing the top of the ladder. She cannot leave the ladder in the middle of climbing. And if the...

I tried it in Python, but could not do it. Can you solve it?
targets: 3

import array
from fractions import Fraction
import functools
import itertools
import math
import os
import sys


def main():
    H = [read_ints() for _ in range(10)]
    print(solve(H))


def pos_idx(x, y):
    i = y * 10
    if y % 2 == 0:
        i += x
    else:
        i += 9 - x
    return i


def idx_pos(i):
    y = i // 10
    if y % 2 == 0:
        x = i % 10
    else:
        x = 9 - i % 10
    return x, y


def solve(H):
    dp = [0] * 100
    for i in range(1, 100):
        e = 0
        for d in range(1, 7):
            j = i - d
            if j < 0:
                rem = 7 - d
                e += rem / 6
                e *= 6 / (6 - rem)
                break
            x, y = idx_pos(j)
            if H[y][x] != 0:
                dy = y - H[y][x]
                k = pos_idx(x, dy)
                assert idx_pos(k) == (x, dy)
                e += (min(dp[j], dp[k]) + 1) / 6
            else:
                e += (dp[j] + 1) / 6
        dp[i] = e
    return dp[99]


###############################################################################
# AUXILIARY FUNCTIONS

DEBUG = 'DEBUG' in os.environ


def inp():
    return sys.stdin.readline().rstrip()


def read_int():
    return int(inp())


def read_ints():
    return [int(e) for e in inp().split()]


def dprint(*value, sep=' ', end='\n'):
    if DEBUG:
        print(*value, sep=sep, end=end)


def __starting_point():
    main()

__starting_point()