<jupyter_start><jupyter_text><NAME> knows of an operation called a right circular rotation on an array of integers. One rotation operation moves the last array element to the first position and shifts all remaining elements right one. To test Sherlock's abilities, Watson provides Sherlock with an array of integers. Sherlock is to perform the rotation operation a number of times then determine the value of the element at a given position.For each array, perform a number of right circular rotations and return the values of the elements at the given indices.<jupyter_code>n,k,q = raw_input().strip().split(' ')
n,k,q = [int(n),int(k),int(q)]
a = map(int,raw_input().strip().split(' '))

#print a    
if k%n!=0:
    k=k%n
    for i in range(k):
        last=a[-1]
        a=a[:-1]
        a.insert(0,last)
    
for a0 in xrange(q):
    m = int(raw_input().strip())
    print a[m]
if __name__ == "__main__":
    n, k, q = map(int, input().split())
    a = list(map(int, input().split()))

    # make the circular rotation
    # in Python, it's ultra-simple
    k = n - k % n
    a = a[k:] + a[:k]

    for _ in range(q):
        i = int(input())
        print(a[i])<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1262541806020067, 'fraction_numerical': 0.004180602006688963, 'mean_word_length': 3.3369565217391304, 'pattern_counts': {'":': 1, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '10679', 'license': 'MIT', 'n_tokens_mistral': 389, 'n_tokens_neox': 381, 'n_words': 145, 'path': 'Algorithm/62. circular array rotation.ipynb', 'repo_name': 'faisalsanto007/Hakcerrank-problem-solving', 'size': '1201'}