• + 1 comment

    This works in Javascript for all test cases:

    function main() {
        var n_temp = readLine().split(' ');
        var n = parseInt(n_temp[0]);
        var k = parseInt(n_temp[1]);
        var q = parseInt(n_temp[2]);
      
        a = readLine().split(' ');
        a = a.map(Number);
      
        for (var i=0; i<q; i++) {
          var m = readLine();
          console.log(a.slice(m-k%n)[0]);
        }
    }