Problem:
 Score : 1800 points    Problem Statement This is an output-only problem. You shouldn't read anything from the input.  In short, your task is to simulate multiplication by using only comparison (x < y) and addition (x + y) .
There is no input in this problem, you just print a sequence of operations.  Imagine that there is a big array a[0], a[1], ..., a[N-1] of length N .
The first two values are initially two non-negative integers A and B (which are unknown to you),
    the other elements are zeros.
Your goal is to get the product A \cdot B in a[2] at the end.  You are allowed operations of two types, with the following format (where 0 \leq i, j, k < N ):   + i j k — applies operation a[k] = a[i] + a[j] .  < i j k — applies operation a[k] = a[i] < a[j] .
    That is, if a[i] < a[j] then a[k] becomes 1 , otherwise it becomes 0 .   You can use at most Q operations.
Elements of a can't exceed V .
Indices (i, j, k) don't have to be distinct.
It's allowed to modify any element of the array (including the first two).
The actual checker simulates the process for multiple pairs (A, B) within a single test.
Each time, the checker chooses values A and B , creates the array a = [A, B, 0, 0, \ldots, 0] ,
    applies all your operations and ensures that a[2] = A \cdot B .      Constraints  0 \leq A, B \leq 10^9  N = Q = 200\,000  V = 10^{19} = 10\,000\,000\,000\,000\,000\,000       Partial Score  800 points will be awarded for passing tests that satisfy A, B \leq 10 .  Another 1000 points will be awarded for passing all tests.         Input The Standard Input is empty.      Output In the first line, print the number of operations.
Each operation should then be printed in a single line of format + i j k or < i j k .        Sample Input 1      Sample Output 1 4
< 0 1 8
+ 0 1 2
+ 2 8 2
+ 0 0 0  In the first sample test, the checker checks your sequence only for a pair (A, B) = (2, 3) .
The provided output is correct for this test:   Initially, a[0] = 2 , a[1] = 3 , a[2] = a[3] = \ldots = a[N-1] = 0 .  < 0 1 8 applies a[8] = 1 because a[0] < a[1] .  + 0 1 2 applies a[2] = a[0] + a[1] = 5 .  + 2 8 2 applies a[2] = a[2] + a[8] = 6 .  + 0 0 0 applies a[0] = a[0] + a[0] = 4 .  As required, at the end we have a[2] = 6 = A \cdot B .

Solution (Python):
ope = []
def plus(i,j,k):
    ope.append(('+',i,j,k))
def lt(i,j,k):
    ope.append(('<',i,j,k))



plus(0,1,3)
lt(2,3,3)


plus(0,3,4)
plus(1,3,5)


plus(1000,3,1000)
for i in range(30):
    plus(1000+i, 1000+i, 1000+i+1)




for i in range(29,-1,-1):
    plus(2900, 1000+i, 2901)
    lt(2901, 4, 2000+i)
    
    lt(99, 2000+i, 2902)
    for j in range(i):
        plus(2902, 2902, 2902)
    plus(2900, 2902, 2900)




for i in range(29,-1,-1):
    plus(3900, 1000+i, 3901)
    lt(3901, 5, 3000+i)
    
    lt(99, 3000+i, 3902)
    for _ in range(i):
        plus(3902, 3902, 3902)
    plus(3900, 3902, 3900)


for a in range(30):
    for b in range(30):
        plus(2000+a, 3000+b, 4000)
        lt(3, 4000, 4001)
        for _ in range(a+b):
            plus(4001, 4001, 4001)
        plus(2, 4001, 2)

print(len(ope))
for row in ope:
    print(*row)

Solution (Python):
data = [0] * 1000
data[0] = 111
data[1] = 1111

idx = -1
def alloc():
	global idx
	idx += 1
	return idx
ans = []
def plus(i,j,k):
	data[k] = data[i] + data[j]
	ans.append(('+', i, j, k))
def lower(i,j,k):
	data[k] = int(data[i] < data[j])
	ans.append(('<', i, j, k))
def leq(i,j,k):
	lower(j, i, k)
	lower(k, one, k)

A = alloc()
B = alloc()
C = alloc()
zero = alloc()
one = alloc()


plus(A, B, one)
lower(zero, one, one)


pow2 = [alloc() for i in range(30)]
plus(one, zero, pow2[0])
for i in range(29):
	plus(pow2[i], pow2[i], pow2[i + 1])


a = [alloc() for i in range(30)]
x = alloc()
A_ = alloc() 
for i in reversed(range(30)):
	plus(A_, pow2[i], x)
	leq(x, A, a[i])
	plus(a[i], zero, x)
	for j in range(i):
		plus(x, x, x)
	plus(A_, x, A_)


b = [alloc() for i in range(30)]
B_ = alloc() 
for i in reversed(range(30)):
	plus(B_, pow2[i], x)
	leq(x, B, b[i])
	plus(b[i], zero, x)
	for j in range(i):
		plus(x, x, x)
	plus(B_, x, B_)


for i in range(30):
	for j in range(30):
		plus(a[i], b[j], x)
		lower(one, x, x)
		for k in range(i + j):
			plus(x, x, x)
		plus(C, x, C)

print(len(ans))
for a, b, c, d in ans:
	print(a, b, c, d)

Solution (Python):










def test(ans):
    arr = [67, 20] + [0] * 300

    for s in ans:
        dbg = False
        if s[-1] == '*':
            s = s[:-1]
            dbg = True
        op, i, j, k = s.split()
        i = int(i)
        j = int(j)
        k = int(k)
        if op == '<':
            arr[k] = int(arr[i] < arr[j])
        elif op == '+':
            arr[k] = arr[i] + arr[j]
        else:
            raise NotImplementedError
        if dbg:
            print(s, arr[i], arr[j], arr[k])
    print(arr)
    return arr


ans = []
ans.append('< 3 0 4')
for i in range(4, 34):
    ans.append('+ {} {} {}'.format(i, i, i + 1))
ans.append('+ 3 4 36')
for i in range(30):
    ans.append('+ {} {} {}'.format(i + 5, i + 36, i + 37))






def binary_convert(target, offset):
    for d in range(31, -1, -1):
        ans.append(f'+ {d + 35} 130 131')
        ans.append(f'< 131 {target} 132')
        ans.append(f'+ 3 132 {d + offset}')
        ans.extend(['+ 132 132 132'] * d)
        ans.append('+ 130 132 130')


binary_convert(0, 67)
binary_convert(1, 99)




for di in range(30):
    i = di + 67
    for dj in range(30):
        j = dj + 99
        ans.append(f'+ {i} {j} 130')
        ans.append('< 4 130 130')
        ans.extend(['+ 130 130 130'] * (di + dj))
        ans.append('+ 2 130 2')



print(len(ans))
print('\n'.join(ans))

Solution (Python):
a,l="+<"
f,r=print,range(29,-1,-1)
f(60451,l,4,0,3)
s,t=[a,7,7,7],[a,8,8,8]
for i in r:f(a,3,4,7,*s*i,a,5,7,7,l,0,7,7,l,7,3,7,a,4,4,6);[f(a,3,4,8,*t*j,a,6,8,8,l,1,8,8,l,8,3,8,l,8,7,9,*t*j,a,8,6,6,l,9,7,8,*t*(i+j),a,8,2,2)for j in r];f(*s*i,a,7,5,5)

Solution (Python):
a,l="+<";f,r=print,range(29,-1,-1);f(60451,l,4,0,3);s,t=[a,7,7,7],[a,8,8,8]
for i in r:f(a,3,4,7,*s*i,a,5,7,7,l,0,7,7,l,7,3,7,a,4,4,6);[f(a,3,4,8,*t*j,a,6,8,8,l,1,8,8,l,8,3,8,l,7,8,9,l,9,8,9,*[a,9,9,9]*(i+j),a,2,9,2,*t*j,a,6,8,6)for j in r];f(*s*i,a,5,7,5)

Solution (Python):
a,l="+<"
f,r=print,range(29,-1,-1)
f(60451,l,4,0,3)
for i in r:f(a,3,4,7,*[a,7,7,7]*i,a,5,7,7,l,0,7,7,l,7,3,7,a,4,4,6);[f(a,3,4,8,*[a,8,8,8]*j,a,6,8,8,l,1,8,8,l,8,3,8,l,7,8,9,l,9,8,9,*[a,9,9,9]*(i+j),a,2,9,2,*[a,8,8,8]*j,a,6,8,6)for j in r];f(*[a,7,7,7]*i,a,5,7,5)

Solution (Python):
a,b,c=0,1,2
one,zero=3,4
x,y=5,6
pi,pj=7,8
z=9
def p(i,j,k):print("+",i,j,k)
def l(i,j,k):print("<",i,j,k)
def s(i,j):
    for k in range(j):p(i,i,i)
print(60452)
p(a,b,one);l(zero,one,one)
for i in range(29,-1,-1):
    p(one,zero,pi);s(pi,i)
    p(x,pi,pi);l(a,pi,pi);l(pi,one,pi)
    p(zero,zero,y)
    for j in range(29,-1,-1):
        p(one,zero,pj);s(pj,j)
        p(y,pj,pj);l(b,pj,pj);l(pj,one,pj)
        l(pi,pj,z);l(z,pj,z);s(z,i+j);p(c,z,c)
        s(pj,j);p(y,pj,y)
    s(pi,i);p(x,pi,x)

Solution (Python):
P,L="+<"
p=print
r=range
p(6652,P,0,1,3,L,2,3,3)
for x in 0,1:p(P,x,3,x);[p(P,v:=x+4,v,v,P,v,3,6,*[P,6,6,6]*(38-t),L,6,x,T:=x*60+t,P,v,T,v)for t in r(9,60)]
for t in r(60):p(P,2,2,2);[p(P,8+t-s,69+s,6,L,3,6,6,P,2,6,2)for s in r(t)]

Solution (Python):
print(110943)
X=[10**9,10**9]
for i in range(10000):
  X.append(0)
C=0
def f(f,i,j,k):
  global C
  C+=1
  if f=='<':
    if X[i]<X[j]:
      X[k]=1
    else:
      X[k]=0
    print('<',i,j,k)
  else:
    X[k]=X[i]+X[j]
    print('+',i,j,k)

def g(a,b,r):
  f('+',900,b,300)
  f('<',r,r,r)
  for j in range(58,-1,-1):
    f('+',r,j+2,435)
    f('<',a,435,436)
    f('<',436,300,436)
    for k in range(58):
      f('+',436+k,436+k,437+k)
    f('+',r,436+j,r)

f('<',2,1,2)
f('<',3,0,3)
f('+',2,3,2)
f('<',4,2,2)
for i in range(58):
  f('+',i+2,i+2,i+3)
f('+',63,0,63)
for i in range(29):
  f('+',i+63,i+63,i+64)
for i in range(29,-1,-1):
  f('+',154,i+2,155)
  f('<',1,155,155)
  f('<',155,2,155)
  f('+',900,155,500)
  for j in range(29):
    f('+',500+j,500+j,501+j)
  g(63+i,155,156)
  f('+',500+i,154,154)
  f('+',156,158,158)
f('+',900,158,2)

Solution (Python):
P,L="+<"
p=print
r=range
p(6484,P,0,1,3,L,2,3,3,P,0,3,0,P,1,3,1)
for x in 0,1:[p(P,v:=x+4,v,v,P,v,3,6,*[P,6,6,6]*(29-t),L,6,x,T:=x*60+9+t,P,v,T,v)for t in r(30)]
for t in r(60):p(P,2,2,2);[p(P,8+t-s,69+s,5,L,3,5,6,P,2,6,2)for s in r(t)]

Solution (Python):
P,L="+<"
p=print
r=range
p(6484,P,0,1,3,L,2,3,3)
for x in 0,1:p(P,x,3,x);[p(P,v:=x+4,v,v,P,v,3,6,*[P,6,6,6]*(38-t),L,6,x,T:=x*60+t,P,v,T,v)for t in r(9,39)]
for t in r(60):p(P,2,2,2);[p(P,8+t-s,69+s,5,L,3,5,6,P,2,6,2)for s in r(t)]

Solution (Python):
P,L="+<"
p=print
r=range
p(6484,P,0,1,3,L,2,3,3)
for x in 0,1:p(P,x,3,x);[p(P,v:=x+4,v,v,P,v,3,6,*[P,6,6,6]*(29-t),L,6,x,T:=x*60+9+t,P,v,T,v)for t in r(30)]
for t in r(60):p(P,2,2,2);[p(P,8+t-s,69+s,5,L,3,5,6,P,2,6,2)for s in r(t)]

Solution (Python):
P,L="+<"
p=print
r=range
p(6484,P,0,1,3,L,2,3,3)
for x in 0,1:
	p(P,x,3,x)
	for t in r(30):p(P,v:=x+4,v,v,P,v,3,6,*[P,6,6,6]*(29-t),L,6,x,T:=x*60+9+t,P,v,T,v)
for t in r(60):p(P,2,2,2);[p(P,8+t-s,69+s,5,L,3,5,6,P,2,6,2)for s in r(t)]

Solution (Python):
P,L="+<"
p=print
r=range
p(6484,P,0,1,3,L,2,3,3)
for x in 0,1:
	p(P,x,3,x)
	for t in r(30):exec('p(P,v:=x+4,v,v,P,v,3,6,'+'P,6,6,6,'*(29-t)+'L,6,x,T:=x*60+9+t,P,v,T,v)')
for t in r(60):p(P,2,2,2);[p(P,8+t-s,69+s,5,L,3,5,6,P,2,6,2)for s in r(t)]

Solution (Python):
P,L="+<"
p=print
r=range
p(6484,P,0,1,3,L,2,3,3)
for x in 0,1:
	p(P,x,3,x)
	for t in r(30):p(P,v:=x+4,v,v,P,v,3,6),exec('p(P,6,6,6);'*(29-t));p(L,6,x,T:=x*60+9+t,P,v,T,v)
for t in r(60):p(P,2,2,2);[p(P,8+t-s,69+s,5,L,3,5,6,P,2,6,2)for s in r(t)]

Solution (Python):
p=print
r=range
p(6484)
p(P:="+",0,1,3)
p(L:="<",2,3,3)
for x in 0,1:
	p(P,x,3,x)
	for t in r(30):p(P,v:=x+4,v,v);p(P,v,3,6),exec('p(P,6,6,6);'*(29-t));p(L,6,x,T:=x*60+9+t);p(P,v,T,v)
for t in r(60):p(P,2,2,2);[(p(P,8+t-s,69+s,5),p(L,3,5,6),p(P,2,6,2))for s in r(t)]

Solution (Python):
r=range
def a(i,j,k,l=0):print("+<"[l],i,j,k)
print(6484)
a(0,1,3)
a(2,3,3,1)
for x in 0,1:
	a(x,3,x)
	for t in r(30):a(v:=x+4,v,v);a(v,3,6),exec('a(6,6,6);'*(29-t));a(6,x,T:=x*60+9+t,1);a(v,T,v)
for t in r(60):a(2,2,2);[(a(8+t-s,69+s,5),a(3,5,6,1),a(2,6,2))for s in r(t)]

Solution (Python):
r=range
def a(i,j,k,l="+"):print(l,i,j,k)
print(6484)
a(0,1,3)
a(2,3,3,L:="<")
for x in 0,1:
	a(x,3,x)
	for t in r(30):a(v:=x+4,v,v);a(v,3,6),exec('a(6,6,6);'*(29-t));a(6,x,T:=x*60+9+t,L);a(v,T,v)
for t in r(60):a(2,2,2);[(a(8+t-s,69+s,5),a(3,5,6,L),a(2,6,2))for s in r(t)]

Solution (Python):
p="+"
h="<"
ans=[]
def f(a,b,c,d):ans.append([a,b,c,d])
f(p,0,1,3)
f(h,2,3,3)
f(p,2,3,10)
f(p,2,3,100)
for i in range(29):
  f(p,10+i,10+i,11+i)
  f(p,100+i,100+i,101+i)
for i in range(29,-1,-1):
  f(p,8,10+i,9)
  f(h,0,9,10+i)
  f(h,10+i,3,9)
  f(p,98,100+i,99)
  f(h,1,99,100+i)
  f(h,100+i,3,99)
  f(h,100+i,3,100+i)
  for j in range(i):
    f(p,9,9,9)
    f(p,99,99,99)
  f(p,8,9,8)
  f(p,98,99,98)
for i in range(30):
  f(h,4,4,4)
  for j in range(30):
    f(h,10+i,100+j,5)
    for k in range(j):f(p,5,5,5)
    f(p,4,5,4)
  for k in range(i):f(p,4,4,4)
  f(p,2,4,2)
print(len(ans))
for i in ans:print(*i)

Solution (Python):
r=range
def a(i,j,k,l="+"):print(l,i,j,k)
print(6484)
a(0,1,3)
a(2,3,3,L:="<")
for x in 0,1:
	a(x,3,x)
	for t in r(30):a(v:=x+4,v,v);a(v,3,6),exec('a(6,6,6);'*(29-t));a(6,x,T:=x*60+35+t,L);a(v,T,v)
for t in r(60):a(2,2,2);[(a(34+t-s,95+s,5),a(3,5,6,L),a(2,6,2))for s in r(t)]

Solution (Python):
A=[0]*1000
A[0]=11111
A[1]=111111
def a(i,j,k,l=0):
    print("+<"[l],i,j,k)
    A[k] = int(A[i] < A[j]) if l else A[i] + A[j]


r=range
print(6484)
a(0,1,3)
a(2,3,3,1)
for x in 0,1:
    a(x,3,x)
    for t in r(30):a(v:=x+4,v,v);a(v,3,6);exec('a(6,6,6);'*(29-t));a(6,x,T:=x*60+9+t,1);a(v,T,v)
for t in r(60):a(2,2,2);[(a(8+t-s,69+s,5),a(3,5,6,1),a(2,6,2))for s in r(t)]


assert((A[0]-1) * (A[1]-1) == A[2])

Solution (Python):
p=print
r=range
def a(i,j,k,l=0):p("+<"[l],i,j,k)
p(6484)
a(0,1,3)
a(2,3,3,1)
for x in 0,1:
	a(x,3,x)
	for t in r(30):a(v:=x+4,v,v);a(v,3,6),exec('a(6,6,6);'*(29-t));a(6,x,T:=x*60+35+t,1);a(v,T,v)
for t in r(60):a(2,2,2);[(a(34+t-s,95+s,5),a(3,5,6,1),a(2,6,2))for s in r(t)]

Solution (Python):
p=print
r=range
def a(i,j,k,l=0):p("+<"[l],i,j,k)
def b(i):a(i,i,i)
p(6484)
a(0,1,3)
a(2,3,3,1)
for x in 0,1:
	a(x,3,x)
	for t in r(30):b(v:=x+4);a(v,3,6),*map(b,[6]*(29-t));a(6,x,T:=x*60+35+t,1);a(v,T,v)
for t in r(60):b(2);[(a(34+t-s,95+s,5),a(3,5,6,1),a(2,6,2))for s in r(t)]

Solution (Python):
p=print
r=range
def a(i,j,k,l=0):p("+<"[l],i,j,k)
def b(i):a(i,i,i)
p(6484)
a(0,1,3)
a(2,3,3,1)
for x in r(2):
	a(x,3,x)
	for t in r(30):b(v:=x+4);a(v,3,6),*map(b,[6]*(29-t));a(6,x,T:=x*60+35+t,1);a(v,T,v)
for t in r(60):b(2);[(a(34+t-s,95+s,5),a(3,5,6,1),a(2,6,2))for s in r(t)]

Solution (Python):
p=print
r=range
def a(i,j,k,l=0):p("+<"[l],i,j,k)
def b(i):a(i,i,i)
def d(x):
	a(x,3,x)
	for t in r(30):b(v:=x+4);a(v,3,6),*map(b,[6]*(29-t));a(6,x,T:=x*60+35+t,1);a(v,T,v)
p(6484)
a(0,1,3)
a(2,3,3,1)
d(0)
d(1)
for t in r(60):b(2);[(a(34+t-s,95+s,5),a(3,5,6,1),a(2,6,2))for s in r(t)]

Solution (Python):
p=print
r=range
def a(i,j,k,l=0):p("+<"[l],i,j,k)
def b(i):a(i,i,i)
def d(x):
	a(x,3,x)
	for t in r(30):b(x+4);a(x+4,3,6),*map(b,[6]*(29-t));a(6,x,T:=x*60+35+t,1);a(x+4,T,x+4)
p(6484)
a(0,1,3)
a(2,3,3,1)
d(0)
d(1)
for t in r(60):b(2);[(a(34+t-s,95+s,5),a(3,5,6,1),a(2,6,2))for s in r(t)]

Solution (Python):
p=print
r=range
def a(i,j,k,l=0):p("+<"[l],i,j,k)
def b(i):a(i,i,i)
def d(x):
	a(x,3,x)
	for t in r(30):b(x+4);a(x+4,3,6),*map(b,[6]*(29-t));a(6,x,T:=x*60+35+t,1);a(x+4,T,x+4)
p(3874)
a(0,1,3)
a(2,3,3,1)
d(0)
d(1)
for t in r(60):b(2);[t-31<s<30!=(a(34+t-s,95+s,5),a(3,5,6,1),a(2,6,2))for s in r(t)]

Solution (Python):
p=print
r=range
c=0
def a(i,j,k,l=0):
	global c
	p("+<"[l],i,j,k)
	c = c + 1
def b(i):a(i,i,i+1)
def d(x,i):
	a(x,3,x)
	for t in r(i,i+30):
		b(p:=t+1)
		a(q:=p+1,3,q)
		[*map(b,r(q,i+31))]
		a(i+31,x,t,1)
		b(p)
		a(q,t,q)
p(3934)
a(0,1,3)
a(2,3,3,1)
d(0,9)
d(1,50)
for t in r(60):a(2,2,2);[t-31<s<30!=(a(8+t-s,50+s,5),a(3,5,6,1),a(2,6,2))for s in r(t)]

Solution (Python):
p=print
r=range
c=0
def a(i,j,k,l=0):
	global c
	p("+<"[l],i,j,k)
	c = c + 1
def b(i):a(i,i,i+1)
def d(x,i):
	a(x,3,x)
	for t in r(i,i+30):
		b(p:=t+1)
		a(q:=p+1,3,q)
		[*map(b,r(q,v:=i+31))]
		a(v,x,t,1)
		b(p)
		a(q,t,q)
p(3934)
a(0,1,3)
a(2,3,3,1)
d(0,9)
d(1,50)
for t in r(60):a(2,2,2);[t-31<s<30!=(a(8+t-s,50+s,5),a(3,5,6,1),a(2,6,2))for s in r(t)]

Solution (Python):
p=print
r=range
def a(i,j,k,l=0):p("+<"[l],i,j,k)
def b(i):a(i,i,i+1)
def d(x,i):
	a(x,3,x)
	for t in r(i,i+30):b(t+1);a(q:=t+2,3,q),*map(b,r(q,v:=i+31));a(v,x,t,1);b(t+1);a(q,t,q)
p(3934)
a(0,1,3)
a(2,3,3,1)
d(0,9)
d(1,50)
for t in r(60):a(2,2,2);[t-31<s<30!=(a(8+t-s,50+s,5),a(3,5,6,1),a(2,6,2))for s in r(t)]

Solution (Python):
p=print
r=range
def a(i,j,k,l=0):p("+<"[l],i,j,k)
def b(i):a(i,i,i+1)
def d(x,i):
	a(x,3,x)
	for t in r(i,i+30):b(p:=t+1);a(q:=p+1,3,q),*map(b,r(q,v:=i+31));a(v,x,t,1);b(p);a(q,t,q)
p(3934)
a(0,1,3)
a(2,3,3,1)
d(0,9)
d(1,50)
for t in r(60):a(2,2,2);[t-31<s<30!=(a(8+t-s,50+s,5),a(3,5,6,1),a(2,6,2))for s in r(t)]

Solution (Python):
p=print
r=range
def a(i,j,k,l=0):p("+<"[l],i,j,k)
def b(i):a(i,i,i+1)
def d(x,i):
	a(x,3,x)
	for t in r(i,i+30):b(p:=t+30);a(q:=p+1,3,q),*map(b,r(q,v:=i+60));a(v,x,t,1);b(p);a(q,t,q)
p(3934)
a(0,1,3)
a(2,3,3,1)
d(0,9)
d(1,50)
for t in r(60):a(2,2,2);[t-31<s<30!=(a(8+t-s,50+s,5),a(3,5,6,1),a(2,6,2))for s in r(t)]

Solution (Python):
p=print
r=range
def a(i,j,k,l=0):p("+<"[l],i,j,k)
def b(i):a(i,i,i+1)
def d(x,i):
	a(x,3,x)
	for t in r(i,i+30):b(p:=t+30);a(q:=p+1,3,q);[*map(b,r(q,v:=i+60))];a(v,x,t,1);b(p);a(q,t,q)
p(3934)
a(0,1,3)
a(2,3,3,1)
d(0,9)
d(1,50)
for t in r(60):a(2,2,2);[t-31<s<30!=(a(8+t-s,50+s,5),a(3,5,6,1),a(2,6,2))for s in r(t)]

Solution (Python):
p=print
r=range
def a(i,j,k,l=0):p("+<"[l],i,j,k)
def b(i):a(i,i,i+1)
def d(x,i):a(x,3,x);[[b(p:=i+t+30),a(q:=p+1,3,q),[*map(b,r(q,v:=i+60))],a(v,x,i+t,1),b(p),a(q,i+t,q)]for t in r(30)]
p(3934)
a(0,1,3)
a(2,3,3,1)
d(0,9)
d(1,50)
for t in r(60):a(2,2,2);[t-31<s<30!=(a(8+t-s,50+s,5),a(3,5,6,1),a(2,6,2))for s in r(t)]

Solution (Python):
p=print
r=range
m=60
def a(i,j,k,l=0):p("+<"[l],i,j,k)
def b(i):a(i,i,i+1)
def d(x,i):
	for t in r(30):b(p:=i+t+30);a(q:=p+1,n,q);[*map(b,r(q,i+m))];a(i+m,x,i+t,1);b(p);a(q,i+t,q)
p(n:=3934)
a(0,1,n)
a(2,n,n,1)
a(0,n,3)
a(1,n,4)
d(3,9)
d(4,m)
for t in r(m):a(2,2,2);[t-31<s<30!=(a(8+t-s,m+s,5),a(n,5,6,1),a(2,6,2))for s in r(t)]

Solution (Python):
p=print
r=range
def a(i,j,k,l=0):p("+<"[l],i,j,k)
def b(i):a(i,i,i+1)
def d(x,i):
	a(x,3,x)
	for t in r(30):b(p:=i+t+30);a(q:=p+1,3,q);[*map(b,r(q,v:=i+60))];a(v,x,i+t,1);b(p);a(q,i+t,q)
p(3934)
a(0,1,3)
a(2,3,3,1)
d(0,9)
d(1,50)
for t in r(60):a(2,2,2);[t-31<s<30!=(a(8+t-s,50+s,5),a(3,5,6,1),a(2,6,2))for s in r(t)]

Solution (Python):
p=print
r=range
def a(i,j,k,l=0):p("+<"[l],i,j,k)
def b(i):a(i,i,i+1)
def d(x,i):
	for t in r(30):b(p:=i+t+30);a(q:=p+1,3,q);[*map(b,r(q,v:=i+60))];a(v,x,i+t,1);b(p);a(q,i+t,q)
p(3934)
a(0,1,3)
a(2,3,3,1)
a(0,3,0)
a(1,3,1)
d(0,9)
d(1,50)
for t in r(60):a(2,2,2);[t-31<s<30!=(a(8+t-s,50+s,5),a(3,5,6,1),a(2,6,2))for s in r(t)]

Solution (Python):
p=print
r=range
def a(i,j,k,l=0):p("+<"[l],i,j,k)
def b(i):a(i,i,i+1)
def d(x,i):
	for t in r(30):b(p:=i+t+30);a(q:=p+1,n,q);[*map(b,r(q,v:=i+60))];a(v,x,i+t,1);b(p);a(q,i+t,q)
p(n:=3934)
a(0,1,n)
a(2,n,n,1)
a(0,n,0)
a(1,n,1)
d(0,9)
d(1,50)
for t in r(60):a(2,2,2);[t-31<s<30!=(a(8+t-s,50+s,5),a(n,5,6,1),a(2,6,2))for s in r(t)]

Solution (Python):
p=print
r=range
def a(i,j,k,l=0):p("+<"[l],i,j,k)
def b(i):a(i,i,i+1)
def d(x,i):
	for t in r(30):b(p:=i+t+30);a(q:=p+1,n,q);[*map(b,r(q,i+60))];a(i+60,x,i+t,1);b(p);a(q,i+t,q)
p(n:=3934)
a(0,1,n)
a(2,n,n,1)
a(0,n,3)
a(1,n,4)
d(3,9)
d(4,50)
for t in r(60):a(2,2,2);[t-31<s<30!=(a(8+t-s,50+s,5),a(n,5,6,1),a(2,6,2))for s in r(t)]

Solution (Python):
p=print
r=range
def a(i,j,k,l=0):p("+<"[l],i,j,k)
def b(i):a(i,i,i+1)
def d(x,i):
	for t in r(30):b(p:=i+t+30);a(q:=p+1,n,q);[*map(b,r(q,v:=i+60))];a(v,x,i+t,1);b(p);a(q,i+t,q)
p(n:=3933)
a(0,1,n)
a(2,n,n,1)
a(0,n,0)
a(1,n,1)
d(0,9)
d(1,60)
for t in r(59):a(2,2,2);[t<s+30<60!=(a(9+t-s,60+s,5),a(n,5,6,1),a(2,6,2))for s in r(t+1)]

Solution (Python):
p=print
r=range
def a(i,j,k,l=0):p("+<"[l],i,j,k)
def b(i):a(i,i,i+1)
def d(x,i):
	for t in r(30):b(p:=i+t+30);a(q:=p+1,n,q);[*map(b,r(q,i+60))];a(i+60,x,i+t,1);b(p);a(q,i+t,q)
p(n:=3933)
a(0,1,n)
a(2,n,n,1)
a(0,n,3)
a(1,n,4)
d(3,9)
d(4,50)
for t in r(59):a(2,2,2);[t-30<s<30!=(a(9+t-s,50+s,5),a(n,5,6,1),a(2,6,2))for s in r(t+1)]

Solution (Python):
p=print
r=range
def a(i,j,k,l=0):p("+<"[l],i,j,k)
def b(i):a(i,i,i+1)
def d(x,i):
	for t in r(30):b(p:=i+t+30);a(q:=p+1,n,q);[*map(b,r(q,i+60))];a(i+60,x,i+t,1);b(p);a(q,i+t,q)
p(n:=3933)
a(0,1,n)
a(2,n,n,1)
a(0,n,3)
a(1,n,4)
d(3,5)
d(4,36)
for t in r(59):a(2,2,2);[t-30<s<30!=(a(5+t-s,36+s,98),a(n,98,99,1),a(2,99,2))for s in r(t+1)]

Solution (Python):
p=print
r=range
def a(i,j,k,l=0):p("+<"[l],i,j,k)
def b(i):a(i,i,i+1)
def d(x,i,j):
	for t in r(30):b(p:=j+t-1);a(q:=j+t,n,q);[*map(b,r(q,j+29))];a(j+29,x,i+t,1);b(p);a(q,i+t,q)
p(n:=3933)
a(0,1,n)
a(2,n,n,1)
a(0,n,3)
a(1,n,4)
d(3,5,36)
d(4,36,67)
for t in r(59):a(2,2,2);[t-30<s<30!=(a(5+t-s,36+s,98),a(n,98,99,1),a(2,99,2))for s in r(t+1)]

Solution (Python):
p=print
r=range
def a(i,j,k,l=0):p("+<"[l],i,j,k)
def b(i):a(i,i,i+1)
def d(x,i,j):
	for t in r(30):b(p:=j+t-1);a(q:=j+t,n,q);[*map(b,r(q,j+29))];a(j+29,x,i+t,1);b(p);a(q,i+t,q)
p(3933)
a(0,1,n:=97)
a(2,n,n,1)
a(0,n,3)
a(1,n,4)
d(3,5,36)
d(4,36,67)
for t in r(59):a(2,2,2);[t-30<s<30!=(a(5+t-s,36+s,98),a(n,98,99,1),a(2,99,2))for s in r(t+1)]

Solution (Python):
p=print
r=range
def a(i,j,k,l=0):p("+<"[l],i,j,k)
def b(i):a(i,i,i+1)
def d(x,i,j):
	for t in r(30):b(p:=j+t-1);a(q:=j+t,n,q);[*map(b,r(q,j+29))];a(j+29,x,i+t,1);b(p);a(q,i+t,q)
p(3933)
a(0,1,n:=97)
a(2,n,n,1)
a(0,n,3)
a(1,n,4)
d(3,5,36)
d(4,36,67)
for t in r(59):a(2,2,2);[(a(5+t-s,36+s,98),a(n,98,99,1),a(2,99,2))for s in r(t+1)if t-30<s<30]

Solution (Python):
n=97
p=print
r=range
def a(i,j,k,l=0):p("+<"[l],i,j,k)
def b(i):a(i,i,i+1)
def d(x,i,j):
	for t in r(30):b(p:=j+t-1);a(q:=p+1,n,q);[*map(b,r(q,j+29))];a(j+29,x,i+t,1);b(p);a(q,i+t,q)
p(3933)
a(0,1,n)
a(2,n,n,1)
a(0,n,3)
a(1,n,4)
d(3,5,36)
d(4,36,67)
for t in r(59):a(2,2,2);[(a(5+t-s,36+s,98),a(n,98,99,1),a(2,99,2))for s in r(t+1)if t-30<s<30]

Solution (Python):
p=print
r=range
def a(i,j,k,l=0):p("+<"[l],i,j,k)
def b(i):a(i,i,i+1)
def d(x,i,j):
	for t in r(30):b(p:=j+t-1);a(q:=j+t,n,q);[*map(b,r(j+t,j+29))];a(j+29,x,i+t,1);b(p);a(q,i+t,q)
p(3933)
a(0,1,n:=97)
a(2,n,n,1)
a(0,n,3)
a(1,n,4)
d(3,5,36)
d(4,36,67)
for t in r(59):a(2,2,2);[(a(5+t-s,36+s,98),a(n,98,99,1),a(2,99,2))for s in r(t+1)if t-30<s<30]

Solution (Python):
n=97
p=print
r=range
def a(i,j,k,l=0):p("+<"[l],i,j,k)
def b(i):a(i,i,i+1)
def d(x,i,j):
	for t in r(30):b(p:=j+t-1);a(j+t,n,j+t);[*map(b,r(j+t,j+29))];a(j+29,x,i+t,1);b(p);a(j+t,i+t,j+t)
p(3933)
a(0,1,n)
a(2,n,n,1)
a(0,n,3)
a(1,n,4)
d(3,5,36)
d(4,36,67)
for t in r(59):a(2,2,2);[(a(5+t-s,36+s,98),a(n,98,99,1),a(2,99,2))for s in r(t+1)if t-30<s<30]

Solution (Python):


LT = '<'
ADD = '+'

mc = 3
ops = []

zero = None
one = None
tp_size = 31
twopow = None

def getM():
    global mc
    mc += 1
    return mc - 1

def setOp(opc, i, j, k):
    ops.append(f'{opc} {i} {j} {k}')
    
def mylog(msg, *vs):
    ops.append(f"D '{msg}' " + ' '.join(map(str, vs)))

def assign(i, j):  
    setOp(ADD, zero, j, i)

def add(i, j):
    m = getM()
    setOp(ADD, i, j, m)
    return m

def lt(i, j):
    m = getM()
    setOp(LT, i, j, m)
    return m

def le(i, j):  
    m = lt(i, add(j, one))
    return m

def myor(i, j):
    return lt(zero, add(i, j))

def mynot(i):
    return lt(i, one)

def myand(i, j):
    m = mynot(myor(mynot(i), mynot(j)))
    
    return m


def mktwopow(x):
    ret = []
    ret.append(x)
    last = x
    for k in range(1, tp_size):
        last = add(last, last)
        ret.append(last)
    return ret

def myifk(f, k): 
    if k == 0:
        return lt(zero, f)
    else:
        m = myifk(f, k-1)
        return add(m, m)

def myif(f, x): 
    t = zero
    for k in range(tp_size - 1, -1, -1):
        s = myifk(myand(f, le(add(t, twopow[k]), x)), k)
        t = add(t, s)
    return t

def prod(x, y):
    t = zero
    s = zero
    for k in range(tp_size - 1, -1, -1):
        
        tc = add(t, twopow[k])
        f = le(tc, x)
        yf = myif(f, y)
        for i in range(k):
            yf = add(yf, yf)
        s = add(s, yf)
        t = add(t, myif(f, twopow[k]))
        
        
    return s
        
def pout():
    print(len(ops))
    for s in ops:
        print(s)                

def main():
    global ops, mc, zero, one, twopow
    ops = []
    zero = getM()
    one = lt(zero, add(lt(zero, 0), lt(zero, 1)))
    twopow = mktwopow(one)
    assign(2, prod(0, 1))
    pout()

main()

Solution (Python):
n=97
r=range
L='<'
P='+'
l=[3933,P,0,1,n,L,2,n,n,P,0,n,3,P,1,n,4]
a=lambda i,j:[P,i,j,i]
b=lambda i:[P,i,i,i+1]
def d(x,i,j):
	return sum([sum([b(j+t-1),a(j+t,n),*(b(s)for s in r(j+t,j+29)),[L,j+29,x,i+t],b(j+t-1),a(j+t,i+t)],[])for t in r(30)],[])
l+=d(3,5,36)
l+=d(4,36,67)
for t in r(59):
	l+=a(2,2)
	for s in r(t+1):
		if t-30<s<30:l+=[P,5+t-s,36+s,98];l+=[L,n,98,99];l+=a(2,99)
print(*l)

Solution (Python):
n=97
p=print
r=range
def a(i,j,k,l=0):p("+<"[l],i,j,k)
def b(i):a(i,i,i+1)
def d(x,i,j):
	for t in r(30):b(j+t-1);a(j+t,n,j+t);[*map(b,r(j+t,j+29))];a(j+29,x,i+t,1);b(j+t-1);a(j+t,i+t,j+t)
p(3933)
a(0,1,n)
a(2,n,n,1)
a(0,n,3)
a(1,n,4)
d(3,5,36)
d(4,36,67)
for t in r(59):a(2,2,2);[(a(5+t-s,36+s,98),a(n,98,99,1),a(2,99,2))for s in r(t+1)if t-30<s<30]

Solution (Python):
n=97
p=print
r=range
def a(i,j,k,l=0):p("+<"[l],i,j,k)
def b(i):a(i,i,i+1)
def d(x,i,j):
	for t in r(30):b(j+t-1);a(j+t,n,j+t);[b(s)for s in r(j+t,j+29)];a(j+29,x,i+t,1);b(j+t-1);a(j+t,i+t,j+t)
p(3933)
a(0,1,n)
a(2,n,n,1)
a(0,n,3)
a(1,n,4)
d(3,5,36)
d(4,36,67)
for t in r(59):a(2,2,2);[(a(5+t-s,36+s,98),a(n,98,99,1),a(2,99,2))for s in r(t+1)if t-30<s<30]

Solution (Python):
n=97
p=print
r=range
def a(i,j,k,l=0):p("+<"[l],i,j,k)
def b(i):a(i,i,i+1)
def d(x,i,j):
	for t in r(30):
		b(j+t-1);a(j+t,n,j+t)
		for s in r(j+t,j+29):b(s)
		a(j+29,x,i+t,1);b(j+t-1);a(j+t,i+t,j+t)
p(3933)
a(0,1,n)
a(2,n,n,1)
a(0,n,3)
a(1,n,4)
d(3,5,36)
d(4,36,67)
for t in r(59):
	a(2,2,2)
	for s in r(t+1):
		if t-30<s<30:a(5+t-s,36+s,98);a(n,98,99,1);a(2,99,2)

Solution (Python):
n=97
p=print
r=range
def a(i,j,k,l=0):p(chr(43+l*17),i,j,k)
def b(i):a(i,i,i+1)
def d(x,i,j):
	for t in r(30):
		b(j+t-1);a(j+t,n,j+t)
		for s in r(j+t,j+29):b(s)
		a(j+29,x,i+t,1);b(j+t-1);a(j+t,i+t,j+t)
p(3933)
a(0,1,n)
a(2,n,n,1)
a(0,n,3)
a(1,n,4)
d(3,5,36)
d(4,36,67)
for t in r(59):
	a(2,2,2)
	for s in r(t+1):
		if t-30<s<30:a(5+t-s,36+s,98);a(n,98,99,1);a(2,99,2)

Solution (Python):
n=97
p=print
r=range
def c(i,j,k):p('<',i,j,k)
def a(i,j,k=0):p('+',i,j,max(i,k))
def b(i):a(i,i,i+1)
def d(x,i,j):
	for t in r(30):
		b(j+t-1);a(j+t,n)
		for s in r(j+t,j+29):b(s)
		c(j+29,x,i+t);b(j+t-1);a(j+t,i+t)
p(3933)
a(0,1,n)
c(2,n,n)
a(0,n,3)
a(1,n,4)
d(3,5,36)
d(4,36,67)
for t in r(59):
	a(2,2)
	for s in r(t+1):
		if t-30<s<30:a(5+t-s,36+s,98);c(n,98,99);a(2,99)

Solution (Python):
n=97
p=print
r=range
def c(i,j,k):p('<',i,j,k)
def a(i,j,k=0):p('+',i,j,max(i,k))
def b(i):a(i,i,i+1)
def d(x,i,j):
	for t in r(30):
		b(j+t-1)
		a(j+t,n)
		for s in r(j+t,j+29):b(s)
		c(j+29,x,i+t)
		b(j+t-1)
		a(j+t,i+t)
p(3933)
a(0,1,n)
c(2,n,n)
a(0,n,3)
a(1,n,4)
d(3,5,36)
d(4,36,67)
for t in r(59):
	a(2,2)
	for s in r(t+1):
		if t-30<s<30:a(5+t-s,36+s,98);c(n,98,99);a(2,99)

Solution (Python):
n=97
p=print
r=range
def c(i,j,k):p('<',i,j,k)
def a(i,j,k):p('+',i,j,k)
def b(i):a(i,i,i+1)
def d(x,i,j):
	for t in r(30):
		b(j+t-1)
		a(j+t,n,j+t)
		for s in r(j+t,j+29):b(s)
		c(j+29,x,i+t)
		b(j+t-1)
		a(j+t,i+t,j+t)
p(3933)
a(0,1,n)
c(2,n,n)
a(0,n,3)
a(1,n,4)
d(3,5,36)
d(4,36,67)
for t in r(59):
	a(2,2,2)
	for s in r(t+1):
		if t-30<s<30:a(5+t-s,36+s,98);c(n,98,99);a(2,99,2)

Solution (Python):
n=97
p=print
r=range
def c(i,j,k):p('<',i,j,k)
def a(i,j,k):p('+',i,j,k)
def d(x,i,j):
	for t in r(30):
		a(j+t-1,j+t-1,j+t)
		a(j+t,n,j+t)
		for s in r(j+t,j+29):a(s,s,s+1)
		c(j+29,x,i+t)
		a(j+t-1,j+t-1,j+t)
		a(j+t,i+t,j+t)
p(3933)
a(0,1,n)
c(2,n,n)
a(0,n,3)
a(1,n,4)
d(3,5,36)
d(4,36,67)
for t in r(59):
	a(2,2,2)
	for s in r(t+1):
		if t-30<s<30:a(5+t-s,36+s,98);c(n,98,99);a(2,99,2)

Solution (Python):
n=97
def c(i,j,k):print('<',i,j,k)
def a(i,j,k):print('+',i,j,k)
def d(x,i,j):
	for t in range(30):
		a(j+t-1,j+t-1,j+t)
		a(j+t,n,j+t)
		for s in range(j+t,j+29):a(s,s,s+1)
		c(j+29,x,i+t)
		a(j+t-1,j+t-1,j+t)
		a(j+t,i+t,j+t)
print(3933)
a(0,1,n)
c(2,n,n)
a(0,n,3)
a(1,n,4)
d(3,5,36)
d(4,36,67)
for t in range(59):
	a(2,2,2)
	for s in range(t+1):
		if t-30<s<30:a(5+t-s,36+s,98);c(n,98,99);a(2,99,2)

Solution (Python):
n=97
def c(i,j,k):print('<',i,j,k)
def a(i,j,k):print('+',i,j,k)
def m(i,j,k):
	for t in range(59):
		a(k,k,k)
		for s in range(t+1):
			if t-30<s<30:a(i+t-s,j+s,98);c(n,98,99);a(k,99,k)
def d(x,i,j):
	for t in range(30):
		a(j+t-1,j+t-1,j+t)
		a(j+t,n,j+t)
		for s in range(j+t,j+29):a(s,s,s+1)
		c(j+29,x,i+t)
		a(j+t-1,j+t-1,j+t)
		a(j+t,i+t,j+t)
print(3933)
a(0,1,n)
c(2,n,n)
a(0,n,3)
a(1,n,4)
d(3,5,36)
d(4,36,67)
for t in range(59):
	a(2,2,2)
	for s in range(t+1):
		if t-30<s<30:a(5+t-s,36+s,98);c(n,98,99);a(2,99,2)

Solution (Python):
n=97
def c(i,j,k):print('<',i,j,k)
def a(i,j,k):print('+',i,j,k)
def m(i,j,k):
	for t in range(59):
		a(k,k,k)
		for s in range(t+1):
			if t-30<s<30:a(i+t-s,j+s,98);c(n,98,99);a(k,99,k)
def d(x,i,j):
	for t in range(30):
		a(j+t-1,j+t-1,j+t)
		a(j+t,n,j+t)
		for s in range(j+t,j+29):a(s,s,s+1)
		c(j+29,x,i+t)
		a(j+t-1,j+t-1,j+t)
		a(j+t,i+t,j+t)
print(3933)
a(0,1,n)
c(2,n,n)
a(0,n,3)
a(1,n,4)
d(3,5,36)
d(4,36,67)
m(5,36,2)

Solution (Python):
class CodeGen:
    codes = []
    cnt = 100

    def __init__(self, A, B):
        self.A = A
        self.B = B    
        self.C1 = self.one()
        self.C2 = self.pow2(self.C1, 1)
        self.C3 = self.pow2(self.C1, 2)
        self.C4 = self.pow2(self.C1, 3)

        self.POW2 = [self.C1]
        for i in range(32):
            self.POW2.append(self.pow2(self.C1, i + 1))
    
    def allocate(self):
        self.cnt += 1
        return self.cnt - 1

    def plus(self, x, y):
        l = self.allocate()
        self.codes.append(f"+ {x} {y} {l}")
        return l

    def gt(self, x, y):
        l = self.allocate()
        self.codes.append(f"< {x} {y} {l}")
        return l

    def ge(self, x, y):
        return self.gt(x, self.plus(y, self.C1))

    def pow2(self, x, n):
        t = x
        for _ in range(n):
            t = self.plus(t, t)
        return t

    def one(self):
        return self.gt(self.allocate(), self.plus(self.A, self.B))

    def bits(self, x, n):
        result = []

        t = self.allocate()
        for i in range(n - 1, -1, -1):
            bit = self.ge(self.plus(self.POW2[i], t), x)
            result.append(bit)
            t = self.plus(t, self.pow2(bit, i))
        return result

    def mult(self, x, y):
        return self.gt(self.C1, self.plus(x, y))

    def show(self, ans):
        t = self.allocate()
        self.codes.append(f"+ {ans} {t} 2")

        print(len(self.codes))
        for c in self.codes:
            print(c)

    def pluss(self, xs):
        if len(xs) == 1:
            return xs[0]
        return self.plus(xs[0], self.pluss(xs[1:]))

class Eval(CodeGen):
    def __init__(self, A, B):
        super().__init__(A, B)
    
    def allocate(self):
        return 0

    def plus(self, x, y):
        return x + y

    def gt(self, x, y):
        if x < y:
            return 1
        return 0

    def show(self, ans):
        print(ans)


if __name__ == "__main__":
    gen = CodeGen(0, 1)
    

    A = gen.bits(gen.A, 32)
    B = gen.bits(gen.B, 32)
    X = []
    for _ in range(64):
        X.append(gen.allocate())
    for i in range(32):
        for j in range(32):
            X[i + j] = gen.plus(X[i + j], gen.mult(A[i], B[j]))
    ans = gen.allocate()
    for i in range(64):
        ans = gen.plus(ans, gen.pow2(X[i], 62- i))
    gen.show(ans)

Solution (Python):

"""

https://atcoder.jp/contests/agc047/tasks/agc047_e

まず2進数に直す

a[3] = a+b
a[4] = 0
a[5] = 1

100 <= n < 131 常に置いておく



"""

ans = []

def add(i,j,k):
    ans.append (("+",i,j,k))
    lis[k] = lis[i] + lis[j]

def slt(i,j,k):
    ans.append (("<",i,j,k))
    if lis[i] < lis[j]:
        lis[k] = 1
    else:
        lis[k] = 0

def make_binary(start):
    for i in range(start,start+31):
        if i == start:
            slt(4,3,i) 
        else:
            add(i-1,i-1,i)

def make_binary2(start):
    for i in range(start,start+64):
        if i == start:
            slt(4,3,i) 
        else:
            add(i-1,i-1,i)
            
def mul(i,j,k): 
    add(i,j,15)
    slt(5,15,k)

A = 15
B = 2
lis = [0] * 200000
lis[0] = A
lis[1] = B

add(0,1,3) 
slt(4,3,5) 
make_binary2(100)


make_binary(200)
for i in range(230,199,-1):
    add(0,4,11) 
    add(11,5,11) 
    slt(i,11,10)
    add(10,i+100,i+100)
    for j in range(i-200):
        add(10,10,10)
        

    for j in range(i-1,199,-1):
        add(10,j,j)





make_binary(400)
for i in range(430,399,-1):
    add(1,4,11) 
    add(11,5,11) 
    slt(i,11,10)
    add(10,i+100,i+100)
    for j in range(i-400):
        add(10,10,10)

    for j in range(i-1,399,-1):
        add(10,j,j)



for ii in range(300,331):
    i = ii-300
    for jj in range(500,531):
        j = jj - 500

        mul(ii,jj,600)
        
        for k in range(i+j):
            add(600,600,600)
        add(600,2,2)

print (len(ans))
for i in ans:
    print (*i)