Harryxun/stf_run huggingface dataset:
import sys
import math


prime_numbers = [2, 3, 5, 7]

def prime_numbers_under(num):
  global prime_numbers

  if max(prime_numbers) > num:
    return list(filter(lambda x: x <= num, prime_numbers))

  primes = prime_numbers_under(num - 1)

  for i in primes:
    if num % i == 0:
      break
  else:
    primes.append(num)

  prime_numbers = primes
  return prime_numbers

def main():
  amount = 0

  length = int(input())
  for _ in range(0, length):
    i = int(input())
    check_max = math.floor(math.sqrt(i))
    for j in prime_numbers_under(check_max):
      if i % j == 0:
        break
    else:
      amount += 1

  print(amount)
  return 0


if __name__ == '__main__':
  main()

### FIXED CODE ###

import math


def is_prime(n):
  if n in [2, 3, 5, 7]:
    return True
  elif 0 in [n%2, n%3, n%5, n%7]:
    return False
  else:
    check_max = math.ceil(math.sqrt(n))
    for i in range(2, check_max + 1):
      if n % i == 0:
        return False
    else:
      return True

def main():
  primes = set([])
  length = int(input())
  for _ in range(0, length):
    n = int(input())
    if is_prime(n):
      primes.add(n)

  print(len(primes))
  return 0


if __name__ == '__main__':
  main()
while True:
 a,op,b=map(str,input().split())
 if op=='+':
   print(int(a)+int(b))
 elif op=='-':
   print(int(a)-int(b))
 elif op=='*':
   printf(int(a)*int(b))
 elif op=='/':
   printf(int(a)//int(b))
 elif op=='?':
   break


### FIXED CODE ###

while True:
 a,op,b=map(str,input().split())
 if op=='+':
   print(int(a)+int(b))
 elif op=='-':
   print(int(a)-int(b))
 elif op=='*':
   print(int(a)*int(b))
 elif op=='/':
   print(int(a)//int(b))
 elif op=='?':
   break
k = int(input())
s = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(s[k] + 1)

### FIXED CODE ###

k = int(input())
s = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(s[k-1])
n,q=map(int,input().split())
s=[0]*-~n
w=m=0
for _ in[0]*q:
 a,v=map(int,input().split())
 s[a]+=v
 if v<0 and a==w:m=max(s),w=s.index(m)
 elif s[a]>maxv:w,m=a,s[a]
 elif s[a]==maxv:w=min(w,a)
 print(w,m)


### FIXED CODE ###

import sys
def f():
 w=m=0;n,q=map(int,input().split());s=[0]*-~n
 for e in sys.stdin:
  a,v=map(int,e.split());s[a]+=v
  if v<0 and a==w:m=max(s);w=s.index(m)
  elif s[a]>m:w,m=a,s[a]
  elif s[a]==m and w>a:w=a
  print(w,m)
f()
a,b,k = map(int,input().split())
if k > a:
  a=0
  k-=a
  if k > b:
    b=0
  else:
    b-=k
else:
  a-=k
print(' '.join([a,b])


### FIXED CODE ###

a,b,k = map(int,input().split())
if k > a:
  k-=a
  a=0
  if k > b:
    b=0
  else:
    b-=k
else:
  a-=k
print(' '.join([str(a),str(b)]))
x = (input())
int flag = 0

for i in (0,4)
    if x[i] == x[i+1]
        flag += 1
    else 
        flag += 0

if flag == 0
    print('Good')
else print('Bad')

### FIXED CODE ###

x = input()
flag = 0

for i in range(0,3):
    if x[i] == x[i+1]:
        flag += 1
    else :
        flag += 0

if flag == 0:
    print("Good")
else :
    print("Bad")
def a(s,i):
    if i = l-1:
        if eval(s)==7:
            return s
    return a(s+"+"+N[i],i+1) + a(s+"-"+N[i],i+1)

N = input()
l = len(N)

print(a(N[0],0) + "=7")

### FIXED CODE ###

def dfs(i, Str, res):
    if i==3:
        if res==7:
            print(Str+"=7")
            exit()
        return
    
    dfs(i+1,Str+"+"+s[i+1],res+int(s[i+1]))
    dfs(i+1,Str+"-"+s[i+1],res-int(s[i+1]))

s=input()
dfs(0,s[0],int(s[0]))
import sys

import numba as nb
import numpy as np

input = sys.stdin.readline


@nb.njit("i8[:](i8,unicode_type,i8)", cache=True)
def solve(N, X, X_int):
    popcount_X = X.count("1")
    if popcount_X == 0:
        ans = np.ones(N, dtype=np.int64)
    elif popcount_X == 1:
        ans = np.ones(N, dtype=np.int64)
        ans[-1] = 2
        ans[int(X.index("1"))] = 0
    else:
        X_mod_popcount_X_p = X_int % (popcount_X + 1)
        X_mod_popcount_X_m = X_int % (popcount_X - 1)
        ans = np.zeros(N, dtype=np.int64)
        for i in range(N):
            if X[i] == "0":
                Y = X_mod_popcount_X_p + (2 ** (N - 1 - i)) % (popcount_X + 1)
                Y = Y % (popcount_X + 1)
            else:
                Y = X_mod_popcount_X_m - (2 ** (N - 1 - i)) % (popcount_X - 1)
                Y = Y + (popcount_X - 1)
                Y = Y % (popcount_X - 1)
            count = 1
            while Y > 0:
                popcount = 0
                tmp = Y
                while tmp > 0:
                    if tmp & 1:
                        popcount += 1
                    tmp >>= 1
                Y = Y % popcount
                count += 1
            ans[i] = count

    return ans


def main():
    N = int(input())
    X = input()

    ans = solve(N, X, int(X, 2))
    print("\n".join(map(str, ans)))


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys

input = sys.stdin.readline


def main():
    N = int(input())
    X = input()

    popcount_X = X.count("1")
    if popcount_X == 0:
        ans = [1] * N
    elif popcount_X == 1:
        ans = [1] * N
        ans[-1] = 2
        ans[X.index("1")] = 0
    else:
        X_mod_popcount_X_p = int(X, 2) % (popcount_X + 1)
        X_mod_popcount_X_m = int(X, 2) % (popcount_X - 1)
        ans = [0] * N
        for i in range(N):
            if X[i] == "0":
                Y = X_mod_popcount_X_p + pow(2, N - 1 - i, mod=popcount_X + 1)
                Y = Y % (popcount_X + 1)
            else:
                Y = X_mod_popcount_X_m - pow(2, N - 1 - i, mod=popcount_X - 1)
                Y = Y + (popcount_X - 1)
                Y = Y % (popcount_X - 1)
            count = 1
            while Y > 0:
                popcount = bin(Y).count("1")
                Y = Y % popcount
                count += 1
            ans[i] = count

    print("\n".join(map(str, ans)))


if __name__ == "__main__":
    main()
#ABC083
import math
X, Y=map(int,input().split())
print(int(math.log(Y//X, 2)+1))

### FIXED CODE ###

#ABC082C
N=int(input())
a_sorted=sorted(list(map(int,input().split())))
#必要な変数の作成
Allowable_original=0
Allowable_count=0
Delete_count=0
#aが要素1個のみの場合
if N==1:
    if a_sorted[0]==1:
        print(0)
    else:
        print(1)
    exit()
#順番にチェック
for i in range(N):
    #開始処理
    if i==0:
        #許容個数カウントとその元値を作成
        Allowable_original=a_sorted[0]
        Allowable_count=Allowable_original-1
        continue

    #前の数字と同じか否か
    # 同じなら、
    if a_sorted[i]==a_sorted[i-1]:
        #許容個数カウントを一つ減らす
        Allowable_count-=1
    # 違うなら、または末尾なら、
    if a_sorted[i]!=a_sorted[i-1]:
        # 許容個数カウントの現在値が正か0か負かチェック
        # 正なら、
        if Allowable_count>0:
            #カウントしてきた許容個数（許容個数カウントの元値-現在値）を削除対象カウントに追加
            Delete_count+=Allowable_original-Allowable_count
        #0以下なら、
        else:
            # -1をかけた値を削除対象カウントに追加
            Delete_count-=Allowable_count
        # 許容個数カウントとその元値を新規作成
        Allowable_original = a_sorted[i]
        Allowable_count = Allowable_original - 1
    #末尾なら、
    if i==N-1:
        # 許容個数カウントの現在値が正か0か負かチェック
        # 正なら、
        if Allowable_count>0:
            #カウントしてきた許容個数（許容個数カウントの元値-現在値）を削除対象カウントに追加
            Delete_count+=Allowable_original-Allowable_count
        #0以下なら、
        else:
            # -1をかけた値を削除対象カウントに追加
            Delete_count-=Allowable_count
#結果出力
print(Delete_count)
def main():
    INF = 10**9
    n,k = map(int,input().split())
    P = [0] + list(map(int,input().split()))
    C = [0] + list(map(int,input().split()))

    scores = [0]*n

    for s in range(1,n+1):
        start = s
        dp = [-INF]*(n+1)
        dp[0] = 0
        for i in range(n):
            p = P[s]
            dp[i+1] = dp[i] + C[p]
            
            if start == p:
                break
            s = p
        if k < i+1:
            scores[start-1] = max(dp[1:k+1])
        elif dp[i+1]<=0:
            scores[start-1] = max(dp[1:])
        else:
            r = k%(i+1)
            q = k//(i+1)
            scores[start-1] = max(max(dp[1:r+1])+dp[i+1]*q, max(dp[1:]))
    
    print(max(scores))
main()

### FIXED CODE ###

def main():
    INF = 10**9
    n,k = map(int,input().split())
    P = [0] + list(map(int,input().split()))
    C = [0] + list(map(int,input().split()))

    scores = [0]*n

    for s in range(1,n+1):
        start = s
        dp = [-INF]*(n+1)
        dp[0] = 0
        for i in range(n):
            p = P[s]
            dp[i+1] = dp[i] + C[p]
            
            if start == p:
                break
            s = p
        if k <= i+1:
            scores[start-1] = max(dp[1:k+1])
        elif dp[i+1]<=0:
            scores[start-1] = max(dp[1:])
        else:
            r = k%(i+1)
            q = k//(i+1)
            if r>0:
                scores[start-1] = max(max(dp[1:r+1])+dp[i+1]*q, max(dp[1:]))
            else:
                scores[start-1] = dp[i+1]*(q-1)+max(dp[1:])

    print(max(scores))
main()
x=input()

a=int(x//500)

b=int((x-a)//5)

c=1000*a+5*b

print(c)

### FIXED CODE ###

x=int(input())

a=x//500

b=(x-a*500)//5

print(1000*a+5*b)
n=list(input())
m=int(input())
i=0
for t in range(len(n)):
  if n[t]=="1":
    pass
  else:
    i=t+1
    break
if m>=i:
  print(int(n[i]))
else:
  print(1)

### FIXED CODE ###

n=list(input())
m=int(input())
i=0
for t in range(len(n)):
  if n[t]!="1":
    i=t+1
    break
if m<i:
  print(1)
else:
  print(int(n[i-1]))
# -*- coding: utf-8 -*-

from numpy import lcm


n = int(input())
t = [int(input()) for _ in range(n)]

ans = 1
for ele in t:
    ans = lcm(ans, ele)

print(ans)


### FIXED CODE ###

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


def gcd(x, y):
    while x % y:
        x, y = y, x % y
    return y


def lcm(x, y):
    return x * y // gcd(x, y)


n = int(input())
t = [int(input()) for _ in range(n)]

ans = 1
for ele in t:
    ans = lcm(ans, ele)

print(ans)
line = input().split()
object_ = input()

N = int(line[0])
A = int(line[1])-1
B = int(line[2])-1
C = int(line[3])-1
D = int(line[4])-1

placing_objects = [True if s == '#' else False for s in list(object_)]

def main():
    if (A < B and C < D) or (A > B and C > D):
        for i in range(N-1):
            if placing_objects[i] and placing_objects[i+1]:
                print('No')
                return
        print('Yes')
        return
    elif A > C or B > D:
        print('No')
        return
    else:
        possible_trans = False
        trans_index = -1
        for i in range(N-1):
            if placing_objects[i] and placing_objects[i+1]:
                print('No')
                return
            if i < N-2 and (not placing_objects[i]) and (not placing_objects[i+1]) and (not placing_objects[i+2]):
                possible_trans = True
                trans_index = i+1
        if not possible_trans:
            if C < D:
                if placing_objects[C-1] or placing_objects[C+1]:
                    print('No')
                    return
            else:
                if placing_objects[D-1] or placing_objects[D+1]:
                    print('No')
                    return
        else:
            if A > B:
                if A > trans_index[0]:
                    print('No')
                    return
            else:
                if B > trans_index[0]:
                    print('No')
                    return
        print('Yes')
        
main()

### FIXED CODE ###

line = input().split()
object_ = input()

N = int(line[0])
A = int(line[1])-1
B = int(line[2])-1
C = int(line[3])-1
D = int(line[4])-1

placing_objects = [True if s == '#' else False for s in list(object_)]

def main():
    if (A < B and C < D) or (A > B and C > D):
        for i in range(N-1):
            if placing_objects[i] and placing_objects[i+1] and i > A and i < max(C, D):
                print('No')
                return
        print('Yes')
        return
    else:
        possible_trans = False
        trans_index = []
        for i in range(N-1):
            if placing_objects[i] and placing_objects[i+1] and i > A and i < max(C, D):
                print('No')
                return
            if i < N-2 and (not placing_objects[i]) and (not placing_objects[i+1]) and (not placing_objects[i+2]):
                possible_trans = True
                trans_index.append(i+1)
        if not possible_trans:
            if C < D:
                if placing_objects[C-1] or placing_objects[C+1]:
                    print('No')
                    return
            else:
                if placing_objects[D-1] or placing_objects[D+1]:
                    print('No')
                    return
        else:
            if A > B:
                if A > max(trans_index):
                    print('No')
                    return
            else:
                if B > max(trans_index) or D < min(trans_index):
                    print('No')
                    return
        print('Yes')
        
main()
N = int(input())
# スペース区切りの整数の入力
A = list(map(int, input().split()))
C=list(set(A))

#print(A)
#print(C)
def gcd(a, b):
  while b > 0:
    a, b = b, a%b
  return a

anslist=[]

if len(C)==1:
  ans=C[0]

elif len(C)==2:
  sol=max(A[0],A[1])

else:
  for i in range(3):
    B=A[:]
    B.remove(C[i])
    sol=0
    for b in B:
        sol=gcd(sol,b)
    anslist.append(sol)
    ans=max(anslist)

#print(anslist)
print(ans)



### FIXED CODE ###

N = int(input())
# スペース区切りの整数の入力
A = list(map(int, input().split()))


def gcd(a, b):
  while b > 0:
    a, b = b, a%b
  return a

list1=[0]
L=0
for a in A:
    L=gcd(L,a)
    list1.append(L)

list2=[0]
R=0
for a in reversed(A):
    R=gcd(R,a)
    list2.append(R)

list2.reverse()

ans=[]

for i in range(N):
    ans.append(gcd(list1[i],list2[i+1]))

print(max(ans))
n = long(input())
a = [long(x) for x in input().split()]

ans=1
for i in range(n):
	ans*=a[i]
	if(ans>1000000000000000000):
		break;
	if(ans==0):
		break;

if(ans>1000000000000000000):
	print(-1)
else:
	print(ans)


### FIXED CODE ###

n = int(input())
a = [int(x) for x in input().split()]

abc=0

for i in range(n):
	if(a[i]==0):
		abc=1
		break
if(abc==1):
	print(0)
else:
	ans=1
	for i in range(n):
		ans*=a[i]
		if(ans>1000000000000000000):
			break

	if(ans>1000000000000000000):
		print(-1)
	else:
		print(ans)
n = int(input())
l = []
for i in range(1, int(math.sqrt(n)//1)):
    if n % i == 0:
        l.append(int(n / i))
print(len(str(l[-1])))

### FIXED CODE ###

import math
n = int(input())
l = []
for i in range(1, int(math.sqrt(n)//1)+1):
    if n % i == 0:
        l.append(int(n / i))
print(len(str(l[-1])))
N, M = map(int, input().split())
z = [-1] * (N+1)
for i in range(M):
     z[int(input())] = 0

def rootCount(x):
     if x == 0:
          z[x] = 1
          return 1
     elif x == 1:
          if z[x] == 0:
               return 0
          else:
               z[x] = 1
               return 1
     elif x < N+1 and z[x] != -1:
          return z[x]
     else:
          z[x] = rootCount(x-1) + rootCount(x-2)
          return z[x]
print(rootCount(N) % 1000000007)


### FIXED CODE ###

N, M = map(int, input().split())
z = [-1] * (N+1)
for i in range(M):
     z[int(input())] = 0

for i, x in enumerate(z):
     if i == 0:
          z[i] = 1
     elif i == 1 and z[i] != 0:
          z[i] = 1
     elif z[i] == 0:
          continue
     elif z[i-1] == 0 and z[i-2] == 0:
          print(0)
          exit()
     else:
          z[i] = z[i-1] + z[i-2]
print(z[-1] % 1000000007)
s = input()
q = int(input())
 
cnt = 0
for _ in range(q):
  t = input()
  if t[0] == "1":
    cnt += 1
  else:
    if cnt%2 == 1:
      s = "".join(list(reversed(s)))
      cnt = 0
    _,f,c = t.split(" ")
    if f == "1":
      s = c + s
    else:
      s = s + c
if cnt%2 == 1:
  s = "".join(list(reversed(s)))
  cnt = 0
 
print(s)
s = input()
q = int(input())

cnt = 0
for _ in range(q):
  t = input()
  if t[0] == "1":
    cnt += 1
  else:
    if cnt%2 == 1:
      s = "".join(list(reversed(s)))
      cnt = 0
    _,f,c = t.split(" ")
    if f == "1":
      s = c + s
    else:
      s = s + c
if cnt%2 == 1:
  s = "".join(list(reversed(s)))
  cnt = 0

print(s)


### FIXED CODE ###

from collections import deque
def main():
  s = deque(list(input()))
  q = int(input())
  sr = s.reverse
  sa = s.append
  sal = s.appendleft

  cnt = 0
  for _ in range(q):
    t = input()
    if t[0] == "1":
      cnt += 1
    else:
      _,f,c = t.split(" ")
      if f == "1":
        if cnt%2==1:
          sa(c)
        else:
          sal(c)
      else:
        if cnt%2==1:
          sal(c)
        else:
          sa(c)
  if cnt%2 == 1:
    sr()
  print("".join(list(s)))

if __name__=="__main__":
  main()
import sys
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = sorted([[a[i], b[i]] for i in range(n)], key=lambda x: x[1])
a = [(x[0], i) for i, x in enumerate(c)]
b = [x[1] for x in c]
a.sort()
for i in range(n):
	if a[i][0] > b[i]:
		print("No")
		sys.exit()
cur, cnt = 0, 0
while a[cur][1] != 0:
	cnt += 1
	cur = a[cur][1]
if cnt < n-1:
	print("Yes")
else:
	for i in range(n-1):
		if a[i] <= b[i+1]:
			print("Yes")
			break
	else:
		print("No")

### FIXED CODE ###

import sys
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = sorted([[a[i], b[i]] for i in range(n)], key=lambda x: x[1])
a = [(x[0], i) for i, x in enumerate(c)]
b = [x[1] for x in c]
a.sort()
for i in range(n):
	if a[i][0] > b[i]:
		print("No")
		sys.exit()
cur, cnt = 0, 0
while a[cur][1] != 0:
	cnt += 1
	cur = a[cur][1]
if cnt < n-1:
	print("Yes")
else:
	for i in range(n-1):
		if a[i+1][0] <= b[i]:
			print("Yes")
			break
	else:
		print("No")
a

### FIXED CODE ###

S = list(map(int, input().split('/')))
X = [2019, 4, 30]

print('Heisei') if all([S[i] <= X[i] for i in range(3)]) else print('TBD')
n, k = [int(i) in input().split()]
p = [int(i) in input().split()]
p.sort()
print(sum(p[:k])

### FIXED CODE ###

n, k = [int(i) for i in input().split()]
p = [int(i) for i in input().split()]
p.sort()
print(sum(p[:k]))
N, M = map(int, input().split())

height = [input() for i in range(M)]
sum = N - sum(height)

if (sum >= 0):
    print(sum)
else:
    print('-1')


### FIXED CODE ###

import numpy as np
N, M = map(int, input().split())
data = np.array(input().split(), dtype=np.int64)

#height = [int(input()) for _ in range(M)]
sum = N - np.sum(data)

if (sum >= 0):
    print(sum)
else:
    print('-1')
resource.setrlimit(resource.RLIMIT_STACK, (-1, -1))
S = [-1]*(101010)
def opt_S(h,n):
    if(n == 0):return 0
    elif(n == 1):return abs(h[1]-h[0])
    else :
        if(S[n] != -1):return S[n]
        s1 = opt_S(h,n-1) + abs(h[n-1]-h[n])
        s2 = opt_S(h,n-2) + abs(h[n-2]-h[n])
        S[n] = min(s1,s2)
        return S[n]



N = int(input())
h = list(map(int,input().split()))
print(opt_S(h,N-1))



### FIXED CODE ###

import sys
sys.setrecursionlimit(200000) #追加
S = [-1]*(101010)
def opt_S(h,n):
    if(n == 0):return 0
    elif(n == 1):return abs(h[1]-h[0])
    else :
        if(S[n] != -1):return S[n]
        s1 = opt_S(h,n-1) + abs(h[n-1]-h[n])
        s2 = opt_S(h,n-2) + abs(h[n-2]-h[n])
        S[n] = min(s1,s2)
        return S[n]



N = int(input())
h = list(map(int,input().split()))
print(opt_S(h,N-1))
def function():
    N, T = map(int, input().split())
    AB = [list(map(int, input().split())) for _ in range(N)]
    
    Dp = [0 for _ in range(T+1)]
    used_ab = [set() for _ in range(T+1)]
    
    
    for i in range(N):
        for j in range(T-1,-1, -1):
            if j+AB[i][0] <= T-1:
                kari1 = Dp[j+AB[i][0]]
                kari2 = Dp[j] + AB[i][1]
                if  kari1< kari2:
                    Dp[j+AB[i][0]] = kari2
                    kari = used_ab[j].copy()
                    kari.add(i)
                    used_ab[j+AB[i][0]] = kari
    
    answer = 0
    for i in range(T):
        max_amari = 0
        for j in range(N):
            if j not in used_ab[i] and max_amari < AB[j][1]:
                max_amari = AB[j][1]
        if Dp[i]+max_amari > answer:
            answer = Dp[i]+max_amari
    
    print(answer)
    
if __name__ = "__main__":
    function()

### FIXED CODE ###

N, T = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N)]

Dp = [0 for _ in range(T+1)]

ab = sorted(ab, key = lambda x: x[0])

for i in range(N):
    for j in range(T-1,-1, -1):
        if j+ab[i][0] <= T-1:
            kari2 = Dp[j] + ab[i][1]
            if  Dp[j+ab[i][0]] < kari2:
                Dp[j+ab[i][0]] = kari2
        else:
            kari2 = Dp[j] +ab[i][1]
            if Dp[T] < kari2:
                Dp[T] = kari2
                
print(max(Dp))
a,b = map(int, input().split())
if a*b/2 == 0:
    print(Even)
else:
    print(Odd)

### FIXED CODE ###

a,b = map(int, input().split())
if a*b%2 == 0:
    print("Even")
else:
    print("Odd")
n,m=map(int,input().split())
ans=1
for i in range(1,m**0.5+1):
    if m%i==0:
        if m/i>=n:
            ans=max(ans,i)
        elif i>=n:
            ans=max(ans,m//i)
print(ans)

### FIXED CODE ###

n,m=map(int,input().split())
ans=1
for i in range(1,int(m**0.5)+1):
    if m%i==0:
        if m/i>=n:
            ans=max(ans,i)
        if i>=n:
            ans=max(ans,m//i)
print(ans)
S = str(input())

Ans = True
for i in range(0, len(S)):
  if i % 2 == 0:
    if S[i] == 'L' or S[i] == 'U' or S[i] == 'D':
    else:
      Ans = False
      break
  if i % 2 != 0:
    if S[i] == 'R' or S[i] == 'U' or S[i] == 'D':
    else:
      Ans = False
      break
else:
  print('Yes')
  
if Ans == False:
  print('No')

### FIXED CODE ###

S = str(input())
 
Ans = True
for i in range(0, len(S)):
  if (i + 1) % 2 == 0:
    if S[i] != 'L' and S[i] != 'U' and S[i] != 'D':
      Ans = False
      break
  if (i + 1) % 2 == 1:
    if S[i] != 'R' and S[i] != 'U' and S[i] != 'D':
      Ans = False
      break
  
if Ans == False:
  print('No')
else:
  print('Yes')
print(input()[0]+len(input()[1:-1])+input()[-1])

### FIXED CODE ###

s=list(input())
print(s[0]+str(len(s)-2)+s[-1])
n=input()
print(0 if n[-3]=='0' else (1000-int(n[-3])*100))

### FIXED CODE ###

n=int(input())
while n>0:
    n-=1000
print(abs(n))
#include <iostream>
#include <string>

using namespace std;

int main(){
  int a;
  string s;
  cin >> a >> s;
  if(a < 3200){
    cout << "red" << endl;
  }else{
    cout << s << endl;
  }
}

### FIXED CODE ###

a = int(input())
s = input()

if a < 3200:
    print('red')
else:
    print(s)
def gcd(x,y):
  if y == 0:
    return x
  else:
    return gcd(y,x%y)
a,b,c,d = map(int, input().split())
p = b//c + (-a//c) +1
q = b//d + (-a//d) +1
r = b*gcd(c,d)//(c*d) + (-a*gcd(c,d)//(c*d)) +1
print(b-a+1-p-q+r)

### FIXED CODE ###

s = input()
for i in range(0,3):
  if s[i] == s[i+1]:
    print('Bad')
    exit()
print('Good')
#d=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
#import numpy as np
#n=int(input())
#import fractions
#S=input()
#import math
#lis=list(map(int,input().split()))

n=int(input())
sp={}
for i in range(n):
    li=input().split()
    li.append(i+1)
    if li[0] not in sp:
        sp[li[0]]=[li]
    else:
        sp[li[0]].append(li)
        sp[li[0]].sort(reverse=True)
items_sorted = sorted(sp.items())
print(items_sorted)
for i in range(n):
    for j in range(len(items_sorted[i])):
        print(items_sorted[i][j+1][2])


### FIXED CODE ###

#d=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
#import numpy as np
#n=int(input())
#import fractions
#S=input()
#import math
#lis=list(map(int,input().split()))

n=int(input())
sp={}
for i in range(n):
    li=input().split()
    li.append(i+1)
    li[1]=int(li[1])
    if li[0] not in sp:
        sp[li[0]]=[li]
    else:
        sp[li[0]].append(li)
        sp[li[0]].sort(reverse=True)
items_sorted = sorted(sp.items())
#print(items_sorted)
for i in range(len(items_sorted)):
    for j in range(len(items_sorted[i][1])):
        print(items_sorted[i][1][j][2])
n = int(input())

print((n**n) - a)

### FIXED CODE ###

n = int(input())
a = int(input())

print(int((n*n) - a))