using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks;
namespacetest05 { classProgram { staticvoidMain(string[] args) { new Solve().run();
//Pause //Remeber Comment it!!! //Console.Write("==================nPause..."); Console.Read(); } } classSolve { publicvoidrun() { string[] tempInput = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); int a = int.Parse(tempInput[0]); int b = int.Parse(tempInput[1]);
List<int[]> ka = isright(a); if (ka.Count == 0) { Console.WriteLine("NO"); return; } List<int[]> kb = isright(b); if (kb.Count == 0) { Console.WriteLine("NO"); return; }
foreach (int[] kaa in ka) { foreach (int[] kbb in kb) { int temp; int a1 = kaa[0], a2 = kaa[1]; int b1 = kbb[0], b2 = kbb[1]; if (a1 > a2) { temp = a1; a1 = a2; a2 = temp; } if (b1 > b2) { temp = b1; b1 = b2; b2 = temp; }
if (a1 * b2 == a2 * b1) { if (a1 != b2) { Console.WriteLine("YES"); Console.WriteLine("0 0"); Console.WriteLine(a2 + " " + a1); Console.WriteLine(-b1 + " " + b2); return; } elseif (a2 != b1) { Console.WriteLine("YES"); Console.WriteLine("0 0"); Console.WriteLine(a1 + " " + a2); Console.WriteLine(-b2 + " " + b1); return; } } } } Console.WriteLine("NO"); } List<int[]> isright(int a) { List<int[]> ans = new List<int[]>(); for (int i = 1; i <= a; i++) { for (int j = 1; j <= a; j++) { if (i * i + j * j == a * a) { ans.Add(newint[] { i, j }); } } } return ans; } }