Problem:
Score : 100 points

Problem Statement

A biscuit making machine produces B biscuits at the following moments: A seconds, 2A seconds, 3A seconds and each subsequent multiple of A seconds after activation.

Find the total number of biscuits produced within T + 0.5 seconds after activation.

Constraints

All values in input are integers.

1 \leq A, B, T \leq 20

Input

Input is given from Standard Input in the following format:

A B T

Output

Print the total number of biscuits produced within T + 0.5 seconds after activation.

Sample Input 1

3 5 7

Sample Output 1

10

Five biscuits will be produced three seconds after activation.

Another five biscuits will be produced six seconds after activation.

Thus, a total of ten biscuits will be produced within 7.5 seconds after activation.

Sample Input 2

3 2 9

Sample Output 2

6

Sample Input 3

20 20 19

Sample Output 3

0

Solution in Kotlin (1.0.0) (judge verdict: Runtime Error)

import java.util.*

fun main(args: Array<String>) {
    val n = Integer.parseInt(readLine() ?: "0")
    val alist = readLine()?.split(" ") ?: listOf()
    val a = alist.map{Integer.parseInt(it)}.distinct()
    when(a.size) {
      0 -> {
        println("0")
      }
      1 -> {
        println(a[0])
      }
      2 -> {
        if(alist[0] > alist[1]) {
          println(alist[0])
        } else {
          println(alist[1])
        }
      }
      else -> {
        var ans = 0
        for(i in 0..n-1) {
          val l = a.take(i)
          val r = a.takeLast(a.size - i - 1)
          val lgcd = gcd(l)
          val rgcd = gcd(r)
          var m = 0
          when {
            lgcd == 0 -> m = rgcd
            rgcd == 0 -> m = lgcd
            else -> {
              m = gcd(listOf(lgcd, rgcd))
            }
          }
          if(ans < m) ans = m
        }
        println(ans)
      }
    }
}

fun listToStack(list: List<Int>): Stack<Int> {
    val stack = Stack<Int>()

    for (e in list) {
        stack.push(e)
    }

    return stack
}

fun gcd(list: List<Int>): Int {
  val stack = listToStack(list)
  if(stack.size == 0) return 0
  while (1 < stack.size) {
    val pops = (0 until 2).map {
      stack.pop()
    }
    val minIndex = if (pops[1] < pops[0]) {
      1
    } else {
      0
    }
    stack.push(pops[minIndex])
    if(pops[minIndex] == 0) {
      //stack.push(pops[(minIndex + 1) % 2])
    } else {
      val r = pops[(minIndex + 1) % 2] % pops[minIndex]
      if (0 < r) {
        stack.push(r)
      }
    }
  }
  return stack.pop()
}

fun solve(numList: List<Int>): Int {
  var newList = numList.distinct().sorted() as MutableList
  var r: Int = 0
  while (newList.count() > 1) {
    r = newList[0]
    newList = newList.takeLast(newList.count() - 1).map {it % newList[0]} as MutableList
    newList.add(r)
    newList = newList.distinct().sorted().filter { it != 0 } as MutableList<Int>
  }
  return r
}