Chef likes problems on geometry a lot. Please help him to solve one such problem.
Find all possible triangles with integer sides which has the radius of inscribed circle (also known as incircle) equal to R.
Two triangles are said to be different if they have at least one different side lengths. Formally, let there be two triangles T1, T2. Let a, b, c denote the sides of triangle T1, such that a ≤ b ≤ c. Similarly, Let d, e, f denote the sides of triangle T2, such that d ≤ e ≤ f. Then T1 will said to be different from T2 if either a ≠ d, or b ≠ e or c ≠ f.

-----Input-----
There is a single test case per test file.
The only line of input contains an integer R.

-----Output-----
Output in first line single number - number of triangles satisfying statement.
Order the sides of triangles in non-decreasing order. Output all triangles in non-decreasing order, i.e. order first by smallest sides, otherwise by second smallest sides, if first and second sides equal, then by third.

-----Constraints-----
- 1 ≤ R ≤ 100 

-----Subtasks-----
- Subtask #1: (20 points)  1 ≤ R ≤ 3
- Subtask #2: (30 points)  1 ≤ R ≤ 20
- Subtask #3: (50 points)  Original constraints

-----Example-----
Input:2

Output:5
5 12 13
6 8 10
6 25 29
7 15 20
9 10 17

Difficulty: interview

Starter code:

Solutions:
r=int(input())
c=0
L=[]
for i in range(2*r+1,2*r**2+2):
 for j in range(i,r**4+2*r**2+2):
  for k in range(j,r**4+3*r**2+2):
   if 4*(i+j+k)*r**2==(i+j-k)*(i+k-j)*(j+k-i):
    L.append([i,j,k])
    c+=1
print(c)
for i in range(c):
 for j in range(3):
  print(L[i][j], end=' ')
 print()
 


from math import sqrt
r = int(input())
cnt=0
rt=[]
for i in range(1,16*r):
 for j in range(i, 460):
  for k in range(j+1, j+i):
   #print i,j,k
   s = float((i+j+k))/2
   #print s,i,j,k,s*(s-i)*(s-j)*(s-k)
   area = sqrt(abs(s*(s-i)*(s-j)*(s-k)))
   #print(float(2*area))/(i+j+k)
   if (r==(float(2*area))/(i+j+k)):
    cnt+=1
    #print i,j,k,area
    rt.append([i,j,k])
    
print(cnt)

for i in rt:
 for j in i:
  print(j, end=' ')
 print()


from math import sqrt
r = int(input())
cnt=0
rt=[]
for i in range(1,10*r):
 for j in range(i, 150):
  for k in range(j+1, j+i):
   #print i,j,k
   s = float((i+j+k))/2
   #print s,i,j,k,s*(s-i)*(s-j)*(s-k)
   area = sqrt(abs(s*(s-i)*(s-j)*(s-k)))
   #print(float(2*area))/(i+j+k)
   if (r==(float(2*area))/(i+j+k)):
    cnt+=1
    #print i,j,k,area
    rt.append([i,j,k])
    
print(cnt)

for i in rt:
 for j in i:
  print(j, end=' ')
 print()


R=int(input())
t=[]
for a in range(2*R,200):
  for b in range(a,300):
   for c in range(b,400 ):
     s=(a+b+c)/2.0
     d=s*(s-a)*(s-b)*(s-c)
     if d>=0 and s!=0 and (a+b)>c:
        if R**2==(d/s**2):
         t.append([a,b,c])
         if len(t)>20:
           break
print(len(t))
for i in range(len(t)):
  print(t[i][0],t[i][1],t[i][2])

R=int(input())
t=[]
for a in range(2*R,50):
  for b in range(a,500):
   for c in range(b,500 ):
     s=(a+b+c)/2.0
     d=s*(s-a)*(s-b)*(s-c)
     if d>=0 and s!=0 and (a+b)>c:
        if R**2==(d/s**2):
         t.append([a,b,c])
         if len(t)>20:
           break
print(len(t))
for i in range(len(t)):
  print(t[i][0],t[i][1],t[i][2])

R=int(input())
t=[]
for a in range(2*R,120):
  for b in range(a,120):
   for c in range(b,120 ):
     s=(a+b+c)/2.0
     d=s*(s-a)*(s-b)*(s-c)
     if d>=0 and s!=0 and (a+b)>c:
        if R**2==(d/s**2):
         t.append([a,b,c])
         if len(t)>20:
           break
print(len(t))
for i in range(len(t)):
  print(t[i][0],t[i][1],t[i][2])

#Pre-Computed using bruteforce
r=int(input())
if(r==2):
 print(5)
 print(5,12,13)
 print(6,8,10)
 print(6,25,29)
 print(7,15,20)
 print(9,10,17)
if(r==1):
 print(1)
 print(3,4,5)
if(r==3):
 print(13)
 print(7,24,25)
 print(7,65,68)
 print(8,15,17)
 print(8,26,30)
 print(9,12,15)
 print(10,10,12)
 print(11,13,20)
 print(11,100,109)
 print(12,55,65)
 print(13,40,51)
 print(15,28,41)
 print(16,25,39)
 print(19,20,37)

for t in range(1):
 r = int(input())
 x = []
 for a in range(1, 200):
  for b in range(a, 200):
   for c in range(b, 200):
    if (c >= (a+b)):
     break
    else:
     s = (a + b + c)/2.0
     A = (s*(s-a)*(s-b)*(s-c))**0.5
     if abs(A/s - r) < 0.0000001:
      x.append((a, b, c))
 print(len(x))
 for a, b, c in x:
  print(a, b, c)