<jupyter_start><jupyter_text>Beautiful Days at the Movies<jupyter_code>#!/bin/python3

import sys

def beautifulDays(i, j, k):
    # Complete this function
    result = []
    for day in range(i, j+1):
        if abs(day - int(str(day)[::-1])) % k == 0:
            result.append(day)
    
    return len(result)
    

if __name__ == "__main__":
    i, j, k = input().strip().split(' ')
    i, j, k = [int(i), int(j), int(k)]
    result = beautifulDays(i, j, k)
    print(result)<jupyter_output>20 23 6
2<jupyter_text>Viral Advertising<jupyter_code>#!/bin/python3

import sys

def viralAdvertising(n):
    # Complete this function
    like_ppl = []
    for i in range(n):
        if i == 0:
            like_ppl.append(5//2)
            get_ad = like_ppl[i] * 3
        else:
            like_ppl.append(get_ad//2)
            get_ad = like_ppl[i] * 3

    return sum(like_ppl)

if __name__ == "__main__":
    n = int(input().strip())
    result = viralAdvertising(n)
    print(result)<jupyter_output>3
9<jupyter_text>Save the Prisoner!  Circular Array Rotation|<jupyter_code>#!/bin/python3

import sys

def circularArrayRotation(a, m):
    # Complete this function
    result = []
    tmp = a[n-k%n:] + a[:n-k%n]
    for i in range(q):
        result.append(tmp[m[i]])
    return result

if __name__ == "__main__":
    n, k, q = input().strip().split(' ')
    n, k, q = [int(n), int(k), int(q)]
    a = list(map(int, input().strip().split(' ')))
    m = []
    m_i = 0
    for m_i in range(q):
        m_t = int(input().strip())
        m.append(m_t)
    result = circularArrayRotation(a, m)
    print ("\n".join(map(str, result)))<jupyter_output>3 2 3
1 2 3
0
1
2
2
3
1<jupyter_text>Sequence Equation<jupyter_code>#!/bin/python3

import sys

def permutationEquation(p):
    # Complete this function
    result = []
    for i in range(1, len(p)+1):
        result.append(p.index(p.index(i)+1)+1)
    return result
    

if __name__ == "__main__":
    n = int(input().strip())
    p = list(map(int, input().strip().split(' ')))
    result = permutationEquation(p)
    print ("\n".join(map(str, result)))<jupyter_output>3
2 3 1
2
3
1<jupyter_text>Jumping on the Clouds: Revisited<jupyter_code>#!/bin/python3

import sys

def jumpingOnClouds(c, k):
    # Complete this function
    energy = 100
    c.append(c[0])
    for i in range(n//k):
        energy -= 1
        if c[i*k] == 1:
            energy -= 2
#     tmp = [c[i], c.index(i) for i in range(n) if i%k == 0]
    return energy

if __name__ == "__main__":
    n, k = input().strip().split(' ')
    n, k = [int(n), int(k)]
    c = list(map(int, input().strip().split(' ')))
    result = jumpingOnClouds(c, k)
    print(result)
    
2 
5 2 1
5 2 2
num=5; candy=2; pid=1;
# n=5; m=2; s=2;

def saveThePrisoner(num, candy, pid):
    # Complete this function
    candy_prisoner = [i for i in range(candy, pid, num)]
    for i in range(candy):
        


result = saveThePrisoner(num, candy, pid)
print(result)

n=5; m=12; s=2;
candy_prisoner=[]
candy_prisoner = [s+i for i in range(1, n-s+1)] 
# print(candy_prisoner)
# if m>n:
#     candy_prisoner += [i for i in range(1, n-s)]
print(candy_prisoner)
candy_prisoner[m-1]
n=5; m=12; s=2; candy_prisoner=[]
candy_prisoner = [i+s for i in range(n-1)]
if m>n:
    candy_prisoner += [i+1-s for i in range(s, m-len(candy_prisoner)-1)]
candy_prisoner
n=5; m=12; s=2; candy_prisoner=[]
candy_prisoner = [i for i in range(s, n+1)] + [i for i in range(1, s)]
candy_prisoner
m%n
candy_prisoner[m%n-1]
n=5; m=12; s=2; candy_prisoner=[]

if m > n:
    print(m%n + s)
else:
    print(n%m + s)
# n=5; m=12; s=2; 
n=5; m=2; s=2;

# candy_prisoner=[]

def saveThePrisoner(n, m, s):
#     Complete this function
    candy_prisoner = [i for i in range(s, n+1)] + [i for i in range(1, s)]
    return candy_prisoner[m%n-1]
#     if m > n:
#         return s + m%n
#     else:
#         return n%m+s

result = saveThePrisoner(n, m, s)
print(result)

# n=5; m=12; s=2; 
# n=5; m=2; s=1;
n=5; m=2; s=2;
# n=46934; m=543563655; s=46743  # 20809
# n=530; m=533048047; s=529 # 15
# n=999999999; m=999999998; s=999983945 # 999983943


def saveThePrisoner(n, m, s):
#     if n-s >= m:
    if n >= m and (n-s) >= m:
        return m-(n-s)-1  
    
    elif n >= m and (n-s) < m:
        return s+m-1

    elif n < m:
        return (m%n + s)%n - 1
    
#     elif n < m and n-s >= m:
#         return (m%n + s)%n - 1
    
#     elif n<m and n-s < m:
#         return (m%n + s)%n - 1

result = saveThePrisoner(n, m, s)
print(result)

n=999999999; m=999999999; s=999983945 
m-n+s-1
m-(n-s)-1  
n=436776012; m=436776012; s=436776011 # 436776010
n-s
m-(n-s)-1  
n=530; m=533048047; s=529 # 15
(m%n + s)%n - 1<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.17190820229494264, 'fraction_numerical': 0.059286017849553764, 'mean_word_length': 2.789855072463768, 'pattern_counts': {'":': 5, '<': 22, '<?xml version=': 0, '>': 26, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 4, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '279967', 'license': 'MIT', 'n_tokens_mistral': 2187, 'n_tokens_neox': 2024, 'n_words': 491, 'path': '20180308_study.ipynb', 'repo_name': 'ninepark/hackerrank_repo', 'size': '4706'}