Harryxun/stf_run huggingface dataset:
from numba import njit
import numpy as np


def main(S, T):
    if len(T)-len(S) != 1:
        print("No")
        return
    count = 0
    for i in range(len(S)):
        if S[i] != T[i+count]:
            count += 1
            if count > 1:
                print("No")
                return
    print("Yes")


def cc_export():
    from numba.pycc import CC
    cc = CC('my_module')
    cc.export('main', '')(main)
    cc.compile()


if __name__ == '__main__':
    import sys
    if sys.argv[-1] == 'ONLINE_JUDGE':
        cc_export()
        exit(0)
    from my_module import main
    S = input()
    T = input()
    main(S, T)

### FIXED CODE ###

from numba import njit
import numpy as np


def main(S, T):
    if len(T)-len(S) != 1:
        print("No")
        return
    count = 0
    for i in range(len(S)):
        if S[i] != T[i]:
            count += 1
            if count > 0:
                print("No")
                return
    print("Yes")


S = input()
T = input()
main(S, T)
a,b=map(int(input().split())
if a==3,b==1 :
  print(2)
elif a==1,b==2 :
  print(3)
elif a==2,b==3 :
  print(1)


### FIXED CODE ###

a=int(input())
b=int(input())
if a==3 and b==1 :
  print(2)
elif a==1 and b==2 :
  print(3)
elif a==2 and b==3 :
  print(1)
elif a==3 and b==2 :
  print(1)
elif a==1 and b==3 :
  print(2)
elif a==2 and b==1 :
  print(3)
a,b=map(int,input().split())
if a+b=15:
    print('+')
elif a*b=15:
    print('*')
else:
    print('x')

### FIXED CODE ###

a,b=map(int,input().split())
if a+b==15:
    print('+')
elif a*b==15:
    print('*')
else:
    print('x')
import math

# inputList=[]
# for i in range(6):
#     inputNum = input()
#     inputList.append(inputNum)
inputa = input().split()
# inputb = input().split()

inputa = [int(n) for n in inputa]
inputa.sort()

a = int(inputa[0])
# b = int(inputa[1])
# c = int(inputa[2])

# x = int(inputb[0])
# y = int(inputb[1])

ans(a*2)


### FIXED CODE ###

import math

# inputList=[]
# for i in range(6):
#     inputNum = input()
#     inputList.append(inputNum)
inputa = input().split()
# inputb = input().split()

# inputa = [int(n) for n in inputa]
# inputa.sort()

a = int(inputa[0])
# b = int(inputa[1])
# c = int(inputa[2])

# x = int(inputb[0])
# y = int(inputb[1])

if a%2 == 0:
    print(a)
else:
    print(a*2)
s = input()

slist = s.split(' ')

left = int(slist[0]) + int(slist[1])

right = int(slist[2]) + int(slist[3])

if left > right:
	print('left')
else if left == right:
	print('Balanced')
else:
	print('right')

### FIXED CODE ###

s = input()

slist = s.split(" ")

left = int(slist[0]) + int(slist[1])

right = int(slist[2]) + int(slist[3])

if left > right:
	print("Left")
	
elif left == right:
	print("Balanced")
	
else:
	print("Right")
import bisect,collections,itertools,math,numpy,string,sympy
def I(): return int(input())
def F(): return float(input())
def S(): return input()
def LI(): return list(map(int,input().split()))
##################################################
def main(a,b,c):
    if float(sympy.sqrt(a))+float(sympy.sqrt(b))-float(sympy.sqrt(c)) < 0:
        return 'Yes'
    else:
        return 'No'
    
a,b,c = LI()
print(main(a,b,c))

### FIXED CODE ###

import bisect,collections,decimal,itertools,math,numpy,string
def I(): return int(input())
def F(): return float(input())
def S(): return input()
def LI(): return list(map(int,input().split()))
##################################################
def main(a,b,c):
    if c-a-b < 0:
        return 'No'
    if 4*a*b < (c-a-b)**2:
        return 'Yes'
    return'No'
    
a,b,c = LI()
print(main(a,b,c))
import sys, re
import math
import numpy as np
from decimal import Decimal
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul	# 
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd	# 最大公約数
from heapq import heappush, heappop

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.maxsize = 10 ** 15
sys.setrecursionlimit(10 ** 9 + 7)
INF = float('inf')
MOD = 10 ** 9 + 7

# -*- coding: utf-8 -*-

n = input()
if n[len(n) - 1] == s:
    print(n + "es")
else:
    print(n + "s")

### FIXED CODE ###

import sys, re
import math
import numpy as np
from decimal import Decimal
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul	# 
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd	# 最大公約数
from heapq import heappush, heappop

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.maxsize = 10 ** 15
sys.setrecursionlimit(10 ** 9 + 7)
INF = float('inf')
MOD = 10 ** 9 + 7

# -*- coding: utf-8 -*-

n = input()
if n[-1] == "s":
    print(n + "es")
else:
    print(n + "s")
input("A%sC"%input()[8])

### FIXED CODE ###

print("A%sC"%input()[8])
N,L=map(int,input().split())
if L >= 0:
  print(int((N-1)/2*(L + L + N)))
else:
  if L + N - 1 >= 0: 
    print(int(N / 2 * (L + L + N - 1)))
  else:
    print(int((N - 1)/ 2 * (L + L + N - 2)))


### FIXED CODE ###

S=input()
for i in range(3):
  if S[i]==S[i+1]:
    print("Bad")
    exit(0)
print("Good")
N, M = map(int, input().split())
ab = []
for i in range(M):
    ab += list(map(int, input().split()))

for i in range(1, N+1):
    print(ab.count(i))

### FIXED CODE ###

a, b, c = map(int, input().split())
if a <= c <= b:
    print('Yes')
else:
    print('No')
def main():
    N = int(input())
    A = input()
    Q = input()

    answer = sum(list(map(int, A.split())))
    A = A.replace(" ", "")

    operateList = (open(0).read().split("\n"))[:-1]
    print(operateList)

    for operate in operateList:
        B, C = operate.split()
        numB = A.count(B)

        answer = answer + (int(C) - int(B)) * numB
        print(answer)

        A = A.replace(B, C)

if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys

def main():
    N = int(input())
    A = list(map(int, input().split()))
    Q = int(input())

    answer = sum(A)
    setA = set(A)
    numNumberList = [0] * 100001

    for Ai in A:
        numNumberList[Ai] = numNumberList[Ai] + 1    

    for i in range(Q):
        B, C = list(map(int, sys.stdin.readline().split()))
        answer = answer + (int(C) - int(B)) * numNumberList[B]

        numNumberList[C] = numNumberList[C] + numNumberList[B]
        numNumberList[B] = 0

        print(answer)

if __name__ == "__main__":
    main()
n, x, t = map(int, input())
print((n//x+1)*t)

### FIXED CODE ###

n, x, t = map(int, input().split())
if n % x == 0:
  print(int(n/x*t))
else:
  print(int((n//x+1)*t))
N, M = list(map(int, input().split(" ")))
list_a = list(map(int, input().split(" ")))

##最大公約数を求める

def gcd(a, b) :
  if(b==0) :
    return a
  else :
    return(b, a%b)
   
##最小公倍数を求める
def lcm(a, b) :
  return a * b / gcd(a, b)
  
##複数個の整数の最小公倍数を求める
def lcm_multi(l) :
  if(len(l) < 2) :
    return l[0]
  res = lcm(l[0], l[1])
  for i in range(2, N) :
    res = lcm(l[i], res)
    
  return res

ans = 0
lcm_m = lcm_multi(list_a)

if(M-lcm_m/2 < 0) :
  print(0)
else :
  print(int((M-lcm_m/2) / lcm_m) + 1)


### FIXED CODE ###

N, M = list(map(int, input().split(" ")))
list_a = list(map(int, input().split(" ")))

##半公倍数が存在するかチェック
def check_exist(l) :
  if(len(l) == 1) :
    return True
  while(True) :
    flag = l[0] % 2
    for x in l[1:] :
      if(x % 2 != flag) :
        return False
    if(flag == 0) :
      l = list(map(lambda x: int(x/2), l))
    else :
      return True
    

##最大公約数を求める

def gcd(a, b) :
  if(b==0) :
    return a
  else :
    return gcd(b, a%b)
   
##最小公倍数を求める
def lcm(a, b) :
  cd = gcd(a, b)
  return (a / cd) * b
  
##複数個の整数の最小公倍数を求める
def lcm_multi(l) :
  cm = 1
  for x in l :
    cm = lcm(x, cm)
    if(cm > 4 * M) :
      print(0)
      exit()
    
  return cm

if(not(check_exist(list_a))) :
  print(0)
  exit()

## 1/2の公倍数
lcm_m = lcm_multi(list(map(lambda x: int(x/2), list_a)))

if(M-lcm_m < 0) :
  print(0)
else :
  print(int((M-lcm_m) / (2*lcm_m)) + 1)
import numpy as np
from itertools import product
n, m, x = [int(x) for x in input().split()]
a = np.stack([np.array(input().split(), dtype=int) for _ in range(n)])
tot = np.sum(a, axis=0)
if min(tot[1:]) < x:
    print(-1)
    exit(0)
cost = tot[0]
whole = np.array(list(product([0,1],repeat=n)), dtype=bool)[1:-1]
for flag in whole:
    tot = np.sum(a[flag], axis=0)
    if min(tot[1:]) >= x and tot[0] < cost:
        cost = tot[0]
print(cost)


### FIXED CODE ###

n, k = [int(x) for x in input().split()]
a = [int(x)-1 for x in input().split()]
assert len(a) == n
current = 0
visited = [-1] * n
visited[0] = 0
for i in range(1, k):
  current = a[current]
  if visited[current] == -1:
    visited[current] = i
  else:
    pre = visited[current]
    count = (k - pre) % (i - pre) + pre
    print(visited.index(count)+1)
    break
else:
  print(a[current]+1)
import math

A,B,C,D = map(int,input().split())
lcm = C*D/math.gcd(C,D)
def c_in_a2b(c):
    return (math.ceil(B//c) - math.floor(A//c) + 1)
print(int((B-A+1)- c_in_a2b(C)-c_in_a2b(D)+c_in_a2b(lcm)))


### FIXED CODE ###

import fractions

a, b, c, d = map(int, input().split())

lcm = c*d // fractions.gcd(c,d)


b_num = b - (b//c + b//d - b//lcm)
a_num = a-1 - (a-1)// c - (a-1)//d + (a-1) // lcm

ans = b_num - a_num
print(ans)
s = list(input())

cnt = 0
i = 1

while i < len(s):
    while len(s) != 0 and s[i - 1] != s[i]:
        s.pop(i)
        s.pop(i - 1)
        i -= 1
        cnt += 2
    i += 1

print(cnt)


### FIXED CODE ###

s = list(input())

# Note: init
# cnt = 0
# i = 1
#
# while i < len(s):
#     while len(s) != 0 and s[i - 1] != s[i]:
#         s.pop(i)
#         s.pop(i - 1)
#         i -= 1
#         cnt += 2
#     i += 1
#
# print(cnt)


cnt = min(s.count("0"), s.count("1"))
print(cnt*2)
# 最小公倍数
# ユークリッドの互除法
def lcm(a, b): 
    def gcd(a, b):  # a >= b
        if b == 0:
            return a
        else:
            return gcd(b, a % b)
    
    return a * b // gcd(a, b)

N, M = map(int, input().split())
S = input()
T = input()

l = lcm(N, M)

ans = ['.']*(l+1)
flag = True

for i in range(N):
    now = (l // N) * i + 1
    if ans[now] == '.':
        ans[now] = S[i]

for i in range(M):
    now = (l // M) * i + 1
    if ans[now] == '.':
        ans[now] = T[i]
    else:
        if ans[now] != T[i]:
            flag = False
            break

if flag:
    print(l)
else:
    print(-1)



### FIXED CODE ###

# 最小公倍数
# ユークリッドの互除法
def lcm(a, b): 
    def gcd(a, b):  # a >= b
        if b == 0:
            return a
        else:
            return gcd(b, a % b)
    
    return a * b // gcd(a, b)

N, M = map(int, input().split())
S = input()
T = input()

l = lcm(N, M)

ans = {}
flag = True

for i in range(N):
    now = (l // N) * i + 1
    ans[now] = S[i]

for i in range(M):
    now = (l // M) * i + 1
    if now in ans:
        if ans[now] != T[i]:
            flag = False
            break

if flag:
    print(l)
else:
    print(-1)
n=int(input())
s,p=list(map(int,input().split()))
li=[]
for i in range(0,n):
  li.append(i+1,s[i],p[i])

new_li=sorted(li,key=lambda x:x[1])
new2_li=sorted(new_li,key=lambda x:x[2])

for j in range(0,n):
  print(new2_li[j][0])

### FIXED CODE ###

n=int(input())

li=[]

for i in range(0,n):
  s,p=input().split()
  p=int(p)
  li.append((i+1,s,p))


new_li=sorted(li,key=lambda x:x[2] , reverse=True)
new2_li=sorted(new_li,key=lambda x:x[1])


for j in range(0,n):
  print(new2_li[j][0])
H, W = map(int, input().split())
map = [input() for _ in range(H)]

white = 0
for d in map:
    white += d.count('.')

memory = [(0,0)]
data = [[0] * W for _ in range(H)]
data[0][0] = 1
direction = [(0,1), (0,-1), (1,0), (-1,0)]
while True:
    x, y = memory.pop(0)
    for dx, dy in direction:

        if x + dx == H - 1 and y + dy == W-1:
            print(white - (data[x][y] + 1))
            exit()
        if 0 <= x + dx < H and 0 <= y + dy < W:
            if map[x+dx][y+dy] == '.' and data[x+dx][y+dy] == 0:
                data[x+dx][y+dy] = data[x][y] + 1
                memory.append((x+dx, y+dy))







### FIXED CODE ###

H, W = map(int, input().split())
map = [input() for _ in range(H)]

white = 0
for d in map:
    white += d.count('.')

memory = [(0,0)]
data = [[0] * W for _ in range(H)]
data[0][0] = 1
direction = [(0,1), (0,-1), (1,0), (-1,0)]
while True:
    if len(memory) == 0:
        print(-1)
        exit()
    x, y = memory.pop(0)
    for dx, dy in direction:

        if x + dx == H - 1 and y + dy == W-1:
            print(white - (data[x][y] + 1))
            exit()
        if 0 <= x + dx < H and 0 <= y + dy < W:
            if map[x+dx][y+dy] == '.' and data[x+dx][y+dy] == 0:
                data[x+dx][y+dy] = data[x][y] + 1
                memory.append((x+dx, y+dy))
# ABC 061: C – Big Array
N, K = [int(i) for i in input().split()]
a, b = [], []
for _ in range(N):
    tmp = input().split()
    a.append(int(tmp[0]))
    b.append(int(tmp[1]))

cnt = [0] * 100000

for i in range(N):
    cnt[a[i]] += b[i]

for j in range(100000):
    if K <= cnt[j]:
        print(j)
        break
    K -= cnt[j]

### FIXED CODE ###

# ABC 061: C – Big Array
N, K = [int(i) for i in input().split()]
a, b = [], []
for _ in range(N):
    tmp = input().split()
    a.append(int(tmp[0]))
    b.append(int(tmp[1]))

cnt = [0] * (100000 + 1)

for i in range(N):
    cnt[a[i]] += b[i]

for j in range(100000 + 1):
    if K <= cnt[j]:
        print(j)
        break
    K -= cnt[j]
n=int(raw_input())

if n==0:
	print(2)
elif n==1:
	print(1)
else:
	ln=[2,1]
	for i in range(2,n+1):
		ln.append(ln[i-1]+ln[i-2])	
print(ln[-1])


### FIXED CODE ###

n=int(raw_input())

if n==0:
	print(2)
elif n==1:
	print(1)
ln=[2,1]
if n >=2:
	for i in range(2,n+1):
		ln.append(ln[i-1]+ln[i-2])	
	print(ln[-1])
def main():
    A, B = map(int, input().split())
    while b != 0: A, B = B, A % B 
    print(num_prime_factor(A))

def num_prime_factor(n):
    
    if n == 1: return 1
    
    ret = 1
    cursor = 2
    if n % cursor == 0: ret += 1
    while n % cursor == 0: n = n // cursor
    
    cursor = 3
    while cursor**2 <= n:
        if n == 1: return ret
        if n % cursor == 0: ret += 1
        while n % cursor == 0: n = n // cursor
        cursor += 2

    if n != 1: ret += 1
        
    return ret

if __name__ == "__main__":
    main()

### FIXED CODE ###

import math, fractions


def num_prime_factor(n):
    
    ret = 0

    for i in range(1, int(math.sqrt(n)) + 2):

        composite = False

        if n % i == 0:
            ret += 1
            n = n / i

            if i != 1:
                while n % i == 0:
                    n = n / i

            if n == 1:
                break

            for j in range(2, int(math.sqrt(n)) + 2):
                if n % j == 0:
                    composite = True
                    break

            if not composite:
                ret += 1
                break

    return ret

if __name__ == "__main__":
    A, B = map(int, input().split())
    n = fractions.gcd(A, B)
    print(num_prime_factor(n))
a,b = map(int,input().split())
if a,b ==[4,6,9,11]:
    print('Yes')
elif a,b ==[1,3,5,7,8,10,12]:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

x,y = map(int,input().split())
a =[4,6,9,11]
b = [1,3,5,7,8,10,12]
if (x in a and y in a) or (x in b and y in b):
    print('Yes')
else:
    print('No')
import math

n, k = map(int, input().split())
const = 1000000007

arr = list(sorted(map(int, input().split())))

def comb(n, r):
    if n < r or n < 0 or r < 0:
        return 0
    else:
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

result = 0
for i, e in enumerate(arr):
    result += e * (comb(i, k - 1) - comb(n - i - 1, k - 1))
    result %= const

print(result)


### FIXED CODE ###

print(chr(ord(input()) + 1))
n, m = map(int,input().split())
a = []
import sys
sys.setrecursionlimit(10000)
for i in range(m):
    a.append(int(input()))
memo = [0 for i in range(n)]
done = [0 for i in range(n)]
def p(i):
    if done[i-1] == 1:
        return memo[i-1]
    if i in a:
        return 0
    elif i == 1:
        return 1
    elif i == 2:
        return p(1) + 1
    else:
        done[i-1] = 1
        memo[i-1] = p(i-1) + p(i-2)
        return memo[i-1]
print(p(n) % (10**9 + 7))

### FIXED CODE ###

n, m = map(int,input().split())
p = [0 for i in range(n+1)]
a = [0 for i in range(n+1)]
for i in range(m):
    a[int(input())] = 1
for i in range(1,n+1):
    if a[i] == 1:
        p[i] = 0
    elif i == 1:
        p[i] = 1
    elif i == 2:
        p[i] = p[1] + 1
    else:
        p[i] = p[i-1] + p[i-2]
print(p[n] % (10**9 + 7))
import collections

n=int(input())


X=list(map(int,input().split()))
odd=[]
even=[]
for i in range(int(n/2)):
    odd.append(X[2*i+1])
    even.append(X[2*i])

odd_counter=collections.Counter(odd) #登場回数とその値の辞書型
even_counter=collections.Counter(even)

odd_count=sorted(odd_counter.values(),reverse=True) #登場回数の多い順に並べた配列
even_count=sorted(even_counter.values(),reverse=True)

max_odd_value=max(odd_counter,key=odd_counter.get) #登場回数が最大の値
max_even_value=max(even_counter,key=even_counter.get)

if max_odd_value!=max_even_value:
    print(n-odd_count[0]-even_count[0])

else:
    print(min(n-odd_count[0]-even_count[1],n-odd_count[1]-even_count[0]))

### FIXED CODE ###

import collections

n=int(input())


X=list(map(int,input().split()))
odd=[]
even=[]
for i in range(int(n/2)):
    odd.append(X[2*i+1])
    even.append(X[2*i])

odd_counter=collections.Counter(odd) #登場回数とその値の辞書型
even_counter=collections.Counter(even)

odd_count=sorted(odd_counter.values(),reverse=True) #登場回数の多い順に並べた配列
even_count=sorted(even_counter.values(),reverse=True)

max_odd_value=max(odd_counter,key=odd_counter.get) #登場回数が最大の値
max_even_value=max(even_counter,key=even_counter.get)

if max_odd_value!=max_even_value:
    print(n-odd_count[0]-even_count[0])
elif len(set(odd))!=1 and len(set(even))!=1:
    print(min(n-odd_count[0]-even_count[1],n-odd_count[1]-even_count[0]))
elif len(set(odd))==1 and len(set(even))==1:
    print(int(n/2))
elif len(set(odd))==1:
    print(int(n/2)-even_count[1])
elif len(set(even))==1:
    print(int(n/2)-odd_count[1])
n, m = map(int, input().split())
a = list([int(x) for x in input().split()])
 
for i in range(m):
    a[a.index(max(a))] = max(a)//2
print(sum(a))

### FIXED CODE ###

s = input()

if s == 'Sunny':
    print('Cloudy')
elif s == 'Cloudy':
    print('Rainy')
else:
    print('Sunny')
import sympy

n = int(input())

num = 0

for i in range(n):
    i +=1
    f = sympy.divisor_count(i)
    num += f*i

print(num)

### FIXED CODE ###


n = int(input())

ans = 0

def calc(b,e):
    cnt = e // b
    return (b + e) * cnt // 2

for i in range(1, n+1):
    ans += calc(i, n//i * i)

print(ans)
# -*- coding: utf-8 -*-

f_line = input().split()
N = int(f_line[0])
L = int(f_line[1])
S = []
s = ""
for i in range(N):
    S.append(input())
S.sort()
for i in range(N):
    s = s + S[i]
print("%s"%(s))


### FIXED CODE ###

# -*- coding: utf-8 -*-

f_count = 2
s_count = 1
haikuflag = False
input_stuck = input().split()
num = [int(input_stuck[0]),int(input_stuck[1]),int(input_stuck[2])]
for i in num:
    if i == 5:
        f_count-=1
    elif i == 7:
        s_count-=1
if f_count == 0 and s_count == 0:
    print('YES')
else:
    print('NO')
N = list(map(int,input().split()))

row = ""

if N[1] == 0:
    print(0)
else:
    remain = int(N[0]//(N[1]+N[2]))
    remain_2 = N[0] - N[1]*remain - N[2]*remain
    row += "b"*N[1]*remain+"a"*N[2]*remain+"b"*remain_2
    print(row.count("b"))

### FIXED CODE ###

N, A, B = map(int, input().split())
ans = N // (A + B) * A
rem = N % (A + B)
ans += min(rem, A)
print(ans)
import sys
import copy
#import math
#import itertools
#import numpy as np
#import re

def func(x,m):
    return x**2%m

N,X,M=[int(c) for c in input().split()]
myset = {X}
mydict = {0:X}
A = []
A.append(X)
s = X
i = 0
i_stop = i
#i=0は計算したので1から
for i in range(1,N):
    A.append(func(A[i-1],M))
    if A[i] in myset:
        i_stop = i
        break
    myset.add(A[i])
    mydict[A[i]] = i
    s+=A[i]
    if i == N-1:
        print(s)
        sys.exit(0)
    if A[i] == 0:
        print(s)
        sys.exit(0)

if i>0:
    #最後にA[i]が出現したのは？
    A_repeat = A[mydict[A[i_stop]]:i_stop]
    s+=((N-1)-(i_stop-1))//len(A_repeat)*sum(A_repeat)

    for k in range(((N-1)-(i_stop-1))%len(A_repeat)):
        s+=A_repeat[k]



print(s) 

### FIXED CODE ###

import sys
import copy
#import math
#import itertools
#import numpy as np
#import re

def func(x,m):
    return x**2%m

N,X,M=[int(c) for c in input().split()]
myset = {X}
mydict = {X:0}
A = []
A.append(X)
s = X
i = 0
i_stop = i
#i=0は計算したので1から
for i in range(1,N):
    A.append(func(A[i-1],M))
    if A[i] in myset:
        i_stop = i
        break
    myset.add(A[i])
    mydict[A[i]] = i
    s+=A[i]
    if i == N-1:
        print(s)
        sys.exit(0)
    if A[i] == 0:
        print(s)
        sys.exit(0)

if i!=0:
    #最後にA[i]が出現したのは？
    A_repeat = A[mydict[A[i_stop]]:i_stop]
    s+=((N-1)-(i_stop-1))//len(A_repeat)*sum(A_repeat)

    for k in range(((N-1)-(i_stop-1))%len(A_repeat)):
        s+=A_repeat[k]

print(s)
シカのAtCoDeerくんはペンキをこれまでに3つ買いました。おととい買ったペンキの色は a , 昨日買ったペンキの色は b , 今日買ったペンキの色は c です。各ペンキの色は1以上100以下の整数で表されます。 AtCoDeerくんはわすれんぼうなため、同じ色のペンキを買ってしまっていることがあります。AtCoDeerくんが買ったペンキの色の種類の個数を教えてあげてください。

a,b,c=map(int, input().split())


### FIXED CODE ###


def penki(a, b, c):
  if a==b and b==c:
    return 1
  elif a!=b and b!=c and c!=a:
    return 3
  else:
    return 2

a,b,c=map(int, input().split())
print(penki(a, b, c))
n,m = input().split();
a = input().splite();

a_sum = sum(a);

rest_day = n - a_sum

if rest_day > 0:
    return rest_day
else: return -1


### FIXED CODE ###

n,m = map(int,input().split())
a = list(map(int,input().split()))

a_sum = sum(a);

if n - a_sum < 0:
    print(-1)
else:
    print(n-a_sum)
L = int(input())
for i in range(20):
    if 2**i >  L :
        r = i-1
        break
        
res = []
for i in range(1, r+1):
    res.append([i, i+1, 0])
    res.append([i, i+1, 2**(i-1)])

for t in range(r, 0, -1):
    if L >= 2**r + 2**(t-1):
        L -= 2**(t-1)
        res.append([t, r+1, L])

print(r+1, len(res))
for i in range(len(res)):
    print(res[i][0], res[i][1], res[i][2])


### FIXED CODE ###

import math
L = int(input())
r = int(math.log2(L))

res = []
for i in range(1, r+1):
    res.append([i, i+1, 0])
    res.append([i, i+1, 2**(i-1)])

for t in range(r, 0, -1):
    if L >= 2**r + 2**(t-1):
        L -= 2**(t-1)
        res.append([t, r+1, L])

print(r+1, len(res))
for i in range(len(res)):
    print(res[i][0], res[i][1], res[i][2])
W,H,x,y,r= map(int,input().split())
if(x-r<0 || x+r>W || y-r<0 || y+r>H):
	print("No")
else:
	print("Yes")

### FIXED CODE ###

W,H,x,y,r= map(int,input().split())
if(x-r<0 or x+r>W or y-r<0 or y+r>H):
	print("No")
else:
	print("Yes")
from functools import reduce

from math import gcd

x, y = list(map(int, input().split()))


def lcm(*numbers):
    def lcm(a, b):
        return (a * b) // gcd(a, b)

    return reduce(lcm, numbers, 1)


a = lcm(x, y) - x

print(-1 if a == 0 else a)


### FIXED CODE ###

x, y = list(map(int, input().split()))


def gcd(a, b): return a if b == 0 else gcd(b, a % b)


def lcm(a, b): return a * b // gcd(a, b)


a = lcm(x, y) - x

print(-1 if a == 0 else a)
A, B = map(int, input().split())

if A == 1:
  A = 14

if B == 1:
  B = 14

if A < B:
  print("Bob")
elif B < A:
  print("Alice")
elif B == A:
  pritn("Draw")

### FIXED CODE ###

A, B = map(int, input().split())

if A == 1:
  A = 14

if B == 1:
  B = 14

if A < B:
  print("Bob")
elif B < A:
  print("Alice")
elif B == A:
  print("Draw")