Buggy python submission (verdict: Runtime Error):

def     RemoveDoublons(pile, elem):
    i = 0
    l = len(pile)
    while (i < l):
        val = pile[i]
        if (val[0] == elem[0] and val[1] == elem[1]):
            pile.pop(i)
            l -= 1
        i += 1
    return pile

def     findCloser(pile, distance):
    pos = 0
    elem = pile[0]
    bestDist = distance[elem[0]][elem[1]]
    if (bestDist == 0):
        return 0
    for i in range(len(pile)):
        val = pile[i]
        if (distance[val[0]][val[1]] < bestDist):
            elem = val
            bestDist = distance[elem[0]][elem[1]]
            pos = i
            if (bestDist == 0):
                return pos
    return pos

def     isValidCase(i, j, size, mappy):
    if (i < 0 or  j < 0 or i >= size[0] or j >= size[1] or not mappy[i][j]):
        return False
    return True

def     Calculdist(i, j, elem):
    if ((i == elem[0] and  abs(j - elem[1]) == 1) or (j == elem[1] and  abs(i - elem[0]) == 1)):
        return 0
    return 1

def printMappy(distance):
    for i in range(len(distance)):
        print(distance[i])

def     parcour(mappy, distance, start, end, size):
    pile = [start]
    distance[start[0]][start[1]] = 0

    while(len(pile) > 0):
        pos = findCloser(pile, distance)
        elem = pile.pop(pos)
        pile = RemoveDoublons(pile, elem)
        myDist = distance[elem[0]][elem[1]]
        if (elem[0] == end[0] and elem[1] == end[1]):
            return myDist
        for i in range(elem[0] - 2, elem[0] + 3):
            for j in range(elem[1] - 2, elem[1] + 3 ):
                if (isValidCase(i, j, size, mappy) and not (i == elem[0] and j == elem[1])):
                    dist = Calculdist(i, j, elem)
                    if (myDist + dist < distance[i][j]):
                        distance[i][j] = myDist + dist
                        pile.append([i,j])
    return -1


data = input().split()
size = [int(data[0]) , int(data[1])]
data = input().split()
start = [int(data[0]) - 1, int(data[1]) - 1]
data = input().split()
end = [int(data[0]) - 1, int(data[1]) - 1]

LIM = 999
mappy = []
distance = []
for i in range(size[0]):
    tmp = [False] * size[1]
    tmp2 = [LIM] * size[1]
    s = input()
    for j in range(size[1]):
        if (s[j] == '.'):
            tmp[j] = True
    mappy.append(tmp)
    distance.append(tmp2)
res = parcour(mappy, distance, start, end, size)
print(res)



Fixed submission:


data = input().split()

n,x,t = int(data[0]), int(data[1]), int(data[2])

res = (n // x) * t
if (n%x != 0):
    res += t
print(res)

Buggy python submission (verdict: Runtime Error):

def     RemoveDoublons(pile, elem):
    i = 0
    l = len(pile)
    while (i < l):
        val = pile[i]
        if (val[0] == elem[0] and val[1] == elem[1]):
            pile.pop(i)
            l -= 1
        i += 1
    return pile

def     findCloser(pile, distance):
    pos = 0
    elem = pile[0]
    bestDist = distance[elem[0]][elem[1]]
    if (bestDist == 0):
        return 0
    for i in range(len(pile)):
        val = pile[i]
        if (distance[val[0]][val[1]] < bestDist):
            elem = val
            bestDist = distance[elem[0]][elem[1]]
            pos = i
            if (bestDist == 0):
                return pos
    return pos

def     isValidCase(i, j, size, mappy):
    if (i < 0 or  j < 0 or i >= size[0] or j >= size[1] or not mappy[i][j]):
        return False
    return True

def     Calculdist(i, j, elem):
    if ((i == elem[0] and  abs(j - elem[1]) == 1) or (j == elem[1] and  abs(i - elem[0]) == 1)):
        return 0
    return 1

def printMappy(distance):
    for i in range(len(distance)):
        print(distance[i])

def     parcour(mappy, distance, start, end, size):
    pile = [start]
    distance[start[0]][start[1]] = 0

    while(len(pile) > 0):
        pos = findCloser(pile, distance)
        elem = pile.pop(pos)
        pile = RemoveDoublons(pile, elem)
        myDist = distance[elem[0]][elem[1]]
        if (elem[0] == end[0] and elem[1] == end[1]):
            return myDist
        for i in range(elem[0] - 2, elem[0] + 3):
            for j in range(elem[1] - 2, elem[1] + 3 ):
                if (isValidCase(i, j, size, mappy) and not (i == elem[0] and j == elem[1])):
                    #print()
                    dist = Calculdist(i, j, elem)
                    if (myDist + dist < distance[i][j]):
                        distance[i][j] = myDist + dist
                        pile.append([i,j])
    return -1


data = input().split()
size = [int(data[0]) , int(data[1])]
data = input().split()
start = [int(data[0]) - 1, int(data[1]) - 1]
data = input().split()
end = [int(data[0]) - 1, int(data[1]) - 1]

LIM = 999
mappy = []
distance = []
for i in range(size[0]):
    tmp = [False] * size[1]
    tmp2 = [LIM] * size[1]
    s = input()
    for j in range(size[1]):
        if (s[j] == '.'):
            tmp[j] = True
    mappy.append(tmp)
    distance.append(tmp2)
res = parcour(mappy, distance, start, end, size)
print(res)



Fixed submission:


data = input().split()

n,x,t = int(data[0]), int(data[1]), int(data[2])

res = (n // x) * t
if (n%x != 0):
    res += t
print(res)