Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

def prime_numbers(numbers):
    total = 0
    for n in numbers:
        for i in range(2, n):
            if n % i == 0:
                break
        else:
            total += 1
    return total

if __name__ == '__main__':
    n = []
    for _ in range(int(input())):
        n.append(int(input()))
    print(prime_numbers(n))



### FIXED CODE ###

import math

def prime_numbers(numbers):
    return list(map(is_prime, numbers)).count(True)


def is_prime(n):
    if (n == 2):
        return True
    elif (n % 2 == 0):
        return False
    else:
        i = 3
        while i <= math.sqrt(n):
            if n % i == 0:
                return False
            i += 2

    return True

if __name__ == '__main__':
    n = int(input())
    numbers = []
    for i in range(0, n):
        numbers.append(int(input()))
    print(prime_numbers(numbers))
### BUGGY CODE ###

# -*- coding: utf-8 -*-
N = int(raw_input())
li = map(int, raw_input().split())

move_max = 0
tmp = 0

for i in xrange(N-1):
	move = 0
	tmp = li[i]
	for j in xrange(i+1,N):
		if tmp >= li[j]:
			tmp = li[j]
			move += 1
		else:
			break
	if move > move_max:
		move_max = move

print move_max

### FIXED CODE ###

n = int(raw_input())
a = map(int, raw_input().split())
 
ans = 0
temp = 0
for i in xrange(n-1):
    if a[i] >= a[i+1]:
        temp = temp + 1
    else:
        ans = max(ans, temp) 
        temp = 0
 
print max(ans, temp)
### BUGGY CODE ###

N,*A = map(int,open(0).read().split())
cnt = 0
for a in range(1,N):
    for b in range(a+1,N+1):
        if abs(b-a) == A[a-1] + A[b-1]:
            cnt += 1
print(cnt)            

### FIXED CODE ###

from collections import Counter

N,*A = map(int,open(0).read().split())
#j - i = Aj + Ai
#j - Aj = Ai + i
#L = i + Ai, R = j - Aj とおく
L = []
R = []
for i in range(N):
    L.append(i+1 + A[i])
    R.append(i+1 - A[i])
l = Counter(L)
r = Counter(R)
 
cnt = 0
for i in range(1,N+1):
    if i in l and i in r:
        cnt += l[i] * r[i]
print(cnt)
### BUGGY CODE ###

N,A = map(int,input().split())
x = list(map(int,input().split()))
X = N*max(max(x),A)
dp = [[[0 for i in range(X+1)] for j in range(N+1)] for k in range(N+1)]
dp[0][0][0] = 1
for k in range(1,N+1):
    for j in range(k+1):
        for i in range(X+1):
            if i - x[k-1] >= 0 and k >= 1:
                dp[k][j][i] = dp[k-1][j-1][i-x[k-1]] + dp[k-1][j][i]
            else:
                dp[k][j][i] = dp[k-1][j][i]
ans = 0
for j in range(1,N+1):
    ans += dp[-1][j][j*A]
print(ans)

### FIXED CODE ###

N,A = map(int,input().split())
x2 = list(map(int,input().split()))
x = [i-A for i in x2]
maxx = max(max(x2),A)
dp = [[0 for i in range(2*N*maxx+1)] for j in range(N+1)]
start = N*maxx
dp[0][start] = 1
for i in range(1,N+1):
    for j in range(2*start+1):
        if 2*start >= j - x[i-1] >= 0:
            dp[i][j] = dp[i-1][j-x[i-1]] + dp[i-1][j]
        else:
            dp[i][j] = dp[i-1][j]
print(dp[-1][start]-1)
### BUGGY CODE ###

def Gcd(a, b):#ユークリッド互除法
	return Gcd(b, a % b) if b else a

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

#最小公倍数
p = (N * M) // Gcd(N, M)
re = p

for i in range(p):
	#交差点
	if i % (p//N) == 0 and i % (p//M) == 0:
		#異なる文字
		if S[i // (p//N)] != T[i // (p//M)]:
			re = -1
print(re)

### FIXED CODE ###

def Gcd(a, b):#ユークリッド互除法
	return Gcd(b, a % b) if b else a

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

#最小公倍数
p = (N * M) // Gcd(N, M)
re = p

for i in range(0,p,max((p//N),(p//M))):
	#交差点
	if i % (p//N) == 0 and i % (p//M) == 0:
		#異なる文字
		if S[i // (p//N)] != T[i // (p//M)]:
			re = -1
			break
print(re)
### BUGGY CODE ###

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

for i in range(1,n+1):
  print(a.index(i)+1)

### FIXED CODE ###

n = int(input())
a = [int(i) for i in input().split()] 
answer = [0 for _ in range(n)]
 
for index, aa in enumerate(a):
  answer[aa-1] = index+1

for an in answer:
  print(an)
### BUGGY CODE ###

inp1 = input()
inp2 = input().split()

a = int(inp1)
#b = np.array(inp2).astype(int)
b = [int(s) for s in inp2]
ansno = a

for ii,i in enumerate(b):
  bslice = b[:ii+1]
  minb = min(bslice)
  if minb == i:
    pass
  else:
    ansno -=1

print(ansno)

### FIXED CODE ###

n = int(input())
m = input().split()
ppp = list(map(int, m))
max = 2*10**5+1
ans = 0
for p in ppp:
    if p < max:
        ans += 1
        max = p
print(ans)
### BUGGY CODE ###

N, K =map(int, input().split())
lst = []
for _ in range(N):
    lst.append(int(input()))
sor = sorted(lst)

mindiff = float('inf')
for i in range(N-K+1):
    selected = sor[i:i+K] 
    diff = selected[-1] - selected[0]
    if diff <= mindiff:
        mindiff = diff
print(mindiff) 

### FIXED CODE ###

N, K =map(int, input().split())
lst = []
for _ in range(N):
    lst.append(int(input()))
sor = sorted(lst)

mindiff = float('inf')
for i in range(N-K+1):
    diff = sor[i+K-1] - sor[i] 
    if diff <= mindiff:
        mindiff = diff
print(mindiff)
### BUGGY CODE ###

import bisect

n, m = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]

a.sort()

for i in range(m):
    div_a = a.pop(-1)
    div_a = div_a // 2
    bisect.insort_left(a, div_a)

ans = sum(a)
print(ans)


### FIXED CODE ###

import bisect

n, m = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]


while m > 0:
    a.sort()
    m -= 1
    a[-1] = a[-1] // 2
    for i in range(n-1)[::-1]:
        if m == 0:
            break
        if a[i] > a[-1]:
            m -= 1
            a[i] = a[i] // 2
        else:
            break

ans = sum(a)
print(ans)
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
b = []

for i in range(n):
    b.append(a[i])
    b = list(reversed(b))

for j in b:
    print(j,end=' ')

### FIXED CODE ###

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

if n % 2 == 0:
    b = a[n-1::-2] + a[::2]
else:
    b = a[n-1::-2] + a[1::2]

print(*b)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
N, M = map(int, input().split())
A = list(map(int, input().split()))
for i in range(M):
  B, C = map(int, input().split())
  A += [C] * B

A.sort(reverse=True)
print(sum(A[0:N]))

### FIXED CODE ###

import sys
input = sys.stdin.readline
N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
sortsecond = lambda val: val[1]
x = [list(map(int, input().split())) for _ in range(M)]
x.sort(key=sortsecond)

i = 0
for j in range(M):
  times = x[-(j+1)][0]
  num = x[-(j+1)][1]
  while (times > 0):
    try:
      tmp = A[i]
    except IndexError:
      print(sum(A))
      exit()
    
    if (tmp < num):
      A[i] = num
    else:
      print(sum(A))
      exit()
    times -= 1
    i += 1

print(sum(A))
### BUGGY CODE ###

# -*- coding: utf-8 -*-
import sys
N, K = map(int, input().split())
if K == 1:
  print(0)
  sys.exit()
  
a = abs(N-K)
while abs(a - K) < a:
  a = abs(a-K)
  if a == N:
    print(a)
    sys.exit()
  
print(a)

### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys

N, K = map(int, input().split())
if K == 1:
  print(0)
  sys.exit()
  
if N / K > 1:
  N = N - int(N / K) * K
a = abs(N-K)
while abs(a - K) < a:
  a = abs(a-K)

print(int(a))
### BUGGY CODE ###

n, k = map(int, input().split())
h = list(map(int, input().split()))
inf = 10**9
dp = [inf]*n
dp[0] = 0
for i in range(n):
    for j in range(1, k+1):
        if i+j >= n:
            break
        dp[i+j] = min(dp[i+j], dp[i]+abs(h[i+j]-h[i]))
print(dp[-1])


### FIXED CODE ###

def main():
    n, k = map(int, input().split())
    stones = tuple(map(int, input().split()))
    inf = 10**9
    dp = [inf]*n
    dp[0] = 0
    for i in range(n):
        for t in range(1, k+1):
            step = i+t
            if step < n:
                v = dp[i]+abs(stones[i]-stones[step])
                if v < dp[step]:
                    dp[step] = v
    print(dp[-1])


if __name__ == '__main__':    
    main()
### BUGGY CODE ###


N, M = map(int, input().split())
A = [int(x) for x in input().split()]

dp = [[0]*(M+1) for _ in range(N+1)]

for product_num in range(N):
    for ticket_num in range(M+1):
        price_caditate_list = []
        for use_num in range(ticket_num+1):
            price_caditate_list.append(dp[product_num][ticket_num-use_num] + (A[product_num]>>use_num))
        dp[product_num+1][ticket_num] = min(price_caditate_list)

print(dp[N][M])


### FIXED CODE ###

N, M = map(int, input().split())
A = [-int(x) for x in input().split()]

import heapq
heapq.heapify(A)

for ticket_num in range(1,M+1):
    max_value = -1*heapq.heappop(A)
    heapq.heappush(A, -1*(max_value>>1))

print(-1*sum(A))
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
ans=0
i=0
while i+1 <= len(a):
    if a[i]!=i+1:
        del a[i]
    else:
        i+=1
if len(a)==0:
    print(-1)
else:
    print(n-len(a))


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
ans = 0
i = 0
while i + 1 <= len(a):
    #index+1がリストの要素と違ったら
    if a[i] != i + 1:
        #正しい要素があるか確認
        if i + 1 in a:
            #正しい要素の手前まで削除
            del a[i:a.index(i + 1)]
        #正しい要素がないなら全部削除
        else:
            del a[i:]
        
    #index+1がリストの要素と同じなら次の要素へ
    else:
        i += 1
#全部消しちゃったら不可能
if len(a) == 0:
  print(-1)
#残ってる要素を引いたら壊した数になる
else:
    print(n - len(a))
### BUGGY CODE ###

import collections

N = int(input())
A = list(map(int, input().split(' ')))


def main(n: int, a: list):
    counter = collections.Counter(a)
    pairs = {k: v * (v - 1) / 2 for k, v in counter.items()}

    counted = {}

    for i in range(N):

        target = a[i]

        if target not in counted.keys():
            temp = pairs.copy()

            v = counter[target] - 1
            temp[target] = v * (v - 1) / 2

            pair_cnt = sum(temp.values())
            counted.update({target: pair_cnt})
        else:
            pair_cnt = counted[target]

        print(int(pair_cnt))


main(N, A)


### FIXED CODE ###

import collections

N = int(input())
A = list(map(int, input().split(' ')))


def main(n: int, a: list):
    counter = collections.Counter(a)
    pairs = {k: v * (v - 1) / 2 for k, v in counter.items()}
    pairs_all = sum(pairs.values())

    for i in range(N):
        k = a[i]
        v = counter[k] - 1
        pair_cnt = pairs_all - pairs[k] + (v * (v - 1) / 2)

        print(int(pair_cnt))


main(N, A)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
"""
Created on Sun Apr 12 02:06:07 2020

@author: Kanaru Sato
"""

import heapq

n,m = list(map(int, input().split()))
albeit = []
for i in range(m+1):
    albeit.append([])

for i in range(n):
    a,b = list(map(int, input().split()))
    if a <= m:
        albeit[a].append(-1*b)

##print(albeit)

for i in range(m):
    heapq.heapify(albeit[i+1])

##print(albeit)

sum = 0
for i in range(m):
    day = i+1 #day:1->m
    ##print("day=",day)
    minlist = []
    for j in range(day):
        if len(albeit[j+1]) >= 1:
            minlist.append(albeit[j+1][0])
        else:
            minlist.append(0)
    ##print(minlist)
    m = min(minlist)
    if m != 0:
        Maxalbeitindex = minlist.index(m)
        sum += -1*heapq.heappop(albeit[Maxalbeitindex+1])
    ##print(sum)

print(sum)

### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Created on Sun Apr 12 02:06:07 2020

@author: Kanaru Sato
"""

import heapq

n,m = list(map(int, input().split()))
albeit = []
for i in range(m+1):
    albeit.append([])

for i in range(n):
    a,b = list(map(int, input().split()))
    if a <= m:
        albeit[a].append(-1*b)

##print(albeit)
Heap = [0]
sum = 0
for i in range(m):
    day = i+1
    for money in albeit[day]:
        heapq.heappush(Heap, money)
    if Heap[0] != 0:
        daymax = heapq.heappop(Heap)*-1
        sum += daymax

print(sum)
### BUGGY CODE ###

n, m = list(map(int, input().split()))
aaa = [int(input()) for _ in range(m)]

dp = [0] * (n + 1)
dp[0] = 1
dp[1] = 1 if 1 not in aaa else 0
MOD = 10 ** 9 + 7

for i in range(2, n + 1):
    if i in aaa:
        continue
    dp[i] = (dp[i - 2] + dp[i - 1])
print(dp[n] % MOD)


### FIXED CODE ###

n, m = list(map(int, input().split()))
broken = [False] * (n + 1)
for _ in range(m):
    broken[int(input())] = True

dp = [0] * (n + 1)
dp[0] = 1
dp[1] = 1 if not broken[1] else 0
MOD = 10 ** 9 + 7

for i in range(2, n + 1):
    if not broken[i - 1]:
        dp[i] += (dp[i - 1])
    if not broken[i - 2]:
        dp[i] += (dp[i - 2])
    dp[i] %= MOD

print(dp[n])
### BUGGY CODE ###

n,m=map(int,input().split())
a=[0]*n
b=[0]*n
for i in range(n):
    a[i],b[i]=map(int,input().split())
def merge(rr):
    mid=len(rr[0])
    c=int(mid/2)
    if mid>1:
        left=merge([rr[0][:c],rr[1][:c]])
        right=merge([rr[0][c:],rr[1][c:]])
        ar=[]
        br=[]
        while len(left[0])!=0 and len(right[0])!=0:
            if left[0][0]<right[0][0]:
                ar.append(left[0].pop(0))
                br.append(left[1].pop(0))
            else:
                ar.append(right[0].pop(0))
                br.append(right[1].pop(0))
        if len(left[0])!=0:
            ar.extend(left[0])
            br.extend(left[1])
        elif len(right[0])!=0:
            ar.extend(right[0])
            br.extend(right[1])
        rr=[ar,br]
    return rr
rr=[a,b]
re=merge(rr)
tot=0
sum=0
while(1):
    if tot+re[1][0]<=m:
        tot+=re[1][0]
        sum+=re[0][0]*re[1][0]
        re[1].pop(0)
        re[0].pop(0)
        if len(re[1])==0:
            break
    else:
        sum+=re[0][0]*(m-tot)
        break
print(sum)

### FIXED CODE ###

import numpy as np

n,m = map(int,input().split())
a=[0] * n
b=[0] * n
for i in range(n):
    a[i],b[i] = map(int,input().split())

mk = np.array([a,b])
#print(m)
index = np.argsort(mk)
#print(index)
mn = np.array([mk[0,index[0,:]],mk[1,index[0,:]]])
#print(mn)

sum = 0
for i in range(n):
    if mn[1][i] <= m:
        sum += mn[0][i] * mn[1][i]
        m = m - mn[1][i]

    else:
        sum += mn[0][i] * m
        break
print(sum)
### BUGGY CODE ###

import itertools

def primes(n):
    l = []
    i = 2
    while i <= n**(1/2):
        while n % i == 0:
            n //= i
            l.append(i)
        i += 1
    l.append(n)
    return l

def mul(l):
    result = 1
    for i in l:
        result *= i
    return result

n = int(input())

per = list(itertools.permutations(primes(n)))

i,j = 1,n
for p in per:
    for k in range(len(p)):
        s,t = mul(p[:k]), mul(p[k:])
        if abs(s-t) < abs(i-j):
            i,j = s,t

print(i+j-2)


### FIXED CODE ###

import math

N = int(input())

ans = 10**15
for k in range(1, int(math.sqrt(N))+1):
    if N % k > 0:
        continue
    ans = min(ans, k + N//k - 2)
print(ans)
### BUGGY CODE ###

N = int(input())
tree = []
for i in range(0, N):
	tree.append([])
for i in range(0, N-1):
	u, v, w = map(int, input().split())
	tree[u-1].append([v-1, w])
	tree[v-1].append([u-1, w])
oddeven = []
for i in range(0, N):
	oddeven.append(-1)
queue = [[0, 0]]
while queue != []:
	now = queue.pop(0)
	oddeven[now[0]] = now[1]%2
	for i in range(0, len(tree[now[0]])):
		if oddeven[tree[now[0]][i][0]] == -1:
			queue.append([tree[now[0]][i][0], now[1]+tree[now[0]][i][1]])
for i in range(0, N):
	print(oddeven[i])

### FIXED CODE ###

N = int(input())
tree = []
for i in range(0, N):
	tree.append([])
for i in range(0, N-1):
	u, v, w = map(int, input().split())
	tree[u-1].append([v-1, w])
	tree[v-1].append([u-1, w])
oddeven = []
for i in range(0, N):
	oddeven.append(-1)
stack = [[0, 0]]
while stack != []:
	now = stack.pop(-1)
	oddeven[now[0]] = now[1]%2
	for i in range(0, len(tree[now[0]])):
		if oddeven[tree[now[0]][i][0]] == -1:
			stack.append([tree[now[0]][i][0], now[1]+tree[now[0]][i][1]])
for i in range(0, N):
	print(oddeven[i])
### BUGGY CODE ###

n, k = map(int, input().split())
p_list = list(map(int, input().split()))
sum = 0
max = 0
index = 0
value = 0

for i in range(n - k + 1):
    sum = 0
    for j in range(k):
        sum += p_list[i + j]
    if sum > max:
        max = sum
        index = i

for i in range(k):
    value += (1 + p_list[index + i])/ 2

print(value)


### FIXED CODE ###

n, k = map(int, input().split())
p_list = list(map(int, input().split()))
num = sum(p_list[0:k])
max = 0
index = 0
value = 0

for i in range(n - k):
    num = num + p_list[i + k] - p_list[i]
    if num > max:
        max = num
        index = i + 1

for i in range(k):
    value += (1 + p_list[index + i])/ 2

print(value)
### BUGGY CODE ###

s=input()

i=0
while i<len(s):
    if s[i:i+2]=="ST":
        s = s[:i] + s[i+2:]
        i -= 1
    else:
        i += 1
        
print(len(s))

### FIXED CODE ###

s=input()

a=0
r=len(s)
for i in range(len(s)):
    if s[i] == "S":
        a += 1
    else:
        if a>0:
            a -= 1
            r -= 2
    
print(r)
### BUGGY CODE ###

n = int(input())
alist = []
for i in range(n):
    alist.append(int(input()))
mod = 998244353
asum = sum(alist)


dp = [[0] * (asum + 1) for _ in range(n + 1)]
dp[0][0] = 1
for i in range(n):
    for j in range(asum + 1):
        dp[i+1][j] = (dp[i+1][j] + dp[i][j] * 2) % mod
        jsum = j + alist[i]
        if jsum > asum:
            continue
        dp[i+1][jsum] = (dp[i+1][jsum] + dp[i][j]) % mod
dp_sum = sum(dp[n][((asum+1)//2):]) % mod
dp_sum *= 3
dp_sum = dp_sum % mod

dp_dup = [[0] * (asum + 1) for _ in range(n + 1)]
dp_dup[0][0] = 1
if asum % 2 == 0:
    for i in range(n):
        for j in range(asum // 2 + 1):
            dp_dup[i+1][j] = (dp_dup[i+1][j] + dp_dup[i][j]) % mod
            jsum = j + alist[i]
            if jsum > asum:
                continue
            dp_dup[i+1][jsum] = (dp_dup[i+1][jsum] + dp_dup[i][j]) % mod
dp_dup_sum = dp_dup[n][(asum+1)//2]
dp_dup_sum *= 3
dp_dup_sum = dp_dup_sum % mod


ans = pow(3, n, mod)
ans -= dp_sum
ans += dp_dup_sum

print(ans % mod)


### FIXED CODE ###

n = int(input())
alist = []
for i in range(n):
    alist.append(int(input()))
mod = 998244353
asum = sum(alist)


asum_half = (asum + 1) // 2
dp = [[0] * (asum_half + 1) for _ in range(n + 1)]
dp[0][0] = 1
for i in range(n):
    for j in range(asum_half + 1):
        inext = i + 1
        dp[inext][j] = (dp[inext][j] + dp[i][j] * 2) % mod
        jsum = min(j + alist[i], asum_half)
        dp[inext][jsum] = (dp[inext][jsum] + dp[i][j]) % mod
dp_sum = dp[n][asum_half] % mod
dp_sum *= 3
dp_sum = dp_sum % mod


dp_dup = [[0] * (asum_half + 1) for _ in range(n + 1)]
dp_dup[0][0] = 1
if asum % 2 == 0:
    for i in range(n):
        for j in range(asum_half + 1):
            inext = i + 1
            dp_dup[inext][j] = (dp_dup[inext][j] + dp_dup[i][j]) % mod
            jsum = j + alist[i]
            if jsum > asum_half:
                continue
            dp_dup[inext][jsum] = (dp_dup[inext][jsum] + dp_dup[i][j]) % mod
dp_dup_sum = dp_dup[n][asum_half]
dp_dup_sum *= 3
dp_dup_sum = dp_dup_sum % mod


ans = pow(3, n, mod)
ans -= dp_sum
ans += dp_dup_sum

print(ans % mod)
### BUGGY CODE ###

n,x,m = map(int, input().split()) 
ans = 0
x_list = []

for _ in range(n):
    x_list.append(x)
    ans += x
    x = x**2 % m
    if x == 0:
        break
    if x == 1:
        ans = ans + (n-len(x_list))
        break
    if x_list.count(x) == 1:
        after_list = x_list[x_list.index(x):(len(x_list))]
        if x_list.index(x) == 0:
            if (n // len(x_list)) == 0:
                ans = sum(x_list) * (n // len(x_list))
            else:
                ans = sum(x_list) * (n // len(x_list)) + sum(x_list[0:((n % len(x_list)))])
        else:
            if (n-x_list.index(x)) % len(after_list) == 0:
                ans = sum(after_list) * ((n-x_list.index(x)) // len(after_list)) + sum(x_list[0:(x_list.index(x))])
            else:
                ans = sum(after_list) * ((n-x_list.index(x)) // len(after_list)) + sum(after_list[0:(((n-x_list.index(x)) % len(after_list)))]) + sum(x_list[0:(x_list.index(x))])
        break

print(ans)

### FIXED CODE ###

N, X, M = map(int, input().split())
 
def next_f(a):
    return a * a % M
 
visited = [None] * M
sum_at_visit = [None] * M
loop_done = False
 
time = 1
ans = 0
x = X
while time <= N:
    if not loop_done and visited[x] is not None:
        # found cycle                                                                                                                                         
        loop_len = time - visited[x]
        loop_sum = ans + x - sum_at_visit[x]
        loops = (N-loop_len-time) // loop_len
        time += loop_len * loops
        ans += loop_sum * loops
        loop_done = True
    ans += x
    visited[x] = time
    sum_at_visit[x] = ans
    time += 1
    x = next_f(x)
print(ans)
### BUGGY CODE ###

N = int(input())
XY = []
L = []
maxL = 0
for i in range(N):
    x,  y = map(int, input().split())
    XY.append([x, y])
    maxL = max(maxL, abs(x) + abs(y))

m = maxL
D = [1 for _ in range(m)]
Move = []
Able = True
for i in range(N):
    x, y = XY[i][0], XY[i][1]
    if x > 0:
        move = "R" * x
    elif x < 0:
        move = "L" * abs(x)
    else:
        move = ""
    if y > 0:
        move += "U" * y
    elif y < 0:
        move += "D" * abs(y)
    if (m - abs(x) - abs(y)) % 2 == 0:
        move += "UD" * ((m-abs(x)-abs(y))//2)
    else:
        Able = False
    Move.append(move)

if Able:
    print(m)
    print(" ".join(map(str, D)))
    for i in range(N):
        print(Move[i])
else:
    print(-1)

### FIXED CODE ###

import sys, math, collections, heapq, itertools
def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while a % b > 0: a, b = b, a % b
    return b
  
def solve():
    file = sys.stdin.readline #single: int(file()), line: map(int, file().split())
    N = int(file())
    point = [[int(i) for i in file().split()] for j in range(N)]
    length = (point[0][0] + point[0][1]) % 2
    for i in range(1, N):
        if sum(point[i]) % 2 != length:
            print(-1)
            break
    else:
        d = [pow(2, i) for i in range(31)]
        direction = {("0", "0"): "L", ("1","1"): "R", ("0", "1"): "D", ("1", "0"): "U"}
        ans = ""
        add = (0 if length == 1 else 1)
        if add == 1: d.append(1)
        for i in range(N):
            U, V = point[i][0] + point[i][1] + add, point[i][0] - point[i][1] + add
            ubit = format((U + pow(2, 31) - 1)//2, "b").zfill(31)
            vbit = format((V + pow(2, 31) - 1)//2, "b").zfill(31)
            arm = ""
            for j in reversed(range(31)):
                arm += direction[(ubit[j], vbit[j])]
            if add == 1: arm += "L"
            ans += arm + "\n"
        print(len(d))
        print(" ".join(map(str, d)))
        print(ans)

    INF = 10 ** 25
    mod = 7 + 10 ** 9
    return 0
  
if __name__ == "__main__":
    solve()
### BUGGY CODE ###

from collections import deque

n = int(input())
ops = [tuple(input().split()) for i in range(n)]

ary = deque([])


def insert(ary, x):
    ary.appendleft(x)


def delete(ary, x):
    if x in ary:
        ary.remove(x)


def delete_first(ary):
    ary.popleft()


def delete_last(ary):
    ary.pop()


def operate(ary, op):
    cmd = op[0]

    if cmd == 'insert':
        x = int(op[1])
        insert(ary, x)
    elif cmd == 'delete':
        x = int(op[1])
        delete(ary, x)
    elif cmd == 'deleteFirst':
        delete_first(ary)
    elif cmd == 'deleteLast':
        delete_last(ary)


[operate(ary, op) for op in ops]
print(' '.join([str(_) for _ in ary]))



### FIXED CODE ###

import sys
from collections import deque

n = int(input())
ary = deque([])

for line in sys.stdin:
    op = line.strip().split()
    cmd = op[0]

    if cmd == 'insert':
        x = op[1]
        ary.appendleft(x)

    elif cmd == 'delete':
        x = op[1]
        if x in ary:
            ary.remove(x)

    elif cmd == 'deleteLast':
        ary.pop()

    else:
        ary.popleft()

print(*ary)