def solve(n):
    r = 0
    uniq = set()
    for x in range(1,n+1):
        for y in range(1,n+1):
            for z in range(1,n+1):
                if abs(x-y)<z < x+ y and x+y+z== n and x != y and y != z and x!=z:
                    e = tuple(sorted((x, y, z)))
                    if not e in uniq:

                        uniq.add(e)
                        r +=1
    for s in sorted(uniq, key=lambda x: (x[0], x[1], x[2])):
        print(s)
    return r
def f(p):
    r = 0
    for x in range(2, p//3+1):
        m=max(0,min(x-1,p-3*x-1))
        r +=  (m // 2 if (p-x)%2==0 else (m+1)//2)
        #print(x,m, r)
    return r

print(f(2026))

            

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: