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):
zero=3
one=4
zero2ten=[i for i in range(3,14)]
flag=14
bin1=15
bin2=45
var=75

ans=[]
def debug(i):
    global ans
    ans.append(("d",i,0,0))
def zeroclear(i):
    upper(i,zero,i)
def add(i,j,k):
    global ans
    ans.append(("+",i,j,k))
def upper(i,j,k):
    global ans
    ans.append(("<",i,j,k))
def and11(i,j,k):
    upper(i,j,k)
    upper(k,j,k)
def copy_if(src,dst):
    global var
    global flag
    one=var+1
    one2=var
    zeroclear(one)
    zeroclear(one2)
    zeroclear(dst)
    add(one,flag,one)
    for _ in range(10):
        upper(dst,src,one2)
        and11(one,one2,one)
        add(one,dst,dst)
    zeroclear(one)
    zeroclear(one2)
def int2bin(src,dstl):
    global var
    sum=var
    cur=var+1
    tmpsum=var+2
    src2=var+3
    var+=3
    zeroclear(sum)
    zeroclear(cur)
    zeroclear(tmpsum)
    zeroclear(src2)
    add(one,src,src2)
    for i in range(29,-1,-1):
        ii=i
        zeroclear(cur)
        add(one,cur,cur)
        for j in range(i):
            add(cur,cur,cur)
        add(sum,cur,tmpsum)
        upper(tmpsum,src2,cur)
        upper(tmpsum,src2,dstl+ii)
        for j in range(i):
            add(cur,cur,cur)
        add(sum,cur,sum)
    zeroclear(sum)
    zeroclear(cur)
    zeroclear(tmpsum)
    zeroclear(src2)
    var-=3
def binprod(src1l,src2l,dst):
    global var
    global flag
    cur=var
    tmp=var+1
    var+=2
    zeroclear(cur)
    zeroclear(var+1)
    zeroclear(dst)
    for i in range(30):
        for j in range(30):
            zeroclear(cur)
            and11(src1l+i,src2l+j,cur)
            for _ in range(i+j):
                add(cur,cur,cur)
            add(cur,dst,dst)
    var-=2

        
        


tmp=var
var=var+1
upper(zero,0,zero2ten[1])
for i in range(9):
    add(zero2ten[i+1],zero2ten[1],zero2ten[i+2])
int2bin(0,bin1)
int2bin(1,bin2)
binprod(bin1,bin2,2)
print(len(ans))
for i in ans:
    print(i[0],i[1],i[2],i[3])

Solution (Python):
def output(S):
  s = S.split()
  i, j, k = map(int, s[1:])
  if s[0] == '<':
    state[k] = 1 if state[i] < state[j] else 0
  else:
    state[k] = state[i] + state[j]
  
  

outputs = []
output = outputs.append
def print_outputs():
  print(len(outputs))
  for x in outputs:
    print(x)

def solve(x, y):
  LIM = 32
  state = [0] * 5 * 10 * LIM
  state[0] = x
  state[1] = y

  usable = 3  
  usable1 = 4  
  usable2 = 5  
  usable3 = 6  
  zero = 7
  one = 8
  base = one  

  output(f'< {zero} 0 {base}')
  output(f'< {zero} 1 {usable}')
  output(f'+ {base} {usable} {base}')  
  output(f'< {zero} {base} {base}')  
  output(f'+ {zero} {zero} {usable}')
  
  for i in range(LIM-1):
    output(f'+ {base+i} {base+i} {base+i+1}') 

  def print_or(i, j, k):
    output(f'+ {i} {j} {k}')
    output(f'< {zero} {k} {k}')

  def print_not(i, k):
    output(f'< {i} {one} {k}')

  def print_zero(i):
    output(f'+ {zero} {zero} {i}')

  def print_and(i, j, k):
    print_not(i, k)
    print_not(j, usable)
    print_or(k, usable, k)
    print_not(k, k)
  
  def print_mult_pow2(n, i, k):
    
    output(f'+ {zero} {i} {k}')
    for _ in range(n):
      output(f'+ {k} {k} {k}')

  def print_binarize(i, k): 
    output(f'+ {one} {i} {usable1}')  

    for p in range(LIM-1, -1, -1):
      
      
      output(f'+ {base+p} {usable2} {usable3}')
      output(f'< {usable3} {usable1} {k+p}')
      print_mult_pow2(p, k+p, usable3)
      output(f'+ {usable3} {usable2} {usable2}')
    print_zero(usable1)
    print_zero(usable2)
    print_zero(usable3)

  A = base + LIM
  B = base + 2 * LIM
  print_binarize(0, A)  
  print_binarize(1, B)  

  for i in range(LIM):
    for j in range(LIM):
      print_and(A+i, B+j, usable1)
      print_mult_pow2(i+j, usable1, usable2)
      output(f'+ 2 {usable2} 2')


  return state[2]

solve(8, 7)
print_outputs()

Solution (Python):
X = []
X.append(("+", 0, 1, 3))
X.append(("<", 4, 3, 100)) 
X.append(("+", 0, 100, 0))
X.append(("+", 1, 100, 1))
for i in range(32):
    X.append(("+", i+100, i+100, i+101))

for t in range(2):
    tt = t * 5000
    for i in range(32):
        s = 31 - i
        X.append(("+", tt + (i+2) * 100 - 1, s + 100, tt + (i+2) * 100))
        X.append(("+", tt + (i+2) * 100 - 1, s + 100, tt + (i+2) * 100 + 1))
        X.append(("<", tt + (i+2) * 100 + 1, t, tt + (i+2) * 100 + s + 2))
        for j in range(s)[::-1]:
            X.append(("+", tt + (i+2) * 100 + j + 3, tt + (i+2) * 100 + j + 3, tt + (i+2) * 100 + j + 2))
        X.append(("+", tt + (i+2) * 100 - 1, tt + (i+2) * 100 + 2, tt + (i+2) * 100 + 99))
        X.append(("+", tt + (i+2) * 100 + s + 2, 90, tt + (i+2) * 100 + 98))
        X.append(("+", tt + (i+2) * 100 + s + 2, 90, 10000 + t * 100 + s))

for i in range(32):
    for j in range(32):
        X.append(("+", 10000 + i, 10100 + j, 95))
        X.append(("<", 100, 95, 95))
        for k in range(i+j):
            X.append(("+", 95, 95, 95))
        X.append(("+", 2, 95, 2))

print(len(X))
for x in X:
    print(*x)

Solution (Python):
print(100000)
cnt = 100000



print("+ 0 1 199999")
print("< 10000 199999 10000")

print("+ 0 10000 0")
print("+ 1 10000 1")



print("< 100 10000 100")
for i in range(29):
    print("+ " + str(100 + i) + " " + str(100 + i) + " " + str(100 + i + 1))

cnt -= 34


for i in range(29,-1,-1):
    print("< " + str(100 + i) + " 1 " + str(150 + i))
    cnt -= 1
    print("+ " + str(150 + i) + " " + str(100000) + " " + str(1000 + i))
    cnt -= 1
    for j in range(i):
        print("+ " + str(1000 + i) + " " + str(1000 + i) + " " + str(1000 + i))
        cnt -= 1
    for j in range(i):
        print("+ " + str(100 + j) + " " + str(1000 + i) + " " + str(100 + j))
        cnt -= 1




for n in range(30):
    
    for i in range(30):
        print("< " + str(100 + i) + " " + str(100 + i) + " " + str(100 + i))
        cnt -= 1
    print("< 100 199999 100")
    cnt -= 1
    for i in range(29):
        print("+ " + str(100 + i) + " " + str(100 + i) + " " + str(100 + i + 1))
        cnt -= 1
    

    print("< " + str(150 + n) + " 10000 10001")
    cnt -= 1
    for i in range(30):
        print("+ 10001 10001 10001")
        cnt -= 1
    for i in range(30):
        print("+ 10001 " + str(100 + i) + " " + str(100 + i))
        cnt -= 1


    

    for i in range(30):
        print("< " + str(2000 + i) + " " + str(2000 + i) + " " + str(2000 + i))
        cnt -= 1


    for i in range(29,-1,-1):
        print("< " + str(100 + i) + " 0 " + str(200 + i))
        cnt -= 1
        for j in range(i):
            print("+ " + str(200 + i) + " " + str(200 + i) + " " + str(200 + i))
            cnt -= 1
        for j in range(i):
            print("+ " + str(100 + j) + " " + str(200 + i) + " " + str(100 + j))
            cnt -= 1
    


    for i in range(30):
        print("+ " + str(300 + n) + " " + str(200 + i) + " " + str(300 + n))
        cnt -= 1


for i in range(30):
    for j in range(i):
        print("+ " + str(300 + i) + " " + str(300 + i) + " " + str(300 + i))
        cnt -= 1

for i in range(30):
    print("+ " + str(300 + i) + " 2 2") 
    cnt -= 1

for i in range(cnt):
    print("< 100000 100000 100000")

Solution (Python):
N = 500
VAL_1 = 3
VAL_0 = 4
TEMP_1 = 5
TEMP_2 = 6
TEMP_3 = 7
TEMP_4 = 8
TEMP_5 = 9
TEMP_6 = 10
TEMP_7 = 11
TEMP_8 = 12

two_power_values = 200
A_binary_expression = 50
B_binary_expression = 100

M = 30

def emurate(ss, A, B):
    seq = [0 for _ in range(N)]
    seq[0]=A
    seq[1] =B
    for s in ss:
        c,i,j,k = s
        if c=="+":
            seq[k] = seq[i]+seq[j]
        elif c=="<":
            seq[k] = (1 if seq[i]<seq[j] else 0)
    return seq

out = []

def plus(i,j,k):
    out.append(("+",i,j,k))

def comp(i,j,k):
    out.append(("<",i,j,k))

def zero_clear(i):
    comp(i,i,i)
    
def move(i,j):
    plus(VAL_0, i, j)
    
def get_binary_expression(val, res):
    M = 30
    zero_clear(TEMP_1)
    for m in range(M,-1,-1):
        
        
        
        
        plus(two_power_values+m, TEMP_1, TEMP_3)
        
        plus(VAL_1,val,TEMP_4)
        comp( TEMP_3, TEMP_4, res+m)
        
        move( res+m, TEMP_2)
        for c in range(m):
            plus(TEMP_2,TEMP_2,TEMP_2)
        plus(TEMP_1,TEMP_2,TEMP_1)
        
def main():
    plus(0,1,TEMP_1)
    comp(VAL_0,TEMP_1,VAL_1)

    for i in range(60):
        if i==0:
            move(VAL_1, two_power_values)
        else:
            plus(two_power_values+i-1,two_power_values+i-1,two_power_values+i)
    
    get_binary_expression(0,A_binary_expression)
    get_binary_expression(1,B_binary_expression)
    
    ans = 2
    for i in range(M):
        for j in range(M):
            plus(A_binary_expression+i,B_binary_expression+j,TEMP_1)
            comp(VAL_1,TEMP_1,TEMP_1)
            for c in range(i+j):
                plus(TEMP_1,TEMP_1,TEMP_1)
            plus(ans,TEMP_1,ans)
    
    print(len(out))
    for c,i,j,k in out:
        print(f'{c} {i} {j} {k}')

    if 0:
        print(len(out))
        A = 10**9
        B = 10**9
        res = emurate(out, A, B)
        print(res)
        print(res[A_binary_expression:])

main()

Solution (Python):
n = q = 2*10**5

fla = []


def pri(s):
    fla.append(s)


pri("+ 0 1 5")
pri("< 3 5 4")

max_log = 30

pri("+ 0 4 0")
pri("+ 1 4 1")

for i in reversed(range(max_log)):
    pri("+ 3 4 8")
    for _ in range(i):
        pri("+ 8 8 8")

    pri("+ 6 8 9")

    pri("< 9 0 %d" % (100+i))

    pri("+ %d 3 9" % (100+i))
    for _ in range(i):
        pri("+ 9 9 9")

    pri("+ 6 9 6")

for i in reversed(range(max_log)):
    pri("+ 3 4 8")
    for _ in range(i):
        pri("+ 8 8 8")

    pri("+ 7 8 9")

    pri("< 9 1 %d" % (200+i))

    pri("+ %d 3 9" % (200+i))
    for _ in range(i):
        pri("+ 9 9 9")

    pri("+ 7 9 7")


def an(i, j, k):
    pri("+ %d %d 6" % (i, j))
    pri("< %d %d 7" % (i, j))
    pri("< %d %d 8" % (j, i))
    pri("+ 7 8 7")
    pri("< 7 6 %d" % k)


for i in range(max_log):
    for j in range(max_log):
        an(100+i, 200+j, 6)
        pri("+ %d 6 %d" % (i+j+300, i+j+300))

for i in range(max_log*2):
    for _ in range(i):
        pri("+ %d %d %d" % (300+i, 300+i, 300+i))
    pri("+ %d 2 2" % (300+i))


print(len(fla))
print("\n".join(fla))

Solution (Python):
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def simulation(words, x, y):
    N = 200_000
    Q = 200_000
    assert len(words) <= Q
    
    A = [0] * N
    A[0], A[1] = x, y
    for w in words:
        if w.startswith('+'):
            i, j, k = map(int, w[2:].split())
            assert 0 <= i < N
            assert 0 <= j < N
            assert 0 <= k < N
            A[k] = A[i] + A[j]
        elif w.startswith('<'):
            i, j, k = map(int, w[2:].split())
            assert 0 <= i < N
            assert 0 <= j < N
            assert 0 <= k < N
            A[k] = 1 * (A[i] < A[j])
        else:
            raise ValueError
    return A

def main():
    S = []

    def ADD(i, j, k):
        S.append(f'+ {i} {j} {k}')

    def LT(i, j, k):
        S.append(f'< {i} {j} {k}')

    
    ONE = 100
    LT(2, 0, ONE)

    POW = 200
    
    ADD(2, ONE, POW)
    for n in range(1, 62):
        ADD(POW + n - 1, POW + n - 1, POW + n)

    TMP = 19000

    
    def binary_expression(pos, i):
        x_pos = TMP  
        y_pos = TMP + 1  
        a_plus_one = TMP + 2
        
        
        ADD(2, 2, x_pos)
        ADD(2, 2, y_pos)
        ADD(i, ONE, a_plus_one)
        for k in range(30, -1, -1):
            
            ADD(x_pos, POW + k, y_pos)
            LT(y_pos, a_plus_one, pos + k)
            
            
            z_pos = TMP + 3
            ADD(pos + k, 2, z_pos)  
            for i in range(k):
                ADD(z_pos, z_pos, z_pos)
            ADD(x_pos, z_pos, x_pos)

    A_BIN = 500
    B_BIN = 600
    binary_expression(A_BIN, 0)
    binary_expression(B_BIN, 1)
    for i in range(30):
        for j in range(30):
            
            ADD(3, 3, TMP)
            
            x_pos = TMP
            ADD(A_BIN + i, B_BIN + j, TMP + 1)  
            LT(ONE, TMP + 1, x_pos)
            
            for _ in range(i + j):
                ADD(x_pos, x_pos, x_pos)
            
            ADD(x_pos, 2, 2)
    return S

S = main()

"""
for a in range(11):
    for b in range(11):
        assert a * b == simulation(S, a, b)[2]
"""

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

Solution (Python):
out = []

def plus(i,j,k):
    out.append(' '.join(['+',str(i),str(j),str(k)]))

def comp(i,j,k):
    out.append(' '.join(['<',str(i),str(j),str(k)]))

comp(2,0,100)
comp(2,1,99)
plus(99,100,100)
comp(500,100,100)
for i in range(62):
    plus(100 + i, 100 + i, 101 + i)



    



plus(0, 100, 297)
for i in range(30, -1, -1):
    plus(298, 100 + i, 299)
    comp(299, 297, 300 + i)
    plus(5000, 300 + i, 296)
    for _ in range(i):
        plus(296, 296, 296)
    plus(296, 298, 298)



plus(1, 100, 397)
for i in range(30, -1, -1):
    plus(398, 100 + i, 399)
    comp(399, 397, 400 + i)
    plus(5000, 400 + i, 396)
    for _ in range(i):
        plus(396, 396, 396)
    plus(396, 398, 398)

for i in range(31):
    for j in range(31):
        plus(300 + i, 400 + j, 500)
        comp(100, 500, 501)
        for _ in range(i + j):
            plus(501,501,501)
        plus(501, 2, 2)

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