For $i$ and $j$ we have $300$ combinations each as they can repeat and $(x,y,z)$ and $(y,x,z)$ are different as order inside triplets are to be considered. Now, once we have chosen $x,y,$ $z$ must be chosen so that $x+y+z$ is divisible by 3. From $1-300$, we have 100 multiples of 3. So, we get $300/3 = 100$ choice for $z$ making total no. of triplets $= 300 \times 300 \times 100 = 9 \times 10^6.$