Project Euler #223: Almost right-angled triangles I

  • + 1 comment

    I'm getting timeout for all cases except case 0 . How can i imporve my algo??

    test=int(input())
    s=[]
    res=[]
    count=0
    for i in range(test):
        s.append(int(input()))
    for i in s:
        for a in range(1,i//2+1):
            for b in range(1,i//2+1):
                for c in range(1,i//2+1):
                    if(a<=b<=c):
                        if (a+b+c<=i):
                            if (a*a+b*b==c*c+1):
                                count+=1
        print(count)