>>318
高速化の余地は大いにあるけど、1000msも掛かることはないと思う。

# include <iostream>

/*
 * a, b, cの最小公倍数が2006の倍数である
 * は、
 * a, b, cのいずれかが2の倍数であり、かつa, b, cのいずれかが17の倍数であり、
 * かつa, b, cのいずれかが59の倍数である
 * と同値である。
 */

bool test(int a, int b, int c)
{
# define DIVISIBLE(n) !(a % n && b % n && c % n)
  return DIVISIBLE(2) && DIVISIBLE(17) && DIVISIBLE(59);
# undef DIVISIBLE
}

int main()
{
  for(int i = 1; i <= 2004; i++)
    for(int j = 1; j <= 2005 - i; j++)
      if(test(i, j, 2006 - i - j))
        std::cout << "(" << i << ", " << j << ", " << 2006 - i - j << ")\n";
}