Project Euler #12 runs very slowly
You're most of the way there, so I'll give you a hint to avoid spoiling the problem:


Your function triangular shows that you know that the formula for the \$ n \$th triangular number is $$ T(n) = { n(n+1) \over 2 }. $$ What numbers can possibly be divisors of \$ T(n) \$? Take a look at some small values of \$ n \$ and see if there is a pattern.


As far as code review goes, some quick points:


Better choice of variable names would make the code easier to read. For example k and a are essentially the same thing (each is the power of a prime in the factorization of x) so why do they have such different names?
y loops over the odd numbers, but if you're solving lots of Project Euler problems then you have probably written a prime number sieve and so you could use that here (and avoid the special case for 2 while you're about it).
Use augmented assignment to make the code shorter and simpler, for example, z=z*(a+1) can be written z *= a + 1.