static void Main(string[] arg) { #if DEBUG var errStream = new System.IO.FileStream(@"..\..\dbg.out", System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.ReadWrite); Debug.Listeners.Add(new System.Diagnostics.TextWriterTraceListener(errStream, "debugStream")); Debug.AutoFlush = false; var sw = new Watch(); sw.Start(); IO.Printer.Out.AutoFlush = true; try { #endif var solver = new Solver(); solver.sc = new IO.StreamScanner(Console.OpenStandardInput()); solver.Solve(); IO.Printer.Out.Flush(); #if DEBUG } catch (Exception ex) { Console.Error.WriteLine(ex.Message); Console.Error.WriteLine(ex.StackTrace); } finally { sw.Stop(); Console.ForegroundColor = ConsoleColor.Green; Console.Error.WriteLine("Time:{0}ms", sw.ElapsedMilliseconds); Debug.Close(); System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite); } #endif }